[2/4] refactor loading of DT overlays in uboot

Message ID 20230801093706.1347928-3-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
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(-)

Comments

Jan Kiszka Aug. 8, 2023, 8:48 a.m. UTC | #1
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
MOESSBAUER, Felix Aug. 31, 2023, 4:56 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:
> > 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
>

Patch

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