[meta-freescale] [PATCH 3/4] cubox-i: add machine config and new image type

Carlos Rafael Giani dv at pseudoterminal.org
Wed Jan 22 08:45:33 PST 2014


The new cubox-i machine config produces images that can be used for
all CuBox-i and HummingBoard devices (u-boot SPL autodetects the platform)

The new image type is based on image_types_fsl and is necessary because
the SPL u-boot build is made up of two blobs (SPL and u-boot.img) instead
of one (u-boot.imx)

Signed-off-by: Carlos Rafael Giani <dv at pseudoterminal.org>
---
 classes/image_types_cubox-i.bbclass | 34 ++++++++++++++++++++++++++++++++++
 conf/machine/cubox-i.conf           | 25 +++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 classes/image_types_cubox-i.bbclass
 create mode 100644 conf/machine/cubox-i.conf

diff --git a/classes/image_types_cubox-i.bbclass b/classes/image_types_cubox-i.bbclass
new file mode 100644
index 0000000..70d16a3
--- /dev/null
+++ b/classes/image_types_cubox-i.bbclass
@@ -0,0 +1,34 @@
+inherit image_types_fsl
+
+SDCARD_GENERATION_COMMAND_cubox-i = "generate_imx_sdcard_cuboxi"
+
+generate_imx_sdcard_cuboxi() {
+	# Create partition table
+	parted -s ${SDCARD} mklabel msdos
+	parted -s ${SDCARD} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED})
+	parted -s ${SDCARD} unit KiB mkpart primary $(expr  ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} \+ $ROOTFS_SIZE)
+	parted ${SDCARD} print
+
+	# Burn bootloader
+	dd if=${DEPLOY_DIR_IMAGE}/${SPL_FILENAME} of=${SDCARD} conv=notrunc seek=2 bs=512
+	dd if=${DEPLOY_DIR_IMAGE}/u-boot.img of=${SDCARD} conv=notrunc seek=42 bs=1K
+
+	# Create boot partition image
+	BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDCARD} unit b print \
+	                  | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 1024 }')
+	mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
+	mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin ::/${KERNEL_IMAGETYPE}
+
+	# Copy boot scripts
+	for item in ${BOOT_SCRIPTS}; do
+		src=`echo $item | awk -F':' '{ print $1 }'`
+		dst=`echo $item | awk -F':' '{ print $2 }'`
+
+		mcopy -i ${WORKDIR}/boot.img -s $src ::/$dst
+	done
+
+	# Burn Partition
+	dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
+	dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc seek=1 bs=$(expr ${BOOT_SPACE_ALIGNED} \* 1024 + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
+}
+
diff --git a/conf/machine/cubox-i.conf b/conf/machine/cubox-i.conf
new file mode 100644
index 0000000..dc5aeba
--- /dev/null
+++ b/conf/machine/cubox-i.conf
@@ -0,0 +1,25 @@
+# machine config for the SolidRun CuBox-i series
+# this also includes the SolidRun HummingBoard devices
+
+require conf/machine/include/imx6sabresd-common.inc
+
+SOC_FAMILY = "mx6:mx6s"
+
+PREFERRED_PROVIDER_u-boot = "u-boot-cubox-i"
+
+PREFERRED_VERSION_linux-imx = "3.0.35"
+PREFERRED_PROVIDER_virtual/kernel = "linux-imx"
+
+UBOOT_MAKE_TARGET = ""
+UBOOT_SUFFIX = "img"
+UBOOT_CONFIG ??= "sd"
+UBOOT_CONFIG[sd] = "mx6_cubox-i_config,sdcard"
+UBOOT_ENTRYPOINT = "0x10800000"
+
+UENV_FILENAME = "uEnv-cubox-i.txt"
+SPL_FILENAME = "SPL-cubox-i"
+
+BOOT_SCRIPTS = "${UENV_FILENAME}:uEnv.txt"
+
+IMAGE_CLASSES += "image_types_cubox-i"
+
-- 
1.8.3.2



More information about the meta-freescale mailing list