Re: Update boot partition on a Pi - necessary? How?

From: Mark Millard <marklmi_at_yahoo.com>
Date: Thu, 04 Jul 2024 16:04:08 UTC
On Jul 4, 2024, at 04:36, Ronald Klop <ronald-lists@klop.ws> wrote:

>> Van: "Patrick M. Hausen" <pmh@hausen.com>
>> Datum: donderdag, 4 juli 2024 09:02
>> Aan: FreeBSD ARM List <freebsd-arm@freebsd.org>
>> Onderwerp: Update boot partition on a Pi - necessary? How?
>> Hi all,
>> 
>> my first release upgrade on the Pi platform - 14.0 --> 14.1.
>> Smooth as usual. Special thanks to ronald@ for the
>> smsc(4) improvements.
>> 
>> Now I wonder how to do what I regularly do on amd64,
>> namely update either the legacy boot partition or the
>> EFI boot loader?
>> 
>> What *are* all these files on that FAT partition, anyway?
>> Is there any documentation on this?
>> 
>> Thanks for pointers.
>> 
>> Kind regards,
>> Patrick
>   
> 
> Hi,
> 
> Thanks :-)
> 
> The files in the FAT partition are a combination of
> https://www.freshports.org/sysutils/rpi-firmware/

Installing that package/port installs files into:

/usr/local/share/rpi-firmware/

From there various files can be copied over to the
msdosfs that has what might be older files.

FreeBSD release and snapshot builds only have a
subset of the files from /usr/local/share/rpi-firmware/ .

Avoid blindly copying over:

/usr/local/share/rpi-firmware/config.txt

to the msdosfs.

The various:

/usr/local/share/rpi-firmware/config_*.txt

are alternatives for the content of the config.txt .

Modern releases and snapshots are based on the
content of:

/usr/local/share/rpi-firmware/config_arm64.txt

But see below about u-boot as well.

Also, if you have your own tailoring of the content
of the msdosfs config.txt then you may want to
preserve that tailoring in your update.

Other than config.txt , copying more files than you
need should not hurt anything so long as the msdosfs
has sufficient space.

Only the armstub8*.bin files and some config.txt
content are somewhat FreeBSD specific. The rest
are just a vintage of materials from the RPi
folks that includes the subset that FreeBSD tries to
support. (The ones in the msdosfs for the release
and snapshot builds for the type of context: armv7
vs. aarch64 . I ignore armv6 here.)

> and
> https://www.freshports.org/sysutils/u-boot-rpi4/

That one is rpi4 specific and would go with use of
the content of:

/usr/local/share/rpi-firmware/config_rpi4.txt

This is not what modern releases and snapshots are
based on.

> But we also have

> https://www.freshports.org/sysutils/u-boot-rpi-arm64/

Modern releases and snapshots are based on this one. It
supports, for example: RPi4B, RPi3B, and RPi2B v1.2

Installing this package/port installs files into:

/usr/local/share/u-boot/u-boot-rpi-arm64/

# ls -C1 /usr/local/share/u-boot/u-boot-rpi-arm64/
README
metadata
u-boot.bin

If newer, the u-boot.bin is copied to the msdosfs to
replace the older one.

The README's reference to "RPI2v1.1" is wrong: it should
reference "RPI2v1.2". (An RPi2B v1.1 is an armv7 system,
not an aarch64 system.)

The content of:

/usr/local/share/rpi-firmware/config_arm64.txt

is what goes with this u-boot, but the content goes in
the msdosfs's config.txt .

If you have your own tailoring of the content of the
msdosfs config.txt then you may want to preserve that
tailoring in your update.

> and I don't know what the difference is.
> 
> You can install the rpi-firmware and u-boot-rpi4 ports/pkgs and copy the content to the FAT partition. Unfortunately I don't know an automated way to do this and if it will overwrite config files.


> Another solution:
> 
> What I usually do is
> - download the https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/14.1/FreeBSD-14.1-RELEASE-arm64-aarch64-RPI.img.xz release file

Using snapshot image files can be an alternative, if any are
available at the time. For example in:

http://ftp3.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/14.1/

However, due to snafus, it happens to be empty until a new
build of snapshots is done. The compressed file's name(s)
would match a pattern something like:

FreeBSD-*-STABLE-arm64-aarch64-RPI-*.img.xz

> - mount it using mdconfig
> - backup and empty the current FAT partition
> - copy the content of the FAT partition from the mounted img
> - diff the config files with my backup.
> At least than I know I have all the files which were also in the release and hopefully tested by some people.
> 
> A mdconfig+mount example can be found here: https://wiki.freebsd.org/arm/Raspberry%20Pi#Boot_Loader_Issues although they copy files into the image instead of the other way around.
> 
> Regards,
> Ronald.
 
===
Mark Millard
marklmi at yahoo.com