Skip to contentSkip to conversation

Fix .ko file pre-filter to use endswith instead of string contains

PATCH Superseded [email protected] 1 participant 3 messages Apr 21

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix .ko file pre-filter to use endswith instead of string contains

Sam Kent (2):
package.py: fix kernel module file pre-filter and document strip
asymmetry
oe/package: add unit tests for kernel module detection helpers

 meta/lib/oe/package.py            |   5 +-
 meta/lib/oe/tests/__init__.py     |   0
 meta/lib/oe/tests/test_package.py | 121 ++++++++++++++++++++++++++++++
 3 files changed, 124 insertions(+), 2 deletions(-)
 create mode 100644 meta/lib/oe/tests/__init__.py
 create mode 100644 meta/lib/oe/tests/test_package.py
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/2 package.py: fix kernel module file pre-filter and document strip asymmetry

Change the check to f.endswith(".ko"), consistent with strip_execs() and with the /lib/modules/ guard already present in is_elf() and splitdebuginfo().

Fixes [YOCTO #2348]

---
 meta/lib/oe/package.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/lib/oe/package.py +3 -2
index 279cd56..c375acc 100644
@@ -37,7 +37,8 @@ def runstrip(file, elftype, strip, extra_strip_sections=''):
 
     stripcmd = [strip]
     skip_strip = False
-    # kernel module
+    # kernel module: use --strip-debug and --preserve-dates (required for
+    # module signing to remain valid after stripping)
     if elftype & 16:
         if is_kernel_module_signed(file):
             bb.debug(1, "Skip strip on signed module %s" % file)
@@ -1167,7 +1168,7 @@ def process_split_and_strip_files(d):
                         or (s[stat.ST_MODE] & stat.S_IXOTH) \
                         or ((file.startswith(libdir) or file.startswith(baselibdir)) \
                         and (".so" in f or ".node" in f)) \
-                        or (f.startswith('vmlinux') or ".ko" in f):
+                        or (f.startswith('vmlinux') or f.endswith(".ko")):
 
                     if cpath.islink(file):
                         checkelflinks[file] = ltarget
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 2/2 oe/package: add unit tests for kernel module detection helpers

In reply to [email protected]

Add unit tests for the filename pre-filter logic, is_kernel_module(), and the is_kernel_module_signed() detection.

---
 meta/lib/oe/tests/__init__.py     |   0
 meta/lib/oe/tests/test_package.py | 121 ++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+)
 create mode 100644 meta/lib/oe/tests/__init__.py
 create mode 100644 meta/lib/oe/tests/test_package.py
meta/lib/oe/tests/__init__.py new file +0 -0
new file mode 100644
index 0000000..e69de29
meta/lib/oe/tests/test_package.py new file +121 -0

121 lines not on this page · raw message

Signature · 1 line
2.34.1