-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
grub: build grub2_pvhgrub_image together with grub2_pvgrub_image
The PvhGrub image requires the same steps to build compared to the PV one, so we moved the old `grub2_pvgrub_image` package and shared that between PV and PVH. Co-authored-by: William Johansson <[email protected]> Signed-off-by: Hongbo <[email protected]>
- Loading branch information
Showing
2 changed files
with
38 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,60 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
grub2_xen, | ||
}: | ||
{ lib, stdenv, buildPvImage ? false, grub2_xen, buildPvhImage ? false | ||
, grub2_xen_pvh, }: | ||
|
||
assert (buildPvImage != buildPvhImage); | ||
let | ||
efiSystemsBuild = { | ||
i686-linux.target = "i386"; | ||
x86_64-linux.target = "x86_64"; | ||
x86_64-linux.target = if buildPvhImage then "i386" else "x86_64"; | ||
armv7l-linux.target = "arm"; | ||
aarch64-linux.target = "aarch64"; | ||
riscv32-linux.target = "riscv32"; | ||
riscv64-linux.target = "riscv64"; | ||
}; | ||
|
||
in | ||
( | ||
in ( | ||
|
||
stdenv.mkDerivation rec { | ||
name = "pvgrub-image"; | ||
name = "grub2-xen-images"; | ||
|
||
configs = ./configs; | ||
|
||
buildInputs = [ grub2_xen ]; | ||
buildInputs = lib.optional buildPvImage grub2_xen | ||
++ lib.optional buildPvhImage grub2_xen_pvh; | ||
|
||
buildCommand = '' | ||
buildCommand = let grubVariant = if buildPvImage then "xen" else "xen_pvh"; | ||
in '' | ||
cp "${configs}"/* . | ||
tar -cf memdisk.tar grub.cfg | ||
# We include all modules except all_video.mod as otherwise grub will fail printing "no symbol table" | ||
# if we include it. | ||
grub-mkimage -O "${ | ||
efiSystemsBuild.${stdenv.hostPlatform.system}.target | ||
}-xen" -c grub-bootstrap.cfg \ | ||
-m memdisk.tar -o "grub-${efiSystemsBuild.${stdenv.hostPlatform.system}.target}-xen.bin" \ | ||
$(ls "${grub2_xen}/lib/grub/${ | ||
grub-mkimage \ | ||
-O "${ | ||
efiSystemsBuild.${stdenv.hostPlatform.system}.target | ||
}-${grubVariant}" \ | ||
-c grub-bootstrap.cfg \ | ||
-m memdisk.tar \ | ||
-o "grub-${ | ||
efiSystemsBuild.${stdenv.hostPlatform.system}.target | ||
}-xen/" |grep 'mod''$'|grep -v '^all_video\.mod''$') | ||
mkdir -p "$out/lib/grub-xen" | ||
cp "grub-${efiSystemsBuild.${stdenv.hostPlatform.system}.target}-xen.bin" $out/lib/grub-xen/ | ||
}-${grubVariant}.bin" \ | ||
$(ls "${if buildPvImage then grub2_xen else grub2_xen_pvh}/lib/grub/${ | ||
efiSystemsBuild.${stdenv.hostPlatform.system}.target | ||
}-${grubVariant}/" | grep 'mod$' | grep -v '^all_video\.mod$') | ||
mkdir -p "$out/lib/grub-${grubVariant}" | ||
cp "grub-${ | ||
efiSystemsBuild.${stdenv.hostPlatform.system}.target | ||
}-${grubVariant}.bin" $out/lib/grub-${grubVariant}/ | ||
''; | ||
|
||
meta = with lib; { | ||
description = "PvGrub image for use for booting PV Xen guests"; | ||
description = | ||
"PvGrub and PvhGrub images for use for booting PV/PVH Xen guests"; | ||
|
||
longDescription = '' | ||
This package provides a PvGrub image for booting Para-Virtualized (PV) | ||
Xen guests | ||
This package provides PvGrub/PvhGrub images for booting | ||
Paravirtualized (PV) or Paravirtualized Hardware (PVH) Xen guests | ||
''; | ||
|
||
platforms = platforms.gnu ++ platforms.linux; | ||
}; | ||
} | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters