Author: shlevy
Date: Fri Mar 16 02:34:07 2012
New Revision: 33135
URL: https://nixos.org/websvn/nix/?rev=33135&sc=1
Log:
efiBootStub: Add the installRemovableMediaImage option
Modified:
nixos/trunk/modules/installer/efi-boot-stub/efi-boot-stub-builder.sh
nixos/trunk/modules/installer/efi-boot-stub/efi-boot-stub.nix
Modified: nixos/trunk/modules/installer/efi-boot-stub/efi-boot-stub-builder.sh
==============================================================================
--- nixos/trunk/modules/installer/efi-boot-stub/efi-boot-stub-builder.sh
Fri Mar 16 02:05:38 2012 (r33134)
+++ nixos/trunk/modules/installer/efi-boot-stub/efi-boot-stub-builder.sh
Fri Mar 16 02:34:07 2012 (r33135)
@@ -75,6 +75,14 @@
defaultbootnum=$(efibootmgr | grep "NixOS $generation Generation" |
sed 's/Boot//' | sed 's/\*.*//')
set -e
fi
+
+ if test -n "@installRemovableMediaImage@"; then
+ mkdir -pv "@efiSysMountPoint@"/efi/boot
+ cp "@removableMediaImage@" \
+ "@efiSysMountPoint@"/efi/boot/boot"@targetArch@".efi
+ iconv -f utf-8 -t UCS-2 < $startup >
"@efiSysMountPoint@"/efi/nixos/boot-params
+ filesCopied["@efiSysMountPoint@"/efi/nixos/boot-params]=1
+ fi
if test -n "@installStartupNsh@"; then
sed 's|.*@[email protected]|@[email protected]|' < $startup >
"@efiSysMountPoint@/startup.nsh"
cp $kernel "@efiSysMountPoint@/@[email protected]"
Modified: nixos/trunk/modules/installer/efi-boot-stub/efi-boot-stub.nix
==============================================================================
--- nixos/trunk/modules/installer/efi-boot-stub/efi-boot-stub.nix Fri Mar
16 02:05:38 2012 (r33134)
+++ nixos/trunk/modules/installer/efi-boot-stub/efi-boot-stub.nix Fri Mar
16 02:34:07 2012 (r33135)
@@ -59,6 +59,18 @@
'';
};
+ installRemovableMediaImage = mkOption {
+ default = false;
+ description = ''
+ Whether to build/install a BOOT{machine type short-name}.EFI file
+ in \EFI\BOOT. This _should_ only be needed for removable devices
+ (CDs, usb sticks, etc.), but it may be an option for broken
+ systems where efibootmgr doesn't work. It reads the UCS-2
+ encoded \EFI\NIXOS\BOOT-PARAMS to find out which kernel to boot
+ with which parameters.
+ '';
+ };
+
};
};
};
@@ -68,14 +80,22 @@
###### implementation
let
- efiBootStubBuilder = pkgs.substituteAll {
+ efiBootStubBuilder = pkgs.substituteAll ({
src = ./efi-boot-stub-builder.sh;
isExecutable = true;
inherit (pkgs) bash;
- path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep] ++
(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;
+ 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;
kernelFile = platform.kernelTarget;
- };
+ } // pkgs.stdenv.lib.optionalAttrs
config.boot.loader.efiBootStub.installRemovableMediaImage {
+ removableMediaImage = "${pkgs.NixosBootPkg}/X64/NixosBoot.efi";
+ targetArch = if pkgs.stdenv.isi686 then
+ "IA32"
+ else if pkgs.stdenv.isx86_64 then
+ "x64"
+ else
+ throw "Unsupported architecture";
+ });
# Temporary check, for nixos to cope both with nixpkgs stdenv-updates and
trunk
platform = pkgs.stdenv.platform;
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits