Nanobsd build for rpi4

Hi all,

I am trying to build a version of nanobsd for the raspberry pi 4. It is failing at the u-boot assembly stage because it is looking for the dtb overlays in a directory that does not have them. So it’s stopping with a “file not found”.

Building the i386 variant to test my installation works fine.

Has anyone encountered this before?

I’m away from the machine at the moment, but can update with more details when I have a moment.
 
Separate the ESP EFI FAT32 msdosfs partition that has the U-BOOT file and the Raspberry Pi 4B Overlay files. The files start4x.elf and fixup.dat files. Usally /dev/da0p1 ESP partition and the /dev/da0p2 freebsd-swap partition and the /dev/da0p3 freebsd-ufs partition with the /boot/kernel/kernel FreeBSD kernel file for aarch64 .
http://ghostbsdarm64.hopto.org/packages/Ghost14_selfbuilt_raspi4b_Dec12_3.img.xz Look at the 3 partitions in her
These 4 commands will characterize the setup of your usb flash disk drive.
camcontrol devlist
geom disk list
gpart status da1
gpart show -lp da1

mkdir -p /mnt/esp /mnt/rootfs
mount -t msdosfs /dev/da1p1 /mnt/esp
mount /dev/da1p3 /mnt/rootfs
tree /mnt/esp
ls -l /mnt/esp/overlay
cat /mnt/esp/config.txt
cat /mnt/esp/cmdline.txt

Sorry, tired this AM Jan2 2024.
https://ghostbsd-arm64.blogspot.com/2023/12/how-to-install-ghostbsd-arm64-into-usb.html#more
https://ghostbsd-arm64.blogspot.com/2023/12/look-inside-usb-flash-drive-partition.html
https://ghostbsd-arm64.blogspot.com/2023/11/creating-ghost14-aarch64-arm64-boot.html Klara Systems Articles
https://ghostbsd-arm64.blogspot.com/2023/11/arm64-boot-usb-flash-drive-hey-buddy.html

Michael Dexter has created the minimal BSD with OccamBSD
https://github.com/michaeldexter/occambsd
https://github.com/michaeldexter
https://papers.freebsd.org/author/michael-dexter/ FreeBSD papers. Look for one related to OccamBSD.

Yes, I wish you success on creating NanoBSD. Keep notes, share back what works. Good luck
Use the FreeBSD.org/where
https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/14.0/ Look for RPI (3/4) image for FreeBSD 14.0 release Nov 10, 2023
https://download.freebsd.org/releas...FreeBSD-14.0-RELEASE-arm64-aarch64-RPI.img.xz
Use this FreeBSD 14.0-RELEASE Nov 10, 2023 version for the ESP EFI FAT32 partition. Overwrite the UFS partition with your kernel files.
 
Hi all,

I am trying to build a version of nanobsd for the raspberry pi 4. It is failing at the u-boot assembly stage because it is looking for the dtb overlays in a directory that does not have them. So it’s stopping with a “file not found”.

Building the i386 variant to test my installation works fine.

Has anyone encountered this before?

I’m away from the machine at the moment, but can update with more details when I have a moment.
Yes, same problem here. From what I saw, the bug comes from the generation of "_.metalog" file which lists files to copy into $NANO_WORLDDIR. In my case, it's an ARMV7 machine (nanopi-neo). But we have the same problem with the configuration file for RPI3 provided in the nanobsd tree.

Code:
cd /usr/src/tools/tools/nanobsd/embedded
../nanobsd.sh -c rpi3.cfg

I had not this problem with releng/13. That said, I didn't have time to dig into the subject since I broke my dev machine. 2024 is not promising :)
 
Back at my machine.

Build environment is 14.0-RELEASE on ARM64 (UTM virtual machine on macOS).

The failing output is in _.cust.dos_boot_part:

Code:
+ dos_boot_part
+ local 'd=/usr/local/share/u-boot/u-boot-rpi4'
+ local 'f=/usr/embedded/rpi4/_.fat'
+ rm -rf /usr/embedded/rpi4/_.fat
+ mkdir /usr/embedded/rpi4/_.fat
+ chdir /usr/embedded/rpi4/_.fat
+ cp /usr/local/share/u-boot/u-boot-rpi4/README /usr/local/share/u-boot/u-boot-rpi4/metadata /usr/local/share/u-boot/u-boot-rpi4/u-boot.bin .
+ touch uEnv.txt
+ cp '/usr/embedded/rpi4/_.w/boot/dtb/*.dtb' .
cp: /usr/embedded/rpi4/_.w/boot/dtb/*.dtb: No such file or directory

My nanobsd config is:

Code:
NANO_ARCH=aarch64
NANO_KERNEL=BROADCOM
NANO_DRIVE=mmc0
NANO_NAME=rpi4
NANO_BOOT_PKG=u-boot-rpi4

. common    # Pull in common definitions, keep last

(I copied the rpi3.cfg and replaced the appropriate bits. )
 
Yes same message error in my case.
Dtb files are build :
Code:
find /usr/embbeded -name "*.dtb"
but not copied in $NANO_WORLDDIR
 
Sorry typo:

Code:
find /usr/embedded -name "*.dtb"

I suppose your kernel configuration is inchanged with FDT option?
 
Build environment is 14.0-RELEASE on ARM64 (UTM virtual machine on macOS).
This might be a problem.
First NanoBSD (including bsdimp's custom work) is made to build on amd64/i386
Use one of those targets instead for your VM..

Also try with 13-STABLE or 13.2-RELEASE. I have had trouble building NanoBSD with FreeBSD 14.0-RELEASE
 
The ARM64 KERNCONF's at /usr/src/sys/arm64/conf/GENERIC

Contains this for your board:

Code:
# DTBs
makeoptions    MODULES_EXTRA="dtb/allwinner dtb/freescale dtb/imx8 dtb/nvidia dtb/mv dtb/rockchip dtb/rpi"
The last one should build all aarch64 RPI DTB's.
/usr/src/sys/conf/dtb.build.mk

Use ARM64's GENERIC kernel unless you have custom needs.
 
I was looking at /usr/src/sys/arm64/conf/BROADCOM on 14.0-RELEASE. That seems to be the same as GENERIC except that it doesn't include unnecessary board options.

std.broadcom includes this:

Code:
# DTBs
makeoptions    MODULES_EXTRA+="dtb/rpi"

 
OK, so using GENERIC I get some of the DTB files created, but not copied. (This seems to be the same as mentioned by oOiOo ). The process still fails at the same place, though.

But I don't see the Raspberry PI dtb, which (I think?) should be something like "spigen-rpi4"?

I'm currently trying on an AMD64 version of 13.2-STABLE. I will report back if anything is difference.
 
An update, but little progress.

I tried building 13.2-STABLE on an AMD VM, but it was very slow and didn't really finish. I also tried 13.2-RELEASE on an ARM64 machine, and ended up with the same problem as 14.0-RELEASE.

What is interesting, however, is that in /usr/embedded/rpi4/_.w/boot/dtb/overlays/ on the 13.2 machine, all the .dtb files are there. But on the 14.0 build they are not. The script fails on 13.2 looking for _.w/boot/ubldr, though.
 
ubldr is deprecated for aarch64, even for armv7 (replaced by loader_lua.efi). Add this option in your nanobsd configuration file:

Code:
CONF_WORLD='
WITHOUT_LOADER_UBOOT=
'

See src.conf(5) for details.
 
I don't have a precise answer to this question. It comes from messages in the arm mailing list or comments in commits (for example here).

Anyway, EFI (loader_lua.efi) is the default loading method on aarch64 with 13.x and 14.0.
 
Back
Top