edk2: loongarch64 support (#338966)
This commit is contained in:
commit
ba63775298
@ -29,6 +29,7 @@
|
|||||||
x86_64 = "OvmfPkg/OvmfPkgX64.dsc";
|
x86_64 = "OvmfPkg/OvmfPkgX64.dsc";
|
||||||
aarch64 = "ArmVirtPkg/ArmVirtQemu.dsc";
|
aarch64 = "ArmVirtPkg/ArmVirtQemu.dsc";
|
||||||
riscv64 = "OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc";
|
riscv64 = "OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc";
|
||||||
|
loongarch64 = "OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc";
|
||||||
}.${stdenv.hostPlatform.parsed.cpu.name}
|
}.${stdenv.hostPlatform.parsed.cpu.name}
|
||||||
or (throw "Unsupported OVMF `projectDscPath` on ${stdenv.hostPlatform.parsed.cpu.name}")
|
or (throw "Unsupported OVMF `projectDscPath` on ${stdenv.hostPlatform.parsed.cpu.name}")
|
||||||
, fwPrefix ? {
|
, fwPrefix ? {
|
||||||
@ -36,6 +37,7 @@
|
|||||||
x86_64 = "OVMF";
|
x86_64 = "OVMF";
|
||||||
aarch64 = "AAVMF";
|
aarch64 = "AAVMF";
|
||||||
riscv64 = "RISCV_VIRT";
|
riscv64 = "RISCV_VIRT";
|
||||||
|
loongarch64 = "LOONGARCH_VIRT";
|
||||||
}.${stdenv.hostPlatform.parsed.cpu.name}
|
}.${stdenv.hostPlatform.parsed.cpu.name}
|
||||||
or (throw "Unsupported OVMF `fwPrefix` on ${stdenv.hostPlatform.parsed.cpu.name}")
|
or (throw "Unsupported OVMF `fwPrefix` on ${stdenv.hostPlatform.parsed.cpu.name}")
|
||||||
, metaPlatforms ? edk2.meta.platforms
|
, metaPlatforms ? edk2.meta.platforms
|
||||||
@ -130,17 +132,17 @@ edk2.mkDerivation projectDscPath (finalAttrs: {
|
|||||||
export PYTHONPATH=$NIX_BUILD_TOP/debian/python:$PYTHONPATH
|
export PYTHONPATH=$NIX_BUILD_TOP/debian/python:$PYTHONPATH
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postBuild = lib.optionalString stdenv.hostPlatform.isAarch ''
|
postBuild = lib.optionalString (stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isLoongArch64) ''
|
||||||
(
|
(
|
||||||
cd ${buildPrefix}/FV
|
cd ${buildPrefix}/FV
|
||||||
cp QEMU_EFI.fd ${fwPrefix}_CODE.fd
|
cp QEMU_EFI.fd ${fwPrefix}_CODE.fd
|
||||||
cp QEMU_VARS.fd ${fwPrefix}_VARS.fd
|
cp QEMU_VARS.fd ${fwPrefix}_VARS.fd
|
||||||
|
)
|
||||||
|
'' + lib.optionalString stdenv.hostPlatform.isAarch ''
|
||||||
# QEMU expects 64MiB CODE and VARS files on ARM/AARCH64 architectures
|
# QEMU expects 64MiB CODE and VARS files on ARM/AARCH64 architectures
|
||||||
# Truncate the firmware files to the expected size
|
# Truncate the firmware files to the expected size
|
||||||
truncate -s 64M ${fwPrefix}_CODE.fd
|
truncate -s 64M ${buildPrefix}/FV/${fwPrefix}_CODE.fd
|
||||||
truncate -s 64M ${fwPrefix}_VARS.fd
|
truncate -s 64M ${buildPrefix}/FV/${fwPrefix}_VARS.fd
|
||||||
)
|
|
||||||
'' + lib.optionalString stdenv.hostPlatform.isRiscV ''
|
'' + lib.optionalString stdenv.hostPlatform.isRiscV ''
|
||||||
truncate -s 32M ${buildPrefix}/FV/${fwPrefix}_CODE.fd
|
truncate -s 32M ${buildPrefix}/FV/${fwPrefix}_CODE.fd
|
||||||
truncate -s 32M ${buildPrefix}/FV/${fwPrefix}_VARS.fd
|
truncate -s 32M ${buildPrefix}/FV/${fwPrefix}_VARS.fd
|
||||||
@ -165,7 +167,7 @@ edk2.mkDerivation projectDscPath (finalAttrs: {
|
|||||||
postInstall = ''
|
postInstall = ''
|
||||||
mkdir -vp $fd/FV
|
mkdir -vp $fd/FV
|
||||||
'' + lib.optionalString (builtins.elem fwPrefix [
|
'' + lib.optionalString (builtins.elem fwPrefix [
|
||||||
"OVMF" "AAVMF" "RISCV_VIRT"
|
"OVMF" "AAVMF" "RISCV_VIRT" "LOONGARCH_VIRT"
|
||||||
]) ''
|
]) ''
|
||||||
mv -v $out/FV/${fwPrefix}_{CODE,VARS}.fd $fd/FV
|
mv -v $out/FV/${fwPrefix}_{CODE,VARS}.fd $fd/FV
|
||||||
'' + lib.optionalString stdenv.hostPlatform.isx86 ''
|
'' + lib.optionalString stdenv.hostPlatform.isx86 ''
|
||||||
|
@ -23,6 +23,8 @@ else if stdenv.isAarch64 then
|
|||||||
"AARCH64"
|
"AARCH64"
|
||||||
else if stdenv.hostPlatform.isRiscV64 then
|
else if stdenv.hostPlatform.isRiscV64 then
|
||||||
"RISCV64"
|
"RISCV64"
|
||||||
|
else if stdenv.hostPlatform.isLoongArch64 then
|
||||||
|
"LOONGARCH64"
|
||||||
else
|
else
|
||||||
throw "Unsupported architecture";
|
throw "Unsupported architecture";
|
||||||
|
|
||||||
@ -128,7 +130,7 @@ edk2 = stdenv.mkDerivation {
|
|||||||
homepage = "https://github.com/tianocore/tianocore.github.io/wiki/EDK-II/";
|
homepage = "https://github.com/tianocore/tianocore.github.io/wiki/EDK-II/";
|
||||||
changelog = "https://github.com/tianocore/edk2/releases/tag/edk2-stable${edk2.version}";
|
changelog = "https://github.com/tianocore/edk2/releases/tag/edk2-stable${edk2.version}";
|
||||||
license = lib.licenses.bsd2;
|
license = lib.licenses.bsd2;
|
||||||
platforms = with lib.platforms; aarch64 ++ arm ++ i686 ++ x86_64 ++ riscv64;
|
platforms = with lib.platforms; aarch64 ++ arm ++ i686 ++ x86_64 ++ loongarch64 ++ riscv64;
|
||||||
maintainers = [ lib.maintainers.mjoerg ];
|
maintainers = [ lib.maintainers.mjoerg ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user