[oe] [PATCH 1/2] kernel-module-split.bbclass: Support module compression
Zoltan Boszormenyi
zboszor at pr.hu
Mon Apr 3 17:01:31 UTC 2017
Support module compression: CONFIG_MODULE_COMPRESS=y and either
CONFIG_MODULE_COMPRESS_GZIP=y or CONFIG_MODULE_COMPRESS_XZ=y
Signed-off-by: Zoltan Boszormenyi <zboszor at pr.hu>
---
meta/classes/kernel-module-split.bbclass | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index 08d2262..8233848 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -39,16 +39,30 @@ python split_kernel_module_packages () {
def extract_modinfo(file):
import tempfile, subprocess
+ compression = re.match('^(.*)(\.k?o)(\.(xz|gz))?$', file)
+ modulefile = compression.group(1) + compression.group(2)
+ if compression.group(4) == 'xz':
+ rm_module_file = 1
+ cmd = "cat %s | xz -cd >%s" % (file, modulefile)
+ subprocess.call(cmd, shell=True)
+ elif compression.group(4) == 'gz':
+ rm_module_file = 1
+ cmd = "cat %s | gzip -cd >%s" % (file, modulefile)
+ subprocess.call(cmd, shell=True)
+ else:
+ rm_module_file = 0
tempfile.tempdir = d.getVar("WORKDIR", True)
tf = tempfile.mkstemp()
tmpfile = tf[1]
- cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX", True) or "", file, tmpfile)
+ cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX", True) or "", modulefile, tmpfile)
subprocess.call(cmd, shell=True)
f = open(tmpfile)
l = f.read().split("\000")
f.close()
os.close(tf[0])
os.unlink(tmpfile)
+ if rm_module_file == 1:
+ os.unlink(modulefile)
vals = {}
for i in l:
m = modinfoexp.match(i)
@@ -119,7 +133,7 @@ python split_kernel_module_packages () {
# Avoid automatic -dev recommendations for modules ending with -dev.
d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
- module_regex = '^(.*)\.k?o$'
+ module_regex = '^(.*)\.k?o(\.(xz|gz))?$'
module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX', True)
module_pattern = module_pattern_prefix + 'kernel-module-%s'
--
1.8.3.1
More information about the Openembedded-devel
mailing list