]> code.ossystems Code Review - meta-freescale.git/commitdiff
sdcard_image.bbclass: add support to choose the bootloader to use
authorOtavio Salvador <otavio@ossystems.com.br>
Sat, 17 Mar 2012 20:13:06 +0000 (20:13 +0000)
committerOtavio Salvador <otavio@ossystems.com.br>
Wed, 21 Mar 2012 17:17:16 +0000 (17:17 +0000)
The IMAGE_BOOTLOADER variable allows to specific the bootloader to be
used. Currently it supports 'u-boot' and 'barebox' as option. Images
using the bbsdcard_image.bbclass need to change the image definition
to adapt to this.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
meta-fsl-arm/classes/bbsdcard_image.bbclass [deleted file]
meta-fsl-arm/classes/sdcard_image.bbclass

diff --git a/meta-fsl-arm/classes/bbsdcard_image.bbclass b/meta-fsl-arm/classes/bbsdcard_image.bbclass
deleted file mode 100644 (file)
index 18914d0..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Create an image that can by written onto a SD card using dd.
-#
-# External variables needed:
-#   ${ROOTFS} - the rootfs image to incorporate
-
-# Add the fstypes we need
-IMAGE_FSTYPES += "bbsdimg"
-
-# Ensure required utilities are present
-IMAGE_DEPENDS_bbsdimg = "parted-native virtual/kernel barebox"
-
-# Default to 2GiB images
-BBSDIMG_SIZE ?= "2000"
-
-# Addional space for boot partition
-BOOT_SPACE ?= "5M"
-
-IMAGE_CMD_bbsdimg () {
-       TMP=${WORKDIR}/tmp
-       SDIMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.bbsdimg
-
-       if [ -f ${SDIMG} ]; then
-               rm ${SDIMG}
-       fi
-       dd if=/dev/zero of=${SDIMG} bs=$(expr 1000 \* 1000) count=${BBSDIMG_SIZE}
-
-       # Create partition table
-       parted -s ${SDIMG} mklabel msdos
-       parted -s ${SDIMG} mkpart primary ${BOOT_SPACE} 100%
-       parted ${SDIMG} print
-
-       dd if=${DEPLOY_DIR_IMAGE}/barebox-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512
-       dd if=${DEPLOY_DIR_IMAGE}/bareboxenv-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=512k
-       dd if=${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=1M
-       dd if=${ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=${BOOT_SPACE}
-}
index 5887240ae4a6c2d8896aed875795da02c5abef53..96f70808a2fa2d712f50d37ba33110455e086cc8 100644 (file)
@@ -3,15 +3,19 @@
 #
 # External variables needed:
 #   ${ROOTFS} - the rootfs image to incorporate
+#   ${IMAGE_BOOTLOADER} - bootloader to use {u-boot, barebox}x
 
 inherit image
 
+IMAGE_BOOTLOADER ?= "u-boot"
+
+do_rootfs[depends] += "parted-native:do_populate_sysroot \
+                       virtual/kernel:do_deploy \
+                       ${IMAGE_BOOTLOADER}:do_deploy"
+
 # Add the fstypes we need
 IMAGE_FSTYPES += "sdimg"
 
-# Ensure required utilities are present
-IMAGE_DEPENDS_sdimg = "parted-native"
-
 # Default to 3.4GiB images
 SDIMG_SIZE ?= "3400"
 
@@ -29,8 +33,21 @@ IMAGE_CMD_sdimg () {
        parted -s ${SDIMG} mkpart primary ${BOOT_SPACE} 100%
        parted ${SDIMG} print
 
-       dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512
-       dd if=${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=1M
+       case "${IMAGE_BOOTLOADER}" in
+               u-boot)
+               dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512
+               dd if=${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=1M
+               ;;
+               barebox)
+               dd if=${DEPLOY_DIR_IMAGE}/barebox-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512
+               dd if=${DEPLOY_DIR_IMAGE}/bareboxenv-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=512k
+               ;;
+               *)
+               bberror "Unkown IMAGE_BOOTLOADER value"
+               exit 1
+               ;;
+       esac
+
        dd if=${ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=${BOOT_SPACE}
 
        cd ${DEPLOY_DIR_IMAGE}