Skip to contentSkip to conversation

bootimage.bbclass, zisofs-tools-native: add ability to compress ISO images

PATCH Superseded Jason Wessel 2 participants 3 messages Sep 11, 2013 – Sep 12, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bootimage.bbclass, zisofs-tools-native: add ability to compress ISO images

The mkzftree is needed to allow ISO images to be compressed with minimal runtime overhead. Below is an example of the savings on a core-image-minimal.

Before ls -l:
24117248 core-image-minimal-qemux86-64.iso

Using the mkzftree ls -l:
16777216 core-image-minimal-qemux86-64.iso

---
 meta/classes/bootimg.bbclass                       |   21 ++++++++++++++--
 .../zisofs-tools/zisofs-tools-native_1.0.8.bb      |   26 ++++++++++++++++++++
 2 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb
meta/classes/bootimg.bbclass +19 -2
index 90a241d..b312e0d 100644
@@ -19,19 +19,23 @@
 
 # External variables (also used by syslinux.bbclass)
 # ${INITRD} - indicates a filesystem image to use as an initrd (optional)
+# ${COMPRESSISO}
 # ${NOISO}  - skip building the ISO image if set to 1
 # ${NOHDD}  - skip building the HDD image if set to 1
 # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
 
+COMPRESSISO ?= ""
 do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
                         mtools-native:do_populate_sysroot \
-                        cdrtools-native:do_populate_sysroot"
+                        cdrtools-native:do_populate_sysroot \
+                        ${@oe.utils.ifelse(d.getVar('COMPRESSISO'),'zisofs-tools-native:do_populate_sysroot','')}"
 
 PACKAGES = " "
 EXCLUDE_FROM_WORLD = "1"
 
 HDDDIR = "${S}/hddimg"
 ISODIR = "${S}/iso"
+COMPACT_ISODIR = "${S}/iso.z"
 
 BOOTIMG_VOLUME_ID   ?= "boot"
 BOOTIMG_EXTRA_SPACE ?= "512"
