* [PATCH 1/4] depmodwrapper-cross: Take into consideration kernel package name
@ 2022-09-09 22:04 Andrei Gherzan
2022-09-09 22:04 ` [PATCH 2/4] kernel.bbclass: Pass the kernel package name to depmodwrapper Andrei Gherzan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andrei Gherzan @ 2022-09-09 22:04 UTC (permalink / raw)
To: openembedded-core; +Cc: andrei, Andrei Gherzan
From: Andrei Gherzan <andrei.gherzan@huawei.com>
depmodwrapper assumes that the kernel package name is "kernel". Since
this is configurable via KERNEL_PACKAGE_NAME variable, the wrapper can
easily look in the wrong place. This change adds an optional positional
argument that can be used to provide the kernel package name - when not
provided, it defaults to "kernel" (current behaviour).
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
.../kmod/depmodwrapper-cross_1.0.bb | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
index 303026ad78..6c0739d64f 100644
--- a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
+++ b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
@@ -21,13 +21,17 @@ do_install() {
#!/bin/sh
# Expected to be called as: depmodwrapper -a KERNEL_VERSION
if [ "\$1" != "-a" -o "\$2" != "-b" ]; then
- echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2
+ echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION [KERNEL_PACKAGE_NAME]" >&2
exit 1
fi
+kernelpkgname="kernel"
+# If no KERNEL_PACKAGE_NAME, assume "kernel".
+[ -z "\$5" ] || kernelpkgname="\$5"
+
kernelabi=""
-if [ -r "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" ]; then
- kernelabi=\$(cat "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion")
+if [ -r "${PKGDATA_DIR}/\${kernelpkgname}-depmod/\${kernelpkgname}-abiversion" ]; then
+ kernelabi=\$(cat "${PKGDATA_DIR}/\${kernelpkgname}-depmod/\${kernelpkgname}-abiversion")
fi
if [ ! -e "\$3${nonarch_base_libdir}/depmod.d/exclude.conf" ]; then
@@ -35,11 +39,11 @@ if [ ! -e "\$3${nonarch_base_libdir}/depmod.d/exclude.conf" ]; then
echo "exclude .debug" > "\$3${nonarch_base_libdir}/depmod.d/exclude.conf"
fi
-if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ] || [ "\$kernelabi" != "\$4" ]; then
- echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2
+if [ ! -r ${PKGDATA_DIR}/\${kernelpkgname}-depmod/System.map-\$4 ] || [ "\$kernelabi" != "\$4" ]; then
+ echo "Unable to read: ${PKGDATA_DIR}/\${kernelpkgname}-depmod/System.map-\$4" >&2
exec env depmod -C "\$3${nonarch_base_libdir}/depmod.d" "\$1" "\$2" "\$3" "\$4"
else
- exec env depmod -C "\$3${nonarch_base_libdir}/depmod.d" "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/kernel-depmod/System.map-\$4" "\$4"
+ exec env depmod -C "\$3${nonarch_base_libdir}/depmod.d" "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/\${kernelpkgname}-depmod/System.map-\$4" "\$4"
fi
EOF
chmod +x ${D}${bindir_crossscripts}/depmodwrapper
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/4] kernel.bbclass: Pass the kernel package name to depmodwrapper 2022-09-09 22:04 [PATCH 1/4] depmodwrapper-cross: Take into consideration kernel package name Andrei Gherzan @ 2022-09-09 22:04 ` Andrei Gherzan 2022-09-09 22:04 ` [PATCH 3/4] kernel-module-split.bbclass: " Andrei Gherzan 2022-09-09 22:04 ` [PATCH 4/4] rootfs.py: Run depmod(wrapper) against each compiled kernel Andrei Gherzan 2 siblings, 0 replies; 4+ messages in thread From: Andrei Gherzan @ 2022-09-09 22:04 UTC (permalink / raw) To: openembedded-core; +Cc: andrei, Andrei Gherzan From: Andrei Gherzan <andrei.gherzan@huawei.com> This makes sure that the postinstall script it using the right kernel paths. Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> --- meta/classes-recipe/kernel.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass index de1b80d0ae..e4e69e0763 100644 --- a/meta/classes-recipe/kernel.bbclass +++ b/meta/classes-recipe/kernel.bbclass @@ -677,7 +677,7 @@ pkg_postinst:${KERNEL_PACKAGE_NAME}-base () { mkdir -p $D/lib/modules/${KERNEL_VERSION} fi if [ -n "$D" ]; then - depmodwrapper -a -b $D ${KERNEL_VERSION} + depmodwrapper -a -b $D ${KERNEL_VERSION} ${KERNEL_PACKAGE_NAME} else depmod -a ${KERNEL_VERSION} fi -- 2.25.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/4] kernel-module-split.bbclass: Pass the kernel package name to depmodwrapper 2022-09-09 22:04 [PATCH 1/4] depmodwrapper-cross: Take into consideration kernel package name Andrei Gherzan 2022-09-09 22:04 ` [PATCH 2/4] kernel.bbclass: Pass the kernel package name to depmodwrapper Andrei Gherzan @ 2022-09-09 22:04 ` Andrei Gherzan 2022-09-09 22:04 ` [PATCH 4/4] rootfs.py: Run depmod(wrapper) against each compiled kernel Andrei Gherzan 2 siblings, 0 replies; 4+ messages in thread From: Andrei Gherzan @ 2022-09-09 22:04 UTC (permalink / raw) To: openembedded-core; +Cc: andrei, Andrei Gherzan From: Andrei Gherzan <andrei.gherzan@huawei.com> This makes sure that the postrm script it using the right kernel paths. Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> --- meta/classes-recipe/kernel-module-split.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes-recipe/kernel-module-split.bbclass b/meta/classes-recipe/kernel-module-split.bbclass index 1b4c864a63..08c2e54e86 100644 --- a/meta/classes-recipe/kernel-module-split.bbclass +++ b/meta/classes-recipe/kernel-module-split.bbclass @@ -18,7 +18,7 @@ pkg_postrm:modules () { if [ -z "$D" ]; then depmod -a ${KERNEL_VERSION} else - depmodwrapper -a -b $D ${KERNEL_VERSION} + depmodwrapper -a -b $D ${KERNEL_VERSION} ${KERNEL_PACKAGE_NAME} fi } -- 2.25.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 4/4] rootfs.py: Run depmod(wrapper) against each compiled kernel 2022-09-09 22:04 [PATCH 1/4] depmodwrapper-cross: Take into consideration kernel package name Andrei Gherzan 2022-09-09 22:04 ` [PATCH 2/4] kernel.bbclass: Pass the kernel package name to depmodwrapper Andrei Gherzan 2022-09-09 22:04 ` [PATCH 3/4] kernel-module-split.bbclass: " Andrei Gherzan @ 2022-09-09 22:04 ` Andrei Gherzan 2 siblings, 0 replies; 4+ messages in thread From: Andrei Gherzan @ 2022-09-09 22:04 UTC (permalink / raw) To: openembedded-core; +Cc: andrei, Andrei Gherzan From: Andrei Gherzan <andrei.gherzan@huawei.com> 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. Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> --- meta/lib/oe/rootfs.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 0b9911e3a6..a02dddf23d 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -325,19 +325,29 @@ class Rootfs(object, metaclass=ABCMeta): bb.note("No Kernel Modules found, not running depmod") return - kernel_abi_ver_file = oe.path.join(self.d.getVar('PKGDATA_DIR'), "kernel-depmod", - 'kernel-abiversion') - if not os.path.exists(kernel_abi_ver_file): - bb.fatal("No kernel-abiversion file found (%s), cannot run depmod, aborting" % kernel_abi_ver_file) + pkgdatadir = self.d.getVar('PKGDATA_DIR') - with open(kernel_abi_ver_file) as f: - kernel_ver = f.read().strip(' \n') + # PKGDATA_DIR can include multiple kernels so we run depmod for each + # one of them. + for direntry in os.listdir(pkgdatadir): + match = re.match('(.*)-depmod', direntry) + if not match: + continue + kernel_package_name = match.group(1) + + kernel_abi_ver_file = oe.path.join(pkgdatadir, direntry, kernel_package_name + '-abiversion') + if not os.path.exists(kernel_abi_ver_file): + bb.fatal("No kernel-abiversion file found (%s), cannot run depmod, aborting" % kernel_abi_ver_file) + + with open(kernel_abi_ver_file) as f: + kernel_ver = f.read().strip(' \n') - versioned_modules_dir = os.path.join(self.image_rootfs, modules_dir, kernel_ver) + versioned_modules_dir = os.path.join(self.image_rootfs, modules_dir, kernel_ver) - bb.utils.mkdirhier(versioned_modules_dir) + bb.utils.mkdirhier(versioned_modules_dir) - self._exec_shell_cmd(['depmodwrapper', '-a', '-b', self.image_rootfs, kernel_ver]) + bb.note("Running depmodwrapper for %s ..." % versioned_modules_dir) + self._exec_shell_cmd(['depmodwrapper', '-a', '-b', self.image_rootfs, kernel_ver, kernel_package_name]) """ Create devfs: -- 2.25.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-09 22:04 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-09-09 22:04 [PATCH 1/4] depmodwrapper-cross: Take into consideration kernel package name Andrei Gherzan 2022-09-09 22:04 ` [PATCH 2/4] kernel.bbclass: Pass the kernel package name to depmodwrapper Andrei Gherzan 2022-09-09 22:04 ` [PATCH 3/4] kernel-module-split.bbclass: " Andrei Gherzan 2022-09-09 22:04 ` [PATCH 4/4] rootfs.py: Run depmod(wrapper) against each compiled kernel Andrei Gherzan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox