Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
adding UEFI to NetBSD /boot/ [was Re: no HDMI on rpi4b NetBSD 10.1]
On Tue, Jul 15, 2025 at 07:45:47PM +0200, Ramiro Aceves wrote:
> El 15 de julio de 2025 18:49:44 CEST, Steve Rikli <sr%genyosha.net@localhost> escribió:
> >> > ...
> >> > Is is possible to simply unzip the RPi4_UEFI_Firmware_v1.42.zip archive
> >> > into a running NetBSD system's msdos /boot/ directory, and then reboot?
> >> > Or it it better to do that "offline", with the microSD mounted in
> >> > another system?
> >>
> >> I have done it in a running system and reboot without problems. Also
> >> Offline.
Turns out, working with the UEFI-related files in /boot/ while NetBSD is
booted indeed works OK; it might not be the "safest" method, e.g. you
could end up with an un-bootable system if you make a mistake.
But in that case you either re-dd the arm64.img or mount the /boot/
partition on another system for repair, which is the likely alternative
method to modifying /boot/ live anyway. :)
So, I did some experiments adding UEFI to my rpi4b NetBSD 10.1 evbarm
system, with microSD sysdisk; details below, but in summary I tried:
1) unzip RPi4_UEFI_Firmware_v1.42.zip into existing arm64.img /boot/
2) unzip RPi4_UEFI_Firmware_v1.42.zip into empty /boot/
3) some amount of "merge" content from those methods
My general conclusion is method #1 is the likely path people will want
if they use only a single boot media (e.g. microSD), and they just want
a running rpi4 NetBSD system. Folks with different/more storage or other
duties (e.g. firmware development) may want other methods.
> >> > If I simply unpack the zip archive directly into /boot/, it will
> >> > overwrite the config.txt which came with NetBSD img; and also end
> >> > up with different copies of at least bcm2711-rpi-4-b.dtb in
> >> > /boot/ as well as in /boot/dtb/broadcom/ .
> >>
> >> I think that config.txt overwritting is needed in order to make
> >> UEFI work. Compare UEFI firmare zip file config.txt with the
> >> NetBSD supplied one and you will see the difference. Keep a copy of
> >> yours just in case you need something. I have only changed
> >> arm_boost=1 to arm_boost=0 to not stress my RPi too much on long
> >> compilation.
For my method #1, I unpacked the RPi4_UEFI_Firmware_v1.42.zip directly
into NetBSD 10.1 arm64.img /boot/ and let it overwrite these files:
config.txt
fixup4.dat
start4.elf
and then simply rebooted without changing anything.
As others have reported, when the system reset I finally saw boot output
and the UEFI "strawberry" splash screen on HDMI, with a line describing
hotkeys for the UEFI actions:
ESC (setup), F1 (shell), ENTER (boot)......
This output appeared on both serial console & HDMI in a mirrored fashion,
i.e. they were not separate input/output, and what I typed in one place
also happened in the other.
Also as others have reported, the system only enabled 3GB memory (it has
8GB) at this point, but I didn't change anything in the UEFI firmware
manager for now.
The rpi4 proceeded to try booting IPv4 & IPv6 PXE & HTML, eventually
giving up since we don't use that infrastructure here for this system.
After timeout we got the usual NetBSD "flag" bootloader banner on both
HDMI and serial, which was a welcome sight. :-)
This is ultimately why I consider method #1 the simplest to do, though
most people will likely want to configure some things in the UEFI menu
as well, and possibly make changes to the UEFI stock /boot/config.txt .
For my method #2 I removed everything in /boot/ and simply unpacked the
same .zip archive into it, then reboot. Same results as above until it
ran out of boot options -- this time the rpi4 did *not* boot NetBSD, but
instead gave up:
BdsDxe: No bootable option or device was found.
BdsDxe: Press any key to enter the Boot Manager Menu.
This wasn't very surprising, since there was no NetBSD /boot/ config
pointing to a NetBSD kernel, root filesystem, etc. Some notes about
related things I tried from this point....
> >Wrt the NetBSD arm64.img /boot/config.txt, I noticed especially:
> >
> > os_prefix=dtb/broadcom/
> > cmdline=../../cmdline.txt
> > kernel=/netbsd.img
> > kernel_address=0x200000
It turns out you don't want these kernel= and kernel_address= lines
added to the UEFI /boot/config.txt file. When I added them, the system
hung shortly after power-on with a message like:
...
MESS:00:00:06.831633:0: Loaded '/netbsd.img' to 0x200000 size 0xfff7e8
MESS:00:00:06.854060:0: Kernel relocated to 0x400000
MESS:00:00:06.855910:0: Device tree loaded to 0x3e0000 (size 0xd831)
MESS:00:00:06.865064:0: uart: Set PL011 baud rate to 103448.300000 Hz
MESS:00:00:06.871304:0: uart: Baud rate change done...
MESS:00:00:06.873323:0: uart: Baud rate change done...
MESS:00:00:06.880730:0: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined
NOTICE: BL31: v2.9(release):v2.9
NOTICE: BL31: Built : 17:09:05, May 24 2023
UEFI firmware (version UEFI Firmware v1.42 built at 09:19:37 on May 25 2025)
Synchronous Exception at 0xFFFFFFFFFFFFFFFF
----
So I reverted to the stock UEFI /boot/config.txt and forged ahead with
cherry-picking things from the original NetBSD /boot/ into the UEFI
/boot/ I created with method #2 above, in hopes of getting a booting
NetBSD system again.
I didn't have much success until I eventually ended up back at a config
like method #1 (i.e. UEFI zip contents unpacked into NetBSD arm64.img
/boot/ directory), where I got a working NetBSD system again.
Next I experimented a bit with the config.txt and cmdline.txt files,
leaving the UEFI, dtb and other binaries alone in /boot/.
> >and in the NetBSD arm64.img /boot/cmdline.txt file there is:
> >
> > root=NAME=netbsd-root console=fb
> >
> >which looks like the NetBSD "/" partition location and presumably default
> >console definition. That seems important at first glance.
I believe /boot/cmdline.txt is not required for UEFI -- my rpi4b boots
NetBSD without it, so presumably the NetBSD "/" root filesystem location
and kernel are specified elsewhere (/boot/EFI/BOOT/bootaa64.efi ?).
I also couldn't find a cmdline.txt setting to let me switch to serial
console while using UEFI; I tried:
- console=com0 like you'd do for x86 /boot.cfg but that had no effect
- removed any console=... setting entirely, as suggested by
https://wiki.netbsd.org/ports/evbarm/raspberry_pi/
but that had no effect for me either; maybe it's U-Boot only?
- fwiw I also tried creating a /boot.cfg with consdev=com0,115200 in
the NetBSD "/" partition, like you'd do with PC hardware; I had low
expectations for this, figuring /boot.cfg isn't applicable to evbarm
(i386 & amd64 only, per boot.cfg(5)), and it had no effect either
The only method I found so far to get working serial console with UEFI
was setting "Preferred console" to "Serial" in UEFI firmware menus.
FYI that setup works but it's a mirrored behavior rather than 2 separate
input/output terminal devices, i.e. everything you see or type on HDMI
happens on serial, and visa versa. Somewhat like a PC with the "console
redirection" function set to always-on.
If anyone has found other serial console setups please share!
> >Fwiw I briefly checked config.txt docs when this rpi4 had the stock
> >Raspbian on it; config.txt appears to offer some functionality here which
> >is provided on other platforms by the NetBSD /boot.cfg file. Probably I
> >should revisit those config.txt docs at this point. :-)
> >
> >I expect there are many ways to craft config.txt plus associated UEFI
> >binaries, config, dtb, and support files to achieve various results.
For now I made just 2 changes to the UEFI version of config.txt:
arm_boost=0
force_turbo=0
since I have no need to overclock or force the CPU to always run at high
frequency. FYI the raspberry pi docs for config.txt can be useful here:
https://www.raspberrypi.com/documentation/computers/config_txt.html
> >> > > Regardless, I recommend booting to the UEFI screen (via serial
> >> > > console or HDMI) and configuring UEFI as desired (to remove the
> >> > > 3 GB RAM limit, set boot order, verify the ACPI mapping to
> >> > > allow the wifi chip to attach, etc) -- then have it boot NetBSD
> >> > > from whichever device holds NetBSD. Doing it in two stages
> >> > > helps debugging later.
> >> >
> >> > I don't know how to "boot to the UEFI screen" yet, but perhaps
> >> > this will become clearer after installing and booting the UEFI
> >> > zip bundle?
> >>
> >> You will see inmediately at boot a screen with a big raspberry from
> >> which you can enter UEFI, similar to a PC BIOS (pressing F2
> >> perhaps? I do not remember exactly the keys).
I may have had more success with method #2 (empty /boot/ + UEFI zipfile)
if I could've figured out how to use the UEFI firmware menus to setup
the system to boot from the FFS NetBSD "/" partition on the microSD.
But my attempts at creating a netbsd UEFI boot order option didn't
result in anything which was bootable; I chalk it up to my lack of
experience with this UEFI firmware manager, so if anyone has notes on
how to do this I'd appreciate seeing them.
A few observations on various docs: I think some of this process can
feel complicated because there's no readily available step-by-step
documented process which describes how to get from a system with blank
media, to booting NetBSD. This is somewhat understandable (read on).
The INSTALL doc handles this for the common x86/amd64 PC situation, but
it's not a complete reference for evbarm; it seems to me that it really
can't be, since there are many ARM64 boards and systems to support.
That said, I do think it might be worth at least mentioning UEFI in the
evbarm INSTALL doc, maybe with a pointer to the git zips for (some?)
platforms. E.g. there's a section about "Installation for Armv7 and
AArch64 devices with U-Boot", maybe there should be a brief section in
the same vicinity about "...devices with UEFI" with similar content.
I.e. I suspect I'd have gotten further in my intial (first ever! :-) )
attemps with NetBSD evbarm if I'd known from INSTALL that there was an
option to add more UEFI files and config to arm64.img /boot/ files.
Aside from that, there's also the NetBSD wiki e.g.
https://wiki.netbsd.org/ports/evbarm/
https://wiki.netbsd.org/ports/evbarm/raspberry_pi/
which I found pretty useful, though maybe a little dated or not very
specific in spots. Still, it's a decent reference overall, and if you
read the whole thing end-to-end you can probably find answers or at
least things to try; in restrospect I should have keep it side-by-side
while following the INSTALL guide.
I know this turned into a pretty long email, hopefully this isn't a
complete repeat of info for everyone; even as a returned NetBSD
user, this was still a useful learning experience for me.
Cheers,
sr.
Home |
Main Index |
Thread Index |
Old Index