Re: Nanobsd for RPI4

From: Guido Falsi <mad_at_madpilot.net>
Date: Tue, 16 Jan 2024 09:46:35 UTC
On 16/01/24 10:30, Andrew Hankinson wrote:
> 
> 
>> On 16 Jan 2024, at 10:03, Guido Falsi <mad@madpilot.net> wrote:
>>
>> On 16/01/24 09:52, Andrew Hankinson wrote:
>>> Hello,
>>> I saw a recent posting to this list about nanobsd for RPI3:
>>> Re: Nanobsd builds for rpi3 out of embedded blow up during build <https://lists.freebsd.org/archives/freebsd-arm/2024-January/003509html>
>>> lists.freebsd.org <https://lists.freebsd.org/archives/freebsd-arm/2024-January/003509.html>
>>> favicon.ico <https://lists.freebsd.org/archives/freebsd-arm/2024-January/003509.html>
>>> <https://lists.freebsdorg/archives/freebsd-arm/2024-January/003509.html>
>>> I just wanted to chime in to say I am seeing the exact same thing for a RPI4 build with both 14.0 release and 15.0 current. I asked about it on the forums, but there didn’t seem to be any solution.
>>> Has anyone here managed to get a nanobsd build working?
>>
>> I am using nanobsd with RPi3. Never tried RPi4. I did some customization to the nanobsd scripts and configuration to get it working though.
>>
>> Last time I rebuilt my image was in mid december. I'm going to build a new image in the next pair of weeks.
>>
>> Is the problem limited to the boot code?
> 
> I haven't been able to get past the boot code bit, but up until this point it works OK. I've simply copied the RPI3.cfg file and changed a few variables.
> 
> My build stops with the following logs:
> 
> # cat /usr/embedded/rpi4/_.cust.dos_boot_part
> + 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
> 
> This seems to be a problem with the dos_boot_part() function in /usr/src/tools/tools/nanobsd/embedded/common.
> 
> Your code seems to bypass this and uses the rpi-firmware package .dtbo files.

I was seeing problems simlar to what you are describing, so I wrote my 
own function.

> 
> So I guess my questions are:
> 
> 1. What changed that the .dtb files are no longer created in the regular build?
> 2. Should the dos_boot_part() function be changed to take the files from the rpi-firmware pkg instead?
> 
> Not being familiar with the nanobsd building process, I'm not really sure what is the best way to go.

I wrote this code some time ago and I don't remember the details, anyway 
my code does take the files from the pkg.

I took idea from the release scripts for aarch64 from:

src/release/release.sh
src/release/arm64/aarch64.conf
src/release/tools/arm.subr

which have more current code.

-- 
Guido Falsi <mad@madpilot.net>