diff options
author | Andrei Gherzan <andrei.gherzan@huawei.com> | 2022-09-10 00:04:25 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-09-13 10:36:50 +0100 |
commit | 5e4f3acbc8497e7676f1c9eb80e7b989104066e0 (patch) | |
tree | 6182462aff216960c21ade8950467fe9d3b308ab /meta/lib/oe/rootfs.py | |
parent | 475639ba49f89d02cfa6a32686e3475cb13c45bf (diff) | |
download | poky-5e4f3acbc8497e7676f1c9eb80e7b989104066e0.tar.gz |
rootfs.py: Run depmod(wrapper) against each compiled kernel
We run depmod (through depmodwrapper) at the end of the rootfs
generation process. This part of the process assumes in its current
implementation that the kernel package name is always 'kernel' and that
there is only one set of kernel modules for which we need to generate
the modules.dep and map files.
The kernel package name can be configured via a variable
(KERNEL_PACKAGE_NAME) and becomes a namespace that enables the build
system to deal with multiple compiled kernel recipes. This patch checks
for all the depmod pkgdata and runs depmod for each of the detected
kernel versions/kernel package name.
(From OE-Core rev: efa88e1c227d695319197f511701e0230d301f39)
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/rootfs.py')
-rw-r--r-- | meta/lib/oe/rootfs.py | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index ad2a4c1441..8587c5db82 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -325,19 +325,29 @@ class Rootfs(object, metaclass=ABCMeta): | |||
325 | bb.note("No Kernel Modules found, not running depmod") | 325 | bb.note("No Kernel Modules found, not running depmod") |
326 | return | 326 | return |
327 | 327 | ||
328 | kernel_abi_ver_file = oe.path.join(self.d.getVar('PKGDATA_DIR'), "kernel-depmod", | 328 | pkgdatadir = self.d.getVar('PKGDATA_DIR') |
329 | 'kernel-abiversion') | ||
330 | if not os.path.exists(kernel_abi_ver_file): | ||
331 | bb.fatal("No kernel-abiversion file found (%s), cannot run depmod, aborting" % kernel_abi_ver_file) | ||
332 | 329 | ||
333 | with open(kernel_abi_ver_file) as f: | 330 | # PKGDATA_DIR can include multiple kernels so we run depmod for each |
334 | kernel_ver = f.read().strip(' \n') | 331 | # one of them. |
332 | for direntry in os.listdir(pkgdatadir): | ||
333 | match = re.match('(.*)-depmod', direntry) | ||
334 | if not match: | ||
335 | continue | ||
336 | kernel_package_name = match.group(1) | ||
337 | |||
338 | kernel_abi_ver_file = oe.path.join(pkgdatadir, direntry, kernel_package_name + '-abiversion') | ||
339 | if not os.path.exists(kernel_abi_ver_file): | ||
340 | bb.fatal("No kernel-abiversion file found (%s), cannot run depmod, aborting" % kernel_abi_ver_file) | ||
341 | |||
342 | with open(kernel_abi_ver_file) as f: | ||
343 | kernel_ver = f.read().strip(' \n') | ||
335 | 344 | ||
336 | versioned_modules_dir = os.path.join(self.image_rootfs, modules_dir, kernel_ver) | 345 | versioned_modules_dir = os.path.join(self.image_rootfs, modules_dir, kernel_ver) |
337 | 346 | ||
338 | bb.utils.mkdirhier(versioned_modules_dir) | 347 | bb.utils.mkdirhier(versioned_modules_dir) |
339 | 348 | ||
340 | self._exec_shell_cmd(['depmodwrapper', '-a', '-b', self.image_rootfs, kernel_ver]) | 349 | bb.note("Running depmodwrapper for %s ..." % versioned_modules_dir) |
350 | self._exec_shell_cmd(['depmodwrapper', '-a', '-b', self.image_rootfs, kernel_ver, kernel_package_name]) | ||
341 | 351 | ||
342 | """ | 352 | """ |
343 | Create devfs: | 353 | Create devfs: |