Re: Notes/questions . . . [Now: bad media has config.txt for armv7's GENERICSD, not aarch64's RPI media, corrected ] [boots fine via USB sdcard reader instead of sdcard slot]

From: Jose Luis Duran <jlduran_at_freebsd.org>
Date: Fri, 04 Sep 2026 00:59:05 UTC
On Thu, Sep 3, 2026 at 9:51 PM Mark Millard <marklmi@yahoo.com> wrote:
>
> On 9/3/26 15:18, Mark Millard wrote:
> > On 9/3/26 14:23, Mark Millard wrote:
> >> On 9/3/26 13:33, Jose Luis Duran wrote:
> >>> . . .
> >>>
> >>> Regarding D58197, earlier I sent you a private email with a link where
> >>> you can download a pre-built image. Just decompress and flash to a
> >>> micro SD card.
> >>> In case you didn't received it:
> >>>
> >>> QUOTE
> >>> This is a private reply with a link of the image (I'll take it down in
> >>> about a week):
> >>>
> >>> https://people.freebsd.org/~jlduran/_.disk.full.xz
> >>> (SHA256 d276e5a6e959abc3ec10f1f466bddc4fcb5c40a275fdf858d6d1e4776fe13eb3)
> >>
> >> Thanks. Downloading.
> >>
> >> The private reply did not even make it the junk area.
> >>
> >>>
> >>> This is a non-working image. To make it work, just put new firmware
> >>> files in the msdos partition.
> > . . .
> >>> The firmware and configuration files that we use MUST match those used
> >>> by release (see:
> >>> https://cgit.freebsd.org/src/tree/release/arm64/RPI.conf), if some are
> >>> missing, please let me know, and I'll update the RPI.conf file.
> >>> END QUOTE
> >>
> >> Thanks again.
> >>> . . .
> > My sdcard media media was a size mismatch, so:
> >
> > # gpart show -p /dev/da4
> > =>      34  31108029    da4  GPT  (238G) [CORRUPT]
> >         34      2014         - free -  (1007K)
> >       2048   1024000  da4p1  ms-basic-data  (500M)
> >    1026048    532480  da4p2  efi  (260M)
> >    1558528  14772224  da4p3  freebsd-ufs  (7.0G)
> >   16330752  14772224  da4p4  freebsd-ufs  (7.0G)
> >   31102976      2048  da4p5  freebsd-ufs  (1.0M)
> >   31105024      3039         - free -  (1.5M)
> >
> > # gpart recover /dev/da4
> > da4 recovered
> >
> > # gpart show -pl /dev/da4
> > =>       40  499744688    da4  GPT  (238G)
> >          40       2008         - free -  (1004K)
> >        2048    1024000  da4p1  cidata  (500M)
> >     1026048     532480  da4p2  efiboot0  (260M)
> >     1558528   14772224  da4p3  code1  (7.0G)
> >    16330752   14772224  da4p4  code2  (7.0G)
> >    31102976       2048  da4p5  cfg  (1.0M)
> >    31105024  468639704         - free -  (223G)
> >
> > The config.txt is wrong for the RPi4:
> >
>
> I should  have mentioned/showed that the mount command for the below was:
>
> # mount -onoatime -tmsdosfs /dev/gpt/cidata /mnt
>
> > # cat /mnt/config.txt
> > init_uart_clock=3000000
> > enable_uart=1
> > kernel=u-boot.bin
> > kernel7=u-boot.bin
> > dtoverlay=mmc
> >
> > The official release media for aarch64 uses a copy of:
> > (Note my local files are as of when I last synchronized.)
> >
> > # cat /usr/local/share/rpi-firmware/config_arm64.txt
> > [all]
> > arm_64bit=1
> > dtparam=audio=on,i2c_arm=on,spi=on
> > dtoverlay=mmc
> > dtoverlay=disable-bt
> > device_tree_address=0x4000
> > kernel=u-boot.bin
> >
> > [pi4]
> > hdmi_safe=1
> > armstub=armstub8-gic.bin
> >
> > What is in what you sent is a match to:
> >
> > /usr/local/share/rpi-firmware/config.txt
> >
> > which is not for aarch64 at all: armv7. For reference:
> >
> > # grep -r 'config.*\.txt' /usr/src/release/
> > /usr/src/release/arm/GENERICSD.conf:  RPI_FIRMWARE_FILES="bootcode.bin
> > config.txt \
> > /usr/src/release/arm64/RPI.conf:      chroot ${CHROOTDIR} cp -p
> > ${DTB_DIR}/config_arm64.txt \
> > /usr/src/release/arm64/RPI.conf:                      ${FATMOUNT}/config.txt
> >
> > GENERICSD.conf is for armv7 instead.
> >
> >
> > I'll need replace the config.txt in order to make any reasonable test.
> >
> > FYI: I ignored:
> >
> > # cat /mnt/meta-data
> > local-hostname: stratipi.home.arpa
> >
> > # cat /mnt/user-data
> > #cloud-config
> >
> >
>
> Of course the update below may not be sufficient --but is necessary.
>
> # mv /mnt/config.txt /mnt/config.txt.armv7-innappropriate
> # cp -aRx /usr/local/share/rpi-firmware/config_arm64.txt /mnt/config.txt
>
> Then I edited /mnt/config.txt to make it:
>
> # cat /mnt/config.txt
> [all]
> arm_64bit=1
> dtparam=audio=on,i2c_arm=on,spi=on
> dtoverlay=mmc
> dtoverlay=disable-bt
> device_tree_address=0x4000
> kernel=u-boot.bin
>
> [pi4]
> hdmi_safe=1
> armstub=armstub8-gic.bin
>
> # Local additions for RPi* firmware debug output to appear:
> [all]
> enable_uart=1
> uart_2ndstage=1
> dtdebug=1
>
>
> For reference:
>
> # strings /mnt/start*.elf | grep VC_BUILD_ID_
> VC_BUILD_ID_USER: dom
> VC_BUILD_ID_TIME: 10:52:42
> VC_BUILD_ID_VARIANT: start
> VC_BUILD_ID_TIME: Mar 17 2023
> VC_BUILD_ID_BRANCH: bcm2711_2
> VC_BUILD_ID_HOSTNAME: buildbot
> VC_BUILD_ID_PLATFORM: raspberrypi_linux
> VC_BUILD_ID_VERSION: 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean)
> VC_BUILD_ID_USER: dom
> VC_BUILD_ID_TIME: 10:50:39
> VC_BUILD_ID_VARIANT: start
> VC_BUILD_ID_TIME: Mar 17 2023
> VC_BUILD_ID_BRANCH: bcm2711_2
> VC_BUILD_ID_HOSTNAME: buildbot
> VC_BUILD_ID_PLATFORM: raspberrypi_linux
> VC_BUILD_ID_VERSION: 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean)
> VC_BUILD_ID_USER: dom
> VC_BUILD_ID_TIME: 10:50:56
> VC_BUILD_ID_TIME: Mar 17 2023
> VC_BUILD_ID_BRANCH: bcm2711_2
> VC_BUILD_ID_VARIANT: start_cd
> VC_BUILD_ID_HOSTNAME: buildbot
> VC_BUILD_ID_PLATFORM: raspberrypi_linux
> VC_BUILD_ID_VERSION: 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean)
> VC_BUILD_ID_USER: dom
> VC_BUILD_ID_TIME: 10:51:11
> VC_BUILD_ID_TIME: Mar 17 2023
> VC_BUILD_ID_BRANCH: bcm2711_2
> VC_BUILD_ID_VARIANT: start_db
> VC_BUILD_ID_HOSTNAME: buildbot
> VC_BUILD_ID_PLATFORM: raspberrypi_linux
> VC_BUILD_ID_VERSION: 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean)
> VC_BUILD_ID_USER: dom
> VC_BUILD_ID_TIME: 10:51:33
> VC_BUILD_ID_VARIANT: start_x
> VC_BUILD_ID_TIME: Mar 17 2023
> VC_BUILD_ID_BRANCH: bcm2711_2
> VC_BUILD_ID_HOSTNAME: buildbot
> VC_BUILD_ID_PLATFORM: raspberrypi_linux
> VC_BUILD_ID_VERSION: 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean)
> VC_BUILD_ID_USER: dom
> VC_BUILD_ID_TIME: 10:53:00
> VC_BUILD_ID_TIME: Mar 17 2023
> VC_BUILD_ID_BRANCH: bcm2711_2
> VC_BUILD_ID_VARIANT: start_cd
> VC_BUILD_ID_HOSTNAME: buildbot
> VC_BUILD_ID_PLATFORM: raspberrypi_linux
> VC_BUILD_ID_VERSION: 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean)
> VC_BUILD_ID_USER: dom
> VC_BUILD_ID_TIME: 10:53:15
> VC_BUILD_ID_TIME: Mar 17 2023
> VC_BUILD_ID_BRANCH: bcm2711_2
> VC_BUILD_ID_VARIANT: start_db
> VC_BUILD_ID_HOSTNAME: buildbot
> VC_BUILD_ID_PLATFORM: raspberrypi_linux
> VC_BUILD_ID_VERSION: 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean)
> VC_BUILD_ID_USER: dom
> VC_BUILD_ID_TIME: 10:53:39
> VC_BUILD_ID_VARIANT: start_x
> VC_BUILD_ID_TIME: Mar 17 2023
> VC_BUILD_ID_BRANCH: bcm2711_2
> VC_BUILD_ID_HOSTNAME: buildbot
> VC_BUILD_ID_PLATFORM: raspberrypi_linux
> VC_BUILD_ID_VERSION: 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean)
>
>
> # mount -onoatime /dev/gpt/code1 /mnt
>
> # cat /mnt/boot/loader.conf.local
> # Configure USB OTG; see usb_template(4).
> hw.usb.template=3
> umodem_load="YES"
>
> # Console ONLY on video! Serial is for GPS!
> console="efi"
> boot_multicons="YES"
> boot_serial="YES"
> #hw.fdt.console="NO"
>  . . .
>
> For my getting RPi* firmware debug output I need to adjust the console
> lines. Also, the above comment and the lines do not fully agree about
> "ONLY on video" status as I understand, because of the boot_serial="YES"
> land boot_multicons="YES" indicating that both are to be used by
> FreeBSD. (Not relevant to my testing, however.)
>
> Just for my testing:
>
> # diff -u /mnt/boot/loader.conf.local.orig /mnt/boot/loader.conf.local
> --- /mnt/boot/loader.conf.local.orig    2026-09-03 09:21:25.000000000 -0700
> +++ /mnt/boot/loader.conf.local 2026-09-03 15:50:17.899722000 -0700
> @@ -3,8 +3,8 @@
>  umodem_load="YES"
>
>  # Console ONLY on video! Serial is for GPS!
> -console="efi"
> -boot_multicons="YES"
> +console="eficom"
> +boot_multicons="NO"
>  boot_serial="YES"
>  #hw.fdt.console="NO"
>
>
> The same goes for: /dev/gpt/code2
>
>
> Some of the initial debug output follows. Note that the EEPROM content
> is recent:
>
>   0.48 RPi: BOOTSYS release VERSION:224877da DATE: 2026/05/17 TIME: 20:13:18
>   0.49 MFG_VER: 1
>   0.49 BOOTMODE: 0x06 partition 63 build-ts BUILD_TIMESTAMP=1779045198
> serial c740af3c boardrev d03115 stc 495306
>   0.50 PM_RSTS 00001575
>   0.50 POWER_OFF_ON_HALT: 0 WAIT_FOR_POWER_BUTTON 0 power-on-reset 0
>   0.51 EEPROM ID 0xef3013
> . . .
>   3.27 SD_OC: 0
>   3.73 Boot mode: SD (01) order f4
> . . .
>   4.56 Trying partition: 0
>   4.55 GPT 4a8a2f94b3a7f1112887fbd68f5c160e 000000001 01dc97fff
> num-partitions 128 entry-size 128 pentry 2 first 0
>   4.56 GPT partition: 0 ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> 000000800..0000fa7ff
>   4.57 Matched GUID bootable-part-idx 0 want partition 0
>   4.81 type: 16 lba: 2048 '        ' '      ^     ' clusters 1023455 (1)
>   4.58 rsc 1 fat-sectors 256 root dir cluster 1 sectors 32 entries 512
>   4.59 FAT16 clusters 1023455
>   4.60 [sdcard] autoboot.txt not found
>   4.60 Select partition rsts 0 C(boot_partition) 0 EEPROM config 0 result 1
>   4.07 Trying partition: 1
>   4.61 GPT 4a8a2f94b3a7f1112887fbd68f5c160e 000000001 01dc97fff
> num-partitions 128 entry-size 128 pentry 2 first 0
>   4.62 GPT partition: 0 ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> 000000800..0000fa7ff
>   4.62 Matched GUID bootable-part-idx 0 want partition 0
>   4.32 type: 16 lba: 2048 '        ' '      ^     ' clusters 1023455 (1)
>   4.63 rsc 1 fat-sectors 256 root dir cluster 1 sectors 32 entries 512
>   4.64 FAT16 clusters 1023455
>   4.49 Read config.txt bytes      284 hnd 0xb188
>   4.65 [sdcard] pieeprom.upd not found
>   4.65 [sdcard] recover4.elf not found
>   4.65 [sdcard] recovery.elf not found
>   4.88 Read start4.elf bytes  2251392 hnd 0x1a06
>   4.93 Read fixup4.dat bytes     5399 hnd 0x2e5
>   4.94 0x00d03115 0x00000000 0x00001fff
>   4.98 MEM GPU: 76 ARM: 948 TOTAL: 1024
>   4.70 Firmware: 82f3750a65fadae9a38077e3c2e217ad158c8d54 Mar 17 2023
> 10:50:39
>   4.07 Starting start4.elf @ 0xfec00200 partition 1
> . . .
>
> So it definitely found config.txt , start4.elf , fixup4.dat on the GPT
> media. The "284" for config.txt matches the size of my adjusted
> config.txt file.
>
> There is more debug output than the last time I was looking at such (not
> recently).
>
> . . .
> MESS:00:00:06.737217:0: kernel=
> . . .
>
> That is the only reference to kernel= (assignment) that I see in the
> debug output so far, despite what is in the config.txt that I used.
> (More later about "kernel".)
>
> . . .
> MESS:00:00:08.761462:0: dtb_file 'bcm2711-rpi-4-b.dtb'
> . . .
> MESS:00:00:08.965164:0: dtb_file 'bcm2711-rpi-4-b.dtb'.
>  . .
> MESS:00:00:09.171767:0: Failed to load Device Tree file '?'
> . . .
> MESS:00:00:09.378786:0: Failed to open command line file 'cmdline.txt'
> . . .
> MESS:00:00:09.586713:0: No compatible kernel found
>
> (That is the last line output.)
>
>
> As a cross check on armv7 vs. aarch64 for u-boot.bin :
>
> # strings /mnt/u-boot.bin | grep -i arm
> ARM Limited
> Bad Linux ARM64 Image magic!
> bcm2835: Could not query ARM memory size
> Failed to prep arm64 kernel (err=%d)
> arm-trusted-firmware
> ARM Trusted Firmware
> arm64
> armbianEnv
> Armbian
> reset -w - warm reset if implemented
> default-arm-bcm283x-rpi
> default-arm-bcm283x
> default-arm
> arm,pl011
> arm,pl010
> arm,cortex-a53
> arm,cortex-a72
> U-Boot.armv8
> arch=arm
> cpu=armv8
>
>
> So it does not seem to have the problem that config.txt had of being for
> armv7 instead.
>
>
> Nothing reported GPT related problems.
>
>
> But there was lots of text like the below in some of the places I listed
> "...":
>
> MESS:00:00:09.385315:0: gpioman: gpioman_get_pin_num: pin
> SDCARD_CONTROL_POWER not defined
> MESS:00:00:09.493027:0: gpioman: gpioman_get_pin_num: pin
> SDCARD_CONTROL_POWER not defined
> MESS:00:00:09.502347:0: arasan: arasan_emmc_set_clock C0: 0x00800000 C1:
> 0x000e8007 emmc: 100000000 actual: 390625 div: 0x00000080 target: 400000
> min: 400000 max: 400000 delay: 5
> MESS:00:00:09.515220:0: arasan: arasan_emmc_set_clock C0: 0x00800f00 C1:
> 0x000e8007 emmc: 100000000 actual: 390625 div: 0x00000080 target: 400000
> min: 390000 max: 400000 delay: 5
> MESS:00:00:09.556375:0: gpioman: gpioman_get_pin_num: pin
> SDCARD_CONTROL_WRITE_PROTECTED not defined
> MESS:00:00:09.565840:0: arasan: arasan_emmc_set_clock C0: 0x00800f06 C1:
> 0x000e0107 emmc: 100000000 actual: 50000000 div: 0x00000001 target:
> 50000000 min: 0 max: 50000000 delay: 1
> MESS:00:00:09.579179:0: gpioman: gpioman_get_pin_num: pin
> SDCARD_CONTROL_POWER not defined
>
>
> So I tried putting the sdcard into a USB3 reader, plugging it in and
> booting that way. It booted just fine being used via USB3 (based on my
> config.txt replacement as well):
>
> . . .
> Starting background file system checks in 60 seconds.
>
> Thu Sep  3 16:21:50 UTC 2026
>
>   ███████╗████████╗██████╗  █████╗ ████████╗██╗██████╗ ██╗
>   ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗╚══██╔══╝██║██╔══██╗██║
>   ███████╗   ██║   ██████╔╝███████║   ██║   ██║██████╔╝██║
>   ╚════██║   ██║   ██╔══██╗██╔══██║   ██║   ██║██╔═══╝ ██║
>   ███████║   ██║   ██║  ██║██║  ██║   ██║   ██║██║     ██║
>   ╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝   ╚═╝╚═╝     ╚═╝
>
>
> FreeBSD/arm64 (Amnesiac) (ttyu0)
>
> login:
>
>
> So it has nothing to do with GPT, just with the handling the microsd
> card slot after some very early stage working activity there.
>
> # ls -lat /boot/msdos/
> total 22721
> drwxr-xr-x  16 root wheel    1536 Sep  3 22:49 ..
> -rwxr-xr-x   1 root wheel     284 Sep  3 16:58 config.txt
> -rwxr-xr-x   1 root wheel    1594 Sep  3 16:21 LICENCE.broadcom
> -rwxr-xr-x   1 root wheel     240 Sep  3 16:21 README
> -rwxr-xr-x   1 root wheel    5888 Sep  3 16:21 armstub8-gic.bin
> -rwxr-xr-x   1 root wheel    5888 Sep  3 16:21 armstub8.bin
> -rwxr-xr-x   1 root wheel   30390 Sep  3 16:21 bcm2710-rpi-2-b.dtb
> -rwxr-xr-x   1 root wheel   32753 Sep  3 16:21 bcm2710-rpi-3-b-plus.dtb
> -rwxr-xr-x   1 root wheel   32142 Sep  3 16:21 bcm2710-rpi-3-b.dtb
> -rwxr-xr-x   1 root wheel   30285 Sep  3 16:21 bcm2710-rpi-cm3.dtb
> -rwxr-xr-x   1 root wheel   31318 Sep  3 16:21 bcm2710-rpi-zero-2-w.dtb
> -rwxr-xr-x   1 root wheel   52593 Sep  3 16:21 bcm2711-rpi-4-b.dtb
> -rwxr-xr-x   1 root wheel   38182 Sep  3 16:21 bcm2711-rpi-cm4-io.dtb
> -rwxr-xr-x   1 root wheel   53202 Sep  3 16:21 bcm2711-rpi-cm4.dtb
> -rwxr-xr-x   1 root wheel   52476 Sep  3 16:21 bootcode.bin
> -rwxr-xr-x   1 root wheel      89 Sep  3 16:21
> config.txt.armv7-inappropriate
> -rwxr-xr-x   1 root wheel    7266 Sep  3 16:21 fixup.dat
> -rwxr-xr-x   1 root wheel    5399 Sep  3 16:21 fixup4.dat
> -rwxr-xr-x   1 root wheel    3173 Sep  3 16:21 fixup4cd.dat
> -rwxr-xr-x   1 root wheel    8381 Sep  3 16:21 fixup4db.dat
> -rwxr-xr-x   1 root wheel    8387 Sep  3 16:21 fixup4x.dat
> -rwxr-xr-x   1 root wheel    3173 Sep  3 16:21 fixup_cd.dat
> -rwxr-xr-x   1 root wheel   10230 Sep  3 16:21 fixup_db.dat
> -rwxr-xr-x   1 root wheel   10228 Sep  3 16:21 fixup_x.dat
> -rwxr-xr-x   1 root wheel      35 Sep  3 16:21 meta-data
> drwxr-xr-x   1 root wheel     512 Sep  3 16:21 overlays
> -rwxr-xr-x   1 root wheel 2975680 Sep  3 16:21 start.elf
> -rwxr-xr-x   1 root wheel 2251392 Sep  3 16:21 start4.elf
> -rwxr-xr-x   1 root wheel  805756 Sep  3 16:21 start4cd.elf
> -rwxr-xr-x   1 root wheel 3747688 Sep  3 16:21 start4db.elf
> -rwxr-xr-x   1 root wheel 2998888 Sep  3 16:21 start4x.elf
> -rwxr-xr-x   1 root wheel  805756 Sep  3 16:21 start_cd.elf
> -rwxr-xr-x   1 root wheel 4819624 Sep  3 16:21 start_db.elf
> -rwxr-xr-x   1 root wheel 3722504 Sep  3 16:21 start_x.elf
> -rwxr-xr-x   1 root wheel  701824 Sep  3 16:21 u-boot.bin
> -rwxr-xr-x   1 root wheel      14 Sep  3 16:21 user-data
> drwxr-xr-x   1 root wheel   16384 Jan  1  1980 .
>
>
> I've not tested any other RPi* with this sdcard context yet --or the
> newer content for /boot/msdos/ on any RPi* yet.
>
> --
> ===
> Mark Millard
> marklmi at yahoo.com

Good to know, but please keep the testing limited to a micro SD card.
If I attempt to boot it using a QEMU VM, for instance, it also works
fine. Please do not deviate from the main issue. We are only
interested in why those binaries do not work with a microSD card.

-- 
Jose Luis Duran