diff options
author | Zoltán Böszörményi <zboszor@gmail.com> | 2021-08-27 09:37:12 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-09-01 14:06:17 +0100 |
commit | e492d55d02a658b7c9385dee9c92fdf830b92197 (patch) | |
tree | 42a78d92d6565f3b1a8eed1bee91a1362ede0003 | |
parent | 3d2904cab5867e450f445a63e0f5e8f7938d355e (diff) | |
download | poky-e492d55d02a658b7c9385dee9c92fdf830b92197.tar.gz |
base/kernel: Support zstd-compressed squashfs and cpio initramfs
Enable zstd PACKAGECONFIG knob for squashfs-tools and add support for zstd
compressed initramfs and squashfs.
(From OE-Core rev: fa146049eec5f9730781830270cc9dc55a2146f7)
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/base.bbclass | 4 | ||||
-rw-r--r-- | meta/classes/image_types.bbclass | 6 | ||||
-rw-r--r-- | meta/classes/kernel-fitimage.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/kernel.bbclass | 10 | ||||
-rw-r--r-- | meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb | 2 |
5 files changed, 18 insertions, 6 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 11b65171d9..340ebe7d78 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -631,6 +631,10 @@ python () { | |||
631 | if path.endswith('.lz4'): | 631 | if path.endswith('.lz4'): |
632 | d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot') | 632 | d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot') |
633 | 633 | ||
634 | # *.zst should DEPEND on zstd-native for unpacking | ||
635 | elif path.endswith('.zst'): | ||
636 | d.appendVarFlag('do_unpack', 'depends', ' zstd-native:do_populate_sysroot') | ||
637 | |||
634 | # *.lz should DEPEND on lzip-native for unpacking | 638 | # *.lz should DEPEND on lzip-native for unpacking |
635 | elif path.endswith('.lz'): | 639 | elif path.endswith('.lz'): |
636 | d.appendVarFlag('do_unpack', 'depends', ' lzip-native:do_populate_sysroot') | 640 | d.appendVarFlag('do_unpack', 'depends', ' lzip-native:do_populate_sysroot') |
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index e0eb06c1e3..32d4cd4c76 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass | |||
@@ -107,6 +107,7 @@ IMAGE_CMD:squashfs = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${ | |||
107 | IMAGE_CMD:squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz ${EXTRA_IMAGECMD} -noappend -comp xz" | 107 | IMAGE_CMD:squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz ${EXTRA_IMAGECMD} -noappend -comp xz" |
108 | IMAGE_CMD:squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo" | 108 | IMAGE_CMD:squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo" |
109 | IMAGE_CMD:squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4" | 109 | IMAGE_CMD:squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4" |
110 | IMAGE_CMD:squashfs-zst = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-zst ${EXTRA_IMAGECMD} -noappend -comp zstd" | ||
110 | 111 | ||
111 | IMAGE_CMD:erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs ${IMAGE_ROOTFS}" | 112 | IMAGE_CMD:erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs ${IMAGE_ROOTFS}" |
112 | IMAGE_CMD:erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4 ${IMAGE_ROOTFS}" | 113 | IMAGE_CMD:erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4 ${IMAGE_ROOTFS}" |
@@ -244,6 +245,7 @@ do_image_squashfs[depends] += "squashfs-tools-native:do_populate_sysroot" | |||
244 | do_image_squashfs_xz[depends] += "squashfs-tools-native:do_populate_sysroot" | 245 | do_image_squashfs_xz[depends] += "squashfs-tools-native:do_populate_sysroot" |
245 | do_image_squashfs_lzo[depends] += "squashfs-tools-native:do_populate_sysroot" | 246 | do_image_squashfs_lzo[depends] += "squashfs-tools-native:do_populate_sysroot" |
246 | do_image_squashfs_lz4[depends] += "squashfs-tools-native:do_populate_sysroot" | 247 | do_image_squashfs_lz4[depends] += "squashfs-tools-native:do_populate_sysroot" |
248 | do_image_squashfs_zst[depends] += "squashfs-tools-native:do_populate_sysroot" | ||
247 | do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot" | 249 | do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot" |
248 | do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot" | 250 | do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot" |
249 | do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot" | 251 | do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot" |
@@ -262,10 +264,10 @@ IMAGE_TYPES = " \ | |||
262 | btrfs \ | 264 | btrfs \ |
263 | iso \ | 265 | iso \ |
264 | hddimg \ | 266 | hddimg \ |
265 | squashfs squashfs-xz squashfs-lzo squashfs-lz4 \ | 267 | squashfs squashfs-xz squashfs-lzo squashfs-lz4 squashfs-zst \ |
266 | ubi ubifs multiubi \ | 268 | ubi ubifs multiubi \ |
267 | tar tar.gz tar.bz2 tar.xz tar.lz4 tar.zst \ | 269 | tar tar.gz tar.bz2 tar.xz tar.lz4 tar.zst \ |
268 | cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \ | 270 | cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 cpio.zst \ |
269 | wic wic.gz wic.bz2 wic.lzma wic.zst \ | 271 | wic wic.gz wic.bz2 wic.lzma wic.zst \ |
270 | container \ | 272 | container \ |
271 | f2fs \ | 273 | f2fs \ |
diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass index 2ef8f06b14..38e05153e3 100644 --- a/meta/classes/kernel-fitimage.bbclass +++ b/meta/classes/kernel-fitimage.bbclass | |||
@@ -576,7 +576,7 @@ fitimage_assemble() { | |||
576 | # | 576 | # |
577 | if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then | 577 | if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then |
578 | # Find and use the first initramfs image archive type we find | 578 | # Find and use the first initramfs image archive type we find |
579 | for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz ext2.gz cpio; do | 579 | for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio; do |
580 | initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}" | 580 | initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}" |
581 | echo "Using $initramfs_path" | 581 | echo "Using $initramfs_path" |
582 | if [ -e "${initramfs_path}" ]; then | 582 | if [ -e "${initramfs_path}" ]; then |
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 2a7d114ed4..d13c38fb02 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass | |||
@@ -9,6 +9,7 @@ PROVIDES += "${@ "virtual/kernel" if (d.getVar("KERNEL_PACKAGE_NAME") == "kernel | |||
9 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native bison-native" | 9 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native bison-native" |
10 | DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lzo", "lzop-native", "", d)}" | 10 | DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lzo", "lzop-native", "", d)}" |
11 | DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lz4", "lz4-native", "", d)}" | 11 | DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lz4", "lz4-native", "", d)}" |
12 | DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.zst", "zstd-native", "", d)}" | ||
12 | PACKAGE_WRITE_DEPS += "depmodwrapper-cross" | 13 | PACKAGE_WRITE_DEPS += "depmodwrapper-cross" |
13 | 14 | ||
14 | do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot gzip-native:do_populate_sysroot" | 15 | do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot gzip-native:do_populate_sysroot" |
@@ -236,7 +237,7 @@ copy_initramfs() { | |||
236 | mkdir -p ${B}/usr | 237 | mkdir -p ${B}/usr |
237 | # Find and use the first initramfs image archive type we find | 238 | # Find and use the first initramfs image archive type we find |
238 | rm -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio | 239 | rm -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio |
239 | for img in cpio cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz; do | 240 | for img in cpio cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst; do |
240 | if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img" ]; then | 241 | if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img" ]; then |
241 | cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/. | 242 | cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/. |
242 | case $img in | 243 | case $img in |
@@ -265,12 +266,17 @@ copy_initramfs() { | |||
265 | xz -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img | 266 | xz -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img |
266 | break | 267 | break |
267 | ;; | 268 | ;; |
269 | *zst) | ||
270 | echo "zst decompressing image" | ||
271 | zstd -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img | ||
272 | break | ||
273 | ;; | ||
268 | esac | 274 | esac |
269 | break | 275 | break |
270 | fi | 276 | fi |
271 | done | 277 | done |
272 | # Verify that the above loop found a initramfs, fail otherwise | 278 | # Verify that the above loop found a initramfs, fail otherwise |
273 | [ -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio ] && echo "Finished copy of initramfs into ./usr" || die "Could not find any ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.cpio{.gz|.lz4|.lzo|.lzma|.xz) for bundling; INITRAMFS_IMAGE_NAME might be wrong." | 279 | [ -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio ] && echo "Finished copy of initramfs into ./usr" || die "Could not find any ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.cpio{.gz|.lz4|.lzo|.lzma|.xz|.zst) for bundling; INITRAMFS_IMAGE_NAME might be wrong." |
274 | } | 280 | } |
275 | 281 | ||
276 | do_bundle_initramfs () { | 282 | do_bundle_initramfs () { |
diff --git a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb index 2b9a765bb2..c78f446711 100644 --- a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb +++ b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb | |||
@@ -17,7 +17,7 @@ S = "${WORKDIR}/git/squashfs-tools" | |||
17 | 17 | ||
18 | EXTRA_OEMAKE = "${PACKAGECONFIG_CONFARGS}" | 18 | EXTRA_OEMAKE = "${PACKAGECONFIG_CONFARGS}" |
19 | 19 | ||
20 | PACKAGECONFIG ??= "gzip xz lzo lz4 lzma xattr reproducible" | 20 | PACKAGECONFIG ??= "gzip xz lzo lz4 lzma xattr zstd reproducible" |
21 | PACKAGECONFIG[gzip] = "GZIP_SUPPORT=1,GZIP_SUPPORT=0,zlib" | 21 | PACKAGECONFIG[gzip] = "GZIP_SUPPORT=1,GZIP_SUPPORT=0,zlib" |
22 | PACKAGECONFIG[xz] = "XZ_SUPPORT=1,XZ_SUPPORT=0,xz" | 22 | PACKAGECONFIG[xz] = "XZ_SUPPORT=1,XZ_SUPPORT=0,xz" |
23 | PACKAGECONFIG[lzo] = "LZO_SUPPORT=1,LZO_SUPPORT=0,lzo" | 23 | PACKAGECONFIG[lzo] = "LZO_SUPPORT=1,LZO_SUPPORT=0,lzo" |