Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Mar 2019 13:30:12 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        =?UTF-8?Q?Manuel_St=C3=BChn?= <freebsdnewbie@freenet.de>
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: efi-loader ignores dtb files?
Message-ID:  <CACNAnaEFJMbiVRvPQR1FvtSZ6Ee6t2nr11dtoa0QyZwQhuVD2w@mail.gmail.com>
In-Reply-To: <20190328190355.1459c85b48211905f8a3e04a@freenet.de>
References:  <20190327192320.GA64908@freebsd-t450.fritz.box> <CACNAnaHQxzhmKKWqb4eUQvqdYr1xYYVRYVakQri_YRyvGb8tXA@mail.gmail.com> <20190328190355.1459c85b48211905f8a3e04a@freenet.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 28, 2019 at 1:06 PM Manuel St=C3=BChn <freebsdnewbie@freenet.de=
> wrote:
>
> On Wed, 27 Mar 2019 14:35:26 -0500
> Kyle Evans <kevans@freebsd.org> wrote:
>
> > On Wed, Mar 27, 2019 at 2:26 PM Manuel St=C3=BChn <freebsdnewbie@freene=
t.de> wrote:
> > >
> > > While trying to get FreeBSD 12.0 up and running on a NanoPI NEO2
> > > (aarch64 Allwinner H5) I'm stumbling over issues with
> > > loader/loader.conf.  FreeBSD starts fine, but it uses the
> > > devicetree-blob provided by uboot/EFI. I've tried to load the FreeBSD
> > > one by adding these lines to loader.conf:
> > >
> > > sun50i-h5-nanopi-neo2.dtb_load=3D"YES"
> > > sun50i-h5-nanopi-neo2.dtb_type=3D"dtb"
> > >
> > > and put the dtb file into /boot/dtb/sun50i-h5-nanopi-neo2.dtb, but th=
is
> > > did not work at all.  It got completely ignored by loader. The rest o=
f
> > > the file was read and applied correctly (kernel-modules i'd added for
> > > testing purposes were loaded correctly).
> > >
> > > I tried to load it by hand like this:
> > >
> > > load -t dtb sun50i-h5-nanopi-neo2.dtb
> > >
> > > which worked, the dtb file was loaded and used. After consulting
> > > loader.conf(5) i found this way to load modules:
> > >
> > > dtbfile_load=3D"YES"
> > > dtbfile_type=3D"dtb"
> > > dtbfile_name=3D"sun50i-h5-nanopi-neo2.dtb"
> > >
> > > and this finally triggered loader(8) to actually load the dtb.
> > > Unfortunatley the problem occurred again when i tried to add overlays=
.
> > > Those are, again, not recognized at all:
> > >
> > > /boot/loader.conf:
> > > fdt_overlays=3D"sun50i-nanopi-neo2-codec.dtbo,sun50i-nanopi-neo2-sid.=
dtbo,sun50i-nanopi-neo2-ths.dtbo"
> > >
> > > Any ideas?
> >
> > Yes- for your first problem, loader doesn't recognize a period as a
> > valid module name, so those directives would not have gotten
> > recognized as modules to load.
>
> Should it work without period (it does not)?
>
> sun50i-h5-nanopi-neo2_load=3D"YES"
> sun50i-h5-nanopi-neo2_type=3D"dtb"
>

Negative, it should not work- anything that isn't a kld that gets
`load`d needs full name with extension specified. Supplying
sun50i-h5-nanopi-neo2_name (with full name as the value) should be
sufficient and fix the above.

> > I'm not sure off-hand why fdt_overlays were not recognized. I would
> > drop to loader prompt and double check that it actually ended up in
> > the environment, but I don't see any reason off-hand that it wouldn't.
>
> I tried to load the overlays from loader prompt by hand like this:
> load -t dtbo sun50i-nanopi-neo2-codec.dtbo
> load -t dtbo sun50i-nanopi-neo2-sid.dtbo
> load -t dtbo sun50i-nanopi-neo2-ths.dtbo
> and they got applied correctly and the corresponding devices appeared in =
the OS.
>
> As another test I did was to not load the base dtb file via loader.conf b=
ut to use the one provided by u-boot/EFI.
> The output looked like this
> [...]
> Using DTB provided by EFI at 0x47ef8000.
> Loading DTB overlays: 'sun50i-nanopi-neo2-codec.dtbo,sun50i-nanopi-neo2-s=
id,sun50i-nanopi-neo2-ths.dtbo'
> /boot/dtb/overlays/sun50i-nanopi-neo2-codec.dtbo size=3D0x11a
> /boot/dtb/overlays/sun50i-nanopi-neo2-sid.dtbo size=3D0x1f5
> /boot/dtb/overlays/sun50i-nanopi-neo2-ths.dtbo size=3D0x3c5
> applying DTB overlay '/boot/dtb/overlays/sun50i-nanopi-neo2-codec.dtbo'
> applying DTB overlay '/boot/dtb/overlays/sun50i-nanopi-neo2-sid.dtbo'
> applying DTB overlay '/boot/dtb/overlays/sun50i-nanopi-neo2-ths.dtbo'
> failed to apply overlay: FDT_ERR_NOTFOUND
> [...]
> In this case the overlays were found and loaded, but did most likely not =
match the u-boot dtb file.
>
> Is there an issue with loading overlays in conjunction with manually load=
ing dtb files via loader.conf?
>

Yes, I see a problem -- try something like [0] (not even compile
tested, but it should work). I'll start working out a more proper
solution.

[0] https://people.freebsd.org/~kevans/overlay-hack.diff



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaEFJMbiVRvPQR1FvtSZ6Ee6t2nr11dtoa0QyZwQhuVD2w>