From faf7bc50d547d8c4960a0a20a5e44ef7d55354df Mon Sep 17 00:00:00 2001 From: Xiaotian Wu Date: Fri, 23 May 2025 11:13:48 +0800 Subject: [PATCH] LoongArch: add network support --- ...QemuPkg-Enabling-some-base-libraries.patch | 24 +++++++ ...LoongArchQemuPkg-Add-network-support.patch | 64 +++++++++++++++++++ 0113-platform-loong64.patch | 26 ++++++++ edk2.spec | 9 ++- 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 0111-LoongArchQemuPkg-Enabling-some-base-libraries.patch create mode 100644 0112-LoongArchQemuPkg-Add-network-support.patch create mode 100644 0113-platform-loong64.patch diff --git a/0111-LoongArchQemuPkg-Enabling-some-base-libraries.patch b/0111-LoongArchQemuPkg-Enabling-some-base-libraries.patch new file mode 100644 index 0000000..1699ac9 --- /dev/null +++ b/0111-LoongArchQemuPkg-Enabling-some-base-libraries.patch @@ -0,0 +1,24 @@ +Index: edk2-edk2-stable202308/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc +=================================================================== +--- edk2-edk2-stable202308.orig/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc ++++ edk2-edk2-stable202308/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc +@@ -156,6 +156,19 @@ + MmuLib | Platform/Loongson/LoongArchQemuPkg/Library/MmuLib/MmuBaseLib.inf + FileExplorerLib | MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + ++ # ++ # CryptoPkg libraries needed by multiple firmware features ++ # ++ IntrinsicLib | CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf ++!if $(NETWORK_TLS_ENABLE) == TRUE ++ OpensslLib | CryptoPkg/Library/OpensslLib/OpensslLib.inf ++!else ++ OpensslLib | CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf ++!endif ++ BaseCryptLib | CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf ++ RngLib | MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf ++ ++ + !if $(HTTP_BOOT_ENABLE) == TRUE + HttpLib | MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf + !endif diff --git a/0112-LoongArchQemuPkg-Add-network-support.patch b/0112-LoongArchQemuPkg-Add-network-support.patch new file mode 100644 index 0000000..d933124 --- /dev/null +++ b/0112-LoongArchQemuPkg-Add-network-support.patch @@ -0,0 +1,64 @@ +Index: edk2-edk2-stable202308/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc +=================================================================== +--- edk2-edk2-stable202308.orig/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc ++++ edk2-edk2-stable202308/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc +@@ -41,6 +41,7 @@ + DEFINE NETWORK_TLS_ENABLE = FALSE + DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE + DEFINE NETWORK_ISCSI_ENABLE = FALSE ++ DEFINE NETWORK_PXE_BOOT_ENABLE = TRUE + + !include NetworkPkg/NetworkDefines.dsc.inc + ############################################################################ +@@ -551,12 +552,15 @@ + # + # Network Support + # +-#!include NetworkPkg/NetworkComponents.dsc.inc ++!include NetworkPkg/NetworkComponents.dsc.inc + +-# NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf { +-# +-# NULL|OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf +-# } ++!if $(NETWORK_ENABLE) == TRUE ++!if $(NETWORK_PXE_BOOT_ENABLE) == TRUE ++ NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf { ++ ++ NULL|OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf ++ } ++!endif + + !if $(NETWORK_TLS_ENABLE) == TRUE + NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf { +@@ -564,6 +568,7 @@ + NULL|OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf + } + !endif ++!endif + OvmfPkg/VirtioNetDxe/VirtioNet.inf + + # +@@ -662,7 +667,9 @@ + NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf ++!if ($(NETWORK_ENABLE) == TRUE) AND ($(NETWORK_IP4_ENABLE) == TRUE) + NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf ++!endif + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf +Index: edk2-edk2-stable202308/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf +=================================================================== +--- edk2-edk2-stable202308.orig/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf ++++ edk2-edk2-stable202308/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf +@@ -224,7 +224,7 @@ INF OvmfPkg/AcpiPlatformDxe/AcpiPlatfor + + # + # Network modules +-#!include NetworkPkg/Network.fdf.inc ++!include NetworkPkg/Network.fdf.inc + + # + # File system diff --git a/0113-platform-loong64.patch b/0113-platform-loong64.patch new file mode 100644 index 0000000..dfc2301 --- /dev/null +++ b/0113-platform-loong64.patch @@ -0,0 +1,26 @@ +Index: edk2-edk2-stable202402/Platform/Loongson/LoongArchQemuPkg/PlatformPei/Platform.c +=================================================================== +--- edk2-edk2-stable202402.orig/Platform/Loongson/LoongArchQemuPkg/PlatformPei/Platform.c ++++ edk2-edk2-stable202402/Platform/Loongson/LoongArchQemuPkg/PlatformPei/Platform.c +@@ -193,7 +193,7 @@ GetSerialConsolePortAddress ( + } + + // Determine the actual path length, as a colon terminates the path. +- Path = ScanMem8 (Prop, PropSize, (UINT8)":"); ++ Path = ScanMem8 (Prop, PropSize, ':'); + if (Path == NULL) { + PathLen = AsciiStrLen (Prop); + } else { +Index: edk2-edk2-stable202402/Platform/Loongson/LoongArchQemuPkg/Library/SerialPortLib/EarlySerialPortLib16550.c +=================================================================== +--- edk2-edk2-stable202402.orig/Platform/Loongson/LoongArchQemuPkg/Library/SerialPortLib/EarlySerialPortLib16550.c ++++ edk2-edk2-stable202402/Platform/Loongson/LoongArchQemuPkg/Library/SerialPortLib/EarlySerialPortLib16550.c +@@ -155,7 +155,7 @@ GetSerialConsolePortAddress ( + } + + // Determine the actual path length, as a colon terminates the path. +- Path = ScanMem8 (Prop, PropSize, (UINT8)":"); ++ Path = ScanMem8 (Prop, PropSize, ':'); + if (Path == NULL) { + PathLen = AsciiStrLen (Prop); + } else { diff --git a/edk2.spec b/edk2.spec index b44ba9a..5dcb704 100644 --- a/edk2.spec +++ b/edk2.spec @@ -7,7 +7,7 @@ Name: edk2 Version: %{stable_date} -Release: 23 +Release: 24 Summary: EFI Development Kit II License: BSD-2-Clause-Patent and OpenSSL and MIT URL: https://github.com/tianocore/edk2 @@ -170,6 +170,10 @@ patch107: 0107-SecurityPkg-Out-of-bound-read-in-HashPeImageByType.patch patch108: 0108-Platform-Loongson-Remove-minimium-memory-size-limita.patch patch109: 0109-Platform-Loongson-Modify-loongarch-uefi-firmware-siz.patch patch110: 0110-fixup-fdt-parse-error.patch +# LoongArch64, Add netowrk support +Patch111: 0111-LoongArchQemuPkg-Enabling-some-base-libraries.patch +Patch112: 0112-LoongArchQemuPkg-Add-network-support.patch +Patch113: 0113-platform-loong64.patch BuildRequires: acpica-tools gcc gcc-c++ libuuid-devel python3 bc nasm python3-unversioned-command isl @@ -448,6 +452,9 @@ chmod +x %{buildroot}%{_bindir}/Rsa2048Sha256GenerateKeys %endif %changelog +* Tue May 20 2025 Xiaotian Wu - 202308-24 +- LoongArch: Add network support + * Mon Apr 28 2025 Wenlong Zhang - 202308-23 - fix Instance of library class RngLib is not found on loongarch64 - sync from 24.03-lts-sp1 -- Gitee