aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-bsp
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp')
-rw-r--r--recipes-bsp/imx-mkimage/imx-boot_0.2.bb191
1 files changed, 191 insertions, 0 deletions
diff --git a/recipes-bsp/imx-mkimage/imx-boot_0.2.bb b/recipes-bsp/imx-mkimage/imx-boot_0.2.bb
new file mode 100644
index 00000000..5ffddd0e
--- /dev/null
+++ b/recipes-bsp/imx-mkimage/imx-boot_0.2.bb
@@ -0,0 +1,191 @@
+# Copyright 2017-2018 NXP
+
+require imx-mkimage_git.inc
+
+DESCRIPTION = "Generate Boot Loader for i.MX 8 device"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+SECTION = "BSP"
+
+IMX_EXTRA_FIRMWARE = "firmware-imx-8 imx-sc-firmware"
+IMX_EXTRA_FIRMWARE_mx8m = "firmware-imx-8m"
+IMX_EXTRA_FIRMWARE_mx8x = "firmware-imx-8x imx-sc-firmware"
+DEPENDS += " \
+ u-boot \
+ firmware-imx \
+ ${IMX_EXTRA_FIRMWARE} \
+ imx-atf \
+"
+DEPENDS_append_mx8m = " dtc-native"
+BOOT_NAME = "imx-boot"
+PROVIDES = "${BOOT_NAME}"
+
+inherit deploy
+
+# Add CFLAGS with native INCDIR & LIBDIR for imx-mkimage build
+CFLAGS = "-O2 -Wall -std=c99 -static -I ${STAGING_INCDIR_NATIVE} -L ${STAGING_LIBDIR_NATIVE}"
+
+# For i.MX 8, this package aggregates the imx-m4-demos
+# output. Note that this aggregation replaces the aggregation
+# that would otherwise be done in the image build as controlled
+# by IMAGE_BOOTFILES_DEPENDS and IMAGE_BOOTFILES in image_types_fsl.bbclass
+IMX_M4_DEMOS = ""
+IMX_M4_DEMOS_mx8qm = "imx-m4-demos:do_deploy"
+IMX_M4_DEMOS_mx8qxp = "imx-m4-demos:do_deploy"
+
+# This package aggregates output deployed by other packages,
+# so set the appropriate dependencies
+do_compile[depends] += " \
+ virtual/bootloader:do_deploy \
+ ${@' '.join('%s:do_deploy' % r for r in '${IMX_EXTRA_FIRMWARE}'.split() )} \
+ imx-atf:do_deploy \
+ ${IMX_M4_DEMOS} \
+"
+
+SC_FIRMWARE_NAME ?= "scfw_tcm.bin"
+
+ATF_MACHINE_NAME ?= "bl31-imx8qm.bin"
+ATF_MACHINE_NAME_mx8qm = "bl31-imx8qm.bin"
+ATF_MACHINE_NAME_mx8qxp = "bl31-imx8qxp.bin"
+ATF_MACHINE_NAME_mx8mq = "bl31-imx8mq.bin"
+ATF_MACHINE_NAME_mx8mm = "bl31-imx8mm.bin"
+ATF_MACHINE_NAME_append = "${@bb.utils.contains('COMBINED_FEATURES', 'optee', '-optee', '', d)}"
+
+DCD_NAME ?= "imx8qm_dcd.cfg.tmp"
+DCD_NAME_mx8qm = "imx8qm_dcd.cfg.tmp"
+DCD_NAME_mx8qxp = "imx8qx_dcd.cfg.tmp"
+
+UBOOT_NAME = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}"
+BOOT_CONFIG_MACHINE = "${BOOT_NAME}-${MACHINE}-${UBOOT_CONFIG}.bin"
+
+TOOLS_NAME ?= "mkimage_imx8"
+
+SOC_TARGET ?= "INVALID"
+SOC_TARGET_mx8qm = "iMX8QM"
+SOC_TARGET_mx8qxp = "iMX8QX"
+SOC_TARGET_mx8mq = "iMX8M"
+SOC_TARGET_mx8mm = "iMX8MM"
+
+IMXBOOT_TARGETS ?= \
+ "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', 'flash_flexspi', \
+ bb.utils.contains('UBOOT_CONFIG', 'nand', 'flash_nand', \
+ 'flash_multi_cores flash flash_dcd', d), d)}"
+IMXBOOT_TARGETS_mx8qxp = \
+ "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', 'flash_flexspi', \
+ bb.utils.contains('UBOOT_CONFIG', 'nand', 'flash_nand', \
+ 'flash_all flash', d), d)}"
+IMXBOOT_TARGETS_mx8qxpa0 = \
+ "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', 'flash_flexspi_a0', \
+ bb.utils.contains('UBOOT_CONFIG', 'nand', 'flash_nand_a0', \
+ 'flash_multi_cores_a0 flash_a0 flash_dcd_a0', d), d)}"
+
+BOOT_STAGING = "${S}/${SOC_TARGET}"
+BOOT_STAGING_mx8mm = "${S}/iMX8M"
+
+SOC_FAMILY = "INVALID"
+SOC_FAMILY_mx8 = "mx8"
+SOC_FAMILY_mx8m = "mx8m"
+SOC_FAMILY_mx8x = "mx8x"
+
+compile_mx8m() {
+ bbnote 8MQ/8MM boot binary build
+ for ddr_firmware in ${DDR_FIRMWARE_NAME}; do
+ bbnote "Copy ddr_firmware: ${ddr_firmware} from ${DEPLOY_DIR_IMAGE} -> ${BOOT_STAGING} "
+ cp ${DEPLOY_DIR_IMAGE}/${ddr_firmware} ${BOOT_STAGING}
+ done
+ cp ${DEPLOY_DIR_IMAGE}/signed_*_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 ${BOOT_STAGING}
+ cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/mkimage_uboot ${BOOT_STAGING}
+ cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${ATF_MACHINE_NAME} ${BOOT_STAGING}/bl31.bin
+ cp ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME} ${BOOT_STAGING}/u-boot.bin
+}
+compile_mx8() {
+ bbnote 8QM boot binary build
+ cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${SC_FIRMWARE_NAME} ${BOOT_STAGING}/scfw_tcm.bin
+ cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${ATF_MACHINE_NAME} ${BOOT_STAGING}/bl31.bin
+ cp ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME} ${BOOT_STAGING}/u-boot.bin
+ cp ${DEPLOY_DIR_IMAGE}/imx8qm_m4_0_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${BOOT_STAGING}/m40_tcm.bin
+ cp ${DEPLOY_DIR_IMAGE}/imx8qm_m4_1_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${BOOT_STAGING}/m41_tcm.bin
+ cp ${DEPLOY_DIR_IMAGE}/mx8qm-ahab-container.img ${BOOT_STAGING}
+}
+compile_mx8x() {
+ bbnote 8QX boot binary build
+ cp ${DEPLOY_DIR_IMAGE}/imx8qx_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${BOOT_STAGING}/m40_tcm.bin
+ cp ${DEPLOY_DIR_IMAGE}/imx8qx_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${BOOT_STAGING}/CM4.bin
+ cp ${DEPLOY_DIR_IMAGE}/mx8qx-ahab-container.img ${BOOT_STAGING}
+ cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${SC_FIRMWARE_NAME} ${BOOT_STAGING}/scfw_tcm.bin
+ cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${ATF_MACHINE_NAME} ${BOOT_STAGING}/bl31.bin
+ cp ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME} ${BOOT_STAGING}/u-boot.bin
+}
+do_compile() {
+ compile_${SOC_FAMILY}
+ # mkimage for i.MX8
+ for target in ${IMXBOOT_TARGETS}; do
+ bbnote "building ${SOC_TARGET} - ${target}"
+ make SOC=${SOC_TARGET} ${target}
+ if [ -e "${BOOT_STAGING}/flash.bin" ]; then
+ cp ${BOOT_STAGING}/flash.bin ${S}/${BOOT_CONFIG_MACHINE}-${target}
+ fi
+ done
+}
+
+do_install () {
+ install -d ${D}/boot
+ for target in ${IMXBOOT_TARGETS}; do
+ install -m 0644 ${S}/${BOOT_CONFIG_MACHINE}-${target} ${D}/boot/
+ done
+}
+
+deploy_mx8m() {
+ install -d ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0644 ${DEPLOY_DIR_IMAGE}/u-boot-spl.bin-${MACHINE}-${UBOOT_CONFIG} ${DEPLOYDIR}/${BOOT_TOOLS}
+ for ddr_firmware in ${DDR_FIRMWARE_NAME}; do
+ install -m 0644 ${DEPLOY_DIR_IMAGE}/${ddr_firmware} ${DEPLOYDIR}/${BOOT_TOOLS}
+ done
+ install -m 0644 ${DEPLOY_DIR_IMAGE}/signed_hdmi*.bin ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0755 ${BOOT_STAGING}/${TOOLS_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0755 ${BOOT_STAGING}/mkimage_fit_atf.sh ${DEPLOYDIR}/${BOOT_TOOLS}
+}
+deploy_mx8() {
+ install -d ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0644 ${BOOT_STAGING}/${DCD_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0644 ${BOOT_STAGING}/mx8qm-ahab-container.img ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0755 ${S}/${TOOLS_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
+}
+deploy_mx8x() {
+ install -d ${DEPLOYDIR}/${BOOT_TOOLS}
+ if [ "${MACHINE}" = "imx8qxpa0mek" ]; then
+ install -m 0644 ${BOOT_STAGING}/${DCD_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
+ fi
+ install -m 0644 ${BOOT_STAGING}/mx8qx-ahab-container.img ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0644 ${BOOT_STAGING}/m40_tcm.bin ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0644 ${BOOT_STAGING}/CM4.bin ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0755 ${S}/${TOOLS_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
+}
+do_deploy() {
+ deploy_${SOC_FAMILY}
+ # copy the tool mkimage to deploy path and sc fw, dcd and uboot
+ install -m 0644 ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
+ # copy makefile (soc.mak) for reference
+ install -m 0644 ${BOOT_STAGING}/soc.mak ${DEPLOYDIR}/${BOOT_TOOLS}
+ # copy the generated boot image to deploy path
+ for target in ${IMXBOOT_TARGETS}; do
+ # Use first "target" as IMAGE_IMXBOOT_TARGET
+ if [ "$IMAGE_IMXBOOT_TARGET" = "" ]; then
+ IMAGE_IMXBOOT_TARGET="$target"
+ echo "Set boot target as $IMAGE_IMXBOOT_TARGET"
+ fi
+ install -m 0644 ${S}/${BOOT_CONFIG_MACHINE}-${target} ${DEPLOYDIR}
+ done
+ cd ${DEPLOYDIR}
+ ln -sf ${BOOT_CONFIG_MACHINE}-${IMAGE_IMXBOOT_TARGET} ${BOOT_CONFIG_MACHINE}
+ cd -
+}
+addtask deploy before do_build after do_compile
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+FILES_${PN} = "/boot"
+
+COMPATIBLE_MACHINE = "(mx8)"