diff options
| author | Ryan Eatmon <reatmon@ti.com> | 2025-10-07 11:22:56 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-09 10:58:07 +0100 |
| commit | 66c528b9c52e1fcbaa5667c7e7bd72ecf23e1319 (patch) | |
| tree | 7c0b381b5a9d34214c9dfc20dc09ac7052325333 /meta | |
| parent | 83e523af784d567a24a96615cca13c17d8f7c9e3 (diff) | |
| download | poky-66c528b9c52e1fcbaa5667c7e7bd72ecf23e1319.tar.gz | |
u-boot: Add specifying make options as part the config looping
There is a need to generate alternative versions of the uboot files
using the existing config looping system, but we need to add additional
settings to the make call rather simply specifying a different config.
Specifically we have two use cases:
1) We want to sign the same uboot files with two different keys where
the key will be passed on the make call.
2) We want to include the alternative defconfigs from a different
repository and need to add the path to this new location on the make
command line.
This introduces a fourth value for the UBOOT_CONFIG settings:
config,images,binary,make_opts
The values are placed into a new generated variable
UBOOT_CONFIG_MAKE_OPTS which is a '?' separated list since space can be
present if you need to specify multiple options. This is handled by
changing IFS in the shell code when looping over the variable.
Additionally, add in a new variable UBOOT_MAKE_OPTS which is added to
the make calls in the various do_compile functions that do the actual
compiling.
(From OE-Core rev: 3338330e0c46b83e33c7e982c012459c89a7ec5c)
Signed-off-by: Ryan Eatmon <reatmon@ti.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/classes-recipe/uboot-config.bbclass | 15 | ||||
| -rw-r--r-- | meta/recipes-bsp/u-boot/u-boot-configure.inc | 18 | ||||
| -rw-r--r-- | meta/recipes-bsp/u-boot/u-boot.inc | 16 |
3 files changed, 42 insertions, 7 deletions
diff --git a/meta/classes-recipe/uboot-config.bbclass b/meta/classes-recipe/uboot-config.bbclass index bc20913f73..eb82dd3583 100644 --- a/meta/classes-recipe/uboot-config.bbclass +++ b/meta/classes-recipe/uboot-config.bbclass | |||
| @@ -35,6 +35,7 @@ UBOOT_BINARYNAME ?= "${@os.path.splitext(d.getVar("UBOOT_BINARY"))[0]}" | |||
| 35 | UBOOT_IMAGE ?= "${UBOOT_BINARYNAME}-${MACHINE}-${UBOOT_VERSION}.${UBOOT_SUFFIX}" | 35 | UBOOT_IMAGE ?= "${UBOOT_BINARYNAME}-${MACHINE}-${UBOOT_VERSION}.${UBOOT_SUFFIX}" |
| 36 | UBOOT_SYMLINK ?= "${UBOOT_BINARYNAME}-${MACHINE}.${UBOOT_SUFFIX}" | 36 | UBOOT_SYMLINK ?= "${UBOOT_BINARYNAME}-${MACHINE}.${UBOOT_SUFFIX}" |
| 37 | UBOOT_MAKE_TARGET ?= "all" | 37 | UBOOT_MAKE_TARGET ?= "all" |
| 38 | UBOOT_MAKE_OPTS ?= "" | ||
| 38 | 39 | ||
| 39 | # Output the ELF generated. Some platforms can use the ELF file and directly | 40 | # Output the ELF generated. Some platforms can use the ELF file and directly |
| 40 | # load it (JTAG booting, QEMU) additionally the ELF can be used for debugging | 41 | # load it (JTAG booting, QEMU) additionally the ELF can be used for debugging |
| @@ -103,6 +104,7 @@ python () { | |||
| 103 | ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') | 104 | ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') |
| 104 | ubootbinary = d.getVar('UBOOT_BINARY') | 105 | ubootbinary = d.getVar('UBOOT_BINARY') |
| 105 | ubootbinaries = d.getVar('UBOOT_BINARIES') | 106 | ubootbinaries = d.getVar('UBOOT_BINARIES') |
| 107 | ubootconfigmakeopts = d.getVar('UBOOT_CONFIG_MAKE_OPTS') | ||
| 106 | # The "doc" varflag is special, we don't want to see it here | 108 | # The "doc" varflag is special, we don't want to see it here |
| 107 | ubootconfigflags.pop('doc', None) | 109 | ubootconfigflags.pop('doc', None) |
| 108 | ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split() | 110 | ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split() |
| @@ -120,6 +122,9 @@ python () { | |||
| 120 | if ubootconfigflags and ubootbinaries: | 122 | if ubootconfigflags and ubootbinaries: |
| 121 | raise bb.parse.SkipRecipe("You cannot use UBOOT_BINARIES as it is internal to uboot_config.bbclass.") | 123 | raise bb.parse.SkipRecipe("You cannot use UBOOT_BINARIES as it is internal to uboot_config.bbclass.") |
| 122 | 124 | ||
| 125 | if ubootconfigflags and ubootconfigmakeopts: | ||
| 126 | raise bb.parse.SkipRecipe("You cannot use UBOOT_CONFIG_MAKE_OPTS as it is internal to uboot_config.bbclass.") | ||
| 127 | |||
| 123 | if len(ubootconfig) > 0: | 128 | if len(ubootconfig) > 0: |
| 124 | for config in ubootconfig: | 129 | for config in ubootconfig: |
| 125 | found = False | 130 | found = False |
| @@ -127,8 +132,8 @@ python () { | |||
| 127 | if config == f: | 132 | if config == f: |
| 128 | found = True | 133 | found = True |
| 129 | items = v.split(',') | 134 | items = v.split(',') |
| 130 | if items[0] and len(items) > 3: | 135 | if items[0] and len(items) > 4: |
| 131 | raise bb.parse.SkipRecipe('Only config,images,binary can be specified!') | 136 | raise bb.parse.SkipRecipe('Only config,images,binary,make_opts can be specified!') |
| 132 | d.appendVar('UBOOT_MACHINE', ' ' + items[0]) | 137 | d.appendVar('UBOOT_MACHINE', ' ' + items[0]) |
| 133 | # IMAGE_FSTYPES appending | 138 | # IMAGE_FSTYPES appending |
| 134 | if len(items) > 1 and items[1]: | 139 | if len(items) > 1 and items[1]: |
| @@ -140,6 +145,12 @@ python () { | |||
| 140 | else: | 145 | else: |
| 141 | bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % ubootbinary) | 146 | bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % ubootbinary) |
| 142 | d.appendVar('UBOOT_BINARIES', ' ' + ubootbinary) | 147 | d.appendVar('UBOOT_BINARIES', ' ' + ubootbinary) |
| 148 | if len(items) > 3 and items[3]: | ||
| 149 | bb.debug(1, "Appending '%s' to UBOOT_CONFIG_MAKE_OPTS." % items[3]) | ||
| 150 | d.appendVar('UBOOT_CONFIG_MAKE_OPTS', items[3] + " ? ") | ||
| 151 | else: | ||
| 152 | bb.debug(1, "Appending '%s' to UBOOT_CONFIG_MAKE_OPTS." % "") | ||
| 153 | d.appendVar('UBOOT_CONFIG_MAKE_OPTS', " ? ") | ||
| 143 | break | 154 | break |
| 144 | 155 | ||
| 145 | if not found: | 156 | if not found: |
diff --git a/meta/recipes-bsp/u-boot/u-boot-configure.inc b/meta/recipes-bsp/u-boot/u-boot-configure.inc index a15511f8b2..bada506b66 100644 --- a/meta/recipes-bsp/u-boot/u-boot-configure.inc +++ b/meta/recipes-bsp/u-boot/u-boot-configure.inc | |||
| @@ -33,7 +33,19 @@ uboot_configure_config () { | |||
| 33 | config=$1 | 33 | config=$1 |
| 34 | type=$2 | 34 | type=$2 |
| 35 | 35 | ||
| 36 | oe_runmake -C ${S} O=${B}/${config} ${config} | 36 | unset k |
| 37 | IFS="?" | ||
| 38 | uboot_config_make_opts="${UBOOT_CONFIG_MAKE_OPTS}" | ||
| 39 | for config_make_opts in $uboot_config_make_opts; do | ||
| 40 | k=$(expr $k + 1); | ||
| 41 | if [ $k -eq $i ]; then | ||
| 42 | break | ||
| 43 | fi | ||
| 44 | done | ||
| 45 | unset IFS | ||
| 46 | unset k | ||
| 47 | |||
| 48 | oe_runmake -C ${S} O=${B}/${config} ${config_make_opts} ${UBOOT_MAKE_OPTS} ${config} | ||
| 37 | if [ -n "${@' '.join(find_cfgs(d))}" ]; then | 49 | if [ -n "${@' '.join(find_cfgs(d))}" ]; then |
| 38 | merge_config.sh -m -O ${B}/${config} ${B}/${config}/.config ${@" ".join(find_cfgs(d))} | 50 | merge_config.sh -m -O ${B}/${config} ${B}/${config}/.config ${@" ".join(find_cfgs(d))} |
| 39 | oe_runmake -C ${S} O=${B}/${config} oldconfig | 51 | oe_runmake -C ${S} O=${B}/${config} oldconfig |
| @@ -42,9 +54,9 @@ uboot_configure_config () { | |||
| 42 | 54 | ||
| 43 | uboot_configure () { | 55 | uboot_configure () { |
| 44 | if [ -n "${UBOOT_MACHINE}" ]; then | 56 | if [ -n "${UBOOT_MACHINE}" ]; then |
| 45 | oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE} | 57 | oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_OPTS} ${UBOOT_MACHINE} |
| 46 | else | 58 | else |
| 47 | oe_runmake -C ${S} O=${B} oldconfig | 59 | oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_OPTS} oldconfig |
| 48 | fi | 60 | fi |
| 49 | merge_config.sh -m .config ${@" ".join(find_cfgs(d))} | 61 | merge_config.sh -m .config ${@" ".join(find_cfgs(d))} |
| 50 | cml1_do_configure | 62 | cml1_do_configure |
diff --git a/meta/recipes-bsp/u-boot/u-boot.inc b/meta/recipes-bsp/u-boot/u-boot.inc index b7242de5de..e0a69e740e 100644 --- a/meta/recipes-bsp/u-boot/u-boot.inc +++ b/meta/recipes-bsp/u-boot/u-boot.inc | |||
| @@ -75,7 +75,19 @@ uboot_compile_config () { | |||
| 75 | config=$2 | 75 | config=$2 |
| 76 | type=$3 | 76 | type=$3 |
| 77 | 77 | ||
| 78 | oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET} | 78 | unset k |
| 79 | IFS="?" | ||
| 80 | uboot_config_make_opts="${UBOOT_CONFIG_MAKE_OPTS}" | ||
| 81 | for config_make_opts in $uboot_config_make_opts; do | ||
| 82 | k=$(expr $k + 1); | ||
| 83 | if [ $k -eq $i ]; then | ||
| 84 | break | ||
| 85 | fi | ||
| 86 | done | ||
| 87 | unset IFS | ||
| 88 | unset k | ||
| 89 | |||
| 90 | oe_runmake -C ${S} O=${B}/${config} ${config_make_opts} ${UBOOT_MAKE_OPTS} ${UBOOT_MAKE_TARGET} | ||
| 79 | 91 | ||
| 80 | unset k | 92 | unset k |
| 81 | for binary in ${UBOOT_BINARIES}; do | 93 | for binary in ${UBOOT_BINARIES}; do |
| @@ -102,7 +114,7 @@ uboot_compile_config_copy_binary () { | |||
| 102 | } | 114 | } |
| 103 | 115 | ||
| 104 | uboot_compile () { | 116 | uboot_compile () { |
| 105 | oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET} | 117 | oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_OPTS} ${UBOOT_MAKE_TARGET} |
| 106 | 118 | ||
| 107 | # Generate the uboot-initial-env | 119 | # Generate the uboot-initial-env |
| 108 | if [ -n "${UBOOT_INITIAL_ENV}" ]; then | 120 | if [ -n "${UBOOT_INITIAL_ENV}" ]; then |
