Introduce a new variable FIT_UBOOT_ENV, which allows to add a u-boot
script as a text file to the fitImage. Such a script can be sourced
from the u-boot shell, as documented here:
https://docs.u-boot.org/en/latest/usage/cmd/source.html#fit-image

The kernel-fitimage.bbclass also evaluates the existing UBOOT_ENV
variable and adds the corresponding script to the fitImage. However, the
UBOOT_ENV variable is also used to install the script as an old u-boot
image, usually named boot.scr into the /boot directory of the target
device. These are different use cases which should be handled
independently.

Appending the script to the u-boot recipe and then hand it over to the
kernel recipe via the staged /boot directory leads to complicated task
dependencies. Decoupling the two use cases will also allow to simplify
the implementation by dropping the evaluation of the UBOOT_ENV variable
in the kernel-fitimage.bbclass. But this commit is supposed to be
backward compatible.

Signed-off-by: Adrian Freihofer <[email protected]>
---
 meta/classes-recipe/kernel-fitimage.bbclass | 5 +++++
 meta/conf/image-fitimage.conf               | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/meta/classes-recipe/kernel-fitimage.bbclass 
b/meta/classes-recipe/kernel-fitimage.bbclass
index fe076badfa5..bd2e371b63a 100644
--- a/meta/classes-recipe/kernel-fitimage.bbclass
+++ b/meta/classes-recipe/kernel-fitimage.bbclass
@@ -616,6 +616,11 @@ fitimage_assemble() {
                        bbwarn "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} 
not found."
                fi
        fi
+       if [ -n "${FIT_UBOOT_ENV}" ]; then
+               cp ${UNPACKDIR}/${FIT_UBOOT_ENV} ${B}
+               bootscr_id="${FIT_UBOOT_ENV}"
+               fitimage_emit_section_boot_script $1 "$bootscr_id" 
${FIT_UBOOT_ENV}
+       fi
 
        #
        # Step 4: Prepare a setup section. (For x86)
diff --git a/meta/conf/image-fitimage.conf b/meta/conf/image-fitimage.conf
index be9ae301346..9be7e452384 100644
--- a/meta/conf/image-fitimage.conf
+++ b/meta/conf/image-fitimage.conf
@@ -51,3 +51,10 @@ FIT_ADDRESS_CELLS ?= "1"
 # Then the images signature checking will not be mandatory and no error will be
 # raised in case of failure.
 # UBOOT_SIGN_IMG_KEYNAME = "dev2" # keys name in keydir (eg. "dev2.crt", 
"dev2.key")
+
+# Additional environment variables or a script which can be sourced by u-boot
+# can be packaged into the fitImage. An example is documented here:
+# https://docs.u-boot.org/en/latest/usage/cmd/source.html#fit-image
+# Machine configurations needing such a script file should include it in the
+# SRC_URI of the kernel recipe and set the FIT_UBOOT_ENV parameter.
+FIT_UBOOT_ENV ?= ""
-- 
2.47.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#210963): 
https://lists.openembedded.org/g/openembedded-core/message/210963
Mute This Topic: https://lists.openembedded.org/mt/111042848/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to