Message ID | 20220209173036.3823144-2-ross.burton@arm.com |
---|---|
State | New |
Headers | show |
Series | [1/2] package: add extra_recommends to do_split_package() | expand |
On Wed, Feb 9, 2022 at 12:30 PM Ross Burton <ross.burton@arm.com> wrote: > > Currently each split-out kernel module RDEPENDS on the top-level kernel > package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems > correct, as modules obviously need their matching kernel, there are many > situations where the kernel is provided out-of-band and forcing the > kernel in via RDEPENDS in the wrong thing to do, for example an > initramfs really shouldn't contain a kernel image, but can contain > kernel modules. > > Change the module splitting logic to use RRECOMMENDS instead of > RDEPENDS, and tighten the dependency to kernel-image instead of kernel > to pull in just the image, which also means PACKAGE_EXCLUDE = > "kernel-image-*" is sufficient to ensure the image doesn't get pulled > into an image. > As much as I hate to suggest it, I think the strength of the image dependency needs to be configurable. I know of situations were rrecommends are disabled AND they use quite a few out of tree modules. While I can't say that they are counting on RDEPENDS heavily in this situation, I also can't rule it out .. so this is a breaking change in behaviour for those configurations. That being said, if RP doesn't want/like a conditional at this particular spot, I can understand that as well .. and am happy to be ignored in that case :) Bruce > Signed-off-by: Ross Burton <ross.burton@arm.com> > --- > meta/classes/kernel-module-split.bbclass | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass > index a29c294810e..4429fee4b51 100644 > --- a/meta/classes/kernel-module-split.bbclass > +++ b/meta/classes/kernel-module-split.bbclass > @@ -175,7 +175,7 @@ python split_kernel_module_packages () { > module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') > module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix > > - 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)) > + 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_recommends='%s-image-%s' % (kernel_package_name, kernel_version)) > if modules: > d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules)) > > -- > 2.25.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
On Wed, Feb 9, 2022 at 9:36 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote: > > On Wed, Feb 9, 2022 at 12:30 PM Ross Burton <ross.burton@arm.com> wrote: > > > > Currently each split-out kernel module RDEPENDS on the top-level kernel > > package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems > > correct, as modules obviously need their matching kernel, there are many > > situations where the kernel is provided out-of-band and forcing the > > kernel in via RDEPENDS in the wrong thing to do, for example an > > initramfs really shouldn't contain a kernel image, but can contain > > kernel modules. > > > > Change the module splitting logic to use RRECOMMENDS instead of > > RDEPENDS, and tighten the dependency to kernel-image instead of kernel > > to pull in just the image, which also means PACKAGE_EXCLUDE = > > "kernel-image-*" is sufficient to ensure the image doesn't get pulled > > into an image. > > > > As much as I hate to suggest it, I think the strength of the image > dependency needs to be configurable. I know of situations were > rrecommends are disabled AND they use quite a few out of tree > modules. While I can't say that they are counting on RDEPENDS > heavily in this situation, I also can't rule it out .. so this is a breaking > change in behaviour for those configurations. > > That being said, if RP doesn't want/like a conditional at this particular > spot, I can understand that as well .. and am happy to be ignored > in that case :) I see that this change eases container image generation. I would be inclined to support this change. > > Bruce > > > Signed-off-by: Ross Burton <ross.burton@arm.com> > > --- > > meta/classes/kernel-module-split.bbclass | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass > > index a29c294810e..4429fee4b51 100644 > > --- a/meta/classes/kernel-module-split.bbclass > > +++ b/meta/classes/kernel-module-split.bbclass > > @@ -175,7 +175,7 @@ python split_kernel_module_packages () { > > module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') > > module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix > > > > - 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)) > > + 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_recommends='%s-image-%s' % (kernel_package_name, kernel_version)) > > if modules: > > d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules)) > > > > -- > > 2.25.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 (#161577): https://lists.openembedded.org/g/openembedded-core/message/161577 > Mute This Topic: https://lists.openembedded.org/mt/89026749/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
On Wed, Feb 9, 2022 at 12:57 PM Khem Raj <raj.khem@gmail.com> wrote: > > On Wed, Feb 9, 2022 at 9:36 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote: > > > > On Wed, Feb 9, 2022 at 12:30 PM Ross Burton <ross.burton@arm.com> wrote: > > > > > > Currently each split-out kernel module RDEPENDS on the top-level kernel > > > package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems > > > correct, as modules obviously need their matching kernel, there are many > > > situations where the kernel is provided out-of-band and forcing the > > > kernel in via RDEPENDS in the wrong thing to do, for example an > > > initramfs really shouldn't contain a kernel image, but can contain > > > kernel modules. > > > > > > Change the module splitting logic to use RRECOMMENDS instead of > > > RDEPENDS, and tighten the dependency to kernel-image instead of kernel > > > to pull in just the image, which also means PACKAGE_EXCLUDE = > > > "kernel-image-*" is sufficient to ensure the image doesn't get pulled > > > into an image. > > > > > > > As much as I hate to suggest it, I think the strength of the image > > dependency needs to be configurable. I know of situations were > > rrecommends are disabled AND they use quite a few out of tree > > modules. While I can't say that they are counting on RDEPENDS > > heavily in this situation, I also can't rule it out .. so this is a breaking > > change in behaviour for those configurations. > > > > That being said, if RP doesn't want/like a conditional at this particular > > spot, I can understand that as well .. and am happy to be ignored > > in that case :) > > I see that this change eases container image generation. I would be inclined > to support this change. To be clear, i think the change is fine as well .. I'm simply saying, it should be configurable, as we are potential breaking the existing use case for another. Cheers, Bruce > > > > > Bruce > > > > > Signed-off-by: Ross Burton <ross.burton@arm.com> > > > --- > > > meta/classes/kernel-module-split.bbclass | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass > > > index a29c294810e..4429fee4b51 100644 > > > --- a/meta/classes/kernel-module-split.bbclass > > > +++ b/meta/classes/kernel-module-split.bbclass > > > @@ -175,7 +175,7 @@ python split_kernel_module_packages () { > > > module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') > > > module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix > > > > > > - 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)) > > > + 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_recommends='%s-image-%s' % (kernel_package_name, kernel_version)) > > > if modules: > > > d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules)) > > > > > > -- > > > 2.25.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 (#161577): https://lists.openembedded.org/g/openembedded-core/message/161577 > > Mute This Topic: https://lists.openembedded.org/mt/89026749/1997914 > > Group Owner: openembedded-core+owner@lists.openembedded.org > > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > > -=-=-=-=-=-=-=-=-=-=-=- > >
On Wed, 2022-02-09 at 12:36 -0500, Bruce Ashfield wrote: > On Wed, Feb 9, 2022 at 12:30 PM Ross Burton <ross.burton@arm.com> wrote: > > > > Currently each split-out kernel module RDEPENDS on the top-level kernel > > package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems > > correct, as modules obviously need their matching kernel, there are many > > situations where the kernel is provided out-of-band and forcing the > > kernel in via RDEPENDS in the wrong thing to do, for example an > > initramfs really shouldn't contain a kernel image, but can contain > > kernel modules. > > > > Change the module splitting logic to use RRECOMMENDS instead of > > RDEPENDS, and tighten the dependency to kernel-image instead of kernel > > to pull in just the image, which also means PACKAGE_EXCLUDE = > > "kernel-image-*" is sufficient to ensure the image doesn't get pulled > > into an image. > > > > As much as I hate to suggest it, I think the strength of the image > dependency needs to be configurable. I know of situations were > rrecommends are disabled AND they use quite a few out of tree > modules. While I can't say that they are counting on RDEPENDS > heavily in this situation, I also can't rule it out .. so this is a breaking > change in behaviour for those configurations. > > That being said, if RP doesn't want/like a conditional at this particular > spot, I can understand that as well .. and am happy to be ignored > in that case :) Isn't there a case where the main kernel "image" package is empty so you just have to break the dependency at the main image level rather than messing with the modules? or am I half remembering something badly? Cheers, Richard
On Wed, Feb 9, 2022 at 2:13 PM Richard Purdie <richard.purdie@linuxfoundation.org> wrote: > > On Wed, 2022-02-09 at 12:36 -0500, Bruce Ashfield wrote: > > On Wed, Feb 9, 2022 at 12:30 PM Ross Burton <ross.burton@arm.com> wrote: > > > > > > Currently each split-out kernel module RDEPENDS on the top-level kernel > > > package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems > > > correct, as modules obviously need their matching kernel, there are many > > > situations where the kernel is provided out-of-band and forcing the > > > kernel in via RDEPENDS in the wrong thing to do, for example an > > > initramfs really shouldn't contain a kernel image, but can contain > > > kernel modules. > > > > > > Change the module splitting logic to use RRECOMMENDS instead of > > > RDEPENDS, and tighten the dependency to kernel-image instead of kernel > > > to pull in just the image, which also means PACKAGE_EXCLUDE = > > > "kernel-image-*" is sufficient to ensure the image doesn't get pulled > > > into an image. > > > > > > > As much as I hate to suggest it, I think the strength of the image > > dependency needs to be configurable. I know of situations were > > rrecommends are disabled AND they use quite a few out of tree > > modules. While I can't say that they are counting on RDEPENDS > > heavily in this situation, I also can't rule it out .. so this is a breaking > > change in behaviour for those configurations. > > > > That being said, if RP doesn't want/like a conditional at this particular > > spot, I can understand that as well .. and am happy to be ignored > > in that case :) > > Isn't there a case where the main kernel "image" package is empty so you just > have to break the dependency at the main image level rather than messing with > the modules? or am I half remembering something badly? I've always just used this (from kernel.bbclass): # Allow machines to override this dependency if kernel image files are # not wanted in images as standard RDEPENDS:${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image (= ${EXTENDPKGV})" Maybe that's the one you are remembering ? Bruce > > Cheers, > > Richard >
On Wed, 9 Feb 2022 at 20:10, Bruce Ashfield <bruce.ashfield@gmail.com> wrote: > I've always just used this (from kernel.bbclass): > > # Allow machines to override this dependency if kernel image files are > # not wanted in images as standard > RDEPENDS:${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image > (= ${EXTENDPKGV})" > > Maybe that's the one you are remembering ? Obviously this won't work in the situations where you want a normal image with a kernel but also a initramfs with a kernel module in it, as that behaviour isn't machine specific but image specific. If this was a recommends then it could be removed via PACKAGE_EXCLUDE, but we'd need to be sure that nothing from the kernel ended up getting pulled in via a single module. Ross
On Thu, 2022-02-10 at 10:52 +0000, Ross Burton wrote: > On Wed, 9 Feb 2022 at 20:10, Bruce Ashfield <bruce.ashfield@gmail.com> wrote: > > I've always just used this (from kernel.bbclass): > > > > # Allow machines to override this dependency if kernel image files are > > # not wanted in images as standard > > RDEPENDS:${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image > > (= ${EXTENDPKGV})" > > > > Maybe that's the one you are remembering ? > > Obviously this won't work in the situations where you want a normal > image with a kernel but also a initramfs with a kernel module in it, > as that behaviour isn't machine specific but image specific. > > If this was a recommends then it could be removed via PACKAGE_EXCLUDE, > but we'd need to be sure that nothing from the kernel ended up getting > pulled in via a single module. I think making this a RRECOMMENDS and doing that may enable more workflows and make things easier all around. Can you check and see if it does pull other unwanted stuff in? I'm hoping it doesn't. Cheers, Richard
On Thu, 10 Feb 2022 at 10:54, Richard Purdie <richard.purdie@linuxfoundation.org> wrote: > > Obviously this won't work in the situations where you want a normal > > image with a kernel but also a initramfs with a kernel module in it, > > as that behaviour isn't machine specific but image specific. > > > > If this was a recommends then it could be removed via PACKAGE_EXCLUDE, > > but we'd need to be sure that nothing from the kernel ended up getting > > pulled in via a single module. > > I think making this a RRECOMMENDS and doing that may enable more workflows and > make things easier all around. Can you check and see if it does pull other > unwanted stuff in? I'm hoping it doesn't. Tested. Our initramfs pulls in a kernel module, and PACKAGE_EXCLUDE=kernel-image-* stops the image itself being pulled in. It does pull in the kernel-5.15-yocto-standard package, but that just contains a few module config files. Patch incoming! Ross
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass index a29c294810e..4429fee4b51 100644 --- a/meta/classes/kernel-module-split.bbclass +++ b/meta/classes/kernel-module-split.bbclass @@ -175,7 +175,7 @@ python split_kernel_module_packages () { module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix - 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)) + 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_recommends='%s-image-%s' % (kernel_package_name, kernel_version)) if modules: d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
Currently each split-out kernel module RDEPENDS on the top-level kernel package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems correct, as modules obviously need their matching kernel, there are many situations where the kernel is provided out-of-band and forcing the kernel in via RDEPENDS in the wrong thing to do, for example an initramfs really shouldn't contain a kernel image, but can contain kernel modules. Change the module splitting logic to use RRECOMMENDS instead of RDEPENDS, and tighten the dependency to kernel-image instead of kernel to pull in just the image, which also means PACKAGE_EXCLUDE = "kernel-image-*" is sufficient to ensure the image doesn't get pulled into an image. Signed-off-by: Ross Burton <ross.burton@arm.com> --- meta/classes/kernel-module-split.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)