Skip to content
Snippets Groups Projects
imx-boot_%.bbappend 2.53 KiB
Newer Older
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-iMX8M-Add-additional-devicetrees-in-dtbs-to-the-u-bo.patch"

do_compile:prepend() {
    for dtb in ${UBOOT_ADDITIONAL_DTB_NAMES};do
        cp -v ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${dtb} ${BOOT_STAGING}
    done
}

do_compile:append() {
    # Integrate fw_env.config and u-boot-initial-env
    cp "${DEPLOY_DIR_IMAGE}/u-boot-initial-env-${MACHINE}-${UBOOT_CONFIG}.bin" "${S}"
    cp "${DEPLOY_DIR_IMAGE}/fw_env-${MACHINE}-${UBOOT_CONFIG}.config" "${S}"
    for target in ${IMXBOOT_TARGETS}; do
        # Store an md5sum to check the files on target before installation
        md5sum ${BOOT_CONFIG_MACHINE}-${target} \
               u-boot-initial-env-${MACHINE}-${UBOOT_CONFIG}.bin \
               fw_env-${MACHINE}-${UBOOT_CONFIG}.config \
               > ${BOOT_CONFIG_MACHINE}-${target}.md5
    done
do_deploy:append() {
    for target in ${IMXBOOT_TARGETS}; do
        # Create a tar from the bootfiles, compressed gz, dereference links (copy the file not the link into the tar)
        cd ${S}
        tar chzf ${DEPLOYDIR}/${BOOT_CONFIG_MACHINE}-${target}.tar.gz \
                 ${BOOT_CONFIG_MACHINE}-${target} \
                 ${BOOT_CONFIG_MACHINE}-${target}.md5 \
                 u-boot-initial-env-${MACHINE}-${UBOOT_CONFIG}.bin \
                 fw_env-${MACHINE}-${UBOOT_CONFIG}.config

        cd -
        cd ${DEPLOYDIR}
        ln -sf ${BOOT_CONFIG_MACHINE}-${target}.tar.gz ${BOOT_NAME}.tar.gz
        cd -
    done
}

# Copy of the original compile function, as UBOOT_ADDITIONAL_DTB_NAMES had to
# be added to the make call
do_compile() {
    # mkimage for i.MX8
    # Copy TEE binary to SoC target folder to mkimage
    if ${DEPLOY_OPTEE}; then
        cp ${DEPLOY_DIR_IMAGE}/tee.bin ${BOOT_STAGING}
    fi
    for target in ${IMXBOOT_TARGETS}; do
        compile_${SOC_FAMILY}
        if [ "$target" = "flash_linux_m4_no_v2x" ]; then
           # Special target build for i.MX 8DXL with V2X off
           bbnote "building ${IMX_BOOT_SOC_TARGET} - ${REV_OPTION} V2X=NO ${target}"
           make SOC=${IMX_BOOT_SOC_TARGET} ${REV_OPTION} V2X=NO dtbs=${UBOOT_DTB_NAME} flash_linux_m4
        else
           bbnote "building ${IMX_BOOT_SOC_TARGET} - ${REV_OPTION} ${target}"
           make SOC=${IMX_BOOT_SOC_TARGET} ${REV_OPTION} dtbs="${UBOOT_DTB_NAME} ${UBOOT_ADDITIONAL_DTB_NAMES}" ${target}
        fi
        if [ -e "${BOOT_STAGING}/flash.bin" ]; then
            cp ${BOOT_STAGING}/flash.bin ${S}/${BOOT_CONFIG_MACHINE}-${target}
        fi
    done
}