diff options
author | Ting Liu <ting.liu@nxp.com> | 2016-06-15 23:01:10 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-01 16:22:40 +0100 |
commit | ec64c9c02f3fc7e8f3f2ca2809036603e04d9b1c (patch) | |
tree | facb0b948791aeca3807c1605153865dea288d2b | |
parent | f91a01be70c554a85c8811279da30bda0b4bfe0a (diff) | |
download | poky-ec64c9c02f3fc7e8f3f2ca2809036603e04d9b1c.tar.gz |
u-boot: extend UBOOT_CONFIG format to support different binary name
When using UBOOT_CONFIG format, the final u-boot binary for each config
may have different names. Extend UBOOT_CONFIG format to support different
binary to be copied.
The new format is supposed to be compatible with old one as ${UBOOT_BINARY}
is copied by default, and images,binary can be empty.
An example format to specify it, in the machine, is:
UBOOT_CONFIG ??= "sdcard-ifc sdcard-qspi lpuart qspi secure-boot nor"
UBOOT_CONFIG[nor] = "ls1021atwr_nor_config,,u-boot-dtb.bin"
UBOOT_CONFIG[sdcard-ifc] = "ls1021atwr_sdcard_ifc_config,,u-boot-with-spl-pbl.bin"
UBOOT_CONFIG[sdcard-qspi] = "ls1021atwr_sdcard_qspi_config,,u-boot-with-spl-pbl.bin"
UBOOT_CONFIG[lpuart] = "ls1021atwr_nor_lpuart_config,,u-boot-dtb.bin"
UBOOT_CONFIG[qspi] = "ls1021atwr_qspi_config,,u-boot-dtb.bin"
UBOOT_CONFIG[secure-boot] = "ls1021atwr_nor_SECURE_BOOT_config"
(From OE-Core rev: 2a5c484f314ddc75cab5f0d01b0215d7fc405b6b)
Signed-off-by: Ting Liu <ting.liu@nxp.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/uboot-config.bbclass | 19 | ||||
-rw-r--r-- | meta/recipes-bsp/u-boot/u-boot.inc | 12 |
2 files changed, 25 insertions, 6 deletions
diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass index cb061af348..3f760f2fbe 100644 --- a/meta/classes/uboot-config.bbclass +++ b/meta/classes/uboot-config.bbclass | |||
@@ -3,7 +3,7 @@ | |||
3 | # The format to specify it, in the machine, is: | 3 | # The format to specify it, in the machine, is: |
4 | # | 4 | # |
5 | # UBOOT_CONFIG ??= <default> | 5 | # UBOOT_CONFIG ??= <default> |
6 | # UBOOT_CONFIG[foo] = "config,images" | 6 | # UBOOT_CONFIG[foo] = "config,images,binary" |
7 | # | 7 | # |
8 | # or | 8 | # or |
9 | # | 9 | # |
@@ -11,9 +11,13 @@ | |||
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 | UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" | ||
15 | |||
14 | python () { | 16 | python () { |
15 | ubootmachine = d.getVar("UBOOT_MACHINE", True) | 17 | ubootmachine = d.getVar("UBOOT_MACHINE", True) |
16 | ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') | 18 | ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') |
19 | ubootbinary = d.getVar('UBOOT_BINARY', True) | ||
20 | ubootbinaries = d.getVar('UBOOT_BINARIES', True) | ||
17 | # The "doc" varflag is special, we don't want to see it here | 21 | # The "doc" varflag is special, we don't want to see it here |
18 | ubootconfigflags.pop('doc', None) | 22 | ubootconfigflags.pop('doc', None) |
19 | 23 | ||
@@ -27,6 +31,9 @@ python () { | |||
27 | if ubootmachine and ubootconfigflags: | 31 | if ubootmachine and ubootconfigflags: |
28 | raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at the same time.") | 32 | raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at the same time.") |
29 | 33 | ||
34 | if ubootconfigflags and ubootbinaries: | ||
35 | raise bb.parse.SkipPackage("You cannot use UBOOT_BINARIES as it is internal to uboot_config.bbclass.") | ||
36 | |||
30 | if not ubootconfigflags: | 37 | if not ubootconfigflags: |
31 | return | 38 | return |
32 | 39 | ||
@@ -36,13 +43,19 @@ python () { | |||
36 | for f, v in ubootconfigflags.items(): | 43 | for f, v in ubootconfigflags.items(): |
37 | if config == f: | 44 | if config == f: |
38 | items = v.split(',') | 45 | items = v.split(',') |
39 | if items[0] and len(items) > 2: | 46 | if items[0] and len(items) > 3: |
40 | raise bb.parse.SkipPackage('Only config,images can be specified!') | 47 | raise bb.parse.SkipPackage('Only config,images,binary can be specified!') |
41 | d.appendVar('UBOOT_MACHINE', ' ' + items[0]) | 48 | d.appendVar('UBOOT_MACHINE', ' ' + items[0]) |
42 | # IMAGE_FSTYPES appending | 49 | # IMAGE_FSTYPES appending |
43 | if len(items) > 1 and items[1]: | 50 | if len(items) > 1 and items[1]: |
44 | bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1]) | 51 | bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1]) |
45 | d.appendVar('IMAGE_FSTYPES', ' ' + items[1]) | 52 | d.appendVar('IMAGE_FSTYPES', ' ' + items[1]) |
53 | if len(items) > 2 and items[2]: | ||
54 | bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % items[2]) | ||
55 | d.appendVar('UBOOT_BINARIES', ' ' + items[2]) | ||
56 | else: | ||
57 | bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % ubootbinary) | ||
58 | d.appendVar('UBOOT_BINARIES', ' ' + ubootbinary) | ||
46 | break | 59 | break |
47 | elif len(ubootconfig) == 0: | 60 | elif len(ubootconfig) == 0: |
48 | raise bb.parse.SkipPackage('You must set a default in UBOOT_CONFIG.') | 61 | raise bb.parse.SkipPackage('You must set a default in UBOOT_CONFIG.') |
diff --git a/meta/recipes-bsp/u-boot/u-boot.inc b/meta/recipes-bsp/u-boot/u-boot.inc index 1071d1f270..1f64faa6f6 100644 --- a/meta/recipes-bsp/u-boot/u-boot.inc +++ b/meta/recipes-bsp/u-boot/u-boot.inc | |||
@@ -32,7 +32,6 @@ UBOOT_LOCALVERSION ?= "" | |||
32 | # but enable individual recipes to change this value. | 32 | # but enable individual recipes to change this value. |
33 | UBOOT_SUFFIX ??= "bin" | 33 | UBOOT_SUFFIX ??= "bin" |
34 | UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" | 34 | UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" |
35 | UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" | ||
36 | UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}" | 35 | UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}" |
37 | UBOOT_MAKE_TARGET ?= "all" | 36 | UBOOT_MAKE_TARGET ?= "all" |
38 | 37 | ||
@@ -82,15 +81,22 @@ do_compile () { | |||
82 | 81 | ||
83 | if [ -n "${UBOOT_CONFIG}" ] | 82 | if [ -n "${UBOOT_CONFIG}" ] |
84 | then | 83 | then |
84 | unset i j k | ||
85 | for config in ${UBOOT_MACHINE}; do | 85 | for config in ${UBOOT_MACHINE}; do |
86 | i=$(expr $i + 1); | 86 | i=$(expr $i + 1); |
87 | for type in ${UBOOT_CONFIG}; do | 87 | for type in ${UBOOT_CONFIG}; do |
88 | j=$(expr $j + 1); | 88 | j=$(expr $j + 1); |
89 | if [ $j -eq $i ] | 89 | if [ $j -eq $i ] |
90 | then | 90 | then |
91 | oe_runmake O=${config} ${config} | 91 | oe_runmake O=${config} ${config} |
92 | oe_runmake O=${config} ${UBOOT_MAKE_TARGET} | 92 | oe_runmake O=${config} ${UBOOT_MAKE_TARGET} |
93 | cp ${S}/${config}/${UBOOT_BINARY} ${S}/${config}/u-boot-${type}.${UBOOT_SUFFIX} | 93 | for binary in ${UBOOT_BINARIES}; do |
94 | k=$(expr $k + 1); | ||
95 | if [ $k -eq $i ]; then | ||
96 | cp ${S}/${config}/${binary} ${S}/${config}/u-boot-${type}.${UBOOT_SUFFIX} | ||
97 | fi | ||
98 | done | ||
99 | unset k | ||
94 | fi | 100 | fi |
95 | done | 101 | done |
96 | unset j | 102 | unset j |