Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Oct 2022 13:19:07 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        bob prohaska <fbsd@www.zefox.net>
Cc:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: How to armv7 boot both RPi2B v1.1 (bcm2709 --real armv7) and RPi3B (bcm2710 aarch64),  but not RPI4B (bcm2711 aarch64)
Message-ID:  <2E0CD516-FDB2-4379-B2B4-71091FEF35AE@yahoo.com>
In-Reply-To: <9635B188-3F76-484A-8DFA-3C508E85B9D2@yahoo.com>
References:  <6B46F46A-2CAF-42C9-9A04-63567D7DB9B2@yahoo.com> <D9B791B7-106A-402E-AD8C-F811EB315560@yahoo.com> <CANCZdfoJ=E=ef86PRaYsvgXWLAu=AdbN%2B_kiv0vPhKVksqPY%2Bg@mail.gmail.com> <FC871551-7C49-4751-8763-2E8F82C1480A@yahoo.com> <CANCZdfoU2Ln2vqymT66Yu6ZdxSrZLAx1%2BA_hstLYSrzBmduHBw@mail.gmail.com> <28D78C89-E195-4EF1-BB7B-E7F75060BDC7@yahoo.com> <20221011153942.GA12477@www.zefox.net> <639AB34E-DEC9-4FA8-8AAC-44604672AEBC@yahoo.com> <20221011171548.GA12624@www.zefox.net> <09A32530-3701-49F1-9369-549FF1162520@yahoo.com> <20221011233327.GA13708@www.zefox.net> <9635B188-3F76-484A-8DFA-3C508E85B9D2@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2022-Oct-12, at 16:15, Mark Millard <marklmi@yahoo.com> wrote:

