diff options
author | Samuel Dionne-Riel <samuel@dionne-riel.com> | 2021-05-22 20:01:07 -0400 |
---|---|---|
committer | Jonathan Ringer <jonringer@users.noreply.github.com> | 2021-05-22 20:04:05 -0700 |
commit | 20b023b5ea63a6513a4dce7f162736a00bce5cc8 (patch) | |
tree | 8b4b52ea628b413c3175a398cbf3c4e0928cf631 /nixos | |
parent | c9bb054dd68964b0eb9a38c51bdf824bfb212fc7 (diff) |
iso-image: Improve disk detection
This should help in rare hardware-specific situations where the root is not automatically detected properly. We search using a marker file. This should help some weird UEFI setups where the root is set to `(hd0,msdos2)` by default. Defaulting to `(hd0)` by looking for the ESP **will break themeing**. It is unclear why, but files in `(hd0,msdos2)` are not all present as they should be. This also fixes an issue introduced with cb5c4fcd3c5d4070f040d591b2dd1da580f234d1 where rEFInd stopped booting in many cases. This is because it ended up using (hd0) rather than using the `search` which was happening beforehand, which in turn uses (hd0,msdos2), which is the ESP. Putting back the `search` here fixes that.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/installer/cd-dvd/iso-image.nix | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index 321a03a0f0c6f..c2836b5a9a1b7 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -182,6 +182,9 @@ let # Menu configuration # + # Search using a "marker file" + search --set=root --file /EFI/nixos-installer-image + insmod gfxterm insmod png set gfxpayload=keep @@ -252,6 +255,9 @@ let } '' mkdir -p $out/EFI/boot/ + # Add a marker so GRUB can find the filesystem. + touch $out/EFI/nixos-installer-image + # ALWAYS required modules. MODULES="fat iso9660 part_gpt part_msdos \ normal boot linux configfile loopback chain halt \ @@ -383,8 +389,10 @@ let ${lib.optionalString (refindBinary != null) '' # GRUB apparently cannot do "chainloader" operations on "CD". if [ "\$root" != "cd0" ]; then + # Force root to be the FAT partition + # Otherwise it breaks rEFInd's boot + search --set=root --no-floppy --fs-uuid 1234-5678 menuentry 'rEFInd' --class refind { - # \$root defaults to the drive the EFI is found on. chainloader (\$root)/EFI/boot/${refindBinary} } fi |