[4/4] use builtin DT for nanopi-neo target

Message ID 20230801093706.1347928-5-felix.moessbauer@siemens.com
State Accepted, archived
Headers show
Series Rework and extend u-boot-script for DT overlays | expand

Commit Message

MOESSBAUER, Felix Aug. 1, 2023, 9:37 a.m. UTC
The upstream kernel still misses the __symbol__ information in the
device tree. By that, overlays cannot be applied (DT was compiled
without -@). However, all u-boot internal device trees are compiled with
symbol information. By that, just use the one from u-boot.
Note, that the mmclbk entry changed in this device tree (mmclbk2
instead of mmclbk0). This change is reflected in the wks file. An
alternative option would be to use --use-uuid.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Kiszka Aug. 8, 2023, 8:48 a.m. UTC | #1
On 01.08.23 11:37, Felix Moessbauer wrote:
> The upstream kernel still misses the __symbol__ information in the
> device tree. By that, overlays cannot be applied (DT was compiled
> without -@). However, all u-boot internal device trees are compiled with
> symbol information. By that, just use the one from u-boot.
> Note, that the mmclbk entry changed in this device tree (mmclbk2
> instead of mmclbk0). This change is reflected in the wks file. An
> alternative option would be to use --use-uuid.
> 

I assume you actually booted with that modification, right? Did you
check if there are no other differences between the two DTs? They can be
subtle as U-Boot is not yet consistently syncing in the kernel DTs for
all boards.

Jan

> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> index de1c92c4..af5b6f08 100644
> --- a/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> +++ b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> @@ -1,10 +1,10 @@
>  #
> -# Copyright (c) Siemens AG, 2018
> +# Copyright (c) Siemens AG, 2018-2023
>  #
>  # SPDX-License-Identifier: MIT
>  
>  part u-boot --source rawcopy --sourceparams "file=/usr/lib/u-boot/nanopi_neo/u-boot-sunxi-with-spl.bin" --no-table --align 8
>  
> -part / --source rootfs-u-boot --ondisk mmcblk0 --fstype ext4 --mkfs-extraopts "-T default" --label platform --align 1024 --active
> +part / --source rootfs-u-boot --ondisk mmcblk2 --fstype ext4 --mkfs-extraopts "-T default" --sourceparams "builtin_dt=yes" --label platform --align 1024 --active
>  
>  bootloader --append "rw rootwait"
MOESSBAUER, Felix Aug. 31, 2023, 5:34 a.m. UTC | #2
On Tue, 2023-08-08 at 10:48 +0200, Jan Kiszka wrote:
> On 01.08.23 11:37, Felix Moessbauer wrote:
> > The upstream kernel still misses the __symbol__ information in the
> > device tree. By that, overlays cannot be applied (DT was compiled
> > without -@). However, all u-boot internal device trees are compiled
> > with
> > symbol information. By that, just use the one from u-boot.
> > Note, that the mmclbk entry changed in this device tree (mmclbk2
> > instead of mmclbk0). This change is reflected in the wks file. An
> > alternative option would be to use --use-uuid.
> > 
> 
> I assume you actually booted with that modification, right? Did you
> check if there are no other differences between the two DTs? They can
> be
> subtle as U-Boot is not yet consistently syncing in the kernel DTs
> for
> all boards.

I booted the board with an MTDA image [1] which uses a lot of the
peripherals of that board. However, I did not do a 1:1 comparison of
the device tree from u-boot and the kernel.

The idea to use the DT from u-boot is based on

1. A kernel developer proposed this in [2]
2. It showcases the added (but now reverted) builtin_dt=yes support

In addition, the kernel DT from the stock debian kernel currently
cannot be used, as this does not support overlays (not compiled with
symbol information). Back then, it was unclear if the corresponding
kernel patch to compile with -@ will be accepted and by that this was
the only feasible solution. Now, the patch from [2] got accepted, but
there is still no release of the bookworm-backports kernel that
includes it.

[1] https://github.com/siemens/mtda
[2] https://www.spinics.net/lists/devicetree/msg622846.html

Best regards,
Felix

