Switch to using efi shell + startup.nsh as the
removable media efi boot option. svn path=/nixos/trunk/; revision=33984
This commit is contained in:
parent
4b650026bf
commit
3aae8bfa61
@ -119,6 +119,17 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
efiShell = if pkgs.stdenv.isi686 then
|
||||||
|
pkgs.fetchurl {
|
||||||
|
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi";
|
||||||
|
sha256 = "0ymm3mbbwx9f6cq0bp2nr7ikyagxgsg4sjs5q1s4xbnms27slwjq";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pkgs.fetchurl {
|
||||||
|
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi";
|
||||||
|
sha256 = "1xchy8a05mgqzr82mmahdni0jbxsz6xf6vm2bg1bch9i6l72qgmh";
|
||||||
|
};
|
||||||
|
|
||||||
# The efi boot image
|
# The efi boot image
|
||||||
efiImg = pkgs.runCommand "efi-image_eltorito" {}
|
efiImg = pkgs.runCommand "efi-image_eltorito" {}
|
||||||
''
|
''
|
||||||
@ -129,11 +140,13 @@ let
|
|||||||
${pkgs.mtools}/bin/mmd -i "$out" efi/boot
|
${pkgs.mtools}/bin/mmd -i "$out" efi/boot
|
||||||
${pkgs.mtools}/bin/mmd -i "$out" efi/nixos
|
${pkgs.mtools}/bin/mmd -i "$out" efi/nixos
|
||||||
${pkgs.mtools}/bin/mcopy -v -i "$out" \
|
${pkgs.mtools}/bin/mcopy -v -i "$out" \
|
||||||
${config.boot.kernelPackages.kernel + "/bzImage"} ::efi/boot/boot${targetArch}.efi
|
${efiShell} ::efi/boot/boot${targetArch}.efi
|
||||||
|
${pkgs.mtools}/bin/mcopy -v -i "$out" \
|
||||||
|
${config.boot.kernelPackages.kernel + "/bzImage"} ::bzImage.efi
|
||||||
${pkgs.mtools}/bin/mcopy -v -i "$out" \
|
${pkgs.mtools}/bin/mcopy -v -i "$out" \
|
||||||
${config.system.build.initialRamdisk + "/initrd"} ::efi/nixos/initrd
|
${config.system.build.initialRamdisk + "/initrd"} ::efi/nixos/initrd
|
||||||
echo "initrd=\\efi\\nixos\\initrd init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}" > boot-params
|
echo "bzImage.efi initrd=\\efi\\nixos\\initrd init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}" > boot-params
|
||||||
${pkgs.mtools}/bin/mcopy -v -i "$out" boot-params ::efi/boot/linux.conf
|
${pkgs.mtools}/bin/mcopy -v -i "$out" boot-params ::startup.nsh
|
||||||
'';
|
'';
|
||||||
|
|
||||||
targetArch = if pkgs.stdenv.isi686 then
|
targetArch = if pkgs.stdenv.isi686 then
|
||||||
|
@ -76,11 +76,6 @@ addEntry() {
|
|||||||
set -e
|
set -e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "@installRemovableMediaImage@"; then
|
|
||||||
mkdir -pv "@efiSysMountPoint@"/efi/boot
|
|
||||||
cp $kernel "@efiSysMountPoint@"/efi/boot/boot"@targetArch@".efi
|
|
||||||
sed 's|.*@kernelFile@.efi ||' $startup > "@efiSysMountPoint@"/efi/boot/linux.conf
|
|
||||||
fi
|
|
||||||
if test -n "@installStartupNsh@"; then
|
if test -n "@installStartupNsh@"; then
|
||||||
sed 's|.*@kernelFile@.efi|@kernelFile@.efi|' < $startup > "@efiSysMountPoint@/startup.nsh"
|
sed 's|.*@kernelFile@.efi|@kernelFile@.efi|' < $startup > "@efiSysMountPoint@/startup.nsh"
|
||||||
cp $kernel "@efiSysMountPoint@/@kernelFile@.efi"
|
cp $kernel "@efiSysMountPoint@/@kernelFile@.efi"
|
||||||
@ -116,6 +111,11 @@ if test -n "@runEfibootmgr@"; then
|
|||||||
set -e
|
set -e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -n "@efiShell@"; then
|
||||||
|
mkdir -pv "@efiSysMountPoint@"/efi/boot
|
||||||
|
cp "@efiShell@" "@efiSysMountPoint@"/efi/boot/boot"@targetArch@".efi
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove obsolete files from the EFI system partition
|
# Remove obsolete files from the EFI system partition
|
||||||
for fn in "@efiSysMountPoint@/efi/nixos/"*; do
|
for fn in "@efiSysMountPoint@/efi/nixos/"*; do
|
||||||
if ! test "${filesCopied[$fn]}" = 1; then
|
if ! test "${filesCopied[$fn]}" = 1; then
|
||||||
|
@ -59,15 +59,14 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
installRemovableMediaImage = mkOption {
|
installShell = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to build/install a BOOT{machine type short-name}.EFI file
|
Whether to install an EFI shell in \EFI\BOOT.
|
||||||
in \EFI\BOOT. This _should_ only be needed for removable devices
|
This _should_ only be needed for removable devices
|
||||||
(CDs, usb sticks, etc.), but it may be an option for broken
|
(CDs, usb sticks, etc.), but it may be an option for broken
|
||||||
systems where efibootmgr doesn't work. It reads the UCS-2
|
systems where efibootmgr doesn't work. Particularly useful in
|
||||||
encoded \EFI\NIXOS\BOOT-PARAMS to find out which kernel to boot
|
conjunction with installStartupNsh
|
||||||
with which parameters.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,7 +84,22 @@ let
|
|||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
inherit (pkgs) bash;
|
inherit (pkgs) bash;
|
||||||
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.glibc] ++ (pkgs.stdenv.lib.optionals config.boot.loader.efiBootStub.runEfibootmgr [pkgs.efibootmgr pkgs.module_init_tools]);
|
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.glibc] ++ (pkgs.stdenv.lib.optionals config.boot.loader.efiBootStub.runEfibootmgr [pkgs.efibootmgr pkgs.module_init_tools]);
|
||||||
inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition installRemovableMediaImage;
|
inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition;
|
||||||
|
|
||||||
|
efiShell = if config.boot.loader.efiBootStub.installShell then
|
||||||
|
if pkgs.stdenv.isi686 then
|
||||||
|
pkgs.fetchurl {
|
||||||
|
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi";
|
||||||
|
sha256 = "0ymm3mbbwx9f6cq0bp2nr7ikyagxgsg4sjs5q1s4xbnms27slwjq";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pkgs.fetchurl {
|
||||||
|
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi";
|
||||||
|
sha256 = "1xchy8a05mgqzr82mmahdni0jbxsz6xf6vm2bg1bch9i6l72qgmh";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
null;
|
||||||
|
|
||||||
kernelFile = platform.kernelTarget;
|
kernelFile = platform.kernelTarget;
|
||||||
targetArch = if pkgs.stdenv.isi686 then
|
targetArch = if pkgs.stdenv.isi686 then
|
||||||
"IA32"
|
"IA32"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user