@@ -92,10 +96,23 @@ build_iso() {
 		grubefi_iso_populate
 	fi
 
+	if [ "${COMPRESSISO}" = "1" ] ; then
+		# create compact directory, compress iso
+		mkdir -p ${COMPACT_ISODIR}
+		mkzftree -z 9 -p 4 -F ${ISODIR}/rootfs.img ${COMPACT_ISODIR}/rootfs.img
+
+		# move compact iso to iso, then remove compact directory
+		mv ${COMPACT_ISODIR}/rootfs.img ${ISODIR}/rootfs.img
+		rm -Rf ${COMPACT_ISODIR}
+		mkisofs_opts="-r"
+	else
+		mkisofs_opts="-R -z -D -l"
+	fi
+
 	if [ "${PCBIOS}" = "1" ]; then
 		mkisofs -V ${BOOTIMG_VOLUME_ID} \
 		        -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
-			-b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \
+			-b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} $mkisofs_opts \
 			${MKISOFS_OPTIONS} ${ISODIR}
 	else
 		bbnote "EFI-only ISO images are untested, please provide feedback."
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +26 -0
new file mode 100644
index 0000000..b590854
@@ -0,0 +1,26 @@
+# zisofs-tools-native OE build file
+# Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+SUMMARY = "A set of tools for iso file compression"
+DESCRIPTION = "A set of tools for iso file compression"
+HOMEPAGE = "http://http://freecode.com/projects/zisofs-tools"
+SECTION = "console/utils"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+PR = "r0"
+
+SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/zisofs-tools/zisofs-tools-${PV}.tar.bz2/2d0ed8c9a1f60b45f949b136f9be1f6c/zisofs-tools-${PV}.tar.bz2"
+
+SRC_URI[md5sum] = "2d0ed8c9a1f60b45f949b136f9be1f6c"
+SRC_URI[sha256sum] = "ae4e53e4914934d41660248fb59d3c8761f1f1fd180d5ec993c17ddb3afd04f3"
+
+inherit native
+
+STAGE_TEMP = "${WORKDIR}/image-temp"
+
+do_install() {
+	install -d ${STAGE_TEMP}
+	make install INSTALLROOT=${STAGE_TEMP}
+
+	install -d ${D}${bindir}/
+	install ${STAGE_TEMP}/usr/bin/* ${D}${bindir}/
+}
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 7 lines · Jason Wessel

The mkzftree is needed to allow ISO images to be compressed with minimal runtime overhead. Below is an example of the savings on a core-image-minimal.

Before ls -l:
24117248 core-image-minimal-qemux86-64.iso

Quoted 6 lines

Using the mkzftree ls -l:
16777216 core-image-minimal-qemux86-64.iso

---
 meta/classes/bootimg.bbclass                       |   21

++++++++++++++--

Quoted 1 line
 .../zisofs-tools/zisofs-tools-native_1.0.8.bb      |   26

++++++++++++++++++++

Quoted 2 lines
 2 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/zisofs-tools/

zisofs-tools-native_1.0.8.bb

meta/classes/bootimg.bbclass line 25

Quoted 13 lines
meta/classes/bootimg.bbclass +1 -0
index 90a241d..b312e0d 100644
@@ -19,19 +19,23 @@
 
 # External variables (also used by syslinux.bbclass)
 # ${INITRD} - indicates a filesystem image to use as an initrd (optional)
+# ${COMPRESSISO}
 # ${NOISO}  - skip building the ISO image if set to 1
 # ${NOHDD}  - skip building the HDD image if set to 1
 # ${ROOTFS} - indicates a filesystem image to include as the root

filesystem (optional)

meta/classes/bootimg.bbclass

Quoted 7 lines
meta/classes/bootimg.bbclass +3 -1
+COMPRESSISO ?= ""
 do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
                         mtools-native:do_populate_sysroot \
-                        cdrtools-native:do_populate_sysroot"
+                        cdrtools-native:do_populate_sysroot \
+

${@oe.utils.ifelse(d.getVar('COMPRESSISO'),'zisofs-tools-native:do_populate_sysroot','')}"

Quoted 11 lines
meta/classes/bootimg.bbclass +1 -0
 PACKAGES = " "
 EXCLUDE_FROM_WORLD = "1"
 
 HDDDIR = "${S}/hddimg"
 ISODIR = "${S}/iso"
+COMPACT_ISODIR = "${S}/iso.z"
 
 BOOTIMG_VOLUME_ID   ?= "boot"
 BOOTIMG_EXTRA_SPACE ?= "512"

meta/classes/bootimg.bbclass build_iso() { · line 102

Quoted 7 lines
meta/classes/bootimg.bbclass +4 -0
@@ -92,10 +96,23 @@ build_iso() {
                grubefi_iso_populate
        fi
 
+       if [ "${COMPRESSISO}" = "1" ] ; then
+               # create compact directory, compress iso
+               mkdir -p ${COMPACT_ISODIR}
+               mkzftree -z 9 -p 4 -F ${ISODIR}/rootfs.img

${COMPACT_ISODIR}/rootfs.img

Quoted 4 lines
meta/classes/bootimg.bbclass +4 -0
+
+               # move compact iso to iso, then remove compact directory
+               mv ${COMPACT_ISODIR}/rootfs.img ${ISODIR}/rootfs.img
+               rm -Rf ${COMPACT_ISODIR}

meta/classes/bootimg.bbclass build_iso() {

Quoted 10 lines
meta/classes/bootimg.bbclass +6 -1
+               mkisofs_opts="-r"
+       else
+               mkisofs_opts="-R -z -D -l"
+       fi
+
        if [ "${PCBIOS}" = "1" ]; then
                mkisofs -V ${BOOTIMG_VOLUME_ID} \
                        -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
-                       -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \
+                       -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} $mkisofs_opts

\

meta/classes/bootimg.bbclass build_iso() {

Quoted 3 lines
meta/classes/bootimg.bbclass +0 -0
                        ${MKISOFS_OPTIONS} ${ISODIR}
        else
                bbnote "EFI-only ISO images are untested, please provide

feedback."

Review

Quoted 1 line
(quoted diff) +0 -0

zisofs-tools-native_1.0.8.bb b/meta/recipes-devtools/zisofs-tools/ zisofs-tools-native_1.0.8.bb

Quoted 6 lines

new file mode 100644
index 0000000..b590854

meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +1 -0
@@ -0,0 +1,26 @@
+# zisofs-tools-native OE build file

meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb line 11

Quoted 10 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +10 -0
+# Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+SUMMARY = "A set of tools for iso file compression"
+DESCRIPTION = "A set of tools for iso file compression"
+HOMEPAGE = "http://http://freecode.com/projects/zisofs-tools"
+SECTION = "console/utils"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+PR = "r0"
+
+SRC_URI = "

http://pkgs.fedoraproject.org/repo/pkgs/zisofs-tools/zisofs-tools-${PV}.tar.bz2/2d0ed8c9a1f60b45f949b136f9be1f6c/zisofs-tools-${PV}.tar.bz2
"

meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb

Quoted 3 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +3 -0
+
+SRC_URI[md5sum] = "2d0ed8c9a1f60b45f949b136f9be1f6c"
+SRC_URI[sha256sum] =

"ae4e53e4914934d41660248fb59d3c8761f1f1fd180d5ec993c17ddb3afd04f3"

meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb line 22

Quoted 8 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +8 -0
+
+inherit native
+
+STAGE_TEMP = "${WORKDIR}/image-temp"
+
+do_install() {
+       install -d ${STAGE_TEMP}
+       make install INSTALLROOT=${STAGE_TEMP}

why cant INSTALLROOT be pointing to ${D}

Quoted 12 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +4 -1
+
+       install -d ${D}${bindir}/
+       install ${STAGE_TEMP}/usr/bin/* ${D}${bindir}/
+}
--

1.7.9.5

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 96 lines · Khem Raj
Quoted 93 lines · On Wednesday, September 11, 2013, Jason Wessel <[email protected]…

The mkzftree is needed to allow ISO images to be compressed with minimal runtime overhead. Below is an example of the savings on a core-image-minimal.

Before ls -l:
24117248 core-image-minimal-qemux86-64.iso

Using the mkzftree ls -l:
16777216 core-image-minimal-qemux86-64.iso

Signed-off-by Jason Wessel <[email protected] <mailto:[email protected]>>
---
 meta/classes/bootimg.bbclass                       |   21 ++++++++++++++--
 .../zisofs-tools/zisofs-tools-native_1.0.8.bb <http://zisofs-tools-native_1.0.8.bb>      |   26 ++++++++++++++++++++
 2 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb <http://zisofs-tools-native_1.0.8.bb>
meta/classes/bootimg.bbclass +19 -2
index 90a241d..b312e0d 100644
@@ -19,19 +19,23 @@
 
 # External variables (also used by syslinux.bbclass)
 # ${INITRD} - indicates a filesystem image to use as an initrd (optional)
+# ${COMPRESSISO}
 # ${NOISO}  - skip building the ISO image if set to 1
 # ${NOHDD}  - skip building the HDD image if set to 1
 # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
 
+COMPRESSISO ?= ""
 do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
                         mtools-native:do_populate_sysroot \
-                        cdrtools-native:do_populate_sysroot"
+                        cdrtools-native:do_populate_sysroot \
+                        ${@oe.utils.ifelse(d.getVar('COMPRESSISO'),'zisofs-tools-native:do_populate_sysroot','')}"
 
 PACKAGES = " "
 EXCLUDE_FROM_WORLD = "1"
 
 HDDDIR = "${S}/hddimg"
 ISODIR = "${S}/iso"
+COMPACT_ISODIR = "${S}/iso.z"
 
 BOOTIMG_VOLUME_ID   ?= "boot"
 BOOTIMG_EXTRA_SPACE ?= "512"
@@ -92,10 +96,23 @@ build_iso() {
                grubefi_iso_populate
        fi
 
+       if [ "${COMPRESSISO}" = "1" ] ; then
+               # create compact directory, compress iso
+               mkdir -p ${COMPACT_ISODIR}
+               mkzftree -z 9 -p 4 -F ${ISODIR}/rootfs.img ${COMPACT_ISODIR}/rootfs.img
+
+               # move compact iso to iso, then remove compact directory
+               mv ${COMPACT_ISODIR}/rootfs.img ${ISODIR}/rootfs.img
+               rm -Rf ${COMPACT_ISODIR}
+               mkisofs_opts="-r"
+       else
+               mkisofs_opts="-R -z -D -l"
+       fi
+
        if [ "${PCBIOS}" = "1" ]; then
                mkisofs -V ${BOOTIMG_VOLUME_ID} \
                        -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
-                       -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \
+                       -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} $mkisofs_opts \
                        ${MKISOFS_OPTIONS} ${ISODIR}
        else
                bbnote "EFI-only ISO images are untested, please provide feedback."
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb <http://zisofs-tools-native_1.0.8.bb> new file +16 -0
new file mode 100644
index 0000000..b590854
@@ -0,0 +1,26 @@
+# zisofs-tools-native OE build file
+# Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+SUMMARY = "A set of tools for iso file compression"
+DESCRIPTION = "A set of tools for iso file compression"
+HOMEPAGE = "http://http://freecode.com/projects/zisofs-tools"
+SECTION = "console/utils"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+PR = "r0"
+
+SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/zisofs-tools/zisofs-tools-${PV}.tar.bz2/2d0ed8c9a1f60b45f949b136f9be1f6c/zisofs-tools-${PV}.tar.bz2 <http://pkgs.fedoraproject.org/repo/pkgs/zisofs-tools/zisofs-tools-$%7BPV%7D.tar.bz2/2d0ed8c9a1f60b45f949b136f9be1f6c/zisofs-tools-$%7BPV%7D.tar.bz2>"
+
+SRC_URI[md5sum] = "2d0ed8c9a1f60b45f949b136f9be1f6c"
+SRC_URI[sha256sum] = "ae4e53e4914934d41660248fb59d3c8761f1f1fd180d5ec993c17ddb3afd04f3"
+
+inherit native
Quoted 8 lines

meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb <http://zisofs-tools-native_1.0.8.bb> line 22

Quoted 6 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb <http://zisofs-tools-native_1.0.8.bb> new file +6 -0
+
+STAGE_TEMP = "${WORKDIR}/image-temp"
+
+do_install() {
+       install -d ${STAGE_TEMP}
+       make install INSTALLROOT=${STAGE_TEMP}

why cant INSTALLROOT be pointing to ${D}

Not being the originator of this patch, I took a look and it is all a game to not copy the man page and ensure that ${bindir} is used.

I'll send a v2 shortly and catch this kind of problem in the future.

Thanks,
Jason.

Quoted 14 lines
Quoted 14 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb <http://zisofs-tools-native_1.0.8.bb> new file +4 -1
+
+       install -d ${D}${bindir}/
+       install ${STAGE_TEMP}/usr/bin/* ${D}${bindir}/
+}
--

1.7.9.5

_______________________________________________
Openembedded-core mailing list
[email protected] <mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/openembedded-core