kernel-module-split.bbclass: Support zstd-compressed modules

(From OE-Core rev: 796d4661a6121dba878c29d2388258c795be3aeb)

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Zoltán Böszörményi
2021-08-23 16:54:47 +02:00
committed by Richard Purdie
parent 95f0ce92b6
commit 2190abe8bb

View File

@@ -44,17 +44,20 @@ python split_kernel_module_packages () {
def extract_modinfo(file):
import tempfile, subprocess
tempfile.tempdir = d.getVar("WORKDIR")
compressed = re.match( r'.*\.([xg])z$', file)
compressed = re.match( r'.*\.(gz|xz|zst)$', file)
tf = tempfile.mkstemp()
tmpfile = tf[1]
if compressed:
tmpkofile = tmpfile + ".ko"
if compressed.group(1) == 'g':
if compressed.group(1) == 'gz':
cmd = "gunzip -dc %s > %s" % (file, tmpkofile)
subprocess.check_call(cmd, shell=True)
elif compressed.group(1) == 'x':
elif compressed.group(1) == 'xz':
cmd = "xz -dc %s > %s" % (file, tmpkofile)
subprocess.check_call(cmd, shell=True)
elif compressed.group(1) == 'zst':
cmd = "zstd -dc %s > %s" % (file, tmpkofile)
subprocess.check_call(cmd, shell=True)
else:
msg = "Cannot decompress '%s'" % file
raise msg
@@ -153,7 +156,7 @@ python split_kernel_module_packages () {
kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel"
kernel_version = d.getVar("KERNEL_VERSION")
module_regex = r'^(.*)\.k?o(?:\.[xg]z)?$'
module_regex = r'^(.*)\.k?o(?:\.(gz|xz|zst))?$'
module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX')
module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')