[Nix-dev] uefi booting on nixos

Mathijs Kwik mathijs at bluescreen303.nl
Sun Mar 18 13:23:16 CET 2012


Little progress:

I upgraded to kernel 3.3 and set this config:

  boot.loader.efiBootStub = {
    enable = true;
    efiSysMountPoint = "/efi";
    runEfibootmgr = true;
    installStartupNsh = true;
  };

I had to disable grub, because it was now looking for a file named
bzImagebzImage.

I ended up with some nixos stuff on my efi partition, and a
startup.nsh script in the root.
efibootmgr shouted a few "cannot connect to efi" lines. I did modprobe
efivars first, but that didn't help. In bios mode, efi is just not
available at all.

So I added /startup.nsh to my boot options in the uefi shell manually.
Trying to boot it doesn't work though. The fallback (bios/grub) takes
over immediately, no error messages or anything.

Are .nsh files part of the UEFI spec?
I was successful before booting grub2_efi. It would not let me boot
linux yet, but at least the menu and mode switching worked.

Any other suggestions I can try?

Thanks,
Mathijs



On Sun, Mar 18, 2012 at 12:18 PM, Mathijs Kwik <mathijs at bluescreen303.nl> wrote:
> Shea Levy <shea at shealevy.com> writes:
>
>> Hi Mathijs,
>>
>> It's not totally complete. In particular, the
>> installRemovableMediaImage option installs an EFI program that is a)
>> really hacky and b) depends on protocols not available on every
>> firmware (though when they're not available the boot fails with no bad
>> effects). I'm working with the kernel devs to ameliorate the problem
>> that necessitated the hack in the first place. I also need to do more
>> extensive testing, especially on the macbook pro. That being said, I
>> have been using it exclusively on my desktop for the past week or so
>> with several successful rebuilds, so there's that. If you do want to
>> try it out, I recommend trying the latest ISO from
>> http://hydra.nixos.org/job/nixos/trunk/iso_efi but if it doesn't boot
>> in EFI mode boot it in BIOS mode for the install then, if your system
>> supports efibootmgr, re-run switch-to-configuration after booting into
>> the built system to install the boot manager entries.
>
> EFI mode doesn't boot. The CD does show up as an UEFI boot option, but
> if I select it, I get a very fast blue flash (grub menu ?),
> followed by my installed (harddisk) grub starting (in bios mode).
>
> Should I just try to switch my running system to UEFI using
> boot.loader.efiBootStub?
> I guess I can always just boot my current BIOS/grub entry when it fails.
>
> I don't fully see how efibootstub would work, how does it plug in to
> grub2_efi? As far as I know (at least on my system) efibootmgr cannot
> communicate with the uefi when booted in bios mode, so I'm pretty sure I
> need a working boot cd, or supply the bootmgr entry in the UEFI shell
> myself. (I had to do that for grub2_efi on Arch)
>
> Mathijs
>
>
>>
>> Let me know if you have any problems.
>>
>> Cheers,
>> Shea
>>
>> On 3/16/12 4:34 PM, Mathijs Kwik wrote:
>>> Hi Shea,
>>>
>>> I saw your commits dealing with uefi booting.
>>> On my laptop, windows 7 boots fine from uefi.
>>> However, linux doesn't. Grub-uefi boots, but something goes wrong
>>> (memory mapping) when handig control to the kernel.
>>> In the past, I've spent countless hours debugging it to no avail.
>>>
>>> I would like to give it another try someday soon.
>>> Do you consider your uefi changes somewhat complete? Or do you still
>>> have more changes planned?
>>>
>>> Anyway, thanks for your work.
>>>
>>> Mathijs


More information about the nix-dev mailing list