summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2011-12-18 18:02:31 +0000
committerOtavio Salvador <otavio@ossystems.com.br>2011-12-20 11:17:34 +0000
commit09486df491246aaf5fecdbfd3bad7a98d2a6a9ff (patch)
tree7012fe0fc4db38068ea600ea2de6e14cd1bd9ae1 /classes
parentff8cbd2f4a9e07951dcca8adf9363c33354d6767 (diff)
downloadmeta-fsl-arm-09486df491246aaf5fecdbfd3bad7a98d2a6a9ff.tar.gz
sdcard_image.bbclass: allow for easy creating of SD card image
This creates an image suitable for writting onto a SD card and use on i.MX53 boards allowing for easy image testing. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'classes')
-rw-r--r--classes/sdcard_image.bbclass38
1 files changed, 38 insertions, 0 deletions
diff --git a/classes/sdcard_image.bbclass b/classes/sdcard_image.bbclass
new file mode 100644
index 0000000..5887240
--- /dev/null
+++ b/classes/sdcard_image.bbclass
@@ -0,0 +1,38 @@
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
7inherit image
8
9# Add the fstypes we need
10IMAGE_FSTYPES += "sdimg"
11
12# Ensure required utilities are present
13IMAGE_DEPENDS_sdimg = "parted-native"
14
15# Default to 3.4GiB images
16SDIMG_SIZE ?= "3400"
17
18# Addional space for boot partition
19BOOT_SPACE ?= "10M"
20
21IMAGE_CMD_sdimg () {
22 TMP=${WORKDIR}/tmp
23 SDIMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.sdimg
24
25 dd if=/dev/zero of=${SDIMG} bs=$(expr 1000 \* 1000) count=${SDIMG_SIZE}
26
27 # Create partition table
28 parted -s ${SDIMG} mklabel msdos
29 parted -s ${SDIMG} mkpart primary ${BOOT_SPACE} 100%
30 parted ${SDIMG} print
31
32 dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512
33 dd if=${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=1M
34 dd if=${ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=${BOOT_SPACE}
35
36 cd ${DEPLOY_DIR_IMAGE}
37 ln -sf ${IMAGE_NAME}.sdimg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.sdimg
38}