> On 2022-Oct-11, at 16:33, bob prohaska <fbsd@www.zefox.net> wrote:
>=20
>> On Tue, Oct 11, 2022 at 11:37:25AM -0700, Mark Millard wrote:
>> [snip]=20
>>> Actually the below is confusing. /boot/msdos
>>> is supposed to be a mount point (empty directory)
>>> at which the msdosfs can be mounted to make those
>>> files show up there, despite being from a different
>>> file system.=20
>>=20
>> Apologies for the ambiguity!
>>=20
>> /dev/da0s1 on /boot/msdos (msdosfs, local, noatime)
>> is the normal dos filesystem on the root USB device.
>> Normally it is mounted, IME.
>>=20
>> /dev/mmcsd0s1 on /mnt (msdosfs, local)
>> was where I mounted the microSD DOS partition
>> so the contents could be listed. This is a Pi2=20
>> so a DOS microSD card is required to boot from USB.
>> Normally /dev/mmcsd0s1 is not mounted when root
>> is booted from USB.
>>=20
>> Mostly I wondered if files placed in an "unused" DOS
>> subdirectory could be hidden from the boot software.
>> It was a poor way to pose the question.
>>=20
>> At the moment the armv7 PATA disk is updating. If it boots
>> the Pi2 successfully I'll try it on Pi3 and Pi4. If
>> that works I'll set up a SATA armv7 disk and test the
>> troublesome disk enclosures.=20
>>=20
>=20
> Here is how I got armv7 going for booting both a
> RPi2B v1.1 (so: Cortex-A7) and a RPi3B (so:
> Cortex-A53). This will not get a RPi4B going.
> Because of the EFI/BOOT/bootarm.efi issues with
> main [so: 14], I used a 13.1-STABLE snapshot as
> the basis for this.
>=20
> FYI: the msdosfs snapshot content in:
>=20
> =
FreeBSD-13.1-STABLE-arm-armv7-GENERICSD-20221007-d497b97e902-252653.img
>=20
> looks like:
>=20
> # mount -onoatime -tmsdosfs /dev/da0s1 /mnt
> # ls -Tld /mnt/*
> drwxr-xr-x  1 root  wheel     4096 Oct  7 05:22:48 2022 /mnt/EFI
> -rwxr-xr-x  1 root  wheel   103876 Oct  7 03:29:26 2022 /mnt/MLO
> -rwxr-xr-x  1 root  wheel    26745 Mar  3 13:29:56 2021 =
/mnt/bcm2709-rpi-2-b.dtb
> -rwxr-xr-x  1 root  wheel    52456 Mar  3 13:29:56 2021 =
/mnt/bootcode.bin
> -rwxr-xr-x  1 root  wheel       89 Oct  7 03:37:56 2022 =
/mnt/config.txt
> drwxr-xr-x  1 root  wheel     8192 Oct  7 05:22:48 2022 /mnt/dtb
> -rwxr-xr-x  1 root  wheel     7314 Mar  3 13:29:56 2021 /mnt/fixup.dat
> -rwxr-xr-x  1 root  wheel     3187 Mar  3 13:29:56 2021 =
/mnt/fixup_cd.dat
> -rwxr-xr-x  1 root  wheel    10298 Mar  3 13:29:56 2021 =
/mnt/fixup_db.dat
> -rwxr-xr-x  1 root  wheel    10298 Mar  3 13:29:56 2021 =
/mnt/fixup_x.dat
> drwxr-xr-x  1 root  wheel     4096 Oct  7 05:22:54 2022 /mnt/overlays
> -rwxr-xr-x  1 root  wheel  2952960 Mar  3 13:29:56 2021 /mnt/start.elf
> -rwxr-xr-x  1 root  wheel   793116 Mar  3 13:29:56 2021 =
/mnt/start_cd.elf
> -rwxr-xr-x  1 root  wheel  4794472 Mar  3 13:29:56 2021 =
/mnt/start_db.elf
> -rwxr-xr-x  1 root  wheel  3704808 Mar  3 13:29:56 2021 =
/mnt/start_x.elf
> -rwxr-xr-x  1 root  wheel   504892 Oct  7 03:37:20 2022 =
/mnt/u-boot.bin
> -rwxr-xr-x  1 root  wheel  1163404 Oct  7 03:29:26 2022 =
/mnt/u-boot.img
> -r-xr-xr-x  1 root  wheel   462032 Oct  7 05:20:00 2022 /mnt/ubldr.bin
>=20
> It does not have the timeout file that allows more time
> for USB devices in particular contexts. But timeout
> is only directly useful on microsd cards, in order to
> allow binding to a wider range of USB boot devices.
>=20
> It also does not have any of:
>=20
> bcm2710-rpi-2-b.dtb
> bcm2710-rpi-3-b-plus.dtb
> bcm2710-rpi-3-b.dtb
> bcm2710-rpi-cm3.dtb
>=20
> Such would be needed for armv7 style booting of any of:
>=20
> RPi2 v1.2
> RPi3B+
> RPi3B
> Compute Module 3
>=20
> (Again, the armv7 u-boot.bin does not handle the bcm2711*.dtb
> related USB hardware, last I checked a RPi4B example anyway.
> So I ignore that context here.)
>=20
> It also has only:
>=20
> # ls -Tld /mnt/overlays/*
> -rwxr-xr-x  1 root  wheel  1221 Mar  3 13:29:56 2021 =
/mnt/overlays/mmc.dtbo
>=20
> so it does not have:
>=20
> disable-bt.dtbo
> miniuart-bt.dtbo
>=20
> for controlling which UART handles the serial console
> on the likes of a RPi3B.
>=20
> The u-boot.bin does not have an adjusted usb_pgood_delay .
> (For some of the USB media that I have access to the
> adjustment is important to booting. So my adjsutment will
> be involved here.)
>=20
> The following is being shown after booting an RPi2 v1.1
> (so: a cortex-A7 form of armv7) based on what I adjusted
> and used:
>=20
> . . .
> FreeBSD 13.1-STABLE #0 stable/13-n252653-d497b97e902: Fri Oct  7 =
05:01:41 UTC 2022
>    root@releng3.nyi.freebsd.org:/usr/obj/usr/src/arm.armv7/sys/GENERIC =
arm
> FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git =
llvmorg-14.0.5-0-gc12386ae247c)
> VT: init without driver.
> No PSCI/SMCCC call function found
> CPU: ARM Cortex-A7 r0p5 (ECO: 0x00000000)
> . . .
> # uname -apKU
> FreeBSD generic 13.1-STABLE FreeBSD 13.1-STABLE #0 =
stable/13-n252653-d497b97e902: Fri Oct  7 05:01:41 UTC 2022     =
root@releng3.nyi.freebsd.org:/usr/obj/usr/src/arm.armv7/sys/GENERIC arm =
armv7 1301507 1301507
>=20
> # gpart show -p
> =3D>      63  62333889    mmcsd0  MBR  (30G)
>        63      2016            - free -  (1.0M)
>      2079    102312  mmcsd0s1  fat32lba  [active]  (50M)
>    104391  62229561            - free -  (30G)
>=20
> =3D>       63  468862065    da0  MBR  (224G)
>         63       1985         - free -  (993K)
>       2048     102400  da0s1  fat32lba  [active]  (50M)
>     104448  468757680  da0s2  freebsd  (224G)
>=20
> =3D>        0  468757680   da0s2  BSD  (224G)
>          0        128          - free -  (64K)
>        128  468757552  da0s2a  freebsd-ufs  (224G)
>=20
> # more /etc/fstab
> # Custom /etc/fstab for FreeBSD embedded images
> /dev/ufs/rootfs         /               ufs     rw              1      =
 1
