From 9a0ca658320a3d87773bfd1ccda4121a96326d68 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Wed, 4 Oct 2017 17:36:04 -0300 Subject: [PATCH] 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 --- conf/machine/include/imx-base.inc | 15 +++++++++++++++ conf/machine/include/utilities.inc | 28 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 conf/machine/include/utilities.inc diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc index 14a0fccb..4b01c2d4 100644 --- a/conf/machine/include/imx-base.inc +++ b/conf/machine/include/imx-base.inc @@ -3,6 +3,8 @@ include conf/machine/include/fsl-default-settings.inc include conf/machine/include/fsl-default-versions.inc +require conf/machine/include/utilities.inc + # Set specific make target and binary suffix PREFERRED_PROVIDER_u-boot ??= "u-boot-fslc" PREFERRED_PROVIDER_virtual/bootloader ??= "u-boot-fslc" @@ -226,6 +228,19 @@ SOC_DEFAULT_IMAGE_FSTYPES_mxs = "uboot-mxsboot-sdcard sdcard.gz" SDCARD_ROOTFS ?= "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ext4" IMAGE_FSTYPES ?= "${SOC_DEFAULT_IMAGE_FSTYPES}" +IMAGE_BOOT_FILES ?= " \ + ${KERNEL_IMAGETYPE} \ + ${@make_dtb_boot_files(d)} \ +" + +### wic default support +WKS_FILE_DEPENDS ?= " \ + virtual/bootloader \ + \ + e2fsprogs-native \ + bmap-tools-native \ +" + SERIAL_CONSOLE = "115200 ttymxc0" SERIAL_CONSOLE_mxs = "115200 ttyAMA0" 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 @@ +### Machine definition file utilities + +def make_dtb_boot_files(d): + # Generate IMAGE_BOOT_FILES entries for device tree files listed in + # KERNEL_DEVICETREE. + alldtbs = d.getVar('KERNEL_DEVICETREE') + imgtyp = d.getVar('KERNEL_IMAGETYPE') + + def transform(dtb): + if dtb.endswith('dtb'): + # eg: whatever/bcm2708-rpi-b.dtb has: + # DEPLOYDIR file: ${KERNEL_IMAGETYPE}-bcm2708-rpi-b.dtb + # destination: bcm2708-rpi-b.dtb + base = os.path.basename(dtb) + src = '{}-{}'.format(imgtyp, base) + dst = base + return '{};{}'.format(src, dst) + elif dtb.endswith('dtbo'): + # overlay dtb: + # eg: overlays/hifiberry-amp.dtbo has: + # DEPLOYDIR file: ${KERNEL_IMAGETYPE}-hifiberry-amp.dtbo + # destination: overlays/hifiberry-amp.dtbo + base = os.path.basename(dtb) + src = '{}-{}'.format(imgtyp, base) + dst = dtb + return '{};{}'.format(src, dtb) + + return ' '.join([transform(dtb) for dtb in alldtbs.split(' ') if dtb]) -- 2.40.1