INITRAMFS_FSTYPES is the official setting for this, use it by default instead of manually setting it from this class.
Also use the same for depending on the correct compressor. kmod and kernel configurations should support the compression type set in INITRAMFS_FSTYPES. Signed-off-by: Böszörményi Zoltán <[email protected]> --- meta-initramfs/classes/dracut.bbclass | 37 ++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/meta-initramfs/classes/dracut.bbclass b/meta-initramfs/classes/dracut.bbclass index 58c4493a3..c70aa6430 100644 --- a/meta-initramfs/classes/dracut.bbclass +++ b/meta-initramfs/classes/dracut.bbclass @@ -1,10 +1,41 @@ DRACUT_PN ??= "${PN}" -DRACUT_OPTS ??= "--early-microcode --lzma" + +def dracut_compression_type(d): + rdtype = d.getVar("INITRAMFS_FSTYPES", True).split('.') + if len(rdtype) != 2: + return ['','',''] + if rdtype[0] != 'cpio': + return ['','',''] + cmptypes = [['gz','--gzip','gzip'],['bz2', '--bzip2','bzip2'],['lzma','--lzma','xz'],['xz','--xz','xz'],['lzo','--lzo','lzo'],['lz4','--lz4','lz4'],['zstd','--zstd','zstd']] + for cmp in cmptypes: + if rdtype[1] == cmp[0]: + return cmp + return ['','',''] + +def dracut_compression_opt(d): + cmp = dracut_compression_type(d) + return cmp[1] + +def dracut_compression_pkg(d): + cmp = dracut_compression_type(d) + return cmp[2] + +def dracut_compression_pkg_native(d): + cmp = dracut_compression_type(d) + if cmp[2] == '': + return '' + return cmp[2] + '-native' + +DRACUT_COMPRESS_OPT ??= "${@dracut_compression_opt(d)}" +DRACUT_COMPRESS_PKG ??= "${@dracut_compression_pkg(d)}" +DRACUT_COMPRESS_PKG_NATIVE ??= "${@dracut_compression_pkg_native(d)}" + +DRACUT_OPTS ??= "--early-microcode ${DRACUT_COMPRESS_OPT}" python __anonymous () { pkg = d.getVar("DRACUT_PN", True) if pkg != 'dracut': - d.appendVar("RDEPENDS_%s" % pkg, " dracut ") + d.appendVar("RDEPENDS_%s" % pkg, " dracut %s " % d.getVar("DRACUT_COMPRESS_PKG", True)) if not pkg.startswith('kernel'): d.appendVarFlag("do_configure", "depends", "virtual/kernel:do_shared_workdir") d.appendVarFlag("do_compile", "depends", "virtual/kernel:do_compile_kernelmodules") @@ -74,7 +105,7 @@ PACKAGESPLITFUNCS_prepend = "dracut_populate_packages " DRACUT_DEPENDS = " \ binutils-cross-${TUNE_ARCH} gcc-cross-${TUNE_ARCH} \ ldconfig-native coreutils-native findutils-native \ - cpio-native util-linux-native kmod-native xz-native \ + cpio-native util-linux-native kmod-native ${DRACUT_COMPRESS_PKG_NATIVE} \ dracut-native pkgconfig-native cross-compiler-ldd \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \ " -- 2.20.1 -- _______________________________________________ Openembedded-devel mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-devel
