Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # Handle U-Boot config for a machine |
| 2 | # |
| 3 | # The format to specify it, in the machine, is: |
| 4 | # |
| 5 | # UBOOT_CONFIG ??= <default> |
| 6 | # UBOOT_CONFIG[foo] = "config,images" |
| 7 | # |
| 8 | # or |
| 9 | # |
| 10 | # UBOOT_MACHINE = "config" |
| 11 | # |
| 12 | # Copyright 2013, 2014 (C) O.S. Systems Software LTDA. |
| 13 | |
| 14 | python () { |
| 15 | ubootmachine = d.getVar("UBOOT_MACHINE", True) |
| 16 | ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') |
| 17 | # The "doc" varflag is special, we don't want to see it here |
| 18 | ubootconfigflags.pop('doc', None) |
| 19 | |
| 20 | if not ubootmachine and not ubootconfigflags: |
| 21 | PN = d.getVar("PN", True) |
| 22 | FILE = os.path.basename(d.getVar("FILE", True)) |
| 23 | bb.debug(1, "To build %s, see %s for instructions on \ |
| 24 | setting up your machine config" % (PN, FILE)) |
| 25 | raise bb.parse.SkipPackage("Either UBOOT_MACHINE or UBOOT_CONFIG must be set in the %s machine configuration." % d.getVar("MACHINE", True)) |
| 26 | |
| 27 | if ubootmachine and ubootconfigflags: |
| 28 | raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at the same time.") |
| 29 | |
| 30 | if not ubootconfigflags: |
| 31 | return |
| 32 | |
| 33 | ubootconfig = (d.getVar('UBOOT_CONFIG', True) or "").split() |
| 34 | if len(ubootconfig) > 0: |
| 35 | for config in ubootconfig: |
| 36 | for f, v in ubootconfigflags.items(): |
| 37 | if config == f: |
| 38 | items = v.split(',') |
| 39 | if items[0] and len(items) > 2: |
| 40 | raise bb.parse.SkipPackage('Only config,images can be specified!') |
| 41 | d.appendVar('UBOOT_MACHINE', ' ' + items[0]) |
| 42 | # IMAGE_FSTYPES appending |
| 43 | if len(items) > 1 and items[1]: |
| 44 | bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1]) |
| 45 | d.appendVar('IMAGE_FSTYPES', ' ' + items[1]) |
| 46 | break |
| 47 | elif len(ubootconfig) == 0: |
| 48 | raise bb.parse.SkipPackage('You must set a default in UBOOT_CONFIG.') |
| 49 | } |