> /dev/msdosfs/MSDOSBOOT  /boot/msdos     msdosfs rw,noatime      0      =
 0
> tmpfs                   /tmp            tmpfs   rw,mode=3D1777    0    =
   0
>=20
> NOTE: /dev/msdosfs/MSDOSBOOT is in mmcsd0s1 in my context.
> (So the USB msdosfs does not have the MSDOSBOOT label. Avoid
> duplicate labels. Which you want mounts as /boot/msdos or
> /boot/efi is up to you. Do not take the choices from this
> example as important for such.)
>=20
> # find /boot/msdos/ -print
> /boot/msdos/
> /boot/msdos/bootcode.bin
> /boot/msdos/timeout
>=20
> Note that I do include timeout in the microsd card's
> msdosfs. I've USB media that will not boot otherwise
> (necessary, but not sufficient by itself overall).
>=20
> As for the USB media . . .
>=20
> # mount -onoatime -tmsdosfs /dev/da0s1 /mnt
> # ls -Tld /mnt/*
> drwxr-xr-x  1 root  wheel     4096 Oct  7 05:22:48 2022 /mnt/EFI
> -rwxr-xr-x  1 root  wheel   103876 Oct  7 03:29:26 2022 /mnt/MLO
> -rwxr-xr-x  1 root  wheel    26745 Mar  3 13:29:56 2021 =
/mnt/bcm2709-rpi-2-b.dtb
> -rwxr-xr-x  1 root  wheel    26894 Mar  3 13:29:56 2021 =
/mnt/bcm2710-rpi-2-b.dtb
> -rwxr-xr-x  1 root  wheel    29011 Mar  3 13:29:56 2021 =
/mnt/bcm2710-rpi-3-b-plus.dtb
> -rwxr-xr-x  1 root  wheel    28392 Mar  3 13:29:56 2021 =
/mnt/bcm2710-rpi-3-b.dtb
> -rwxr-xr-x  1 root  wheel    26890 Mar  3 13:29:56 2021 =
/mnt/bcm2710-rpi-cm3.dtb
> -rwxr-xr-x  1 root  wheel    52456 Mar  3 13:29:56 2021 =
/mnt/bootcode.bin
> -rwxr-xr-x  1 root  wheel      207 Oct 10 06:05:20 2022 =
/mnt/config.txt
> -rwxr-xr-x  1 root  wheel       89 Oct  7 03:37:56 2022 =
/mnt/config.txt.orig
> drwxr-xr-x  1 root  wheel     8192 Oct  7 05:22:48 2022 /mnt/dtb
> -rwxr-xr-x  1 root  wheel     7314 Mar  3 13:29:56 2021 /mnt/fixup.dat
> -rwxr-xr-x  1 root  wheel     3187 Mar  3 13:29:56 2021 =
/mnt/fixup_cd.dat
> -rwxr-xr-x  1 root  wheel    10298 Mar  3 13:29:56 2021 =
/mnt/fixup_db.dat
> -rwxr-xr-x  1 root  wheel    10298 Mar  3 13:29:56 2021 =
/mnt/fixup_x.dat
> drwxr-xr-x  1 root  wheel     4096 Oct  7 05:22:54 2022 /mnt/overlays
> -rwxr-xr-x  1 root  wheel  2952960 Mar  3 13:29:56 2021 /mnt/start.elf
> -rwxr-xr-x  1 root  wheel   793116 Mar  3 13:29:56 2021 =
/mnt/start_cd.elf
> -rwxr-xr-x  1 root  wheel  4794472 Mar  3 13:29:56 2021 =
/mnt/start_db.elf
> -rwxr-xr-x  1 root  wheel  3704808 Mar  3 13:29:56 2021 =
/mnt/start_x.elf
> -rwxr-xr-x  1 root  wheel        0 Apr 24 10:58:58 2022 /mnt/timeout
> -rwxr-xr-x  1 root  wheel   504932 Oct 10 05:17:40 2022 =
/mnt/u-boot.bin
> -rwxr-xr-x  1 root  wheel   504892 Oct  7 03:37:20 2022 =
/mnt/u-boot.bin.orig
> -rwxr-xr-x  1 root  wheel  1163404 Oct  7 03:29:26 2022 =
/mnt/u-boot.img
> -r-xr-xr-x  1 root  wheel   462032 Oct  7 05:20:00 2022 /mnt/ubldr.bin
>=20
> So I had added:
>=20
> bcm2710-rpi-2-b.dtb
> bcm2710-rpi-3-b-plus.dtb
> bcm2710-rpi-3-b.dtb
> bcm2710-rpi-cm3.dtb
>=20
> and (not important on USB media but added anyway):
>=20
> timeout
>=20
> I used an updated config.txt:
>=20
> # diff -u /mnt/config.txt.orig /mnt/config.txt
> --- /mnt/config.txt.orig        2022-10-07 03:37:56.000000000 +0000
> +++ /mnt/config.txt     2022-10-10 06:05:20.000000000 +0000
> @@ -1,5 +1,13 @@
> -init_uart_clock=3D3000000
> +#init_uart_clock=3D3000000
> enable_uart=3D1
> kernel=3Du-boot.bin
> kernel7=3Du-boot.bin
> dtoverlay=3Dmmc
> +#
> +# Local additions:
> +dtoverlay=3Ddisable-bt
> +initial_turbo=3D60
> +#uart_2ndstage=3D1
> +#dtdebug=3D1
> +gpu_mem_1024=3D32
> +force_turbo=3D1
>=20
> (Having config.txt on the microsd card's msdosfs will prevent
> booting from USB media.)
>=20
> I used a u-boot.bin that has my patch, including the
> usb_pgood_delay adjustment.
>=20
> I also added the 2 *-bt.dtbo files:
>=20
> # ls -Tld /mnt/overlays/*
> -rwxr-xr-x  1 root  wheel  1073 Mar  3 13:29:56 2021 =
/mnt/overlays/disable-bt.dtbo
> -rwxr-xr-x  1 root  wheel  1819 Mar  3 13:29:56 2021 =
/mnt/overlays/miniuart-bt.dtbo
> -rwxr-xr-x  1 root  wheel  1221 Mar  3 13:29:56 2021 =
/mnt/overlays/mmc.dtbo
>=20
> I will note that, in this configuration, u-boot.bin
> output is the first output to show up on the serial
> console. This can take a bit to get that far so it
> looks initially like nothing is happening but it is.
> Be willing to wait a bit.

