diff options
author | Paul Barker <paul@paulbarker.me.uk> | 2013-09-02 21:11:49 +0100 |
---|---|---|
committer | Andrei Gherzan <andrei@gherzan.ro> | 2013-11-12 17:17:46 +0200 |
commit | 164e87c29133b58450e218c596ebd3a9d2bace5e (patch) | |
tree | fa7ca0cdddcf65077131cc05e9ef1f0226a89705 | |
parent | c52d4b3da1e755f3fa9bd4cf2d1629a8015530f9 (diff) | |
download | meta-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>
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | classes/sdcard_image-rpi.bbclass | 20 |
2 files changed, 22 insertions, 0 deletions
@@ -112,6 +112,8 @@ How to use it: | |||
112 | IMAGE_FSTYPES = "tar.bz2 ext3.xz rpi-sdimg.xz | 112 | IMAGE_FSTYPES = "tar.bz2 ext3.xz rpi-sdimg.xz |
113 | 2. Overwrite SDIMG_ROOTFS_TYPE in local.conf | 113 | 2. Overwrite SDIMG_ROOTFS_TYPE in local.conf |
114 | SDIMG_ROOTFS_TYPE = "ext3.xz" | 114 | SDIMG_ROOTFS_TYPE = "ext3.xz" |
115 | 3. Overwrite SDIMG_COMPRESSION in local.conf | ||
116 | SDIMG_COMPRESSION = "xz" | ||
115 | *Accommodate the values above to your own needs (ex: ext3 / ext4). | 117 | *Accommodate the values above to your own needs (ex: ext3 / ext4). |
116 | 118 | ||
117 | 2.B. Optional - GPU memory: | 119 | 2.B. Optional - GPU memory: |
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 |
51 | SDIMG = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg" | 51 | SDIMG = "${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. |
54 | FATPAYLOAD ?= "" | 61 | FATPAYLOAD ?= "" |
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 | ||
112 | ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " | 132 | ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " |