diff options
author | Shea Levy <shea@shealevy.com> | 2012-03-16 05:37:24 +0000 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2012-03-16 05:37:24 +0000 |
commit | 8efda48496d1be5d47518f7903b5ada110738beb (patch) | |
tree | 9d89a4e9a1656c5734ba579156d1bdcca8878ac9 /modules/installer/cd-dvd/iso-image.nix | |
parent | b89a65e54cf1742f37db6d24f7c8a7dd1e930be7 (diff) | |
download | nixpkgs-8efda48496d1be5d47518f7903b5ada110738beb.tar nixpkgs-8efda48496d1be5d47518f7903b5ada110738beb.tar.gz nixpkgs-8efda48496d1be5d47518f7903b5ada110738beb.tar.bz2 nixpkgs-8efda48496d1be5d47518f7903b5ada110738beb.tar.lz nixpkgs-8efda48496d1be5d47518f7903b5ada110738beb.tar.xz nixpkgs-8efda48496d1be5d47518f7903b5ada110738beb.tar.zst nixpkgs-8efda48496d1be5d47518f7903b5ada110738beb.zip |
Enable building an efi-bootable ISO
svn path=/nixos/trunk/; revision=33140
Diffstat (limited to 'modules/installer/cd-dvd/iso-image.nix')
-rw-r--r-- | modules/installer/cd-dvd/iso-image.nix | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/modules/installer/cd-dvd/iso-image.nix b/modules/installer/cd-dvd/iso-image.nix index 7cc08315d01..82acac9a3e5 100644 --- a/modules/installer/cd-dvd/iso-image.nix +++ b/modules/installer/cd-dvd/iso-image.nix @@ -73,6 +73,14 @@ let ''; }; + isoImage.makeEfiBootable = mkOption { + default = false; + description = '' + Whether the ISO image should be an efi-bootable volume + ''; + }; + + }; @@ -110,6 +118,20 @@ let ${config.boot.loader.grub.extraEntries} ''; + + # The boot params for the efi boot stub + bootParams = pkgs.runCommand "boot-params_eltorito" {} + '' + echo "\\boot\\bzImage initrd=\\boot\\initrd init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}" | iconv -f utf-8 -t UCS-2 > $out + ''; + + targetArch = if pkgs.stdenv.isi686 then + "IA32" + else if pkgs.stdenv.isx86_64 then + "x64" + else + throw "Unsupported architecture"; + in { @@ -220,6 +242,13 @@ in source = pkgs.runCommand "empty" {} "ensureDir $out"; target = "/nix/store"; } + ] ++ pkgs.stdenv.lib.optionals config.isoImage.makeEfiBootable [ + { source = bootParams; + target = "/efi/nixos/boot-params"; + } + { source = "${pkgs.NixosBootPkg}/*/NixosBoot.efi"; + target = "/efi/boot/boot${targetArch}.efi"; + } ]; # The Grub menu. @@ -239,14 +268,17 @@ in boot.loader.grub.timeout = 10; # Create the ISO image. - system.build.isoImage = import ../../../lib/make-iso9660-image.nix { + system.build.isoImage = import ../../../lib/make-iso9660-image.nix ({ inherit (pkgs) stdenv perl cdrkit pathsFromGraph; inherit (config.isoImage) isoName compressImage volumeID contents; bootable = true; bootImage = "/boot/grub/grub_eltorito"; - }; + } // pkgs.stdenv.lib.optionalAttrs config.isoImage.makeEfiBootable { + efiBootable = true; + efiBootImage = "efi/boot/boot${targetArch}.efi"; + }); boot.postBootCommands = '' |