generic-poky/meta/classes/uboot-config.bbclass
Ting Liu ec64c9c02f 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>
2016-07-01 16:22:40 +01:00

63 lines
2.6 KiB
Text

# Handle U-Boot config for a machine
#
# The format to specify it, in the machine, is:
#
# UBOOT_CONFIG ??= <default>
# UBOOT_CONFIG[foo] = "config,images,binary"
#
# or
#
# UBOOT_MACHINE = "config"
#
# Copyright 2013, 2014 (C) O.S. Systems Software LTDA.
UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
python () {
ubootmachine = d.getVar("UBOOT_MACHINE", True)
ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
ubootbinary = d.getVar('UBOOT_BINARY', True)
ubootbinaries = d.getVar('UBOOT_BINARIES', True)
# The "doc" varflag is special, we don't want to see it here
ubootconfigflags.pop('doc', None)
if not ubootmachine and not ubootconfigflags:
PN = d.getVar("PN", True)
FILE = os.path.basename(d.getVar("FILE", True))
bb.debug(1, "To build %s, see %s for instructions on \
setting up your machine config" % (PN, FILE))
raise bb.parse.SkipPackage("Either UBOOT_MACHINE or UBOOT_CONFIG must be set in the %s machine configuration." % d.getVar("MACHINE", True))
if ubootmachine and ubootconfigflags:
raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at the same time.")
if ubootconfigflags and ubootbinaries:
raise bb.parse.SkipPackage("You cannot use UBOOT_BINARIES as it is internal to uboot_config.bbclass.")
if not ubootconfigflags:
return
ubootconfig = (d.getVar('UBOOT_CONFIG', True) or "").split()
if len(ubootconfig) > 0:
for config in ubootconfig:
for f, v in ubootconfigflags.items():
if config == f:
items = v.split(',')
if items[0] and len(items) > 3:
raise bb.parse.SkipPackage('Only config,images,binary can be specified!')
d.appendVar('UBOOT_MACHINE', ' ' + items[0])
# IMAGE_FSTYPES appending
if len(items) > 1 and items[1]:
bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1])
d.appendVar('IMAGE_FSTYPES', ' ' + items[1])
if len(items) > 2 and items[2]:
bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % items[2])
d.appendVar('UBOOT_BINARIES', ' ' + items[2])
else:
bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % ubootbinary)
d.appendVar('UBOOT_BINARIES', ' ' + ubootbinary)
break
elif len(ubootconfig) == 0:
raise bb.parse.SkipPackage('You must set a default in UBOOT_CONFIG.')
}