diff options
author | Eric Bénard <eric@eukrea.com> | 2012-03-08 17:22:50 +0100 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2012-03-08 16:34:38 +0000 |
commit | 91a0d301c7aa4db826cf8cc342ea019506e05455 (patch) | |
tree | 82078c8c44b0da04f6fb2a4b68c1e907150aa851 /classes | |
parent | e0f6eddce82399a5cb64d8a0055a1c620b5928e4 (diff) | |
download | meta-fsl-arm-91a0d301c7aa4db826cf8cc342ea019506e05455.tar.gz |
bbsdcard-image: add new class
this class allows the generation of a ready to use SDCard image
using barebox bootloader.
example on how to use it (with angstrom distro) :
1- add these 3 lines to your local.conf :
ROOTFS = "${DEPLOY_DIR_IMAGE}/console-image-imx53qsb.ext3"
INHERIT += "bbsdcard_image"
BBSDIMG_SIZE = "512"
2- build the image
bitbake console-image
3- copy it to the sdcard (update device for you sdcard, take care to not erase your hard drive ;-)
sudo dd if=build/tmp-angstrom_2010_x-eglibc/deploy/images/imx53qsb/console-image-imx53qsb.bbsdimg of=/dev/mmcblk0
Signed-off-by: Eric Bénard <eric@eukrea.com>
Diffstat (limited to 'classes')
-rw-r--r-- | classes/bbsdcard_image.bbclass | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/classes/bbsdcard_image.bbclass b/classes/bbsdcard_image.bbclass new file mode 100644 index 0000000..18914d0 --- /dev/null +++ b/classes/bbsdcard_image.bbclass | |||
@@ -0,0 +1,37 @@ | |||
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 | } | ||