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>
This commit is contained in:
Paul Barker 2013-09-02 21:11:49 +01:00 committed by Andrei Gherzan
parent c52d4b3da1
commit 164e87c291
2 changed files with 22 additions and 0 deletions

2
README
View File

@ -112,6 +112,8 @@ How to use it:
IMAGE_FSTYPES = "tar.bz2 ext3.xz rpi-sdimg.xz IMAGE_FSTYPES = "tar.bz2 ext3.xz rpi-sdimg.xz
2. Overwrite SDIMG_ROOTFS_TYPE in local.conf 2. Overwrite SDIMG_ROOTFS_TYPE in local.conf
SDIMG_ROOTFS_TYPE = "ext3.xz" SDIMG_ROOTFS_TYPE = "ext3.xz"
3. Overwrite SDIMG_COMPRESSION in local.conf
SDIMG_COMPRESSION = "xz"
*Accommodate the values above to your own needs (ex: ext3 / ext4). *Accommodate the values above to your own needs (ex: ext3 / ext4).
2.B. Optional - GPU memory: 2.B. Optional - GPU memory:

View File

@ -50,6 +50,13 @@ IMAGE_DEPENDS_rpi-sdimg = " \
# SD card image name # SD card image name
SDIMG = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg" SDIMG = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg"
# Compression method to apply to SDIMG after it has been created. Supported
# compression formats are "gzip", "bzip2" or "xz". The original .rpi-sdimg file
# is kept and a new compressed file is created if one of these compression
# formats is chosen. If SDIMG_COMPRESSION is set to any other value it is
# silently ignored.
#SDIMG_COMPRESSION ?= ""
# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS. # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
FATPAYLOAD ?= "" FATPAYLOAD ?= ""
@ -107,6 +114,19 @@ IMAGE_CMD_rpi-sdimg () {
else else
dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
fi fi
# Optionally apply compression
case "${SDIMG_COMPRESSION}" in
"gzip")
gzip -k9 "${SDIMG}"
;;
"bzip2")
bzip2 -k9 "${SDIMG}"
;;
"xz")
xz -k "${SDIMG}"
;;
esac
} }
ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; "