NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Booting NetBSD from GPT/EFI



On Tuesday 07 June 2016 20:34:27 Michael van Elst wrote:
> jaapb%kerguelen.org@localhost (Jaap Boender) writes:
> >Is this at all possible? I understand the bootloader has to go in the
> >existing EFI partition; can I overwrite that without bothering Windows?
> 
> EFI allows multiple bootloaders. This isn't the problem.
> 
> >Does the order of partitions matter (currently the NetBSD bits are
> >indexes 7 and 8)? Should I rather use Grub? Are there tutorials
> >available?
> 
> For a dual boot from a GPT disk, the only solution currently is
> to use grub as an EFI bootloader.
> 
> The alternative is to reformat everything as a 'legacy' MBR disk.
> 
> While there is a 'gptmbr.bin' bootloader for NetBSD that
> requires BIOS boot but then accesses a GPT instead of the MBR
> partitions, I doubt that such a disk is supported by Windows.

Just to document this, what I finally ended up doing was to install grub2 
through an Ubuntu Live USB stick (the NetBSD grub2 package doesn't install the 
x86_64-efi source directory, I may look at that at some point).

grub-install --target=x86_64-efi --efi-directory=XXX --bootloader-id=grub --
boot-directory=XXX --debug

(where XXX is whatever directory you've mounted your EFI partition on).

This allows you to get a grub prompt when rebooting, so you do the usual:
insmod ufs2
set root=(...) <- put in your NetBSD partition here; (hd0,gpt3) for example
knetbsd /netbsd --root=dk2 (substitute your own dk)
boot

Then mount your EFI partition under NetBSD and run the grub-mkconfig from 
there:

grub-mkconfig -o XXX/grub/grub.cfg

(if you do this under Ubuntu the resulting Grub doesn't work, my guess is it 
has something to do with video modes).

And it works. Thanks all for your help!

best,

  Jaap
-- 
"Then I'll tell the truth. We're allowed to do that in emergencies."


Home | Main Index | Thread Index | Old Index