[oe-commits] [meta-openembedded] branch master-next updated: dracut.bbclass: Autodetect initramfs compression type

git at git.openembedded.org git at git.openembedded.org
Sat Mar 2 16:09:11 UTC 2019


This is an automated email from the git hooks/post-receive script.

khem pushed a commit to branch master-next
in repository meta-openembedded.

The following commit(s) were added to refs/heads/master-next by this push:
     new 3e2b7e9  dracut.bbclass: Autodetect initramfs compression type
3e2b7e9 is described below

commit 3e2b7e918d054ee7d27552b262e9d70ec525da55
Author: William A. Kennington III via Openembedded-devel <openembedded-devel at lists.openembedded.org>
AuthorDate: Sat Mar 2 10:26:07 2019 +0100

    dracut.bbclass: Autodetect initramfs compression type
    
    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 <zboszor at pr.hu>
    Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 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 58c4493..c70aa64 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)} \
 		"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list