Patchwork [meta-fsl-arm,PATCHv2,3/3] image_types_fsl: mxs: Add support for a barebox bootstream

login
register
mail settings
Submitter Alexandre Belloni
Date Aug. 23, 2013, 4:04 p.m.
Message ID <1377273842-7052-4-git-send-email-alexandre.belloni@free-electrons.com>
Download mbox | patch
Permalink /patch/56415/
State Changes Requested
Delegated to: Otavio Salvador
Headers show

Comments

Alexandre Belloni - Aug. 23, 2013, 4:04 p.m.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 classes/image_types_fsl.bbclass | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
Otavio Salvador - Aug. 24, 2013, 6:21 p.m.
On Fri, Aug 23, 2013 at 1:04 PM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

This is ready to apply when the barebox update it done.

Patch

diff --git a/classes/image_types_fsl.bbclass b/classes/image_types_fsl.bbclass
index 1868c41..6f63402 100644
--- a/classes/image_types_fsl.bbclass
+++ b/classes/image_types_fsl.bbclass
@@ -36,6 +36,16 @@  IMAGE_CMD_linux.sb () {
 	rm -f $kernel_bin-dtb
 }
 
+# IMX Bootlets barebox bootstream
+IMAGE_DEPENDS_barebox.mxsboot-sdcard = "elftosb-native u-boot-mxsboot-native imx-bootlets barebox"
+IMAGE_CMD_barebox.mxsboot-sdcard () {
+	barebox_bd_file=imx-bootlets-barebox_ivt.bd-${MACHINE}
+
+	# Ensure the files are generated
+	rm -f ${IMAGE_NAME}.barebox.sb ${IMAGE_NAME}.barebox.mxsboot-sdcard
+	elftosb -f mx28 -z -c $barebox_bd_file -o ${IMAGE_NAME}.barebox.sb
+	mxsboot sd ${IMAGE_NAME}.barebox.sb ${IMAGE_NAME}.barebox.mxsboot-sdcard
+}
 
 # U-Boot mxsboot generation to SD-Card
 UBOOT_SUFFIX_SDCARD_mxs ?= "mxsboot-sdcard"
@@ -49,6 +59,9 @@  BOOTDD_VOLUME_ID ?= "Boot ${MACHINE}"
 # Boot partition size [in KiB]
 BOOT_SPACE ?= "8192"
 
+# Barebox environment size [in KiB]
+BAREBOX_ENV_SPACE ?= "512"
+
 # Set alignment to 4MB [in KiB]
 IMAGE_ROOTFS_ALIGNMENT = "4096"
 
@@ -238,6 +251,15 @@  generate_mxs_sdcard () {
 
 		dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=2 bs=$(expr 1024 \* 1024)
 		;;
+		barebox)
+		# BAREBOX_ENV_SPACE is taken on BOOT_SPACE_ALIGNED but it doesn't really matter as long as the rootfs is aligned
+		parted -s ${SDCARD} unit KiB mkpart primary 1024 $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} - ${BAREBOX_ENV_SPACE})
+		parted -s ${SDCARD} unit KiB mkpart primary $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} - ${BAREBOX_ENV_SPACE}) $(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)
+
+		dd if=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.barebox.mxsboot-sdcard of=${SDCARD} conv=notrunc seek=1 bs=$(expr 1024 \* 1024)
+		dd if=${DEPLOY_DIR_IMAGE}/bareboxenv-${MACHINE}.bin of=${SDCARD} conv=notrunc seek=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} - ${BAREBOX_ENV_SPACE}) bs=1024
+		;;
 		*)
 		bberror "Unkown IMAGE_BOOTLOADER value"
 		exit 1