> 
> Jan
> 
> > Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> > ---
> >  meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> > b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> > index de1c92c4..af5b6f08 100644
> > --- a/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> > +++ b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> > @@ -1,10 +1,10 @@
> >  #
> > -# Copyright (c) Siemens AG, 2018
> > +# Copyright (c) Siemens AG, 2018-2023
> >  #
> >  # SPDX-License-Identifier: MIT
> >  
> >  part u-boot --source rawcopy --sourceparams "file=/usr/lib/u-
> > boot/nanopi_neo/u-boot-sunxi-with-spl.bin" --no-table --align 8
> >  
> > -part / --source rootfs-u-boot --ondisk mmcblk0 --fstype ext4 --
> > mkfs-extraopts "-T default" --label platform --align 1024 --active
> > +part / --source rootfs-u-boot --ondisk mmcblk2 --fstype ext4 --
> > mkfs-extraopts "-T default" --sourceparams "builtin_dt=yes" --label
> > platform --align 1024 --active
> >  
> >  bootloader --append "rw rootwait"
>
Jan Kiszka Aug. 31, 2023, 7:01 a.m. UTC | #3
On 31.08.23 07:34, MOESSBAUER, Felix (T CED INW-CN) wrote:
> On Tue, 2023-08-08 at 10:48 +0200, Jan Kiszka wrote:
>> On 01.08.23 11:37, Felix Moessbauer wrote:
>>> The upstream kernel still misses the __symbol__ information in the
>>> device tree. By that, overlays cannot be applied (DT was compiled
>>> without -@). However, all u-boot internal device trees are compiled
>>> with
>>> symbol information. By that, just use the one from u-boot.
>>> Note, that the mmclbk entry changed in this device tree (mmclbk2
>>> instead of mmclbk0). This change is reflected in the wks file. An
>>> alternative option would be to use --use-uuid.
>>>
>>
>> I assume you actually booted with that modification, right? Did you
>> check if there are no other differences between the two DTs? They can
>> be
>> subtle as U-Boot is not yet consistently syncing in the kernel DTs
>> for
>> all boards.
> 
> I booted the board with an MTDA image [1] which uses a lot of the
> peripherals of that board. However, I did not do a 1:1 comparison of
> the device tree from u-boot and the kernel.

If all major features of the board still work (networking, storage,
other I/O) and this board is actually looked after in U-Boot as Andre
suggested, then we are good. I was just asking based on past negative
experiences I made.

Jan

> 
> The idea to use the DT from u-boot is based on
> 
> 1. A kernel developer proposed this in [2]
> 2. It showcases the added (but now reverted) builtin_dt=yes support
> 
> In addition, the kernel DT from the stock debian kernel currently
> cannot be used, as this does not support overlays (not compiled with
> symbol information). Back then, it was unclear if the corresponding
> kernel patch to compile with -@ will be accepted and by that this was
> the only feasible solution. Now, the patch from [2] got accepted, but
> there is still no release of the bookworm-backports kernel that
> includes it.
> 
> [1] https://github.com/siemens/mtda
> [2] https://www.spinics.net/lists/devicetree/msg622846.html
> 
> Best regards,
> Felix
> 
>>
>> Jan
>>
>>> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
>>> ---
>>>  meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
>>> b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
>>> index de1c92c4..af5b6f08 100644
>>> --- a/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
>>> +++ b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
>>> @@ -1,10 +1,10 @@
>>>  #
>>> -# Copyright (c) Siemens AG, 2018
>>> +# Copyright (c) Siemens AG, 2018-2023
>>>  #
>>>  # SPDX-License-Identifier: MIT
>>>
>>>  part u-boot --source rawcopy --sourceparams "file=/usr/lib/u-
>>> boot/nanopi_neo/u-boot-sunxi-with-spl.bin" --no-table --align 8
>>>
>>> -part / --source rootfs-u-boot --ondisk mmcblk0 --fstype ext4 --
>>> mkfs-extraopts "-T default" --label platform --align 1024 --active
>>> +part / --source rootfs-u-boot --ondisk mmcblk2 --fstype ext4 --
>>> mkfs-extraopts "-T default" --sourceparams "builtin_dt=yes" --label
>>> platform --align 1024 --active
>>>
>>>  bootloader --append "rw rootwait"
>>
>
MOESSBAUER, Felix Aug. 31, 2023, 7:07 a.m. UTC | #4
On Thu, 2023-08-31 at 09:01 +0200, Jan Kiszka wrote:
> On 31.08.23 07:34, MOESSBAUER, Felix (T CED INW-CN) wrote:
> > On Tue, 2023-08-08 at 10:48 +0200, Jan Kiszka wrote:
> > > On 01.08.23 11:37, Felix Moessbauer wrote:
> > > > The upstream kernel still misses the __symbol__ information in
> > > > the
> > > > device tree. By that, overlays cannot be applied (DT was
> > > > compiled
> > > > without -@). However, all u-boot internal device trees are
> > > > compiled
> > > > with
> > > > symbol information. By that, just use the one from u-boot.
> > > > Note, that the mmclbk entry changed in this device tree
> > > > (mmclbk2
> > > > instead of mmclbk0). This change is reflected in the wks file.
> > > > An
> > > > alternative option would be to use --use-uuid.
> > > > 
> > > 
> > > I assume you actually booted with that modification, right? Did
> > > you
> > > check if there are no other differences between the two DTs? They
> > > can
> > > be
> > > subtle as U-Boot is not yet consistently syncing in the kernel
> > > DTs
> > > for
> > > all boards.
> > 
> > I booted the board with an MTDA image [1] which uses a lot of the
> > peripherals of that board. However, I did not do a 1:1 comparison
> > of
> > the device tree from u-boot and the kernel.
> 
> If all major features of the board still work (networking, storage,
> other I/O) and this board is actually looked after in U-Boot as Andre
> suggested, then we are good. I was just asking based on past negative
> experiences I made.

