[meta-freescale] [PATCH] imx-base.inc: Generate a default IMAGE_BOOT_FILES

Daiane Angolini daiane.list at gmail.com
Thu Oct 5 10:45:48 PDT 2017


On Wed, Oct 4, 2017 at 5:40 PM, Otavio Salvador <otavio at ossystems.com.br> wrote:
> 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.

Nice solution. Thanks for the patch

>
> Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>

Reviewed-by: Daiane Angolini <daiane.angolini at nxp.com>

> ---
>
>  conf/machine/include/imx-base.inc  |  7 +++++++
>  conf/machine/include/utilities.inc | 28 ++++++++++++++++++++++++++++
>  2 files changed, 35 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 06f93fcb..c96216de 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,11 @@ 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 \
> 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.14.2
>
> --
> _______________________________________________
> meta-freescale mailing list
> meta-freescale at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-freescale


More information about the meta-freescale mailing list