summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/uboot-config.bbclass39
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass
new file mode 100644
index 0000000000..fc37620369
--- /dev/null
+++ b/meta/classes/uboot-config.bbclass
@@ -0,0 +1,39 @@
1# Allow easy override of 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# Copyright 2013 (C) O.S. Systems Software LTDA.
9
10addhandler uboot_config_eventhandler
11uboot_config_eventhandler[eventmask] = "bb.event.ConfigParsed"
12python uboot_config_eventhandler() {
13 ubootconfigflags = e.data.getVarFlags('UBOOT_CONFIG')
14 if not ubootconfigflags:
15 return
16
17 ubootconfig = (e.data.getVar('UBOOT_CONFIG', True) or "").split()
18 if len(ubootconfig) > 1:
19 raise bb.parse.SkipPackage('You can only have a single default for UBOOT_CONFIG.')
20 elif len(ubootconfig) == 0:
21 raise bb.parse.SkipPackage('You must set a default in UBOOT_CONFIG.')
22 ubootconfig = ubootconfig[0]
23
24 for f, v in ubootconfigflags.items():
25 if f == 'defaultval':
26 continue
27
28 items = v.split(',')
29 if items[0] and len(items) > 2:
30 raise bb.parse.SkipPackage('Only config,images can be specified!')
31
32 if ubootconfig == f:
33 bb.debug(1, "Setting UBOOT_MACHINE to %s." % items[0])
34 e.data.setVar('UBOOT_MACHINE', items[0])
35
36 if items[1]:
37 bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1])
38 e.data.appendVar('IMAGE_FSTYPES', ' ' + items[1])
39}