diff options
Diffstat (limited to 'external/poky/meta/classes/kernel-module-split.bbclass')
-rw-r--r-- | external/poky/meta/classes/kernel-module-split.bbclass | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/external/poky/meta/classes/kernel-module-split.bbclass b/external/poky/meta/classes/kernel-module-split.bbclass index 67ab4161..221022b7 100644 --- a/external/poky/meta/classes/kernel-module-split.bbclass +++ b/external/poky/meta/classes/kernel-module-split.bbclass @@ -44,15 +44,32 @@ python split_kernel_module_packages () { def extract_modinfo(file): import tempfile, subprocess tempfile.tempdir = d.getVar("WORKDIR") + compressed = re.match( r'.*\.([xg])z$', file) tf = tempfile.mkstemp() tmpfile = tf[1] - cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile) + if compressed: + tmpkofile = tmpfile + ".ko" + if compressed.group(1) == 'g': + cmd = "gunzip -dc %s > %s" % (file, tmpkofile) + subprocess.check_call(cmd, shell=True) + elif compressed.group(1) == 'x': + cmd = "xz -dc %s > %s" % (file, tmpkofile) + subprocess.check_call(cmd, shell=True) + else: + msg = "Cannot decompress '%s'" % file + raise msg + cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", tmpkofile, tmpfile) + else: + cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile) subprocess.check_call(cmd, shell=True) - f = open(tmpfile) + # errors='replace': Some old kernel versions contain invalid utf-8 characters in mod descriptions (like 0xf6, 'รถ') + f = open(tmpfile, errors='replace') l = f.read().split("\000") f.close() os.close(tf[0]) os.unlink(tmpfile) + if compressed: + os.unlink(tmpkofile) vals = {} for i in l: m = modinfoexp.match(i) @@ -132,7 +149,7 @@ python split_kernel_module_packages () { kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel" kernel_version = d.getVar("KERNEL_VERSION") - module_regex = '^(.*)\.k?o$' + module_regex = r'^(.*)\.k?o(?:\.[xg]z)?$' module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX') module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') |