summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorPaul Barker <paul@paulbarker.me.uk>2013-09-02 21:11:49 +0100
committerAndrei Gherzan <andrei@gherzan.ro>2013-11-12 17:17:46 +0200
commit164e87c29133b58450e218c596ebd3a9d2bace5e (patch)
treefa7ca0cdddcf65077131cc05e9ef1f0226a89705 /classes
parentc52d4b3da1e755f3fa9bd4cf2d1629a8015530f9 (diff)
downloadmeta-raspberrypi-164e87c29133b58450e218c596ebd3a9d2bace5e.tar.gz
sdcard_image-rpi.bbclass: Allow optional compression
Image files will typically contain lots of null blocks and should compress well. This will help with distribution of images over slow network links. Change-Id: Icec7454ff61cd81a2872037037a93ce01191ece5 Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
Diffstat (limited to 'classes')
-rw-r--r--classes/sdcard_image-rpi.bbclass20
1 files changed, 20 insertions, 0 deletions
diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass
index a2fcd52..3ee4e94 100644
--- a/classes/sdcard_image-rpi.bbclass
+++ b/classes/sdcard_image-rpi.bbclass
@@ -50,6 +50,13 @@ IMAGE_DEPENDS_rpi-sdimg = " \
50# SD card image name 50# SD card image name
51SDIMG = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg" 51SDIMG = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg"
52 52
53# Compression method to apply to SDIMG after it has been created. Supported
54# compression formats are "gzip", "bzip2" or "xz". The original .rpi-sdimg file
55# is kept and a new compressed file is created if one of these compression
56# formats is chosen. If SDIMG_COMPRESSION is set to any other value it is
57# silently ignored.
58#SDIMG_COMPRESSION ?= ""
59
53# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS. 60# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
54FATPAYLOAD ?= "" 61FATPAYLOAD ?= ""
55 62
@@ -107,6 +114,19 @@ IMAGE_CMD_rpi-sdimg () {
107 else 114 else
108 dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync 115 dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
109 fi 116 fi
117
118 # Optionally apply compression
119 case "${SDIMG_COMPRESSION}" in
120 "gzip")
121 gzip -k9 "${SDIMG}"
122 ;;
123 "bzip2")
124 bzip2 -k9 "${SDIMG}"
125 ;;
126 "xz")
127 xz -k "${SDIMG}"
128 ;;
129 esac
110} 130}
111 131
112ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " 132ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; "