Skip to contentSkip to conversation

rootfs.py: find .ko.gz and .ko.xz kernel modules as well

PATCH Superseded Martin Jansa 2 participants 3 messages Apr 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rootfs.py: find .ko.gz and .ko.xz kernel modules as well

From: Christophe Chapuis <[email protected]>

* with xz PACKAGECONFIG enabled in kmod and xz module compression enabled in kernel the do_rootfs task doesn't run depmod in the image, because it thinks there are no modules:
NOTE: No Kernel Modules found, not running depmod

---
 meta/lib/oe/rootfs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/rootfs.py +1 -1
index 5f81023040..e4de0bfddf 100644
@@ -305,7 +305,7 @@ class Rootfs(object, metaclass=ABCMeta):
     def _check_for_kernel_modules(self, modules_dir):
         for root, dirs, files in os.walk(modules_dir, topdown=True):
             for name in files:
-                found_ko = name.endswith(".ko")
+                found_ko = name.endswith(".ko") or name.endswith(".ko.gz") or name.endswith(".ko.xz")
                 if found_ko:
                     return found_ko
         return False
Signature · 1 line
2.30.2
#1 lore raw
Quoted 20 lines · Martin Jansa

From: Christophe Chapuis <[email protected]>

* with xz PACKAGECONFIG enabled in kmod and xz module compression enabled in kernel the do_rootfs task doesn't run depmod in the image, because it thinks there are no modules:
  NOTE: No Kernel Modules found, not running depmod

---
 meta/lib/oe/rootfs.py | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/rootfs.py +0 -0
index 5f81023040..e4de0bfddf 100644
@@ -305,7 +305,7 @@ class Rootfs(object, metaclass=ABCMeta):

     def _check_for_kernel_modules(self, modules_dir):
         for root, dirs, files in os.walk(modules_dir, topdown=True):
             for name in files:

meta/lib/oe/rootfs.py class Rootfs(object, metaclass=ABCMeta): · line 308

Quoted 2 lines
meta/lib/oe/rootfs.py +1 -1
-                found_ko = name.endswith(".ko")
+                found_ko = name.endswith(".ko") or name.endswith(".ko.gz") or name.endswith(".ko.xz")

For reference you can do name.endswith((".ko", ".ko.gz", ".ko.xz")) as endswith takes a tuple.

Cheers,

Richard

#2 lore raw

PATCH v2 1/1 rootfs.py: find .ko.gz and .ko.xz kernel modules as well

From: Christophe Chapuis <[email protected]>

* with xz PACKAGECONFIG enabled in kmod and xz module compression enabled in kernel the do_rootfs task doesn't run depmod in the image, because it thinks there are no modules:
NOTE: No Kernel Modules found, not running depmod

---

v2: nothing else was broken, only xz was enabled only in target kmod, after enabling
it for kmod-native as well it seems to work fine.
Also use tuple as updated by Christophe and suggested by RP.

 meta/lib/oe/rootfs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/rootfs.py +1 -1
index 5f81023040..d634adda4e 100644
@@ -305,7 +305,7 @@ class Rootfs(object, metaclass=ABCMeta):
     def _check_for_kernel_modules(self, modules_dir):
         for root, dirs, files in os.walk(modules_dir, topdown=True):
             for name in files:
-                found_ko = name.endswith(".ko")
+                found_ko = name.endswith((".ko", ".ko.gz", ".ko.xz"))
                 if found_ko:
                     return found_ko
         return False