Later below I've added notes about getting initial RPi*
firmware debug output.

> Moving the microsd card and USB media to the RPi3B and
> attempting to boot worked just fine (but required
> some of my changes reported above).
>=20
> . . .
> FreeBSD 13.1-STABLE #0 stable/13-n252653-d497b97e902: Fri Oct  7 =
05:01:41 UTC 2022
>    root@releng3.nyi.freebsd.org:/usr/obj/usr/src/arm.armv7/sys/GENERIC =
arm
> FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git =
llvmorg-14.0.5-0-gc12386ae247c)
> VT: init without driver.
> No PSCI/SMCCC call function found
> CPU: ARM Cortex-A53 r0p4 (ECO: 0x00000080)
> . . .
> # uname -apKU
> FreeBSD generic 13.1-STABLE FreeBSD 13.1-STABLE #0 =
stable/13-n252653-d497b97e902: Fri Oct  7 05:01:41 UTC 2022     =
root@releng3.nyi.freebsd.org:/usr/obj/usr/src/arm.armv7/sys/GENERIC arm =
armv7 1301507 1301507

Showing the differences needed for bootcode.bin to
cause basic serial console output from the RPi*
firmware (different mounting context than original
message):

# strings /boot/efi/bootcode.bin.orig | grep BOOT_UART=3D
BOOT_UART=3D0

# strings /boot/efi/bootcode.bin | grep BOOT_UART=3D
BOOT_UART=3D1

# cmp -x /boot/efi/bootcode.bin.orig /boot/efi/bootcode.bin
00009872 30 31

An in-place (no backup) update can be done with the likes of:

# sed -i '' -e 's@BOOT_UART=3D0@BOOT_UART=3D1@' /boot/efi/bootcode.bin

(linux typically has different -i notation requirements.)

This change makes it more obvious if there is any initial
progress or not, instead of waiting for U-Boot output to
show up.

With this much in place, the uart_2ndstage=3D1 and dtdebug=3D1
lines work when not commented out in config.txt :

# more /boot/efi/config.txt=20
#init_uart_clock=3D3000000
enable_uart=3D1
kernel=3Du-boot.bin
kernel7=3Du-boot.bin
dtoverlay=3Dmmc
#
# Local additions:
dtoverlay=3Ddisable-bt
initial_turbo=3D60
uart_2ndstage=3D1
dtdebug=3D1
gpu_mem_1024=3D32
force_turbo=3D1

=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2E0CD516-FDB2-4379-B2B4-71091FEF35AE>