Merge pull request #25724 from michalpalka/pvgrub-new
pvgrub_image: add package
This commit is contained in:
commit
d38d3d1096
@ -3,6 +3,7 @@
|
|||||||
, zfs ? null
|
, zfs ? null
|
||||||
, efiSupport ? false
|
, efiSupport ? false
|
||||||
, zfsSupport ? true
|
, zfsSupport ? true
|
||||||
|
, xenSupport ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
@ -46,6 +47,7 @@ in (
|
|||||||
|
|
||||||
assert efiSupport -> canEfi;
|
assert efiSupport -> canEfi;
|
||||||
assert zfsSupport -> zfs != null;
|
assert zfsSupport -> zfs != null;
|
||||||
|
assert !(efiSupport && xenSupport);
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "grub-${version}";
|
name = "grub-${version}";
|
||||||
@ -98,7 +100,8 @@ stdenv.mkDerivation rec {
|
|||||||
patches = [ ./fix-bash-completion.patch ];
|
patches = [ ./fix-bash-completion.patch ];
|
||||||
|
|
||||||
configureFlags = optional zfsSupport "--enable-libzfs"
|
configureFlags = optional zfsSupport "--enable-libzfs"
|
||||||
++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystemsBuild.${stdenv.system}.target}" "--program-prefix=" ];
|
++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystemsBuild.${stdenv.system}.target}" "--program-prefix=" ]
|
||||||
|
++ optionals xenSupport [ "--with-platform=xen" "--target=${efiSystemsBuild.${stdenv.system}.target}"];
|
||||||
|
|
||||||
# save target that grub is compiled for
|
# save target that grub is compiled for
|
||||||
grubTarget = if efiSupport
|
grubTarget = if efiSupport
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
normal (memdisk)/grub.cfg
|
10
pkgs/tools/misc/grub/pvgrub_image/configs/grub.cfg
Normal file
10
pkgs/tools/misc/grub/pvgrub_image/configs/grub.cfg
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# The parentheses around ${root} here to match Grub's config file syntax
|
||||||
|
if search -s -f /boot/grub/grub.cfg ; then
|
||||||
|
echo "Reading (${root})/boot/grub/grub.cfg"
|
||||||
|
configfile /boot/grub/grub.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
if search -s -f /grub/grub.cfg ; then
|
||||||
|
echo "Reading (${root})/grub/grub.cfg"
|
||||||
|
configfile /grub/grub.cfg
|
||||||
|
fi
|
42
pkgs/tools/misc/grub/pvgrub_image/default.nix
Normal file
42
pkgs/tools/misc/grub/pvgrub_image/default.nix
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{ stdenv, grub2_xen }:
|
||||||
|
|
||||||
|
with stdenv.lib;
|
||||||
|
let
|
||||||
|
efiSystemsBuild = {
|
||||||
|
"i686-linux".target = "i386";
|
||||||
|
"x86_64-linux".target = "x86_64";
|
||||||
|
"aarch64-linux".target = "aarch64";
|
||||||
|
};
|
||||||
|
|
||||||
|
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.
|
||||||
|
grub-mkimage -O "${efiSystemsBuild.${stdenv.system}.target}-xen" -c grub-bootstrap.cfg \
|
||||||
|
-m memdisk.tar -o "grub-${efiSystemsBuild.${stdenv.system}.target}-xen.bin" \
|
||||||
|
$(ls "${grub2_xen}/lib/grub/${efiSystemsBuild.${stdenv.system}.target}-xen/" |grep 'mod''$'|grep -v '^all_video\.mod''$')
|
||||||
|
mkdir -p "$out/lib/grub-xen"
|
||||||
|
cp "grub-${efiSystemsBuild.${stdenv.system}.target}-xen.bin" $out/lib/grub-xen/
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
description = "PvGrub image for use for booting PV Xen guests";
|
||||||
|
|
||||||
|
longDescription =
|
||||||
|
'' This package provides a PvGrub image for booting Para-Virtualized (PV)
|
||||||
|
Xen guests
|
||||||
|
'';
|
||||||
|
|
||||||
|
platforms = platforms.gnu;
|
||||||
|
};
|
||||||
|
})
|
@ -2257,6 +2257,12 @@ with pkgs;
|
|||||||
zfsSupport = false;
|
zfsSupport = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
grub2_xen = callPackage ../tools/misc/grub/2.0x.nix {
|
||||||
|
xenSupport = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
grub2_pvgrub_image = callPackage ../tools/misc/grub/pvgrub_image { };
|
||||||
|
|
||||||
grub4dos = callPackage ../tools/misc/grub4dos {
|
grub4dos = callPackage ../tools/misc/grub4dos {
|
||||||
stdenv = stdenv_32bit;
|
stdenv = stdenv_32bit;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user