Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2022 22:16:44 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        nick@i11.co
Cc:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: path for overlays
Message-ID:  <B7117A0D-68E8-4300-ADCD-9F8CA4F613C0@yahoo.com>
References:  <B7117A0D-68E8-4300-ADCD-9F8CA4F613C0.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Nick Kostyria <nick_at_i11.co> wrote on
Date: Tue, 12 Jul 2022 03:27:25 UTC :

> On Mon, 11 Jul 2022 00:18:59 -0300
> "Dr. Rolf Jansen" <freebsd-rj@cyclaero.com> wrote:
>=20
>=20
> >=20
> > Anyway, for enabling I2C5 (we may choose from I2C3, I2C4, I2C5 and =
I2C6) on a Raspberry Pi 4, we do:
> >=20
> > # fetch =
https://github.com/raspberrypi/linux/blob/rpi-5.15.y/arch/arm/boot/dts/ove=
rlays/i2c5-overlay.dts
> > # dtc -I dts -O dtb -b0 -@ -o /boot/msdos/overlays/i2c5.dtbo =
i2c5-overlay.dts
> >=20
> > Then we add the following 2 lines to /boot/msdos/config.txt:
> >=20
> >   gpio=3D12,13=3Da5
> >   dtoverlay=3Di2c5,pins_12_13
> >=20
>=20
> Hello.
>=20
> I see you use /boot/msdos/overlays/ for overlays.
> I have a question for a long time and I can't find an answer.
>=20
> What is the difference between /boot/msdos/overlays/ and =
/boot/dtb/overlays/ (fdt_overlays in /boot/loader.conf).

[I've written these notes to presume a RPi* context based on
U-Boot, not EDK2 UEFI/ACPI or the like, and  not for other
platforms.]

Some of this is just convention, and these notes are from memory,
but:

A) If the partitioning is MBR, /boot/msdos is a mount point where
   the msdosfs is mounted by FreeBSD. The RPi* firmware has access
   to the msdosfs (MS-DOS  file system). The FreeBSD loader gets a
   copy in the msdosfs (that is started by U-Boot, which in turn is
   started by the RPi* firmware) but the rest of FreeBSD does not
   go in the msdosfs.

B) If the partitioning is GPT /boot/efi is a mount point where
   the msdosfs is mounted by FreeBSD. The RPi* firmware has access
   to the msdosfs (MS-DOS  file system). The FreeBSD loader gets a
   copy in the msdosfs (that is started by U-Boot, which in turn is
   started by the RPi* firmware) but the rest of FreeBSD does not
   go in the msdosfs.

C) /boot/dtb is not used as such a mount point. It is part of the
   UFS (or ZFS) file system. The RPi* firmware and U-Boot do not
   have access into the UFS or ZFS file systems. This is a reason
   why a copy of an appropriate FreeBSD loader is put on the
   msdosfs. The FreeBSD loader, in turn, can access UFS or ZFS.

(A)/(B) are used for the dtb files so that the RPi* firmware loads
and sets up the dtb material to be in the DeviceTree, well before
FreeBSD is involved. The RPi* firmware and U-Boot hand over a
version of that DeviceTree to the FreeBSD loader and, from there
the FreeBSD kernel sees it.

(C) would be for only the FreeBSD kernel seeing/using the dtb.

FreeBSD does not have full control of the RPi* and some types
of overlays have to be processed by the RPi* firmware, if I
understand right. For RPi*'s /boot/dtb/ use is likely rare.

Do not presume all the content of these notes apply to other
types of FreeBSD platforms.

> What is more correct?
> What should be used?
>=20
> /boot/msdos/overlays/ or /boot/dtb/overlays/
> /boot/msdos/config.txt or /boot/loader.conf

config.txt is for the RPi* firmware use, not FreeBSD's
direct use. loader.conf is for FreeBSD's direct use, not RPi*
firmware use (nor U-Boot). Nothing says that the notations
used in the two files would be compatible. Moving text correct
for one file to the other (but unchanged) is not likely to
work.

In this case, the config.txt text "dtoverlay=3Di2c5" is tied to
the file placement (as seen via FreeBSD's /boot/msdos mount
point):

/boot/msdos/overlays/i2c5.dtbo

and "pins_12_13" is a configuration parameter of some sort.
The "gpio=3D12,13=3Da5" is also defined for and handled by the
RPi* firmware, not directly by FreeBSD.

The lack of a /boot/msdosfs/ prefix (or, possibly, /boot/efi/
prefix) is a clue that loader.conf is just for FreeBSD's use.


I'll note that the RPi* firmware accesses the msdosfs long
before FreeBSD starts. The FreeBSD mount point use (for
access to the msdosfs from FreeBSD) happens later.

=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?B7117A0D-68E8-4300-ADCD-9F8CA4F613C0>