Re: Using loader to switch kernel and root device on Pi2

From: 風來散人 <furaisanjin_at_gmail.com>
Date: Thu, 03 Apr 2025 00:46:37 UTC
2025 April 3  0:21 bob prohaska <fbsd@www.zefox.net>:

> On Wed, Apr 02, 2025 at 08:15:19AM +0900, 風來散人 wrote:
> > Hello all.
> >
> > Are we able to utilize /EFI/freebsd/loader.env to specify rootdev? "man
> > loader.efi"says "Additional Environment Variable".
> > I don't have RPI2 but have RPI4.
>
> If you have a Pi4 it might be worth trying to use the new Raspberry Pi
> boot menu feature. Supposedly it's available on the Pi4 and Pi5, though
>

I have 2 PI4's and one is dedicated to router. This doesn't need any
mechanical disk so that SD cad is used.
Another one is used for home server like NAS, DNS, web, mail and etc. This
boots from USB disk with onboard E2ROM.

> I put 2 freebsd systems on one micro SD
> > and I can't switch boot partition by loader.env file.
>

Sorry for confusing, There was typo. I wanted to write "can', not "can't".


> > The number to assign for disks is question but if I put
> "rootdev=disk0s3a",
> > the third partition on SD card is used.
>
> I put in /boot/loader.conf on the boot device the lines
> currdev="disk0s2a"
> and
> vfs.root.mountfrom="ufs:/dev/da0s2a"
>

As far as I understand loader.conf is used after FreeBSD kernel boots, but
loader.env  is used after FreeBSD bootloader starts.
So still you have chance to tweak the root device for FreeBSD kernel.

I'm not accquainted with loader.env.


I wasn't either. I found this feature last October.

Regards,
furaisanjin