summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Hochstein <tom.hochstein@nxp.com>2018-11-29 12:18:19 -0600
committerOtavio Salvador <otavio@ossystems.com.br>2018-12-13 07:26:04 -0200
commit1e34a9f93fe9c78652d6ca665e330facd7df4264 (patch)
tree1a104edab67938c7a0d9c10e2e4c7d97974b135f
parentcdda3a3b46e3522ca93af69c6272ab31074b5be9 (diff)
downloadmeta-freescale-1e34a9f93fe9c78652d6ca665e330facd7df4264.tar.gz
imx-boot: Add recipe for i.MX 8 boot partition packages
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
-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 @@
1# Copyright 2017-2018 NXP
2
3require imx-mkimage_git.inc
4
5DESCRIPTION = "Generate Boot Loader for i.MX 8 device"
6LICENSE = "GPLv2"
7LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
8SECTION = "BSP"
9
10IMX_EXTRA_FIRMWARE = "firmware-imx-8 imx-sc-firmware"
11IMX_EXTRA_FIRMWARE_mx8m = "firmware-imx-8m"
12IMX_EXTRA_FIRMWARE_mx8x = "firmware-imx-8x imx-sc-firmware"
13DEPENDS += " \
14 u-boot \
15 firmware-imx \
16 ${IMX_EXTRA_FIRMWARE} \
17 imx-atf \
18"
19DEPENDS_append_mx8m = " dtc-native"
20BOOT_NAME = "imx-boot"
21PROVIDES = "${BOOT_NAME}"
22
23inherit deploy
24
25# Add CFLAGS with native INCDIR & LIBDIR for imx-mkimage build
26CFLAGS = "-O2 -Wall -std=c99 -static -I ${STAGING_INCDIR_NATIVE} -L ${STAGING_LIBDIR_NATIVE}"
27
28# For i.MX 8, this package aggregates the imx-m4-demos
29# output. Note that this aggregation replaces the aggregation
30# that would otherwise be done in the image build as controlled
31# by IMAGE_BOOTFILES_DEPENDS and IMAGE_BOOTFILES in image_types_fsl.bbclass
32IMX_M4_DEMOS = ""
33IMX_M4_DEMOS_mx8qm = "imx-m4-demos:do_deploy"
34IMX_M4_DEMOS_mx8qxp = "imx-m4-demos:do_deploy"
35
36# This package aggregates output deployed by other packages,
37# so set the appropriate dependencies
38do_compile[depends] += " \
39 virtual/bootloader:do_deploy \
40 ${@' '.join('%s:do_deploy' % r for r in '${IMX_EXTRA_FIRMWARE}'.split() )} \
41 imx-atf:do_deploy \
42 ${IMX_M4_DEMOS} \
43"
44
45SC_FIRMWARE_NAME ?= "scfw_tcm.bin"
46
47ATF_MACHINE_NAME ?= "bl31-imx8qm.bin"
48ATF_MACHINE_NAME_mx8qm = "bl31-imx8qm.bin"
49ATF_MACHINE_NAME_mx8qxp = "bl31-imx8qxp.bin"
50ATF_MACHINE_NAME_mx8mq = "bl31-imx8mq.bin"
51ATF_MACHINE_NAME_mx8mm = "bl31-imx8mm.bin"
52ATF_MACHINE_NAME_append = "${@bb.utils.contains('COMBINED_FEATURES', 'optee', '-optee', '', d)}"
53
54DCD_NAME ?= "imx8qm_dcd.cfg.tmp"
55DCD_NAME_mx8qm = "imx8qm_dcd.cfg.tmp"
56DCD_NAME_mx8qxp = "imx8qx_dcd.cfg.tmp"
57
58UBOOT_NAME = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}"
59BOOT_CONFIG_MACHINE = "${BOOT_NAME}-${MACHINE}-${UBOOT_CONFIG}.bin"
60
61TOOLS_NAME ?= "mkimage_imx8"
62
63SOC_TARGET ?= "INVALID"
64SOC_TARGET_mx8qm = "iMX8QM"
65SOC_TARGET_mx8qxp = "iMX8QX"
66SOC_TARGET_mx8mq = "iMX8M"
67SOC_TARGET_mx8mm = "iMX8MM"
68
69IMXBOOT_TARGETS ?= \
70 "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', 'flash_flexspi', \
71 bb.utils.contains('UBOOT_CONFIG', 'nand', 'flash_nand', \
72 'flash_multi_cores flash flash_dcd', d), d)}"
73IMXBOOT_TARGETS_mx8qxp = \
74 "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', 'flash_flexspi', \
75 bb.utils.contains('UBOOT_CONFIG', 'nand', 'flash_nand', \
76 'flash_all flash', d), d)}"
77IMXBOOT_TARGETS_mx8qxpa0 = \
78 "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', 'flash_flexspi_a0', \
79 bb.utils.contains('UBOOT_CONFIG', 'nand', 'flash_nand_a0', \
80 'flash_multi_cores_a0 flash_a0 flash_dcd_a0', d), d)}"
81
82BOOT_STAGING = "${S}/${SOC_TARGET}"
83BOOT_STAGING_mx8mm = "${S}/iMX8M"
84
85SOC_FAMILY = "INVALID"
86SOC_FAMILY_mx8 = "mx8"
87SOC_FAMILY_mx8m = "mx8m"
88SOC_FAMILY_mx8x = "mx8x"
89
90compile_mx8m() {
91 bbnote 8MQ/8MM boot binary build
92 for ddr_firmware in ${DDR_FIRMWARE_NAME}; do
93 bbnote "Copy ddr_firmware: ${ddr_firmware} from ${DEPLOY_DIR_IMAGE} -> ${BOOT_STAGING} "
94 cp ${DEPLOY_DIR_IMAGE}/${ddr_firmware} ${BOOT_STAGING}
95 done
96 cp ${DEPLOY_DIR_IMAGE}/signed_*_imx8m.bin ${BOOT_STAGING}
97 cp ${DEPLOY_DIR_IMAGE}/u-boot-spl.bin-${MACHINE}-${UBOOT_CONFIG} ${BOOT_STAGING}/u-boot-spl.bin
98 cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${UBOOT_DTB_NAME} ${BOOT_STAGING}
99 cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/u-boot-nodtb.bin ${BOOT_STAGING}
100 cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/mkimage_uboot ${BOOT_STAGING}
101 cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${ATF_MACHINE_NAME} ${BOOT_STAGING}/bl31.bin
102 cp ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME} ${BOOT_STAGING}/u-boot.bin
103}
104compile_mx8() {
105 bbnote 8QM boot binary build
106 cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${SC_FIRMWARE_NAME} ${BOOT_STAGING}/scfw_tcm.bin
107 cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${ATF_MACHINE_NAME} ${BOOT_STAGING}/bl31.bin
108 cp ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME} ${BOOT_STAGING}/u-boot.bin
109 cp ${DEPLOY_DIR_IMAGE}/imx8qm_m4_0_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${BOOT_STAGING}/m40_tcm.bin
110 cp ${DEPLOY_DIR_IMAGE}/imx8qm_m4_1_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${BOOT_STAGING}/m41_tcm.bin
111 cp ${DEPLOY_DIR_IMAGE}/mx8qm-ahab-container.img ${BOOT_STAGING}
112}
113compile_mx8x() {
114 bbnote 8QX boot binary build
115 cp ${DEPLOY_DIR_IMAGE}/imx8qx_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${BOOT_STAGING}/m40_tcm.bin
116 cp ${DEPLOY_DIR_IMAGE}/imx8qx_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${BOOT_STAGING}/CM4.bin
117 cp ${DEPLOY_DIR_IMAGE}/mx8qx-ahab-container.img ${BOOT_STAGING}
118 cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${SC_FIRMWARE_NAME} ${BOOT_STAGING}/scfw_tcm.bin
119 cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${ATF_MACHINE_NAME} ${BOOT_STAGING}/bl31.bin
120 cp ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME} ${BOOT_STAGING}/u-boot.bin
121}
122do_compile() {
123 compile_${SOC_FAMILY}
124 # mkimage for i.MX8
125 for target in ${IMXBOOT_TARGETS}; do
126 bbnote "building ${SOC_TARGET} - ${target}"
127 make SOC=${SOC_TARGET} ${target}
128 if [ -e "${BOOT_STAGING}/flash.bin" ]; then
129 cp ${BOOT_STAGING}/flash.bin ${S}/${BOOT_CONFIG_MACHINE}-${target}
130 fi
131 done
132}
133
134do_install () {
135 install -d ${D}/boot
136 for target in ${IMXBOOT_TARGETS}; do
137 install -m 0644 ${S}/${BOOT_CONFIG_MACHINE}-${target} ${D}/boot/
138 done
139}
140
141deploy_mx8m() {
142 install -d ${DEPLOYDIR}/${BOOT_TOOLS}
143 install -m 0644 ${DEPLOY_DIR_IMAGE}/u-boot-spl.bin-${MACHINE}-${UBOOT_CONFIG} ${DEPLOYDIR}/${BOOT_TOOLS}
144 for ddr_firmware in ${DDR_FIRMWARE_NAME}; do
145 install -m 0644 ${DEPLOY_DIR_IMAGE}/${ddr_firmware} ${DEPLOYDIR}/${BOOT_TOOLS}
146 done
147 install -m 0644 ${DEPLOY_DIR_IMAGE}/signed_hdmi*.bin ${DEPLOYDIR}/${BOOT_TOOLS}
148 install -m 0755 ${BOOT_STAGING}/${TOOLS_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
149 install -m 0755 ${BOOT_STAGING}/mkimage_fit_atf.sh ${DEPLOYDIR}/${BOOT_TOOLS}
150}
151deploy_mx8() {
152 install -d ${DEPLOYDIR}/${BOOT_TOOLS}
153 install -m 0644 ${BOOT_STAGING}/${DCD_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
154 install -m 0644 ${BOOT_STAGING}/mx8qm-ahab-container.img ${DEPLOYDIR}/${BOOT_TOOLS}
155 install -m 0755 ${S}/${TOOLS_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
156}
157deploy_mx8x() {
158 install -d ${DEPLOYDIR}/${BOOT_TOOLS}
159 if [ "${MACHINE}" = "imx8qxpa0mek" ]; then
160 install -m 0644 ${BOOT_STAGING}/${DCD_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
161 fi
162 install -m 0644 ${BOOT_STAGING}/mx8qx-ahab-container.img ${DEPLOYDIR}/${BOOT_TOOLS}
163 install -m 0644 ${BOOT_STAGING}/m40_tcm.bin ${DEPLOYDIR}/${BOOT_TOOLS}
164 install -m 0644 ${BOOT_STAGING}/CM4.bin ${DEPLOYDIR}/${BOOT_TOOLS}
165 install -m 0755 ${S}/${TOOLS_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
166}
167do_deploy() {
168 deploy_${SOC_FAMILY}
169 # copy the tool mkimage to deploy path and sc fw, dcd and uboot
170 install -m 0644 ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
171 # copy makefile (soc.mak) for reference
172 install -m 0644 ${BOOT_STAGING}/soc.mak ${DEPLOYDIR}/${BOOT_TOOLS}
173 # copy the generated boot image to deploy path
174 for target in ${IMXBOOT_TARGETS}; do
175 # Use first "target" as IMAGE_IMXBOOT_TARGET
176 if [ "$IMAGE_IMXBOOT_TARGET" = "" ]; then
177 IMAGE_IMXBOOT_TARGET="$target"
178 echo "Set boot target as $IMAGE_IMXBOOT_TARGET"
179 fi
180 install -m 0644 ${S}/${BOOT_CONFIG_MACHINE}-${target} ${DEPLOYDIR}
181 done
182 cd ${DEPLOYDIR}
183 ln -sf ${BOOT_CONFIG_MACHINE}-${IMAGE_IMXBOOT_TARGET} ${BOOT_CONFIG_MACHINE}
184 cd -
185}
186addtask deploy before do_build after do_compile
187
188PACKAGE_ARCH = "${MACHINE_ARCH}"
189FILES_${PN} = "/boot"
190
191COMPATIBLE_MACHINE = "(mx8)"