summaryrefslogtreecommitdiffstats
path: root/conf/machine/include/utilities.inc
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2017-10-04 17:36:04 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2017-10-05 15:32:48 -0300
commitac419895663889d65cc3828b7d6ce150199526bb (patch)
treeff28d576a06b744c0f01f0e144d65233e601e528 /conf/machine/include/utilities.inc
parentb35452627c07ccfbb6a3d41454adbd5ffbdc3bb8 (diff)
downloadmeta-freescale-ac419895663889d65cc3828b7d6ce150199526bb.tar.gz
imx-base.inc: Generate a default IMAGE_BOOT_FILES
When the machine requires a boot partition, it needs to define the IMAGE_BOOT_FILES to include the device tree files and Linux kernel image. This is essentially a generic solution so instead of defining it for all machines we are providing a default value for them. To implement that, we borrowed an utility function from Raspberry Pi BSP. It is copied as is at conf/machine/include/utilities.inc file. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'conf/machine/include/utilities.inc')
-rw-r--r--conf/machine/include/utilities.inc28
1 files changed, 28 insertions, 0 deletions
diff --git a/conf/machine/include/utilities.inc b/conf/machine/include/utilities.inc
new file mode 100644
index 00000000..bcb1c2a7
--- /dev/null
+++ b/conf/machine/include/utilities.inc
@@ -0,0 +1,28 @@
1### Machine definition file utilities
2
3def make_dtb_boot_files(d):
4 # Generate IMAGE_BOOT_FILES entries for device tree files listed in
5 # KERNEL_DEVICETREE.
6 alldtbs = d.getVar('KERNEL_DEVICETREE')
7 imgtyp = d.getVar('KERNEL_IMAGETYPE')
8
9 def transform(dtb):
10 if dtb.endswith('dtb'):
11 # eg: whatever/bcm2708-rpi-b.dtb has:
12 # DEPLOYDIR file: ${KERNEL_IMAGETYPE}-bcm2708-rpi-b.dtb
13 # destination: bcm2708-rpi-b.dtb
14 base = os.path.basename(dtb)
15 src = '{}-{}'.format(imgtyp, base)
16 dst = base
17 return '{};{}'.format(src, dst)
18 elif dtb.endswith('dtbo'):
19 # overlay dtb:
20 # eg: overlays/hifiberry-amp.dtbo has:
21 # DEPLOYDIR file: ${KERNEL_IMAGETYPE}-hifiberry-amp.dtbo
22 # destination: overlays/hifiberry-amp.dtbo
23 base = os.path.basename(dtb)
24 src = '{}-{}'.format(imgtyp, base)
25 dst = dtb
26 return '{};{}'.format(src, dtb)
27
28 return ' '.join([transform(dtb) for dtb in alldtbs.split(' ') if dtb])