Skip to content
Snippets Groups Projects
imx-boot_%.bbappend 2.9 KiB
Newer Older
require imx-mkimage_kuk.inc

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SOC_TARGET:imx8mguf = "iMX8MM"
SOC_TARGET:imx8mpguf = "iMX8MP"
SOC_FAMILY:imx8mguf = "mx8m"
SOC_FAMILY:imx8mpguf = "mx8m"
ATF_MACHINE_NAME:imx8mguf = "bl31-imx8mm.bin"
ATF_MACHINE_NAME:imx8mpguf = "bl31-imx8mp.bin"
BOOT_STAGING:imx8mguf = "${S}/iMX8M"
BOOT_STAGING:imx8mpguf = "${S}/iMX8M"
MACHINE_SOCARCH_SUFFIX:imx8mguf = "-mx8mm"
MACHINE_SOCARCH_SUFFIX:imx8mpguf = "-mx8mp"

# Using prepuilt bl31 for now
DEPENDS:remove = "imx-atf"

# Remove some copy operations from the original compile_mx8m, because we already
# have some of the files fscl wants to copy there checked out
compile_mx8m() {
    bbnote 8MQ/8MM/8MN/8MP boot binary build
    cp ${DEPLOY_DIR_IMAGE}/signed_dp_imx8m.bin               ${BOOT_STAGING}
    cp ${DEPLOY_DIR_IMAGE}/u-boot-spl.bin-${MACHINE}-${UBOOT_CONFIG} \
                                                             ${BOOT_STAGING}/u-boot-spl.bin
    cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${UBOOT_DTB_NAME}   ${BOOT_STAGING}
    cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/u-boot-nodtb.bin-${MACHINE}-${UBOOT_CONFIG} \
                                                             ${BOOT_STAGING}/u-boot-nodtb.bin

    # We had same issues with the precompiled mkimage from the repo
    #cp ${STAGING_DIR_NATIVE}/${bindir}/mkimage               ${BOOT_STAGING}/mkimage_uboot

    # The BL31 firmware is already inside the imx-mkimage repo
    #cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${ATF_MACHINE_NAME} ${BOOT_STAGING}/bl31.bin
    cp ${BOOT_STAGING}/${ATF_MACHINE_NAME}                   ${BOOT_STAGING}/bl31.bin
    cp ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME}                     ${BOOT_STAGING}/u-boot.bin
}
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
}