On Mon, Aug 23, 2021 at 8:23 AM Zoltan Boszormenyi via
lists.openembedded.org <[email protected]> wrote:
>
> From: Zoltán Böszörményi <[email protected]>
>
> For some use cases, a monolithic kernel-modules package containing
> all modules built from the kernel sources may be preferred.
> For one, download time is shorter and installation time is faster.
>

There's still an outstanding issue though. Unless you generate the
provides/rdepends along with the monolithic package, any existing
rdepends on kernel modules break.

While that likely isn't something you hit in your use case, it would
be something that would have to be covered to make this part of core.

About 7 years ago, I was most of the way through a similar change,
that created on large package with all the rprovides generated (I'm
not sure I can track it down now, but I could have a look), since
doing an on target update with thousands of kernel module package is
very painful.

Cheers,

Bruce

> Set KERNEL_SPLIT_MODULES="0" for this.
>
> The default is one subpackage per module.
>
> Signed-off-by: Zoltán Böszörményi <[email protected]>
> ---
>  meta/classes/kernel-module-split.bbclass | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes/kernel-module-split.bbclass 
> b/meta/classes/kernel-module-split.bbclass
> index 6c1de4c992..a29c294810 100644
> --- a/meta/classes/kernel-module-split.bbclass
> +++ b/meta/classes/kernel-module-split.bbclass
> @@ -28,6 +28,7 @@ do_install:append() {
>         install -d ${D}${sysconfdir}/modules-load.d/ 
> ${D}${sysconfdir}/modprobe.d/
>  }
>
> +KERNEL_SPLIT_MODULES ?= "1"
>  PACKAGESPLITFUNCS:prepend = "split_kernel_module_packages "
>
>  KERNEL_MODULES_META_PACKAGE ?= "${@ d.getVar("KERNEL_PACKAGE_NAME") or 
> "kernel" }-modules"
> @@ -156,18 +157,26 @@ python split_kernel_module_packages () {
>      kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel"
>      kernel_version = d.getVar("KERNEL_VERSION")
>
> +    metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE')
> +    splitmods = d.getVar('KERNEL_SPLIT_MODULES')
> +    postinst = d.getVar('pkg_postinst:modules')
> +    postrm = d.getVar('pkg_postrm:modules')
> +
> +    if splitmods != '1':
> +        etcdir = d.getVar('sysconfdir')
> +        d.appendVar('FILES:' + metapkg, '%s/modules-load.d/ %s/modprobe.d/ 
> %s/modules/' % (etcdir, etcdir, d.getVar("nonarch_base_libdir")))
> +        d.appendVar('pkg_postinst:%s' % metapkg, postinst)
> +        d.prependVar('pkg_postrm:%s' % metapkg, postrm);
> +        return
> +
>      module_regex = r'^(.*)\.k?o(?:\.(gz|xz|zst))?$'
>
>      module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX')
>      module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
>      module_pattern = module_pattern_prefix + kernel_package_name + 
> '-module-%s' + module_pattern_suffix
>
> -    postinst = d.getVar('pkg_postinst:modules')
> -    postrm = d.getVar('pkg_postrm:modules')
> -
>      modules = do_split_packages(d, root='${nonarch_base_libdir}/modules', 
> file_regex=module_regex, output_pattern=module_pattern, description='%s 
> kernel module', postinst=postinst, postrm=postrm, recursive=True, 
> hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, 
> kernel_version))
>      if modules:
> -        metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE')
>          d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
>
>      # If modules-load.d and modprobe.d are empty at this point, remove them 
> to
> --
> 2.31.1
>
>
> 
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#155152): 
https://lists.openembedded.org/g/openembedded-core/message/155152
Mute This Topic: https://lists.openembedded.org/mt/85083968/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to