iso-image: Make efi-bootable cds actually bootable.
The image passed to genisofs needs to be a FAT image with the right filesystem layout, not an EFI executable image svn path=/nixos/trunk/; revision=33162
This commit is contained in:
parent
c5ca681c06
commit
097c656361
@ -119,10 +119,25 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
# The boot params for the efi boot stub
|
# The efi boot image
|
||||||
bootParams = pkgs.runCommand "boot-params_eltorito" {}
|
efiImg = pkgs.runCommand "efi-image_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
|
#Let's hope 8M is enough
|
||||||
|
dd bs=2048 count=4096 if=/dev/zero of="$out"
|
||||||
|
${pkgs.dosfstools}/sbin/mkfs.vfat "$out"
|
||||||
|
${pkgs.mtools}/bin/mmd -i "$out" efi
|
||||||
|
${pkgs.mtools}/bin/mmd -i "$out" efi/boot
|
||||||
|
${pkgs.mtools}/bin/mmd -i "$out" efi/nixos
|
||||||
|
${pkgs.mtools}/bin/mcopy -v -i "$out" \
|
||||||
|
${config.boot.kernelPackages.kernel + "/bzImage"} ::efi/nixos/bzImage
|
||||||
|
${pkgs.mtools}/bin/mcopy -v -i "$out" \
|
||||||
|
${config.system.build.initialRamdisk + "/initrd"} ::efi/nixos/initrd
|
||||||
|
echo "\\efi\\nixos\\bzImage initrd=\\efi\\nixos\\initrd init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}" | iconv -f utf-8 -t UCS-2 > boot-params
|
||||||
|
${pkgs.mtools}/bin/mcopy -v -i "$out" boot-params ::efi/nixos/boot-params
|
||||||
|
${pkgs.mtools}/bin/mcopy -v -i "$out" \
|
||||||
|
${import ../efi-boot-stub/nixos-boot-pkg.nix {
|
||||||
|
inherit (pkgs) edk2 stdenv fetchhg;
|
||||||
|
}}/*/NixosBoot.efi ::efi/boot/boot${targetArch}.efi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
targetArch = if pkgs.stdenv.isi686 then
|
targetArch = if pkgs.stdenv.isi686 then
|
||||||
@ -243,13 +258,8 @@ in
|
|||||||
target = "/nix/store";
|
target = "/nix/store";
|
||||||
}
|
}
|
||||||
] ++ pkgs.stdenv.lib.optionals config.isoImage.makeEfiBootable [
|
] ++ pkgs.stdenv.lib.optionals config.isoImage.makeEfiBootable [
|
||||||
{ source = bootParams;
|
{ source = efiImg;
|
||||||
target = "/efi/nixos/boot-params";
|
target = "/boot/efi.img";
|
||||||
}
|
|
||||||
{ source = ''${import ../efi-boot-stub/nixos-boot-pkg.nix {
|
|
||||||
inherit (pkgs) edk2 stdenv fetchhg;
|
|
||||||
}}/*/NixosBoot.efi'';
|
|
||||||
target = "/efi/boot/boot${targetArch}.efi";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -279,7 +289,7 @@ in
|
|||||||
bootImage = "/boot/grub/grub_eltorito";
|
bootImage = "/boot/grub/grub_eltorito";
|
||||||
} // pkgs.stdenv.lib.optionalAttrs config.isoImage.makeEfiBootable {
|
} // pkgs.stdenv.lib.optionalAttrs config.isoImage.makeEfiBootable {
|
||||||
efiBootable = true;
|
efiBootable = true;
|
||||||
efiBootImage = "efi/boot/boot${targetArch}.efi";
|
efiBootImage = "boot/efi.img";
|
||||||
});
|
});
|
||||||
|
|
||||||
boot.postBootCommands =
|
boot.postBootCommands =
|
||||||
|
Loading…
Reference in New Issue
Block a user