diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2012-03-17 20:13:06 +0000 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2012-03-21 17:17:16 +0000 |
commit | 86134fd884f419f1bef7f49bbd296a0ae4f5a94b (patch) | |
tree | 0410999824e432fc3d2f4a279910021747990295 /classes | |
parent | cb5755268d2bbe26ed09c7a669535b35dda6194b (diff) | |
download | meta-fsl-arm-86134fd884f419f1bef7f49bbd296a0ae4f5a94b.tar.gz |
sdcard_image.bbclass: add support to choose the bootloader to use
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>
Diffstat (limited to 'classes')
-rw-r--r-- | classes/bbsdcard_image.bbclass | 37 | ||||
-rw-r--r-- | classes/sdcard_image.bbclass | 27 |
2 files changed, 22 insertions, 42 deletions
diff --git a/classes/bbsdcard_image.bbclass b/classes/bbsdcard_image.bbclass deleted file mode 100644 index 18914d0..0000000 --- a/classes/bbsdcard_image.bbclass +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | # | ||
2 | # Create an image that can by written onto a SD card using dd. | ||
3 | # | ||
4 | # External variables needed: | ||
5 | # ${ROOTFS} - the rootfs image to incorporate | ||
6 | |||
7 | # Add the fstypes we need | ||
8 | IMAGE_FSTYPES += "bbsdimg" | ||
9 | |||
10 | # Ensure required utilities are present | ||
11 | IMAGE_DEPENDS_bbsdimg = "parted-native virtual/kernel barebox" | ||
12 | |||
13 | # Default to 2GiB images | ||
14 | BBSDIMG_SIZE ?= "2000" | ||
15 | |||
16 | # Addional space for boot partition | ||
17 | BOOT_SPACE ?= "5M" | ||
18 | |||
19 | IMAGE_CMD_bbsdimg () { | ||
20 | TMP=${WORKDIR}/tmp | ||
21 | SDIMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.bbsdimg | ||
22 | |||
23 | if [ -f ${SDIMG} ]; then | ||
24 | rm ${SDIMG} | ||
25 | fi | ||
26 | dd if=/dev/zero of=${SDIMG} bs=$(expr 1000 \* 1000) count=${BBSDIMG_SIZE} | ||
27 | |||
28 | # Create partition table | ||
29 | parted -s ${SDIMG} mklabel msdos | ||
30 | parted -s ${SDIMG} mkpart primary ${BOOT_SPACE} 100% | ||
31 | parted ${SDIMG} print | ||
32 | |||
33 | dd if=${DEPLOY_DIR_IMAGE}/barebox-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512 | ||
34 | dd if=${DEPLOY_DIR_IMAGE}/bareboxenv-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=512k | ||
35 | dd if=${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=1M | ||
36 | dd if=${ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=${BOOT_SPACE} | ||
37 | } | ||
diff --git a/classes/sdcard_image.bbclass b/classes/sdcard_image.bbclass index 5887240..96f7080 100644 --- a/classes/sdcard_image.bbclass +++ b/classes/sdcard_image.bbclass | |||
@@ -3,15 +3,19 @@ | |||
3 | # | 3 | # |
4 | # External variables needed: | 4 | # External variables needed: |
5 | # ${ROOTFS} - the rootfs image to incorporate | 5 | # ${ROOTFS} - the rootfs image to incorporate |
6 | # ${IMAGE_BOOTLOADER} - bootloader to use {u-boot, barebox}x | ||
6 | 7 | ||
7 | inherit image | 8 | inherit image |
8 | 9 | ||
10 | IMAGE_BOOTLOADER ?= "u-boot" | ||
11 | |||
12 | do_rootfs[depends] += "parted-native:do_populate_sysroot \ | ||
13 | virtual/kernel:do_deploy \ | ||
14 | ${IMAGE_BOOTLOADER}:do_deploy" | ||
15 | |||
9 | # Add the fstypes we need | 16 | # Add the fstypes we need |
10 | IMAGE_FSTYPES += "sdimg" | 17 | IMAGE_FSTYPES += "sdimg" |
11 | 18 | ||
12 | # Ensure required utilities are present | ||
13 | IMAGE_DEPENDS_sdimg = "parted-native" | ||
14 | |||
15 | # Default to 3.4GiB images | 19 | # Default to 3.4GiB images |
16 | SDIMG_SIZE ?= "3400" | 20 | SDIMG_SIZE ?= "3400" |
17 | 21 | ||
@@ -29,8 +33,21 @@ IMAGE_CMD_sdimg () { | |||
29 | parted -s ${SDIMG} mkpart primary ${BOOT_SPACE} 100% | 33 | parted -s ${SDIMG} mkpart primary ${BOOT_SPACE} 100% |
30 | parted ${SDIMG} print | 34 | parted ${SDIMG} print |
31 | 35 | ||
32 | dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512 | 36 | case "${IMAGE_BOOTLOADER}" in |
33 | dd if=${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=1M | 37 | u-boot) |
38 | dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512 | ||
39 | dd if=${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=1M | ||
40 | ;; | ||
41 | barebox) | ||
42 | dd if=${DEPLOY_DIR_IMAGE}/barebox-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512 | ||
43 | dd if=${DEPLOY_DIR_IMAGE}/bareboxenv-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=512k | ||
44 | ;; | ||
45 | *) | ||
46 | bberror "Unkown IMAGE_BOOTLOADER value" | ||
47 | exit 1 | ||
48 | ;; | ||
49 | esac | ||
50 | |||
34 | dd if=${ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=${BOOT_SPACE} | 51 | dd if=${ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=${BOOT_SPACE} |
35 | 52 | ||
36 | cd ${DEPLOY_DIR_IMAGE} | 53 | cd ${DEPLOY_DIR_IMAGE} |