Current-Users archive

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

Re: 10.0 BETA: How to boot using UEFI or grub




> On Dec 25, 2022, at 05:33, Mayuresh <mayuresh%acm.org@localhost> wrote:
> 
> I have installed NetBSD 10.0 BETA amd64 on a Lenovo laptop with Ubuntu on
> an another partition.
> 
> [ This is a different laptop than the one I am discussing on some other
> threads ].
> 
> The laptop supports UEFI and legacy boot. But the installation medium
> showed up only as legacy boot. So I think the installer worked in legacy
> boot mode.
> 
> Now I wish to boot this using either UEFI or grub.
> 
> 2. Using grub
> 
> I tried on grub prompt
> 
>    set root=(hd0,gpt3)
>    insmod part_gpt
>    insmod part_bsd
>    knetbsd /netbsd
> 
> I get
> 
>    error: unknown filesystem
> 

I never managed to get grub to boot a netbsd kernel directly, IIRC, but it's easy to chainload the netbsd efi boot loader.  To make the setup persistent across grub configuration updates, I put a script in /etc/grub.d (under ubuntu), called 30_netbsd, that contains:

#! /bin/sh
set -e

# grub-mkconfig helper script.

echo "menuentry 'NetBSD boot loader' --class netbsd --class os {
	chainloader (hd0,gpt1)/EFI/netbsd/bootx64.efi
}"

This obviously makes no attempt to autodetect netbsd when running grub-mkconfig---it just hardwires a menu entry for it.  It assumes the disk is hd0 (by grub's naming convetion) and your gpt efi partition is the first partition.  Of course, you have to copy the netbsd /usr/mdec/bootx64.efi file into /boot/efi/EFI/netbsd (the location seen under ubuntu), and that's where netbsd's boot.cfg should go (though you can also put it in the legacy location in the root directory on netbsd).  You'll have to update the grub configuration, which IIRC is done by running grub-mkconfig and putting the resulting configuration in /boot/grub/grub.cfg (be sure to back up the original, just in case).

Then when you boot with grub you can select netbsd from the grub menu.

There are also other ways of incorporating the menu entry, using mechanisms provided in the existing scripts /etc/grub.d/4{0,1}_custom.  You might prefer using one of those.

HTH

-- 
Jim


Home | Main Index | Thread Index | Old Index