Re: adding UEFI to NetBSD /boot/ [was Re: no HDMI on rpi4b NetBSD 10.1]

Ramiro Aceves <[email protected]> Thu, 24 Jul 2025 09:10:39 +0200
Newsgroups gmane.os.netbsd.ports.arm
Message-ID <[email protected]>
Hello Michael

El 23/7/25 a las 17:02, Michael van Elst escribió:
> [email protected] (Ramiro Aceves) writes:
>
>> In my armv6 RaspberrypiZeroW, there is no /netbsd kernel file and
>> /boot/kernel.img seems to be the loaded kernel.
>> netbsd-raspaZeroW$ file kernel.img
>> lhs/off overflow 2148331788 0
>> kernel.img: data
> /boot/kernel.img is what the RPI firmware regularly loads. You still
> need (a similar) /netbsd for some NetBSD tools.


Thanks for explaining everything. It has helped a lot in understanding it.

I only do not understand well this sentence:

"/boot/kernel.img is what the RPI firmware regularly loads. You still
need (a similar) /netbsd for some NetBSD tools."

Can you explain it further? ¿What tools? (I do not have /netbsd file in 
my RpiZeroWsystem)

Thanks.



>
> The firmware is actually a bit smarter. Depending on the RPI model
> it looks for 64bit and 32bit kernels and searches for kernel8.img
> or kernel7.img respectively and uses kernel.img as fallback. You
> can also specify which kernel to boot and make that depend on
> a GPIO signal (e.g. connect a switch).
>
>
>> On the other side, in my UEFI firmwared Raspberrypi4, netbsd.img is not
>> used (I believe it is only used when no UEFI fw is installed). There is
>> a /netbsd kernel in the usual standard place:
> The process is controlled by entries in config.txt.
>
> In this case the firmware loads UEFI, UEFI loads bootaa64.efi
> and bootaa64.efi loads /netbsd.
>
> The RPI documentation gives lots of details:
> https://www.raspberrypi.com/documentation/computers/config_txt.html
>
> E.g.:
>
> # start in 64bit mode (default is 32bit for RPI0-3 compatibility)
> arm_64bit=1
>
> # configure GPIO 14+15 as UART TX+RX lines
> enable_uart=1
>
> # RPI4 specific. The chip has several interrupt controllers, this
> # configures it to use the (arm standard) GIC-400 controller.
> enable_gic=1
>
> # load the "armstub" code from file, the default is to use code
> # embedded in start4.elf. The embedded code sets up low-level
> # hardware like the interrupt controller. The UEFI code
> # needs to do that by itself.
> armstub=RPI_EFI.fd
>
> # Don't prepare legacy boot options in memory
> # However, the value 2 is not documented.
> disable_commandline_tags=2
>
> # move the DTB into this memory area for UEFI to find it
> device_tree_address=0x3e0000
> device_tree_end=0x400000
>
>
>
>> netbsd-raspa4$ file netbsd.img
>> netbsd.img: Linux kernel ARM64 boot executable Image, little-endian, 4K
>> pages
>> note "Linux" there....
> The firmware loads a Linux kernel image and NetBSD hides as that. The file
> command just reports the fact.
>