Hello all,
I think that many people wish to test NetBSD on the RPI4 but end
abandoning because of the confusing documentation about how to setup a
working Raspberrypi4 with the UEFI firmware. Several people have asked
for help in Reddit with the same problem. I also were very lost at the
beggining
Last night I tested the procedure of creating a image file from a NetBSD
system with the UEFI firmware included for flashing directly in the SD
card for the RPi4.
I wrote a simple dirty script to automate it and as a proof of concept.
Be careful, this script is tested on my own raspberrypi4 NetBSD 10.1
system, NO NOT RUN IT BLINDLY IN YOUR NetBSD SYSTEM cause wedges names
may be different and you may destroy it. I wrote it for automating and
testing the procedure.
I have tested the created image and boots well, you only have to boot,
enter the BIOS and remove the 3GB RAM limit. You need a HDMI monitor and
a keyboard attached to the RPI4.
netbsd-raspa4$ cat generate_NetBSD_RPI4_UEFI_image.sh
#!/bin/sh
set -x
WORKDIR=raspberrypi4-NetBSD.UEFI
NetBSDimage=https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.1/evbarm-aarch64/binary/gzimg/arm64.img.gz
UEFIfw=https://github.com/pftf/RPi4/releases/download/v1.42/RPi4_UEFI_Firmware_v1.42.zip
UEFIfwFILE=$(basename $UEFIfw)
mkdir $WORKDIR
cd $WORKDIR
wget $NetBSDimage
gunzip arm64.img.gz
vndconfig -c vnd0 arm64.img
mkdir msdos_partition
mount /dev/dk2 msdos_partition/
cd msdos_partition/
wget $UEFIfw
unzip -o $UEFIfwFILE
rm $UEFIfwFILE
cd ..
umount msdos_partition/
vndconfig -u vnd0
mv $(basename $NetBSDimage .gz) arm64-uefi-fw.img
echo "image saved in " $WORKDIR
netbsd-raspa4$
Same instructions in a more human format to be able to publish in a WIKI
style way:
# mkdir raspberrypi4-NetBSD.UEFI
# cd raspberrypi4-NetBSD.UEFI
# wget
https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.1/evbarm-aarch64/binary/gzimg/arm64.img.gz
$ gunzip arm64.img.gz
# vndconfig -c vnd0 arm64.img
# mkdir msdos_partition
# mount /dev/dk2 msdos_partition/
# cd msdos_partition/
# wget
https://github.com/pftf/RPi4/releases/download/v1.42/RPi4_UEFI_Firmware_v1.42.zip
# unzip -o RPi4_UEFI_Firmware_v1.42.zip
# rm RPi4_UEFI_Firmware_v1.42.zip
# cd ..
# umount msdos_partition/
# vndconfig -u vnd0
# mv arm64.img arm64-uefi-fw.img
Now you can flash your SD with the arm64-uefi-fw.img created image file
the usual way. I can put the image somewhere for downloading if you wish
and trust me...
I believe that there are the great Jun Ebihara images, not sure if they
are based only on NetBSD current and I think they come with preinstalled
packages. This procedure creates the SD card with a stock clean standard
NetBSD system ready to configure by the user.
Regards.
Ramiro.