diff options
author | Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> | 2021-09-01 12:29:54 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-09-02 12:12:08 +0100 |
commit | 7c08a9e3cd169b6b9d208a570ed7cb2c3384361a (patch) | |
tree | 773eb4ae118067419140aa7758dfa6da008fad93 /meta | |
parent | b8b43622e81065c7c97732b066d319483fb08446 (diff) | |
download | poky-7c08a9e3cd169b6b9d208a570ed7cb2c3384361a.tar.gz |
u-boot: Make SPL suffix configurable
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.
(From OE-Core rev: e4cfec633c20d6406523da905530e887b853f7ed)
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/uboot-config.bbclass | 14 | ||||
-rw-r--r-- | 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 451db0c650..e9e7148f0d 100644 --- a/meta/classes/uboot-config.bbclass +++ b/meta/classes/uboot-config.bbclass | |||
@@ -11,6 +11,11 @@ | |||
11 | # | 11 | # |
12 | # Copyright 2013, 2014 (C) O.S. Systems Software LTDA. | 12 | # Copyright 2013, 2014 (C) O.S. Systems Software LTDA. |
13 | 13 | ||
14 | def removesuffix(s, suffix): | ||
15 | if suffix and s.endswith(suffix): | ||
16 | return s[:-len(suffix)] | ||
17 | return s | ||
18 | |||
14 | # Some versions of u-boot use .bin and others use .img. By default use .bin | 19 | # Some versions of u-boot use .bin and others use .img. By default use .bin |
15 | # but enable individual recipes to change this value. | 20 | # but enable individual recipes to change this value. |
16 | UBOOT_SUFFIX ??= "bin" | 21 | UBOOT_SUFFIX ??= "bin" |
@@ -33,10 +38,13 @@ UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}" | |||
33 | # should be packaged along with the u-boot binary as well as placed in the | 38 | # should be packaged along with the u-boot binary as well as placed in the |
34 | # deploy directory. For those versions they can set the following variables | 39 | # deploy directory. For those versions they can set the following variables |
35 | # to allow packaging the SPL. | 40 | # to allow packaging the SPL. |
41 | SPL_SUFFIX ?= "" | ||
36 | SPL_BINARY ?= "" | 42 | SPL_BINARY ?= "" |
37 | SPL_BINARYNAME ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}" | 43 | SPL_DELIMITER ?= "${@'.' if d.getVar("SPL_SUFFIX") else ''}" |
38 | SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}" | 44 | SPL_BINARYFILE ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}" |
39 | SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}" | 45 | SPL_BINARYNAME ?= "${@removesuffix(d.getVar("SPL_BINARYFILE"), "." + d.getVar("SPL_SUFFIX"))}" |
46 | SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}" | ||
47 | SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}${SPL_DELIMITER}${SPL_SUFFIX}" | ||
40 | 48 | ||
41 | # Additional environment variables or a script can be installed alongside | 49 | # Additional environment variables or a script can be installed alongside |
42 | # u-boot to be used automatically on boot. This file, typically 'uEnv.txt' | 50 | # 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 a8ebcc9ea0..0e2a55d29f 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 () { | |||
184 | j=$(expr $j + 1); | 184 | j=$(expr $j + 1); |
185 | if [ $j -eq $i ] | 185 | if [ $j -eq $i ] |
186 | then | 186 | then |
187 | install -m 644 ${B}/${config}/${SPL_BINARY} ${D}/boot/${SPL_BINARYNAME}-${type}-${PV}-${PR} | 187 | install -m 644 ${B}/${config}/${SPL_BINARY} ${D}/boot/${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} |
188 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}-${type} | 188 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${D}/boot/${SPL_BINARYFILE}-${type} |
189 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME} | 189 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${D}/boot/${SPL_BINARYFILE} |
190 | fi | 190 | fi |
191 | done | 191 | done |
192 | unset j | 192 | unset j |
@@ -194,7 +194,7 @@ do_install () { | |||
194 | unset i | 194 | unset i |
195 | else | 195 | else |
196 | install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE} | 196 | install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE} |
197 | ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYNAME} | 197 | ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYFILE} |
198 | fi | 198 | fi |
199 | fi | 199 | fi |
200 | 200 | ||
@@ -315,12 +315,12 @@ do_deploy () { | |||
315 | j=$(expr $j + 1); | 315 | j=$(expr $j + 1); |
316 | if [ $j -eq $i ] | 316 | if [ $j -eq $i ] |
317 | then | 317 | then |
318 | install -m 644 ${B}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type}-${PV}-${PR} | 318 | install -m 644 ${B}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} |
319 | rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK} | 319 | rm -f ${DEPLOYDIR}/${SPL_BINARYFILE} ${DEPLOYDIR}/${SPL_SYMLINK} |
320 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type} | 320 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_BINARYFILE}-${type} |
321 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME} | 321 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_BINARYFILE} |
322 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} | 322 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} |
323 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK} | 323 | ln -sf ${SPL_BINARYNAME}-${type}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_SYMLINK} |
324 | fi | 324 | fi |
325 | done | 325 | done |
326 | unset j | 326 | unset j |