[PATCH] imx-boot: split out common variables to a bbclass


liu.ming50@...
 

From: Ming Liu <liu.ming50@...>

The variables defined in imx-boot recipe are sort of so related to
machine deployment, sometimes we need access these variables in other
recipes like image bbclass during machine files deployment. So we would
like to split them out into a common bbclass, then other recipes could
simplily inherit it to avoid redundantly redefine them.

Signed-off-by: Ming Liu <liu.ming50@...>
---
classes/imx-boot-common.bbclass | 39 ++++++++++++++++++++++++++++
recipes-bsp/imx-mkimage/imx-boot_0.2.bb | 40 +++--------------------------
recipes-bsp/imx-mkimage/imx-mkimage_git.inc | 1 -
3 files changed, 42 insertions(+), 38 deletions(-)
create mode 100644 classes/imx-boot-common.bbclass

diff --git a/classes/imx-boot-common.bbclass b/classes/imx-boot-common.bbclass
new file mode 100644
index 0000000..7116bfe
--- /dev/null
+++ b/classes/imx-boot-common.bbclass
@@ -0,0 +1,39 @@
+# IMX boot common variables
+
+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"
+
+BOOT_NAME = "imx-boot"
+
+SC_FIRMWARE_NAME ?= "scfw_tcm.bin"
+SECO_FIRMWARE_NAME ?= "mx8qm-ahab-container.img"
+
+ATF_MACHINE_NAME ?= "bl31-imx8qm.bin"
+ATF_MACHINE_NAME_mx8qm = "bl31-imx8qm.bin"
+ATF_MACHINE_NAME_mx8qxp = "bl31-imx8qx.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)}"
+
+UBOOT_NAME = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}"
+BOOT_CONFIG_MACHINE = "${BOOT_NAME}-${MACHINE}-${UBOOT_CONFIG}.bin"
+
+BOOT_TOOLS ?= "imx-boot-tools"
+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 flash_dcd', d), d)}"
+
+SOC_FAMILY = "INVALID"
+SOC_FAMILY_mx8 = "mx8"
+SOC_FAMILY_mx8m = "mx8m"
+SOC_FAMILY_mx8x = "mx8x"
diff --git a/recipes-bsp/imx-mkimage/imx-boot_0.2.bb b/recipes-bsp/imx-mkimage/imx-boot_0.2.bb
index a4c9263..3cc1c33 100644
--- a/recipes-bsp/imx-mkimage/imx-boot_0.2.bb
+++ b/recipes-bsp/imx-mkimage/imx-boot_0.2.bb
@@ -7,19 +7,15 @@ 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 += " \
firmware-imx \
${IMX_EXTRA_FIRMWARE} \
imx-atf \
"
DEPENDS_append_mx8m = " dtc-native"
-BOOT_NAME = "imx-boot"
PROVIDES = "${BOOT_NAME}"

-inherit deploy
+inherit deploy imx-boot-common

# Add CFLAGS with native INCDIR & LIBDIR for imx-mkimage build
CFLAGS = "-O2 -Wall -std=c99 -I ${STAGING_INCDIR_NATIVE} -L ${STAGING_LIBDIR_NATIVE}"
@@ -32,39 +28,9 @@ do_compile[depends] += " \
imx-atf:do_deploy \
"

-SC_FIRMWARE_NAME ?= "scfw_tcm.bin"
-
-ATF_MACHINE_NAME ?= "bl31-imx8qm.bin"
-ATF_MACHINE_NAME_mx8qm = "bl31-imx8qm.bin"
-ATF_MACHINE_NAME_mx8qxp = "bl31-imx8qx.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)}"
-
-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 flash_dcd', 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
@@ -87,7 +53,7 @@ compile_mx8() {
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}/mx8qm-ahab-container.img ${BOOT_STAGING}
+ cp ${DEPLOY_DIR_IMAGE}/${SECO_FIRMWARE_NAME} ${BOOT_STAGING}
}
compile_mx8x() {
bbnote 8QX boot binary build
@@ -129,7 +95,7 @@ deploy_mx8m() {
}
deploy_mx8() {
install -d ${DEPLOYDIR}/${BOOT_TOOLS}
- install -m 0644 ${BOOT_STAGING}/mx8qm-ahab-container.img ${DEPLOYDIR}/${BOOT_TOOLS}
+ install -m 0644 ${BOOT_STAGING}/${SECO_FIRMWARE_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
install -m 0755 ${S}/${TOOLS_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
}
deploy_mx8x() {
diff --git a/recipes-bsp/imx-mkimage/imx-mkimage_git.inc b/recipes-bsp/imx-mkimage/imx-mkimage_git.inc
index ab354f9..6eb87a7 100644
--- a/recipes-bsp/imx-mkimage/imx-mkimage_git.inc
+++ b/recipes-bsp/imx-mkimage/imx-mkimage_git.inc
@@ -7,5 +7,4 @@ SRC_URI = "git://source.codeaurora.org/external/imx/imx-mkimage.git;protocol=htt
SRCREV = "dd0234001713623c79be92b60fa88bc07b07f24f"
S = "${WORKDIR}/git"

-BOOT_TOOLS = "imx-boot-tools"
SYSROOT_DIRS += "/boot"
--
2.7.4

Join meta-freescale@lists.yoctoproject.org to automatically receive all group messages.