2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, grub2_xen }:
|
2017-05-12 08:34:38 +02:00
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
with lib;
|
2017-05-12 08:34:38 +02:00
|
|
|
let
|
|
|
|
efiSystemsBuild = {
|
2019-08-13 23:52:01 +02:00
|
|
|
i686-linux.target = "i386";
|
|
|
|
x86_64-linux.target = "x86_64";
|
|
|
|
aarch64-linux.target = "aarch64";
|
2017-05-12 08:34:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
in (
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "pvgrub-image";
|
|
|
|
|
|
|
|
configs = ./configs;
|
|
|
|
|
|
|
|
buildInputs = [ grub2_xen ];
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
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.
|
2018-08-20 21:11:29 +02:00
|
|
|
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/${efiSystemsBuild.${stdenv.hostPlatform.system}.target}-xen/" |grep 'mod''$'|grep -v '^all_video\.mod''$')
|
2017-05-12 08:34:38 +02:00
|
|
|
mkdir -p "$out/lib/grub-xen"
|
2018-08-20 21:11:29 +02:00
|
|
|
cp "grub-${efiSystemsBuild.${stdenv.hostPlatform.system}.target}-xen.bin" $out/lib/grub-xen/
|
2017-05-12 08:34:38 +02:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2017-05-12 08:34:38 +02:00
|
|
|
description = "PvGrub image for use for booting PV Xen guests";
|
|
|
|
|
|
|
|
longDescription =
|
|
|
|
'' This package provides a PvGrub image for booting Para-Virtualized (PV)
|
|
|
|
Xen guests
|
|
|
|
'';
|
|
|
|
|
2018-05-01 00:43:54 +02:00
|
|
|
platforms = platforms.gnu ++ platforms.linux;
|
2017-05-12 08:34:38 +02:00
|
|
|
};
|
|
|
|
})
|