module.bbclass: Allow for modules to be packaged seperate from ${PN}
PATCH 1/1 module.bbclass: Allow for modules to be packaged seperate from ${PN}
This patch will allow recipes that provide kernel modules to package the module or modules in specific packages. That list is contained in MODULE_PACKAGES, this defaults to to preserve the current behavior. The package can also define MODULE_FILES to specify files.
[YOCTO #3803]
--- meta/classes/module.bbclass | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
meta/classes/module.bbclass +15 -4
@@ -1,4 +1,3 @@ -RDEPENDS_${PN} += "kernel-image" DEPENDS += "virtual/kernel" inherit module-base
@@ -25,7 +24,7 @@ module_do_install() { modules_install } -pkg_postinst_${PN}_append () { +module_pkg_postinst () { if [ -z "$D" ]; then depmod -a ${KERNEL_VERSION} else
@@ -33,7 +32,7 @@ else fi } -pkg_postrm_${PN}_append () { +module_pkg_postrm () { if [ -z "$D" ]; then depmod -a ${KERNEL_VERSION} else
@@ -43,4 +42,16 @@ fi EXPORT_FUNCTIONS do_compile do_install -FILES_${PN} = "/etc /lib/modules" +MODULE_PACKAGES ?= "${PN}" + +python __anonymous() { + for package in d.getVar("MODULE_PACKAGES", True).split(): + d.appendVar("RDEPENDS_%s" % package, " kernel-image") + files = d.getVar("MODULE_FILES_%s" % package, True) or "/etc /lib/modules" + d.appendVar("FILES_%s" % package, " " + files) + d.appendVar('pkg_postinst_%s' % package, " " + d.getVar('module_pkg_postinst', True)) + d.appendVar('pkg_postrm_%s' % package, " " + d.getVar('module_pkg_postrm', True)) + if not package in d.getVar("PACKAGES", True): + d.prependVar("PACKAGES", package + " ") +} +
Signature · 1 line
1.8.0.2
Quoted 3 lines · Saul Wold
This patch will allow recipes that provide kernel modules to package the module or modules in specific packages. That list is contained in
MODULE_PACKAGES, this defaults to to preserve the current behavior.
s/to to preserve/to preserving/
Quoted 1 line
The package can also define
MODULE_FILESto specify files.
So, for example, the hello-mod recipe in meta-skeleton can remain unchanged? It will then get /lib/modules/*/hello.ko in FILES_hello-mod and MODULE_PACKAGES will be set to hello-mod. If I wanted to, hello-mod could create to modules, and package them separately by specifying two values in MODULE_PACKAGES and creating the appropriate MODULE_FILES_foo|bar entries?
Right, seems to make sense to me. What testing has this seen? Have you verified it with hello-mod?
--
Darren
Quoted 54 lines
[YOCTO #3803]
Signed-off-by Saul Wold <[email protected]>--- meta/classes/module.bbclass | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)meta/classes/module.bbclass +15
-4@@ -1,4 +1,3 @@ -RDEPENDS_${PN} += "kernel-image" DEPENDS += "virtual/kernel" inherit module-base@@ -25,7 +24,7 @@ module_do_install() { modules_install } -pkg_postinst_${PN}_append () { +module_pkg_postinst () { if [ -z "$D" ]; then depmod -a ${KERNEL_VERSION} else@@ -33,7 +32,7 @@ else fi } -pkg_postrm_${PN}_append () { +module_pkg_postrm () { if [ -z "$D" ]; then depmod -a ${KERNEL_VERSION} else@@ -43,4 +42,16 @@ fi EXPORT_FUNCTIONS do_compile do_install -FILES_${PN} = "/etc /lib/modules" +MODULE_PACKAGES ?= "${PN}" + +python __anonymous() { + for package in d.getVar("MODULE_PACKAGES", True).split(): + d.appendVar("RDEPENDS_%s" % package, " kernel-image") + files = d.getVar("MODULE_FILES_%s" % package, True) or "/etc /lib/modules" + d.appendVar("FILES_%s" % package, " " + files) + d.appendVar('pkg_postinst_%s' % package, " " + d.getVar('module_pkg_postinst', True)) + d.appendVar('pkg_postrm_%s' % package, " " + d.getVar('module_pkg_postrm', True)) + if not package in d.getVar("PACKAGES", True): + d.prependVar("PACKAGES", package + " ") +} +
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Technical Lead - Linux Kernel
Quoted 7 lines · Darren Hart
Quoted 3 lines · Saul Wold
This patch will allow recipes that provide kernel modules to package the module or modules in specific packages. That list is contained in
MODULE_PACKAGES, this defaults to to preserve the current behavior.s/to to preserve/to preserving/
Fixed in my MUT branch
Quoted 3 lines
Quoted 1 line
The package can also define
MODULE_FILESto specify files.So, for example, the hello-mod recipe in meta-skeleton can remain unchanged?
Correct, the default for MODULE_PACKAGES is "${PN}" so no changes are required.
Quoted 6 lines
It will then get
/lib/modules/*/hello.koin FILES_hello-mod andMODULE_PACKAGESwill be set to hello-mod. If I wanted to, hello-mod could create to modules, and package them separately by specifying two values inMODULE_PACKAGESand creating the appropriate MODULE_FILES_foo|bar entries?
Correct, 2 packages would be created and the files specified would be packaged into foo and bar.
Quoted 3 lines
Right, seems to make sense to me. What testing has this seen? Have you verified it with hello-mod?
I verified it with lttng-module and added MODULE_PACKAGES = "module-test" and MODULE_FILES_module-test = "/etc" and then verified packages and variables.
Sau!
Quoted 58 lines
--
DarrenQuoted 54 lines
[YOCTO #3803]
Signed-off-by Saul Wold <[email protected]>--- meta/classes/module.bbclass | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)meta/classes/module.bbclass +15
-4@@ -1,4 +1,3 @@ -RDEPENDS_${PN} += "kernel-image" DEPENDS += "virtual/kernel" inherit module-base@@ -25,7 +24,7 @@ module_do_install() { modules_install } -pkg_postinst_${PN}_append () { +module_pkg_postinst () { if [ -z "$D" ]; then depmod -a ${KERNEL_VERSION} else@@ -33,7 +32,7 @@ else fi } -pkg_postrm_${PN}_append () { +module_pkg_postrm () { if [ -z "$D" ]; then depmod -a ${KERNEL_VERSION} else@@ -43,4 +42,16 @@ fi EXPORT_FUNCTIONS do_compile do_install -FILES_${PN} = "/etc /lib/modules" +MODULE_PACKAGES ?= "${PN}" + +python __anonymous() { + for package in d.getVar("MODULE_PACKAGES", True).split(): + d.appendVar("RDEPENDS_%s" % package, " kernel-image") + files = d.getVar("MODULE_FILES_%s" % package, True) or "/etc /lib/modules" + d.appendVar("FILES_%s" % package, " " + files) + d.appendVar('pkg_postinst_%s' % package, " " + d.getVar('module_pkg_postinst', True)) + d.appendVar('pkg_postrm_%s' % package, " " + d.getVar('module_pkg_postrm', True)) + if not package in d.getVar("PACKAGES", True): + d.prependVar("PACKAGES", package + " ") +} +
Darren Hart
Acked-byQuoted 25 lines · Saul Wold
Quoted 7 lines · Darren Hart
Quoted 3 lines · Saul Wold
This patch will allow recipes that provide kernel modules to package the module or modules in specific packages. That list is contained in
MODULE_PACKAGES, this defaults to to preserve the current behavior.s/to to preserve/to preserving/
Fixed in my MUT branch
Quoted 3 lines
Quoted 1 line
The package can also define
MODULE_FILESto specify files.So, for example, the hello-mod recipe in meta-skeleton can remain unchanged?
Correct, the default for
MODULE_PACKAGESis "${PN}" so no changes are required.Quoted 6 lines
It will then get
/lib/modules/*/hello.koin FILES_hello-mod andMODULE_PACKAGESwill be set to hello-mod. If I wanted to, hello-mod could create to modules, and package them separately by specifying two values inMODULE_PACKAGESand creating the appropriate MODULE_FILES_foo|bar entries?Correct, 2 packages would be created and the files specified would be packaged into foo and bar.
Quoted 16 lines
Quoted 3 lines
Right, seems to make sense to me. What testing has this seen? Have you verified it with hello-mod?
I verified it with lttng-module and added
MODULE_PACKAGES= "module-test" and MODULE_FILES_module-test = "/etc" and then verified packages and variables.Sau!
Quoted 7 lines
--
DarrenQuoted 4 lines
[YOCTO #3803]
Signed-off-by Saul Wold <[email protected]>
Thanks Saul!
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Technical Lead - Linux Kernel