* [PATCH 0/4] Rework and extend u-boot-script for DT overlays
@ 2023-08-01 9:37 Felix Moessbauer
2023-08-01 9:37 ` [PATCH 1/4] fix(u-boot-script): use correct ramdisk size Felix Moessbauer
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: Felix Moessbauer @ 2023-08-01 9:37 UTC (permalink / raw)
To: isar-users; +Cc: florian.bezdeka, jan.kiszka, Felix Moessbauer
This series fixes a critical bug in the generated boot.scr u-boot
script (p1) and adds support to use the builtin device dtbs of u-boot.
Finally, the nanopi-neo target is switched over to the u-boot builtin
DT (instead of the kernel DT), as these are compiled with symbol
information which are needed to apply DT overlays.
@Maintainer: Feel free to cherry-pick p1 in case the other changes
need some discussions.
Felix Moessbauer
Siemens AG
Felix Moessbauer (4):
fix(u-boot-script): use correct ramdisk size
refactor loading of DT overlays in uboot
u-boot-script: add support to use builtin dt
use builtin DT for nanopi-neo target
.../lib/wic/canned-wks/nanopi-neo.wks.in | 4 +--
.../u-boot-script/files/u-boot-script | 3 +++
.../u-boot-script/files/update-u-boot-script | 25 ++++++++++++-------
.../lib/wic/plugins/source/rootfs-u-boot.py | 3 +++
4 files changed, 24 insertions(+), 11 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/4] fix(u-boot-script): use correct ramdisk size
2023-08-01 9:37 [PATCH 0/4] Rework and extend u-boot-script for DT overlays Felix Moessbauer
@ 2023-08-01 9:37 ` Felix Moessbauer
2023-08-03 10:22 ` Gylstorff Quirin
2023-08-01 9:37 ` [PATCH 2/4] refactor loading of DT overlays in uboot Felix Moessbauer
` (3 subsequent siblings)
4 siblings, 1 reply; 16+ messages in thread
From: Felix Moessbauer @ 2023-08-01 9:37 UTC (permalink / raw)
To: isar-users; +Cc: florian.bezdeka, jan.kiszka, Felix Moessbauer
When booting the kernel via a boot* command, the ramdisk is passed as
address : size. However, the size pointed to the temporary variable
filesize, which denotes the filesize of the last load. When combining
with DT overlays, the overlays are loaded later and by that overwrite
the filesize variable, resulting in a partially passed initrd.
To fix this, we assign the size immediately after loading it to an env
variable and use that when booting.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/recipes-bsp/u-boot-script/files/update-u-boot-script | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
index 39b9fa0f..e9ace15e 100755
--- a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
+++ b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
@@ -50,7 +50,8 @@ yes|1)
echo "load \${devtype} \${devnum}:\${distro_bootpart}" \
"\${ramdisk_addr_r} /boot/initrd.img-${KERNEL_VERSION}" \
>> ${BOOT_CMD}
- INITRD_ADDR="\${ramdisk_addr_r}:\${filesize}"
+ echo "setenv ramdisk_size \${filesize}" >> ${BOOT_CMD}
+ INITRD_ADDR="\${ramdisk_addr_r}:\${ramdisk_size}"
esac
if [ -n "${OVERLAYS}" ]; then
--
2.34.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 2/4] refactor loading of DT overlays in uboot
2023-08-01 9:37 [PATCH 0/4] Rework and extend u-boot-script for DT overlays Felix Moessbauer
2023-08-01 9:37 ` [PATCH 1/4] fix(u-boot-script): use correct ramdisk size Felix Moessbauer
@ 2023-08-01 9:37 ` Felix Moessbauer
2023-08-08 8:48 ` Jan Kiszka
2023-08-01 9:37 ` [PATCH 3/4] u-boot-script: add support to use builtin dt Felix Moessbauer
` (2 subsequent siblings)
4 siblings, 1 reply; 16+ messages in thread
From: Felix Moessbauer @ 2023-08-01 9:37 UTC (permalink / raw)
To: isar-users; +Cc: florian.bezdeka, jan.kiszka, Felix Moessbauer
As we already expand the DT overlays variable in the code generation, we
do not need to loop over the elements in the generated code again. This
reduces the size of the boot.src script a little and makes it better
readable.
No functional change.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/recipes-bsp/u-boot-script/files/update-u-boot-script | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
index e9ace15e..14a81563 100755
--- a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
+++ b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
@@ -63,13 +63,11 @@ if [ -n "${OVERLAYS}" ]; then
if ! echo $OVERLAY | grep -q "^/"; then
OVERLAY_PATH=/usr/lib/linux-image-${KERNEL_VERSION}/
fi
- echo "for entry in ${OVERLAY}; do" >> ${BOOT_CMD}
- echo "echo Loading ${OVERLAY_PATH}\${entry}..." >> ${BOOT_CMD}
+ echo "echo Loading ${OVERLAY_PATH}${OVERLAY} ..." >> ${BOOT_CMD}
echo "load \${devtype} \${devnum}:${ROOT_PARTITION}" \
- "\${overlay_addr_r} ${OVERLAY_PATH}\${entry}" \
+ "\${overlay_addr_r} ${OVERLAY_PATH}${OVERLAY}" \
>> ${BOOT_CMD}
echo "fdt apply \${overlay_addr_r}" >> ${BOOT_CMD}
- echo "done" >> ${BOOT_CMD}
done
fi
--
2.34.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 3/4] u-boot-script: add support to use builtin dt
2023-08-01 9:37 [PATCH 0/4] Rework and extend u-boot-script for DT overlays Felix Moessbauer
2023-08-01 9:37 ` [PATCH 1/4] fix(u-boot-script): use correct ramdisk size Felix Moessbauer
2023-08-01 9:37 ` [PATCH 2/4] refactor loading of DT overlays in uboot Felix Moessbauer
@ 2023-08-01 9:37 ` Felix Moessbauer
2023-08-01 9:37 ` [PATCH 4/4] use builtin DT for nanopi-neo target Felix Moessbauer
2023-08-08 7:05 ` [PATCH 0/4] Rework and extend u-boot-script for DT overlays Uladzimir Bely
4 siblings, 0 replies; 16+ messages in thread
From: Felix Moessbauer @ 2023-08-01 9:37 UTC (permalink / raw)
To: isar-users; +Cc: florian.bezdeka, jan.kiszka, Felix Moessbauer
This patch adds support to use the u-boot builtin device tree instead of
the one from the rootfs / linux. This enables the use of dt overlays
even if the corresponding device tree in the kernel is not compiled with
symbol support (uboot builtin DTBs always have symbol information).
To use the builtin dt, add the WKS sourceparam "builtin_dt=yes" to the
rootfs-u-boot sourcer.
Co-developed-by: Florian Bezdeka <florian.bezdeka@siemens.com>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
.../u-boot-script/files/u-boot-script | 3 +++
.../u-boot-script/files/update-u-boot-script | 16 ++++++++++++----
.../lib/wic/plugins/source/rootfs-u-boot.py | 3 +++
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-bsp/u-boot-script/files/u-boot-script b/meta/recipes-bsp/u-boot-script/files/u-boot-script
index d053d721..a11212c0 100644
--- a/meta/recipes-bsp/u-boot-script/files/u-boot-script
+++ b/meta/recipes-bsp/u-boot-script/files/u-boot-script
@@ -15,3 +15,6 @@ NO_INITRD=""
# U-boot commands to prepend to boot script
SCRIPT_PREPEND=""
+
+# use u-boot builtin device tree
+BUILTIN_DT="no"
diff --git a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
index 14a81563..f4e36ed2 100755
--- a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
+++ b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
@@ -33,10 +33,18 @@ echo "${SCRIPT_PREPEND}" >> ${BOOT_CMD}
echo "setenv bootargs ${KERNEL_ARGS}" >> ${BOOT_CMD}
-echo "echo Loading /usr/lib/linux-image-${KERNEL_VERSION}/\${fdtfile}..." \
- >> ${BOOT_CMD}
-echo "load \${devtype} \${devnum}:${ROOT_PARTITION} \${fdt_addr_r}" \
- "/usr/lib/linux-image-${KERNEL_VERSION}/\${fdtfile}" >> ${BOOT_CMD}
+if [ "${BUILTIN_DT}" = "yes" ]; then
+ echo "echo Loading builtin device tree..." \
+ >> ${BOOT_CMD}
+ echo "fdt addr \${fdtcontroladdr}" >> ${BOOT_CMD}
+ echo "fdt move \${fdtcontroladdr} \${fdt_addr_r}" >> ${BOOT_CMD}
+else
+ echo "echo Loading /usr/lib/linux-image-${KERNEL_VERSION}/\${fdtfile}..." \
+ >> ${BOOT_CMD}
+ echo "load \${devtype} \${devnum}:${ROOT_PARTITION} \${fdt_addr_r}" \
+ "/usr/lib/linux-image-${KERNEL_VERSION}/\${fdtfile}" >> ${BOOT_CMD}
+fi
+
echo "echo Loading /boot/${KERNEL_FILE}-${KERNEL_VERSION}..." >> ${BOOT_CMD}
echo "load \${devtype} \${devnum}:\${distro_bootpart} \${kernel_addr_r}" \
"/boot/${KERNEL_FILE}-${KERNEL_VERSION}" >> ${BOOT_CMD}
diff --git a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
index 0b4f9eec..93600dc2 100644
--- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
+++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
@@ -10,6 +10,7 @@
# Recognized sourceparams:
# - no_initrd=yes (disables initrd loading)
# - overlays=file.dtbo ... (overlay files)
+# - builtin_dt=no (use DT from uboot instead of kernel)
# - script_prepend=cmd;... (prepends U-Boot command)
import glob
@@ -82,6 +83,8 @@ class RootfsUBootPlugin(RootfsPlugin):
cfg.write('NO_INITRD="%s"\n' % no_initrd)
overlays = source_params.get('overlays') or ''
cfg.write('OVERLAYS="%s"\n' % overlays)
+ builtin_dt = source_params.get('builtin_dt') or ''
+ cfg.write('BUILTIN_DT="%s"\n' % builtin_dt)
script_prepend = source_params.get('script_prepend') or ''
# remove escapes from $\{var\} that are needed to avoid expansion by wic
script_prepend = re.sub(r'\$\\{([^\\]+)\\}', r'${\1}', script_prepend)
--
2.34.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 4/4] use builtin DT for nanopi-neo target
2023-08-01 9:37 [PATCH 0/4] Rework and extend u-boot-script for DT overlays Felix Moessbauer
` (2 preceding siblings ...)
2023-08-01 9:37 ` [PATCH 3/4] u-boot-script: add support to use builtin dt Felix Moessbauer
@ 2023-08-01 9:37 ` Felix Moessbauer
2023-08-08 8:48 ` Jan Kiszka
2023-08-08 7:05 ` [PATCH 0/4] Rework and extend u-boot-script for DT overlays Uladzimir Bely
4 siblings, 1 reply; 16+ messages in thread
From: Felix Moessbauer @ 2023-08-01 9:37 UTC (permalink / raw)
To: isar-users; +Cc: florian.bezdeka, jan.kiszka, Felix Moessbauer
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(-)
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"
--
2.34.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] fix(u-boot-script): use correct ramdisk size
2023-08-01 9:37 ` [PATCH 1/4] fix(u-boot-script): use correct ramdisk size Felix Moessbauer
@ 2023-08-03 10:22 ` Gylstorff Quirin
0 siblings, 0 replies; 16+ messages in thread
From: Gylstorff Quirin @ 2023-08-03 10:22 UTC (permalink / raw)
To: isar-users, Uladzimir Bely
On 8/1/23 11:37, 'Felix Moessbauer' via isar-users wrote:
> When booting the kernel via a boot* command, the ramdisk is passed as
> address : size. However, the size pointed to the temporary variable
> filesize, which denotes the filesize of the last load. When combining
> with DT overlays, the overlays are loaded later and by that overwrite
> the filesize variable, resulting in a partially passed initrd.
>
> To fix this, we assign the size immediately after loading it to an env
> variable and use that when booting.
>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
> meta/recipes-bsp/u-boot-script/files/update-u-boot-script | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
> index 39b9fa0f..e9ace15e 100755
> --- a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
> +++ b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
> @@ -50,7 +50,8 @@ yes|1)
> echo "load \${devtype} \${devnum}:\${distro_bootpart}" \
> "\${ramdisk_addr_r} /boot/initrd.img-${KERNEL_VERSION}" \
> >> ${BOOT_CMD}
> - INITRD_ADDR="\${ramdisk_addr_r}:\${filesize}"
> + echo "setenv ramdisk_size \${filesize}" >> ${BOOT_CMD}
> + INITRD_ADDR="\${ramdisk_addr_r}:\${ramdisk_size}"
> esac
>
> if [ -n "${OVERLAYS}" ]; then
I think this patch should be applied separately.
Quirin
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/4] Rework and extend u-boot-script for DT overlays
2023-08-01 9:37 [PATCH 0/4] Rework and extend u-boot-script for DT overlays Felix Moessbauer
` (3 preceding siblings ...)
2023-08-01 9:37 ` [PATCH 4/4] use builtin DT for nanopi-neo target Felix Moessbauer
@ 2023-08-08 7:05 ` Uladzimir Bely
2023-08-08 10:24 ` Jan Kiszka
4 siblings, 1 reply; 16+ messages in thread
From: Uladzimir Bely @ 2023-08-08 7:05 UTC (permalink / raw)
To: Felix Moessbauer, isar-users
On Tue, 2023-08-01 at 09:37 +0000, 'Felix Moessbauer' via isar-users
wrote:
> This series fixes a critical bug in the generated boot.scr u-boot
> script (p1) and adds support to use the builtin device dtbs of u-
> boot.
> Finally, the nanopi-neo target is switched over to the u-boot builtin
> DT (instead of the kernel DT), as these are compiled with symbol
> information which are needed to apply DT overlays.
>
> @Maintainer: Feel free to cherry-pick p1 in case the other changes
> need some discussions.
>
> Felix Moessbauer
> Siemens AG
>
> Felix Moessbauer (4):
> fix(u-boot-script): use correct ramdisk size
> refactor loading of DT overlays in uboot
> u-boot-script: add support to use builtin dt
> use builtin DT for nanopi-neo target
>
> .../lib/wic/canned-wks/nanopi-neo.wks.in | 4 +--
> .../u-boot-script/files/u-boot-script | 3 +++
> .../u-boot-script/files/update-u-boot-script | 25 ++++++++++++-----
> --
> .../lib/wic/plugins/source/rootfs-u-boot.py | 3 +++
> 4 files changed, 24 insertions(+), 11 deletions(-)
>
> --
> 2.34.1
>
Applied to next, thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] use builtin DT for nanopi-neo target
2023-08-01 9:37 ` [PATCH 4/4] use builtin DT for nanopi-neo target Felix Moessbauer
@ 2023-08-08 8:48 ` Jan Kiszka
2023-08-31 5:34 ` MOESSBAUER, Felix
0 siblings, 1 reply; 16+ messages in thread
From: Jan Kiszka @ 2023-08-08 8:48 UTC (permalink / raw)
To: Felix Moessbauer, isar-users; +Cc: florian.bezdeka
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"
--
Siemens AG, Technology
Linux Expert Center
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/4] refactor loading of DT overlays in uboot
2023-08-01 9:37 ` [PATCH 2/4] refactor loading of DT overlays in uboot Felix Moessbauer
@ 2023-08-08 8:48 ` Jan Kiszka
2023-08-31 4:56 ` MOESSBAUER, Felix
0 siblings, 1 reply; 16+ messages in thread
From: Jan Kiszka @ 2023-08-08 8:48 UTC (permalink / raw)
To: Felix Moessbauer, isar-users; +Cc: florian.bezdeka
On 01.08.23 11:37, Felix Moessbauer wrote:
> As we already expand the DT overlays variable in the code generation, we
> do not need to loop over the elements in the generated code again. This
> reduces the size of the boot.src script a little and makes it better
> readable.
>
> No functional change.
>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
> meta/recipes-bsp/u-boot-script/files/update-u-boot-script | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
> index e9ace15e..14a81563 100755
> --- a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
> +++ b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
> @@ -63,13 +63,11 @@ if [ -n "${OVERLAYS}" ]; then
> if ! echo $OVERLAY | grep -q "^/"; then
> OVERLAY_PATH=/usr/lib/linux-image-${KERNEL_VERSION}/
> fi
> - echo "for entry in ${OVERLAY}; do" >> ${BOOT_CMD}
> - echo "echo Loading ${OVERLAY_PATH}\${entry}..." >> ${BOOT_CMD}
> + echo "echo Loading ${OVERLAY_PATH}${OVERLAY} ..." >> ${BOOT_CMD}
> echo "load \${devtype} \${devnum}:${ROOT_PARTITION}" \
> - "\${overlay_addr_r} ${OVERLAY_PATH}\${entry}" \
> + "\${overlay_addr_r} ${OVERLAY_PATH}${OVERLAY}" \
> >> ${BOOT_CMD}
> echo "fdt apply \${overlay_addr_r}" >> ${BOOT_CMD}
> - echo "done" >> ${BOOT_CMD}
> done
> fi
>
NACK, see commit 8b9f930410234ad46135df3642bc0c7053fc854b.
Jan
--
Siemens AG, Technology
Linux Expert Center
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/4] Rework and extend u-boot-script for DT overlays
2023-08-08 7:05 ` [PATCH 0/4] Rework and extend u-boot-script for DT overlays Uladzimir Bely
@ 2023-08-08 10:24 ` Jan Kiszka
2023-08-09 5:40 ` Uladzimir Bely
0 siblings, 1 reply; 16+ messages in thread
From: Jan Kiszka @ 2023-08-08 10:24 UTC (permalink / raw)
To: Uladzimir Bely, Felix Moessbauer, isar-users
On 08.08.23 09:05, Uladzimir Bely wrote:
> On Tue, 2023-08-01 at 09:37 +0000, 'Felix Moessbauer' via isar-users
> wrote:
>> This series fixes a critical bug in the generated boot.scr u-boot
>> script (p1) and adds support to use the builtin device dtbs of u-
>> boot.
>> Finally, the nanopi-neo target is switched over to the u-boot builtin
>> DT (instead of the kernel DT), as these are compiled with symbol
>> information which are needed to apply DT overlays.
>>
>> @Maintainer: Feel free to cherry-pick p1 in case the other changes
>> need some discussions.
>>
>> Felix Moessbauer
>> Siemens AG
>>
>> Felix Moessbauer (4):
>> fix(u-boot-script): use correct ramdisk size
>> refactor loading of DT overlays in uboot
>> u-boot-script: add support to use builtin dt
>> use builtin DT for nanopi-neo target
>>
>> .../lib/wic/canned-wks/nanopi-neo.wks.in | 4 +--
>> .../u-boot-script/files/u-boot-script | 3 +++
>> .../u-boot-script/files/update-u-boot-script | 25 ++++++++++++-----
>> --
>> .../lib/wic/plugins/source/rootfs-u-boot.py | 3 +++
>> 4 files changed, 24 insertions(+), 11 deletions(-)
>>
>> --
>> 2.34.1
>>
>
> Applied to next, thanks.
>
Revert 2-4, please, there are many open issues.
Jan
--
Siemens AG, Technology
Linux Expert Center
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/4] Rework and extend u-boot-script for DT overlays
2023-08-08 10:24 ` Jan Kiszka
@ 2023-08-09 5:40 ` Uladzimir Bely
2023-08-09 7:43 ` Baurzhan Ismagulov
0 siblings, 1 reply; 16+ messages in thread
From: Uladzimir Bely @ 2023-08-09 5:40 UTC (permalink / raw)
To: Jan Kiszka, Felix Moessbauer, isar-users
On Tue, 2023-08-08 at 12:24 +0200, Jan Kiszka wrote:
> On 08.08.23 09:05, Uladzimir Bely wrote:
> > On Tue, 2023-08-01 at 09:37 +0000, 'Felix Moessbauer' via isar-
> > users
> > wrote:
> > > This series fixes a critical bug in the generated boot.scr u-boot
> > > script (p1) and adds support to use the builtin device dtbs of u-
> > > boot.
> > > Finally, the nanopi-neo target is switched over to the u-boot
> > > builtin
> > > DT (instead of the kernel DT), as these are compiled with symbol
> > > information which are needed to apply DT overlays.
> > >
> > > @Maintainer: Feel free to cherry-pick p1 in case the other
> > > changes
> > > need some discussions.
> > >
> > > Felix Moessbauer
> > > Siemens AG
> > >
> > > Felix Moessbauer (4):
> > > fix(u-boot-script): use correct ramdisk size
> > > refactor loading of DT overlays in uboot
> > > u-boot-script: add support to use builtin dt
> > > use builtin DT for nanopi-neo target
> > >
> > > .../lib/wic/canned-wks/nanopi-neo.wks.in | 4 +--
> > > .../u-boot-script/files/u-boot-script | 3 +++
> > > .../u-boot-script/files/update-u-boot-script | 25 ++++++++++++-
> > > ----
> > > --
> > > .../lib/wic/plugins/source/rootfs-u-boot.py | 3 +++
> > > 4 files changed, 24 insertions(+), 11 deletions(-)
> > >
> > > --
> > > 2.34.1
> > >
> >
> > Applied to next, thanks.
> >
>
> Revert 2-4, please, there are many open issues.
>
> Jan
>
Would it be OK just to move "origin/next" three commits down (e.g.,
force push), or these should be separate revert patch(es)?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/4] Rework and extend u-boot-script for DT overlays
2023-08-09 5:40 ` Uladzimir Bely
@ 2023-08-09 7:43 ` Baurzhan Ismagulov
0 siblings, 0 replies; 16+ messages in thread
From: Baurzhan Ismagulov @ 2023-08-09 7:43 UTC (permalink / raw)
To: isar-users; +Cc: Jan Kiszka, Felix Moessbauer, Uladzimir Bely
On 2023-08-09 08:40, Uladzimir Bely wrote:
> On Tue, 2023-08-08 at 12:24 +0200, Jan Kiszka wrote:
> > Revert 2-4, please, there are many open issues.
>
> Would it be OK just to move "origin/next" three commits down (e.g.,
> force push), or these should be separate revert patch(es)?
No need to force-push, we will revert but we'd like to have the discussion on
the list why some patches should be applied separately or what the open issues
are.
With kind regards,
Baurzhan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/4] refactor loading of DT overlays in uboot
2023-08-08 8:48 ` Jan Kiszka
@ 2023-08-31 4:56 ` MOESSBAUER, Felix
0 siblings, 0 replies; 16+ messages in thread
From: MOESSBAUER, Felix @ 2023-08-31 4:56 UTC (permalink / raw)
To: isar-users, Kiszka, Jan; +Cc: Bezdeka, Florian
On Tue, 2023-08-08 at 10:48 +0200, Jan Kiszka wrote:
> On 01.08.23 11:37, Felix Moessbauer wrote:
> > As we already expand the DT overlays variable in the code
> > generation, we
> > do not need to loop over the elements in the generated code again.
> > This
> > reduces the size of the boot.src script a little and makes it
> > better
> > readable.
> >
> > No functional change.
> >
> > Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> > ---
> > meta/recipes-bsp/u-boot-script/files/update-u-boot-script | 6 ++--
> > --
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta/recipes-bsp/u-boot-script/files/update-u-boot-
> > script b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
> > index e9ace15e..14a81563 100755
> > --- a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
> > +++ b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script
> > @@ -63,13 +63,11 @@ if [ -n "${OVERLAYS}" ]; then
> > if ! echo $OVERLAY | grep -q "^/"; then
> > OVERLAY_PATH=/usr/lib/linux-image-
> > ${KERNEL_VERSION}/
> > fi
> > - echo "for entry in ${OVERLAY}; do" >> ${BOOT_CMD}
> > - echo "echo Loading ${OVERLAY_PATH}\${entry}..." >>
> > ${BOOT_CMD}
> > + echo "echo Loading ${OVERLAY_PATH}${OVERLAY} ..."
> > >> ${BOOT_CMD}
> > echo "load \${devtype}
> > \${devnum}:${ROOT_PARTITION}" \
> > - "\${overlay_addr_r} ${OVERLAY_PATH}\${entry}"
> > \
> > + "\${overlay_addr_r} ${OVERLAY_PATH}${OVERLAY}"
> > \
> > >> ${BOOT_CMD}
> > echo "fdt apply \${overlay_addr_r}" >> ${BOOT_CMD}
> > - echo "done" >> ${BOOT_CMD}
> > done
> > fi
> >
>
> NACK, see commit 8b9f930410234ad46135df3642bc0c7053fc854b.
Ok, got it. But there should be a comment in the code about this
particular detail. I'll add one when re-proposing the u-boot DT patches
which unfortunately got reverted as well.
Felix
>
> Jan
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] use builtin DT for nanopi-neo target
2023-08-08 8:48 ` Jan Kiszka
@ 2023-08-31 5:34 ` MOESSBAUER, Felix
2023-08-31 7:01 ` Jan Kiszka
0 siblings, 1 reply; 16+ messages in thread
From: MOESSBAUER, Felix @ 2023-08-31 5:34 UTC (permalink / raw)
To: isar-users, Kiszka, Jan; +Cc: Bezdeka, Florian
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"
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] use builtin DT for nanopi-neo target
2023-08-31 5:34 ` MOESSBAUER, Felix
@ 2023-08-31 7:01 ` Jan Kiszka
2023-08-31 7:07 ` MOESSBAUER, Felix
0 siblings, 1 reply; 16+ messages in thread
From: Jan Kiszka @ 2023-08-31 7:01 UTC (permalink / raw)
To: MOESSBAUER, Felix (T CED INW-CN), isar-users
Cc: Bezdeka, Florian (T CED SES-DE)
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"
>>
>
--
Siemens AG, Technology
Linux Expert Center
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] use builtin DT for nanopi-neo target
2023-08-31 7:01 ` Jan Kiszka
@ 2023-08-31 7:07 ` MOESSBAUER, Felix
0 siblings, 0 replies; 16+ messages in thread
From: MOESSBAUER, Felix @ 2023-08-31 7:07 UTC (permalink / raw)
To: isar-users, Kiszka, Jan; +Cc: Bezdeka, Florian
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"
> > >
> >
>
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2023-08-31 7:07 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-01 9:37 [PATCH 0/4] Rework and extend u-boot-script for DT overlays Felix Moessbauer
2023-08-01 9:37 ` [PATCH 1/4] fix(u-boot-script): use correct ramdisk size Felix Moessbauer
2023-08-03 10:22 ` Gylstorff Quirin
2023-08-01 9:37 ` [PATCH 2/4] refactor loading of DT overlays in uboot Felix Moessbauer
2023-08-08 8:48 ` Jan Kiszka
2023-08-31 4:56 ` MOESSBAUER, Felix
2023-08-01 9:37 ` [PATCH 3/4] u-boot-script: add support to use builtin dt Felix Moessbauer
2023-08-01 9:37 ` [PATCH 4/4] use builtin DT for nanopi-neo target Felix Moessbauer
2023-08-08 8:48 ` Jan Kiszka
2023-08-31 5:34 ` MOESSBAUER, Felix
2023-08-31 7:01 ` Jan Kiszka
2023-08-31 7:07 ` MOESSBAUER, Felix
2023-08-08 7:05 ` [PATCH 0/4] Rework and extend u-boot-script for DT overlays Uladzimir Bely
2023-08-08 10:24 ` Jan Kiszka
2023-08-09 5:40 ` Uladzimir Bely
2023-08-09 7:43 ` Baurzhan Ismagulov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox