public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Chao Zeng <chao.zeng@siemens.com>,
	Bao Cheng Su <baocheng.su@siemens.com>
Subject: [PATCH] u-boot-script: Allow OVERLAY to be a u-boot env variable as well
Date: Thu, 13 Jan 2022 10:46:24 +0100	[thread overview]
Message-ID: <fe6c9b21-fb54-a9fa-1048-6211466f6be6@siemens.com> (raw)

From: Jan Kiszka <jan.kiszka@siemens.com>

This allows to define the list of overlays also during boot-time,
retrieving it from a u-boot env variable. All we need to do for that is
adding a loop around loading and applying entries in the generated
script. That will interpret an entry during boot-time as list and
iterate over all entries.

In order to use this feature, the wks entry for a rootfs-u-boot
partition needs to be extended by

--sourceparams "overlays=\"\$\{my_overlays\}\""

Quoting and escaping is important to propagate ${my_overlays} into the
generated script.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Chao, please confirm if this fully addresses your case.

  meta/recipes-bsp/u-boot-script/files/update-u-boot-script | 6 ++++--
  1 file changed, 4 insertions(+), 2 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 eb2c2955..39b9fa0f 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
@@ -62,11 +62,13 @@ if [ -n "${OVERLAYS}" ]; then
  		if ! echo $OVERLAY | grep -q "^/"; then
  			OVERLAY_PATH=/usr/lib/linux-image-${KERNEL_VERSION}/
  		fi
-		echo "echo Loading ${OVERLAY_PATH}${OVERLAY}..." >> ${BOOT_CMD}
+		echo "for entry in ${OVERLAY}; do" >> ${BOOT_CMD}
+		echo "echo Loading ${OVERLAY_PATH}\${entry}..." >> ${BOOT_CMD}
  		echo "load \${devtype} \${devnum}:${ROOT_PARTITION}" \
-		     "\${overlay_addr_r} ${OVERLAY_PATH}${OVERLAY}" \
+		     "\${overlay_addr_r} ${OVERLAY_PATH}\${entry}" \
  		     >> ${BOOT_CMD}
  		echo "fdt apply \${overlay_addr_r}" >> ${BOOT_CMD}
+		echo "done" >> ${BOOT_CMD}
  	done
  fi
  
-- 
2.31.1

             reply	other threads:[~2022-01-13  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13  9:46 Jan Kiszka [this message]
2022-02-14 10:17 ` Anton Mikanovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe6c9b21-fb54-a9fa-1048-6211466f6be6@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=baocheng.su@siemens.com \
    --cc=chao.zeng@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox