From: Stefan Herbrechtsmeier <stefan.herbrechtsme...@weidmueller.com>

Make the SPL suffix configurable via SPL_SUFFIX variable to support SPL
binaries with suffix. The suffix is optional and empty per default. The
delimiter in front of the suffix is added automatically if the suffix
is not empty. A new variable SPL_BINARYFILE contains the binary file
name inclusive optional delimiter and suffix and the old variable
SPL_BINARYNAME contains only the name of the binary without directory,
delimiter and specified suffix. This behavior is backward compatible
with empty SPL_SUFFIX variable.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsme...@weidmueller.com>

---

 meta/classes/uboot-config.bbclass  | 14 +++++++++++---
 meta/recipes-bsp/u-boot/u-boot.inc | 20 ++++++++++----------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/meta/classes/uboot-config.bbclass 
b/meta/classes/uboot-config.bbclass
index 54efbd027a..07a303d0a0 100644
--- a/meta/classes/uboot-config.bbclass
+++ b/meta/classes/uboot-config.bbclass
@@ -11,6 +11,11 @@
 #
 # Copyright 2013, 2014 (C) O.S. Systems Software LTDA.
 
+def removesuffix(s, suffix):
+    if suffix and s.endswith(suffix):
+        return s[:-len(suffix)]
+    return s
+
 # Some versions of u-boot use .bin and others use .img.  By default use .bin
 # but enable individual recipes to change this value.
 UBOOT_SUFFIX ??= "bin"
@@ -33,10 +38,13 @@ UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}"
 # should be packaged along with the u-boot binary as well as placed in the
 # deploy directory.  For those versions they can set the following variables
 # to allow packaging the SPL.
+SPL_SUFFIX ?= ""
 SPL_BINARY ?= ""
-SPL_BINARYNAME ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}"
-SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}"
-SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}"
+SPL_DELIMITER  ?= "${@'.' if d.getVar("SPL_SUFFIX") else ''}"
+SPL_BINARYFILE ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}"
+SPL_BINARYNAME ?= "${@removesuffix(d.getVar("SPL_BINARYFILE"), "." + 
d.getVar("SPL_SUFFIX"))}"
+SPL_IMAGE ?= 
"${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}"
+SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}${SPL_DELIMITER}${SPL_SUFFIX}"
 
 # Additional environment variables or a script can be installed alongside
 # u-boot to be used automatically on boot.  This file, typically 'uEnv.txt'
diff --git a/meta/recipes-bsp/u-boot/u-boot.inc 
b/meta/recipes-bsp/u-boot/u-boot.inc
index f63f853583..f27fdd5998 100644
--- a/meta/recipes-bsp/u-boot/u-boot.inc
+++ b/meta/recipes-bsp/u-boot/u-boot.inc
@@ -184,9 +184,9 @@ do_install () {
                     j=$(expr $j + 1);
                     if [ $j -eq $i ]
                     then
-                         install -m 644 ${B}/${config}/${SPL_BINARY} 
${D}/boot/${SPL_BINARYNAME}-${type}-${PV}-${PR}
-                         ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} 
${D}/boot/${SPL_BINARYNAME}-${type}
-                         ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} 
${D}/boot/${SPL_BINARYNAME}
+                         install -m 644 ${B}/${config}/${SPL_BINARY} 
${D}/boot/${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}
+                         ln -sf 
${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} 
${D}/boot/${SPL_BINARYFILE}-${type}
+                         ln -sf 
${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} 
${D}/boot/${SPL_BINARYFILE}
                     fi
                 done
                 unset j
@@ -194,7 +194,7 @@ do_install () {
             unset i
         else
             install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
-            ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYNAME}
+            ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYFILE}
         fi
     fi
 
@@ -315,12 +315,12 @@ do_deploy () {
                     j=$(expr $j + 1);
                     if [ $j -eq $i ]
                     then
-                        install -m 644 ${B}/${config}/${SPL_BINARY} 
${DEPLOYDIR}/${SPL_BINARYNAME}-${type}-${PV}-${PR}
-                        rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} 
${DEPLOYDIR}/${SPL_SYMLINK}
-                        ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} 
${DEPLOYDIR}/${SPL_BINARYNAME}-${type}
-                        ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} 
${DEPLOYDIR}/${SPL_BINARYNAME}
-                        ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} 
${DEPLOYDIR}/${SPL_SYMLINK}-${type}
-                        ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} 
${DEPLOYDIR}/${SPL_SYMLINK}
+                        install -m 644 ${B}/${config}/${SPL_BINARY} 
${DEPLOYDIR}/${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}
+                        rm -f ${DEPLOYDIR}/${SPL_BINARYFILE} 
${DEPLOYDIR}/${SPL_SYMLINK}
+                        ln -sf 
${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} 
${DEPLOYDIR}/${SPL_BINARYFILE}-${type}
+                        ln -sf 
${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} 
${DEPLOYDIR}/${SPL_BINARYFILE}
+                        ln -sf 
${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} 
${DEPLOYDIR}/${SPL_SYMLINK}-${type}
+                        ln -sf 
${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} 
${DEPLOYDIR}/${SPL_SYMLINK}
                     fi
                 done
                 unset j
-- 
2.20.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#155554): 
https://lists.openembedded.org/g/openembedded-core/message/155554
Mute This Topic: https://lists.openembedded.org/mt/85298334/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to