* [PATCH] support CONFIG_MODULE_COMPRESS=y
@ 2019-04-03 13:18 Jens Rehsack
2019-04-03 13:58 ` Richard Purdie
0 siblings, 1 reply; 5+ messages in thread
From: Jens Rehsack @ 2019-04-03 13:18 UTC (permalink / raw)
To: openembedded-core; +Cc: Jens Rehsack
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 3838 bytes --]
In case, kernel config enables compressed modules, support of
splitting via split_kernel_module_packages won't find any module.
So, first expand module pattern regex to recognize compressed
modules and then objcopy on temporary extacted to extract module
information.
Signed-off-by: Jens Rehsack <sno@netbsd.org>
---
meta/classes/kernel-module-split.bbclass | 36 +++++++++++++++++-------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index e8d3eb5105..61819dca99 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -1,31 +1,31 @@
pkg_postinst_modules () {
if [ -z "$D" ]; then
- depmod -a ${KERNEL_VERSION}
+ depmod -a ${KERNEL_VERSION}
else
- # image.bbclass will call depmodwrapper after everything is installed,
- # no need to do it here as well
- :
+ # image.bbclass will call depmodwrapper after everything is installed,
+ # no need to do it here as well
+ :
fi
}
pkg_postrm_modules () {
if [ -z "$D" ]; then
- depmod -a ${KERNEL_VERSION}
+ depmod -a ${KERNEL_VERSION}
else
- depmodwrapper -a -b $D ${KERNEL_VERSION}
+ depmodwrapper -a -b $D ${KERNEL_VERSION}
fi
}
autoload_postinst_fragment() {
if [ x"$D" = "x" ]; then
- modprobe %s || true
+ modprobe %s || true
fi
}
PACKAGE_WRITE_DEPS += "kmod-native depmodwrapper-cross"
do_install_append() {
- install -d ${D}${sysconfdir}/modules-load.d/ ${D}${sysconfdir}/modprobe.d/
+ install -d ${D}${sysconfdir}/modules-load.d/ ${D}${sysconfdir}/modprobe.d/
}
PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
@@ -44,9 +44,23 @@ 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)
# errors='replace': Some old kernel versions contain invalid utf-8 characters in mod descriptions (like 0xf6, 'ö')
f = open(tmpfile, errors='replace')
@@ -54,6 +68,8 @@ python split_kernel_module_packages () {
f.close()
os.close(tf[0])
os.unlink(tmpfile)
+ if compressed:
+ os.unlink(tmpkofile)
vals = {}
for i in l:
m = modinfoexp.match(i)
@@ -133,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 = r'^(.*)\.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')
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] support CONFIG_MODULE_COMPRESS=y
2019-04-03 13:18 [PATCH] support CONFIG_MODULE_COMPRESS=y Jens Rehsack
@ 2019-04-03 13:58 ` Richard Purdie
2019-04-03 17:05 ` Jens Rehsack
0 siblings, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2019-04-03 13:58 UTC (permalink / raw)
To: Jens Rehsack, openembedded-core
On Wed, 2019-04-03 at 15:18 +0200, Jens Rehsack wrote:
> In case, kernel config enables compressed modules, support of
> splitting via split_kernel_module_packages won't find any module.
> So, first expand module pattern regex to recognize compressed
> modules and then objcopy on temporary extacted to extract module
> information.
>
> Signed-off-by: Jens Rehsack <sno@netbsd.org>
> ---
> meta/classes/kernel-module-split.bbclass | 36 +++++++++++++++++-----
> --
> 1 file changed, 26 insertions(+), 10 deletions(-)
There is a lot of whitespace noise in this, could you clean that up and
resend please?
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] support CONFIG_MODULE_COMPRESS=y
2019-04-03 13:58 ` Richard Purdie
@ 2019-04-03 17:05 ` Jens Rehsack
2019-04-03 17:10 ` richard.purdie
0 siblings, 1 reply; 5+ messages in thread
From: Jens Rehsack @ 2019-04-03 17:05 UTC (permalink / raw)
To: Richard Purdie; +Cc: openembedded-core
[-- Attachment #1.1: Type: text/plain, Size: 926 bytes --]
> Am 03.04.2019 um 15:58 schrieb Richard Purdie <richard.purdie@linuxfoundation.org>:
>
> On Wed, 2019-04-03 at 15:18 +0200, Jens Rehsack wrote:
>> In case, kernel config enables compressed modules, support of
>> splitting via split_kernel_module_packages won't find any module.
>> So, first expand module pattern regex to recognize compressed
>> modules and then objcopy on temporary extacted to extract module
>> information.
>>
>> Signed-off-by: Jens Rehsack <sno@netbsd.org>
>> ---
>> meta/classes/kernel-module-split.bbclass | 36 +++++++++++++++++-----
>> --
>> 1 file changed, 26 insertions(+), 10 deletions(-)
>
> There is a lot of whitespace noise in this, could you clean that up and
> resend please?
It's because of <tab>s were replaced with spaces - which is reasonable when python code is mixed in.
Sure that you want keep the tab's?
Cheers
--
Jens Rehsack - rehsack@gmail.com
[-- Attachment #1.2: Type: text/html, Size: 2477 bytes --]
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 849 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] support CONFIG_MODULE_COMPRESS=y
2019-04-03 17:05 ` Jens Rehsack
@ 2019-04-03 17:10 ` richard.purdie
2019-04-04 9:19 ` Jens Rehsack
0 siblings, 1 reply; 5+ messages in thread
From: richard.purdie @ 2019-04-03 17:10 UTC (permalink / raw)
To: Jens Rehsack; +Cc: openembedded-core
On Wed, 2019-04-03 at 19:05 +0200, Jens Rehsack wrote:
>
>
> > Am 03.04.2019 um 15:58 schrieb Richard Purdie <
> > richard.purdie@linuxfoundation.org>:
> >
> > On Wed, 2019-04-03 at 15:18 +0200, Jens Rehsack wrote:
> > > In case, kernel config enables compressed modules, support of
> > > splitting via split_kernel_module_packages won't find any module.
> > > So, first expand module pattern regex to recognize compressed
> > > modules and then objcopy on temporary extacted to extract module
> > > information.
> > >
> > > Signed-off-by: Jens Rehsack <sno@netbsd.org>
> > > ---
> > > meta/classes/kernel-module-split.bbclass | 36 +++++++++++++++++
> > > -----
> > > --
> > > 1 file changed, 26 insertions(+), 10 deletions(-)
> >
> > There is a lot of whitespace noise in this, could you clean that up
> > and
> > resend please?
>
> It's because of <tab>s were replaced with spaces - which is
> reasonable when python code is mixed in.
> Sure that you want keep the tab's?
Rightly or wrongly, the style convention for OE-Core is tabs in shell,
spaces in python (I'd prefer not to open that can of worms again right
now).
Whitespace changes need to be in a separate patch to code changes
regardless.
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] support CONFIG_MODULE_COMPRESS=y
2019-04-03 17:10 ` richard.purdie
@ 2019-04-04 9:19 ` Jens Rehsack
0 siblings, 0 replies; 5+ messages in thread
From: Jens Rehsack @ 2019-04-04 9:19 UTC (permalink / raw)
To: Purdie, Richard; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1450 bytes --]
> Am 03.04.2019 um 19:10 schrieb richard.purdie@linuxfoundation.org:
>
> On Wed, 2019-04-03 at 19:05 +0200, Jens Rehsack wrote:
>>
>>
>>> Am 03.04.2019 um 15:58 schrieb Richard Purdie <
>>> richard.purdie@linuxfoundation.org>:
>>>
>>> On Wed, 2019-04-03 at 15:18 +0200, Jens Rehsack wrote:
>>>> In case, kernel config enables compressed modules, support of
>>>> splitting via split_kernel_module_packages won't find any module.
>>>> So, first expand module pattern regex to recognize compressed
>>>> modules and then objcopy on temporary extacted to extract module
>>>> information.
>>>>
>>>> Signed-off-by: Jens Rehsack <sno@netbsd.org>
>>>> ---
>>>> meta/classes/kernel-module-split.bbclass | 36 +++++++++++++++++
>>>> -----
>>>> --
>>>> 1 file changed, 26 insertions(+), 10 deletions(-)
>>>
>>> There is a lot of whitespace noise in this, could you clean that up
>>> and
>>> resend please?
>>
>> It's because of <tab>s were replaced with spaces - which is
>> reasonable when python code is mixed in.
>> Sure that you want keep the tab's?
>
> Rightly or wrongly, the style convention for OE-Core is tabs in shell,
> spaces in python (I'd prefer not to open that can of worms again right
> now).
That wasn't the intension - I just wanted to be sure.
> Whitespace changes need to be in a separate patch to code changes
> regardless.
Understood.
Cheers
--
Jens Rehsack - rehsack@gmail.com
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 849 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-04 9:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 13:18 [PATCH] support CONFIG_MODULE_COMPRESS=y Jens Rehsack
2019-04-03 13:58 ` Richard Purdie
2019-04-03 17:05 ` Jens Rehsack
2019-04-03 17:10 ` richard.purdie
2019-04-04 9:19 ` Jens Rehsack
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.