From 4bb8fe4891086135320a1c3aa7f51fc72a802863 Mon Sep 17 00:00:00 2001 From: Xiaotian Wu Date: Wed, 21 May 2025 10:13:45 +0800 Subject: [PATCH] LoongArch: Fix function parameter type error and add network support Signed-off-by: Xiaotian Wu --- ...QemuPkg-Enabling-some-base-libraries.patch | 40 +++++++++ ...LoongArchQemuPkg-Add-network-support.patch | 82 +++++++++++++++++++ edk2.spec | 10 ++- fixup-fdt-parse-error.patch | 4 +- 4 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 1006-LoongArchQemuPkg-Enabling-some-base-libraries.patch create mode 100644 1007-LoongArchQemuPkg-Add-network-support.patch diff --git a/1006-LoongArchQemuPkg-Enabling-some-base-libraries.patch b/1006-LoongArchQemuPkg-Enabling-some-base-libraries.patch new file mode 100644 index 0000000..b2041d2 --- /dev/null +++ b/1006-LoongArchQemuPkg-Enabling-some-base-libraries.patch @@ -0,0 +1,40 @@ +From 2a1079fdd7b98e4ee6f6b4933409ab0871ac6c05 Mon Sep 17 00:00:00 2001 +From: Chao Li +Date: Thu, 22 May 2025 16:22:32 +0800 +Subject: [PATCH 1/2] LoongArchQemuPkg: Enabling some base libraries + +BaseCryptLib, RngLib, IntrinsicLib and OpensslLib are enabled by default +on LoongArchQemuPkg, since some APPs or OS require them. + +Signed-off-by: Chao Li +--- + Platform/Loongson/LoongArchQemuPkg/Loongson.dsc | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc +index de111b9805..0712d74e66 100644 +--- a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc ++++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc +@@ -157,6 +157,19 @@ + FileExplorerLib | MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + ImagePropertiesRecordLib | MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.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 | MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf ++ ++ + !if $(HTTP_BOOT_ENABLE) == TRUE + HttpLib | MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf + !endif +-- +2.27.0 + diff --git a/1007-LoongArchQemuPkg-Add-network-support.patch b/1007-LoongArchQemuPkg-Add-network-support.patch new file mode 100644 index 0000000..141082f --- /dev/null +++ b/1007-LoongArchQemuPkg-Add-network-support.patch @@ -0,0 +1,82 @@ +From f3a82805e61ec7c8da086143d9491867708f894a Mon Sep 17 00:00:00 2001 +From: Chao Li +Date: Fri, 23 May 2025 10:13:00 +0800 +Subject: [PATCH 2/2] LoongArchQemuPkg: Add network support + +Open the network option to enable networking. + +edk2 commit ID: 8bb9145ad1a5db068f63e3e19b4a532226351b2b + +Signed-off-by: Chao Li +--- + Platform/Loongson/LoongArchQemuPkg/Loongson.dsc | 17 ++++++++++++----- + Platform/Loongson/LoongArchQemuPkg/Loongson.fdf | 2 +- + 2 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc +index 0712d74e66..8f9c10237b 100644 +--- a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc ++++ b/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 + ############################################################################ +@@ -546,12 +547,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 { +@@ -559,6 +563,7 @@ + NULL|OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf + } + !endif ++!endif + OvmfPkg/VirtioNetDxe/VirtioNet.inf + + # +@@ -657,7 +662,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 +diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf b/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf +index 5af691c6af..1c609e2356 100644 +--- a/Platform/Loongson/LoongArchQemuPkg/Loongson.fdf ++++ b/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 +-- +2.27.0 + diff --git a/edk2.spec b/edk2.spec index 5cbc736..d1ca2f1 100644 --- a/edk2.spec +++ b/edk2.spec @@ -1,4 +1,4 @@ -%define anolis_release 11 +%define anolis_release 12 %undefine _auto_set_build_flags ExclusiveArch: x86_64 aarch64 loongarch64 @@ -64,6 +64,8 @@ Source81: edk2-build Source90: 0023-Platform-Loongson-Remove-minimium-memory-size-limita.patch Source91: 0024-Platform-Loongson-Modify-loongarch-uefi-firmware-siz.patch Source92: fixup-fdt-parse-error.patch +Source93: 1006-LoongArchQemuPkg-Enabling-some-base-libraries.patch +Source94: 1007-LoongArchQemuPkg-Add-network-support.patch Patch0001: 0001-MdePkg-Add-StandardSignatureIsHygonGenuine-in-BaseCp.patch Patch0002: 0002-UefiCpuPkg-LocalApicLib-Exclude-second-SendIpi-seque.patch @@ -267,6 +269,8 @@ cp -a -- \ %{__patch} -p1 -i %{SOURCE90} %{__patch} -p1 -i %{SOURCE91} %{__patch} -p1 -i %{SOURCE92} +%{__patch} -p1 -i %{SOURCE93} +%{__patch} -p1 -i %{SOURCE94} %build @@ -508,6 +512,10 @@ install -m 0644 \ %changelog +* Tue May 20 2025 Xiaotian Wu - 202402-12 +- LoongArch: Fix function parameter type error +- LoongArch: Add network support + * Tue Apr 08 2025 hanliyang - 202402-11 - Build OVMF.fd using AmdSevX64.dsc to support Full Disk Encryption diff --git a/fixup-fdt-parse-error.patch b/fixup-fdt-parse-error.patch index f1ac873..2f13b3f 100644 --- a/fixup-fdt-parse-error.patch +++ b/fixup-fdt-parse-error.patch @@ -18,7 +18,7 @@ index c713c6e9..dd64a000 100644 // Determine the actual path length, as a colon terminates the path. - Path = ScanMem8 (Prop, ':', PropSize); -+ Path = ScanMem8 (Prop, PropSize, (UINT8)":"); ++ Path = ScanMem8 (Prop, PropSize, ':'); if (Path == NULL) { PathLen = AsciiStrLen (Prop); } else { @@ -31,7 +31,7 @@ index 84bb8e8a..02982cd0 100644 // Determine the actual path length, as a colon terminates the path. - Path = ScanMem8 (Prop, ':', PropSize); -+ Path = ScanMem8 (Prop, PropSize, (UINT8)":"); ++ Path = ScanMem8 (Prop, PropSize, ':'); if (Path == NULL) { PathLen = AsciiStrLen (Prop); } else { -- Gitee