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

login
register
mail settings
Submitter Alexandre Belloni
Date Aug. 22, 2013, 2:42 p.m.
Message ID <1377182527-5041-1-git-send-email-alexandre.belloni@free-electrons.com>
Download mbox | patch
Permalink /patch/56267/
State Changes Requested
Delegated to: Otavio Salvador
Headers show

Comments

Alexandre Belloni - Aug. 22, 2013, 2:42 p.m.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 classes/image_types_fsl.bbclass | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
Otavio Salvador - Aug. 22, 2013, 5:02 p.m.
On Thu, Aug 22, 2013 at 11:42 AM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  classes/image_types_fsl.bbclass | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/classes/image_types_fsl.bbclass b/classes/image_types_fsl.bbclass
> index 1868c41..7048f06 100644
> --- a/classes/image_types_fsl.bbclass
> +++ b/classes/image_types_fsl.bbclass
> @@ -36,6 +36,18 @@ IMAGE_CMD_linux.sb () {
>         rm -f $kernel_bin-dtb
>  }
>
> +# IMX Bootlets barebox bootstream
> +IMAGE_DEPENDS_barebox.sb = "elftosb-native mx28-bcb-native imx-bootlets barebox"
> +IMAGE_LINK_NAME_barebox.sb = ""
> +IMAGE_CMD_barebox.sb () {
> +       barebox_bd_file=imx-bootlets-barebox_ivt.bd-${MACHINE}
> +
> +       # Ensure the file is generated
> +       rm -f ${IMAGE_NAME}.barebox.sb
> +       elftosb -f mx28 -z -c $barebox_bd_file -o ${IMAGE_NAME}.barebox.sb
> +}
> +
> +

Drop one of new lines.

Patch

diff --git a/classes/image_types_fsl.bbclass b/classes/image_types_fsl.bbclass
index 1868c41..7048f06 100644
--- a/classes/image_types_fsl.bbclass
+++ b/classes/image_types_fsl.bbclass
@@ -36,6 +36,18 @@  IMAGE_CMD_linux.sb () {
 	rm -f $kernel_bin-dtb
 }
 
+# IMX Bootlets barebox bootstream
+IMAGE_DEPENDS_barebox.sb = "elftosb-native mx28-bcb-native imx-bootlets barebox"
+IMAGE_LINK_NAME_barebox.sb = ""
+IMAGE_CMD_barebox.sb () {
+	barebox_bd_file=imx-bootlets-barebox_ivt.bd-${MACHINE}
+
+	# Ensure the file is generated
+	rm -f ${IMAGE_NAME}.barebox.sb
+	elftosb -f mx28 -z -c $barebox_bd_file -o ${IMAGE_NAME}.barebox.sb
+}
+
+
 
 # U-Boot mxsboot generation to SD-Card
 UBOOT_SUFFIX_SDCARD_mxs ?= "mxsboot-sdcard"
@@ -49,6 +61,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 +253,14 @@  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)
+
+		mx28_bcb.py --bootstream ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.barebox.sb --start 2048 ${SDCARD}
+		;;
 		*)
 		bberror "Unkown IMAGE_BOOTLOADER value"
 		exit 1