OK, then I'll re-propose the patches 3 and 4 and rebase against next.
For patch 2, I'll keep the old implementation and just add a comment
about the need for the loop. The critical fix in 1 is already merged.

Felix

> 
> Jan
> 
> > 
> > The idea to use the DT from u-boot is based on
> > 
> > 1. A kernel developer proposed this in [2]
> > 2. It showcases the added (but now reverted) builtin_dt=yes support
> > 
> > In addition, the kernel DT from the stock debian kernel currently
> > cannot be used, as this does not support overlays (not compiled
> > with
> > symbol information). Back then, it was unclear if the corresponding
> > kernel patch to compile with -@ will be accepted and by that this
> > was
> > the only feasible solution. Now, the patch from [2] got accepted,
> > but
> > there is still no release of the bookworm-backports kernel that
> > includes it.
> > 
> > [1] https://github.com/siemens/mtda
> > [2] https://www.spinics.net/lists/devicetree/msg622846.html
> > 
> > Best regards,
> > Felix
> > 
> > > 
> > > Jan
> > > 
> > > > Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> > > > ---
> > > >  meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in | 4 ++-
> > > > -
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/meta-isar/scripts/lib/wic/canned-wks/nanopi-
> > > > neo.wks.in
> > > > b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> > > > index de1c92c4..af5b6f08 100644
> > > > --- a/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> > > > +++ b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
> > > > @@ -1,10 +1,10 @@
> > > >  #
> > > > -# Copyright (c) Siemens AG, 2018
> > > > +# Copyright (c) Siemens AG, 2018-2023
> > > >  #
> > > >  # SPDX-License-Identifier: MIT
> > > > 
> > > >  part u-boot --source rawcopy --sourceparams "file=/usr/lib/u-
> > > > boot/nanopi_neo/u-boot-sunxi-with-spl.bin" --no-table --align 8
> > > > 
> > > > -part / --source rootfs-u-boot --ondisk mmcblk0 --fstype ext4 -
> > > > -
> > > > mkfs-extraopts "-T default" --label platform --align 1024 --
> > > > active
> > > > +part / --source rootfs-u-boot --ondisk mmcblk2 --fstype ext4 -
> > > > -
> > > > mkfs-extraopts "-T default" --sourceparams "builtin_dt=yes" --
> > > > label
> > > > platform --align 1024 --active
> > > > 
> > > >  bootloader --append "rw rootwait"
> > > 
> > 
>

Patch

diff --git a/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
index de1c92c4..af5b6f08 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
+++ b/meta-isar/scripts/lib/wic/canned-wks/nanopi-neo.wks.in
@@ -1,10 +1,10 @@ 
 #
-# Copyright (c) Siemens AG, 2018
+# Copyright (c) Siemens AG, 2018-2023
 #
 # SPDX-License-Identifier: MIT
 
 part u-boot --source rawcopy --sourceparams "file=/usr/lib/u-boot/nanopi_neo/u-boot-sunxi-with-spl.bin" --no-table --align 8
 
-part / --source rootfs-u-boot --ondisk mmcblk0 --fstype ext4 --mkfs-extraopts "-T default" --label platform --align 1024 --active
+part / --source rootfs-u-boot --ondisk mmcblk2 --fstype ext4 --mkfs-extraopts "-T default" --sourceparams "builtin_dt=yes" --label platform --align 1024 --active
 
 bootloader --append "rw rootwait"