meta: handle UBOOT_CONFIG in image.bbclass
PATCH 1/1 meta: handle UBOOT_CONFIG in image.bbclass
From: Ming Liu <[email protected]>
The code dealing with IMAGE_FSTYPES in uboot-config.bbclass would not take any effect since it's in a uboot particular class, but it's not being inherited by any image recipes.
Move the IMAGE_FSTYPES handling part to image.bbclass would make it really work.
Also drop some trivial debug code.
--- meta/classes/image.bbclass | 12 ++++++++++++ meta/classes/uboot-config.bbclass | 17 ++++------------- meta/conf/documentation.conf | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-)
meta/classes/image.bbclass +12 -0
@@ -365,6 +365,18 @@ python () { return basetype + # Check UBOOT_CONFIG + ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split() + ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') + ubootconfigflags.pop('doc', None) + if len(ubootconfig) > 0: + for config in ubootconfig: + for f, v in ubootconfigflags.items(): + if config == f: + items = v.split(',') + if len(items) > 1 and items[1]: + d.appendVar('IMAGE_FSTYPES', ' ' + items[1]) + basetypes = {} alltypes = d.getVar('IMAGE_FSTYPES').split() typedeps = {}
meta/classes/uboot-config.bbclass +4 -13
@@ -15,18 +15,15 @@ UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" python () { ubootmachine = d.getVar("UBOOT_MACHINE") - ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') ubootbinary = d.getVar('UBOOT_BINARY') ubootbinaries = d.getVar('UBOOT_BINARIES') + ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split() + ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') + # The "doc" varflag is special, we don't want to see it here ubootconfigflags.pop('doc', None) - ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split() if not ubootmachine and not ubootconfig: - PN = d.getVar("PN") - FILE = os.path.basename(d.getVar("FILE")) - bb.debug(1, "To build %s, see %s for instructions on \ - setting up your machine config" % (PN, FILE)) raise bb.parse.SkipRecipe("Either UBOOT_MACHINE or UBOOT_CONFIG must be set in the %s machine configuration." % d.getVar("MACHINE")) if ubootmachine and ubootconfig:
@@ -40,18 +37,12 @@ python () { for f, v in ubootconfigflags.items(): if config == f: items = v.split(',') - if items[0] and len(items) > 3: + if len(items) == 0 or len(items) > 3: raise bb.parse.SkipRecipe('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 }
meta/conf/documentation.conf +1 -1
@@ -439,7 +439,7 @@ TUNEVALID[doc] = "Descriptions, stored as flags, of valid tuning features." #U -UBOOT_CONFIG[doc] = "Configures the UBOOT_MACHINE and can also define IMAGE_FSTYPES for individual cases." +UBOOT_CONFIG[doc] = "Configures the UBOOT_MACHINE and can also define IMAGE_FSTYPES, UBOOT_BINARIES for individual cases." UBOOT_ENTRYPOINT[doc] = "Specifies the entry point for the U-Boot image." UBOOT_LOADADDRESS[doc] = "Specifies the load address for the U-Boot image." UBOOT_LOCALVERSION[doc] = "Appends a string to the name of the local version of the U-Boot image."
Signature · 1 line
2.7.4
Quoted 9 lines · On Wed, 2019-05-15 at 21:22 +0200, [email protected] wrote:
From: Ming Liu <[email protected]>
The code dealing with
IMAGE_FSTYPESin uboot-config.bbclass would not take any effect since it's in a uboot particular class, but it's not being inherited by any image recipes.Move the
IMAGE_FSTYPEShandling part to image.bbclass would make it really work.
Quoted 8 lines
Also drop some trivial debug code.
Signed-off-by Ming Liu <[email protected]>--- meta/classes/image.bbclass | 12 ++++++++++++ meta/classes/uboot-config.bbclass | 17 ++++------------- meta/conf/documentation.conf | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-)
This doesn't make sense, if we want to set IMAGE_FSTYPES, lets just set that.
I'd imagine the code is designed so you'd inherit uboot-config in the machine and this therefore could be made to work as is.
Moving the code to image.bbclass is the wrong thing to do though and I'd question whether we want UBOOT_CONFIG doing this at all...
Cheers,
Richard
Hi, Richard:
Quoted 1 line
I'd imagine the code is designed so you'd inherit uboot-config in the
machine and this therefore could be made to work as is.
Yes, that probably is how the author intended it to be used, but unfortunately, that's not how it's being used in BSP layers, that fact is, in most BSP meta layers, they do not put it into INHERIT, only u-boot recipes are inheriting uboot-config.
I am on board there is no need to set IMAGE_FSTYPES in uboot-config.bbclass, maybe we should drop it from UBOOT_CONFIG and it would be like: 'UBOOT_CONFIG = "config,,binary"', there will be a empty item in the middle, so the BSP meta layers would work as usual.
Will send a V2 if you agree with this.
//Ming Liu
Richard Purdie <[email protected]> 於 2019年5月16日 週四 上午10:23寫道:
Quoted 33 lines · On Wed, 2019-05-15 at 21:22 +0200, [email protected] wrote:
Quoted 9 lines
From: Ming Liu <[email protected]>
The code dealing with
IMAGE_FSTYPESin uboot-config.bbclass would not take any effect since it's in a uboot particular class, but it's not being inherited by any image recipes.Move the
IMAGE_FSTYPEShandling part to image.bbclass would make it really work.Quoted 8 lines
Also drop some trivial debug code.
Signed-off-by Ming Liu <[email protected]>--- meta/classes/image.bbclass | 12 ++++++++++++ meta/classes/uboot-config.bbclass | 17 ++++------------- meta/conf/documentation.conf | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-)This doesn't make sense, if we want to set
IMAGE_FSTYPES, lets just set that.I'd imagine the code is designed so you'd inherit uboot-config in the machine and this therefore could be made to work as is.
Moving the code to image.bbclass is the wrong thing to do though and I'd question whether we want
UBOOT_CONFIGdoing this at all...Cheers,
Richard
Quoted 10 lines · Ming Liu
Hi, Richard:
Quoted 1 line
I'd imagine the code is designed so you'd inherit uboot-config in
the machine and this therefore could be made to work as is.
Yes, that probably is how the author intended it to be used, but unfortunately, that's not how it's being used in BSP layers, that fact is, in most BSP meta layers, they do not put it into INHERIT, only u-boot recipes are inheriting uboot-config.
Quoted 6 lines
I am on board there is no need to set
IMAGE_FSTYPESin uboot- config.bbclass, maybe we should drop it fromUBOOT_CONFIGand it would be like: 'UBOOT_CONFIG= "config,,binary"', there will be a empty item in the middle, so the BSP meta layers would work as usual.Will send a V2 if you agree with this.
I agree, I wonder if we need to make it warn about missing functionality if someone is using the old option though?
Cheers,
Richard
Quoted 1 line
I wonder if we need to make it warn about missing functionality if
someone is using the old option though?
Agreed, will do that in V2.
//Ming Liu
<[email protected]> 於 2019年5月16日 週四 下午12:55寫道:
Quoted 26 lines · Ming Liu
Quoted 10 lines
Hi, Richard:
Quoted 1 line
I'd imagine the code is designed so you'd inherit uboot-config in
the machine and this therefore could be made to work as is.
Yes, that probably is how the author intended it to be used, but unfortunately, that's not how it's being used in BSP layers, that fact is, in most BSP meta layers, they do not put it into INHERIT, only u-boot recipes are inheriting uboot-config.
Quoted 6 lines
I am on board there is no need to set
IMAGE_FSTYPESin uboot- config.bbclass, maybe we should drop it fromUBOOT_CONFIGand it would be like: 'UBOOT_CONFIG= "config,,binary"', there will be a empty item in the middle, so the BSP meta layers would work as usual.Will send a V2 if you agree with this.
I agree, I wonder if we need to make it warn about missing functionality if someone is using the old option though?
Cheers,
Richard