* [PATCH] module.bbclass: check whether CONFIG_MODULES set
@ 2026-02-04 2:09 kai.kang
2026-02-04 13:46 ` [OE-core] " Bruce Ashfield
0 siblings, 1 reply; 11+ messages in thread
From: kai.kang @ 2026-02-04 2:09 UTC (permalink / raw)
To: openembedded-core
From: Kai Kang <kai.kang@windriver.com>
Check whether kernel config CONFIG_MODULES set or not before do_compile
and do_install in module.bbclass. If not set, it cannot build and
install external modules.
Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
meta/classes-recipe/module.bbclass | 60 +++++++++++++++++-------------
1 file changed, 34 insertions(+), 26 deletions(-)
diff --git a/meta/classes-recipe/module.bbclass b/meta/classes-recipe/module.bbclass
index 4948e995c5..d2b90e9c2c 100644
--- a/meta/classes-recipe/module.bbclass
+++ b/meta/classes-recipe/module.bbclass
@@ -47,37 +47,45 @@ python do_devshell:prepend () {
}
module_do_compile() {
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
- oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \
- KERNEL_VERSION=${KERNEL_VERSION} \
- CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
- AR="${KERNEL_AR}" OBJCOPY="${KERNEL_OBJCOPY}" \
- STRIP="${KERNEL_STRIP}" \
- O=${STAGING_KERNEL_BUILDDIR} \
- KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
- ${MAKE_TARGETS}
+ if grep -q -i '^CONFIG_MODULES=y$' ${STAGING_KERNEL_BUILDDIR}/.config ; then
+ unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
+ oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \
+ KERNEL_VERSION=${KERNEL_VERSION} \
+ CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
+ AR="${KERNEL_AR}" OBJCOPY="${KERNEL_OBJCOPY}" \
+ STRIP="${KERNEL_STRIP}" \
+ O=${STAGING_KERNEL_BUILDDIR} \
+ KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
+ ${MAKE_TARGETS}
+ else
+ bbnote "The present kernel disabled CONFIG_MODULES that cannot build or install external modules."
+ fi
}
module_do_install() {
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
- oe_runmake DEPMOD=echo MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \
- INSTALL_FW_PATH="${D}${nonarch_base_libdir}/firmware" \
- CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" \
- STRIP="${KERNEL_STRIP}" \
- O=${STAGING_KERNEL_BUILDDIR} \
- KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
- ${MODULES_INSTALL_TARGET}
+ if grep -q -i '^CONFIG_MODULES=y$' ${STAGING_KERNEL_BUILDDIR}/.config; then
+ unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
+ oe_runmake DEPMOD=echo MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \
+ INSTALL_FW_PATH="${D}${nonarch_base_libdir}/firmware" \
+ CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" \
+ STRIP="${KERNEL_STRIP}" \
+ O=${STAGING_KERNEL_BUILDDIR} \
+ KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
+ ${MODULES_INSTALL_TARGET}
- if [ ! -e "${B}/${MODULES_MODULE_SYMVERS_LOCATION}/Module.symvers" ] ; then
- bbwarn "Module.symvers not found in ${B}/${MODULES_MODULE_SYMVERS_LOCATION}"
- bbwarn "Please consider setting MODULES_MODULE_SYMVERS_LOCATION to a"
- bbwarn "directory below B to get correct inter-module dependencies"
+ if [ ! -e "${B}/${MODULES_MODULE_SYMVERS_LOCATION}/Module.symvers" ] ; then
+ bbwarn "Module.symvers not found in ${B}/${MODULES_MODULE_SYMVERS_LOCATION}"
+ bbwarn "Please consider setting MODULES_MODULE_SYMVERS_LOCATION to a"
+ bbwarn "directory below B to get correct inter-module dependencies"
+ else
+ install -Dm0644 "${B}/${MODULES_MODULE_SYMVERS_LOCATION}"/Module.symvers ${D}${includedir}/${BPN}/Module.symvers
+ # Module.symvers contains absolute path to the build directory.
+ # While it doesn't actually seem to matter which path is specified,
+ # clear them out to avoid confusion
+ sed -e 's:${B}/::g' -i ${D}${includedir}/${BPN}/Module.symvers
+ fi
else
- install -Dm0644 "${B}/${MODULES_MODULE_SYMVERS_LOCATION}"/Module.symvers ${D}${includedir}/${BPN}/Module.symvers
- # Module.symvers contains absolute path to the build directory.
- # While it doesn't actually seem to matter which path is specified,
- # clear them out to avoid confusion
- sed -e 's:${B}/::g' -i ${D}${includedir}/${BPN}/Module.symvers
+ bbnote "The present kernel disabled CONFIG_MODULES that cannot build or install external modules."
fi
}
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-04 2:09 [PATCH] module.bbclass: check whether CONFIG_MODULES set kai.kang
@ 2026-02-04 13:46 ` Bruce Ashfield
2026-02-04 13:58 ` Richard Purdie
0 siblings, 1 reply; 11+ messages in thread
From: Bruce Ashfield @ 2026-02-04 13:46 UTC (permalink / raw)
To: kai.kang; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 6115 bytes --]
On Tue, Feb 3, 2026 at 9:09 PM Kai Kang via lists.openembedded.org
<kai.kang=windriver.com@lists.openembedded.org> wrote:
> From: Kai Kang <kai.kang@windriver.com>
>
> Check whether kernel config CONFIG_MODULES set or not before do_compile
> and do_install in module.bbclass. If not set, it cannot build and
> install external modules.
>
This isn't the place to do that check.
If modules are disabled get modules_do_compile out of the tasks.
Bruce
>
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
> meta/classes-recipe/module.bbclass | 60 +++++++++++++++++-------------
> 1 file changed, 34 insertions(+), 26 deletions(-)
>
> diff --git a/meta/classes-recipe/module.bbclass
> b/meta/classes-recipe/module.bbclass
> index 4948e995c5..d2b90e9c2c 100644
> --- a/meta/classes-recipe/module.bbclass
> +++ b/meta/classes-recipe/module.bbclass
> @@ -47,37 +47,45 @@ python do_devshell:prepend () {
> }
>
> module_do_compile() {
> - unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
> - oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \
> - KERNEL_VERSION=${KERNEL_VERSION} \
> - CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
> - AR="${KERNEL_AR}" OBJCOPY="${KERNEL_OBJCOPY}" \
> - STRIP="${KERNEL_STRIP}" \
> - O=${STAGING_KERNEL_BUILDDIR} \
> - KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
> - ${MAKE_TARGETS}
> + if grep -q -i '^CONFIG_MODULES=y$'
> ${STAGING_KERNEL_BUILDDIR}/.config ; then
> + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
> + oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \
> + KERNEL_VERSION=${KERNEL_VERSION} \
> + CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
> + AR="${KERNEL_AR}" OBJCOPY="${KERNEL_OBJCOPY}" \
> + STRIP="${KERNEL_STRIP}" \
> + O=${STAGING_KERNEL_BUILDDIR} \
> + KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
> + ${MAKE_TARGETS}
> + else
> + bbnote "The present kernel disabled CONFIG_MODULES that
> cannot build or install external modules."
> + fi
> }
>
> module_do_install() {
> - unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
> - oe_runmake DEPMOD=echo
> MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \
> - INSTALL_FW_PATH="${D}${nonarch_base_libdir}/firmware" \
> - CC="${KERNEL_CC}" LD="${KERNEL_LD}"
> OBJCOPY="${KERNEL_OBJCOPY}" \
> - STRIP="${KERNEL_STRIP}" \
> - O=${STAGING_KERNEL_BUILDDIR} \
> - KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
> - ${MODULES_INSTALL_TARGET}
> + if grep -q -i '^CONFIG_MODULES=y$'
> ${STAGING_KERNEL_BUILDDIR}/.config; then
> + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
> + oe_runmake DEPMOD=echo
> MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \
> +
> INSTALL_FW_PATH="${D}${nonarch_base_libdir}/firmware" \
> + CC="${KERNEL_CC}" LD="${KERNEL_LD}"
> OBJCOPY="${KERNEL_OBJCOPY}" \
> + STRIP="${KERNEL_STRIP}" \
> + O=${STAGING_KERNEL_BUILDDIR} \
> + KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
> + ${MODULES_INSTALL_TARGET}
>
> - if [ ! -e "${B}/${MODULES_MODULE_SYMVERS_LOCATION}/Module.symvers"
> ] ; then
> - bbwarn "Module.symvers not found in
> ${B}/${MODULES_MODULE_SYMVERS_LOCATION}"
> - bbwarn "Please consider setting
> MODULES_MODULE_SYMVERS_LOCATION to a"
> - bbwarn "directory below B to get correct inter-module
> dependencies"
> + if [ ! -e
> "${B}/${MODULES_MODULE_SYMVERS_LOCATION}/Module.symvers" ] ; then
> + bbwarn "Module.symvers not found in
> ${B}/${MODULES_MODULE_SYMVERS_LOCATION}"
> + bbwarn "Please consider setting
> MODULES_MODULE_SYMVERS_LOCATION to a"
> + bbwarn "directory below B to get correct
> inter-module dependencies"
> + else
> + install -Dm0644
> "${B}/${MODULES_MODULE_SYMVERS_LOCATION}"/Module.symvers
> ${D}${includedir}/${BPN}/Module.symvers
> + # Module.symvers contains absolute path to the
> build directory.
> + # While it doesn't actually seem to matter which
> path is specified,
> + # clear them out to avoid confusion
> + sed -e 's:${B}/::g' -i
> ${D}${includedir}/${BPN}/Module.symvers
> + fi
> else
> - install -Dm0644
> "${B}/${MODULES_MODULE_SYMVERS_LOCATION}"/Module.symvers
> ${D}${includedir}/${BPN}/Module.symvers
> - # Module.symvers contains absolute path to the build
> directory.
> - # While it doesn't actually seem to matter which path is
> specified,
> - # clear them out to avoid confusion
> - sed -e 's:${B}/::g' -i
> ${D}${includedir}/${BPN}/Module.symvers
> + bbnote "The present kernel disabled CONFIG_MODULES that
> cannot build or install external modules."
> fi
> }
>
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#230492):
> https://lists.openembedded.org/g/openembedded-core/message/230492
> Mute This Topic: https://lists.openembedded.org/mt/117627823/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
[-- Attachment #2: Type: text/html, Size: 8907 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-04 13:46 ` [OE-core] " Bruce Ashfield
@ 2026-02-04 13:58 ` Richard Purdie
2026-02-04 14:02 ` Bruce Ashfield
0 siblings, 1 reply; 11+ messages in thread
From: Richard Purdie @ 2026-02-04 13:58 UTC (permalink / raw)
To: bruce.ashfield, kai.kang; +Cc: openembedded-core
On Wed, 2026-02-04 at 08:46 -0500, Bruce Ashfield via lists.openembedded.org wrote:
>
>
> On Tue, Feb 3, 2026 at 9:09 PM Kai Kang via lists.openembedded.org <kai.kang=windriver.com@lists.openembedded.org> wrote:
> > From: Kai Kang <kai.kang@windriver.com>
> >
> > Check whether kernel config CONFIG_MODULES set or not before do_compile
> > and do_install in module.bbclass. If not set, it cannot build and
> > install external modules.
> >
>
>
> This isn't the place to do that check.
>
> If modules are disabled get modules_do_compile out of the tasks.
Does it make sense to have something including module.bbclass which
doesn't have CONFIG_MODULES set?
Cheers,
Richard
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-04 13:58 ` Richard Purdie
@ 2026-02-04 14:02 ` Bruce Ashfield
2026-02-04 14:05 ` Richard Purdie
0 siblings, 1 reply; 11+ messages in thread
From: Bruce Ashfield @ 2026-02-04 14:02 UTC (permalink / raw)
To: Richard Purdie; +Cc: kai.kang, openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]
On Wed, Feb 4, 2026 at 8:58 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:
> On Wed, 2026-02-04 at 08:46 -0500, Bruce Ashfield via
> lists.openembedded.org wrote:
> >
> >
> > On Tue, Feb 3, 2026 at 9:09 PM Kai Kang via lists.openembedded.org
> <kai.kang=windriver.com@lists.openembedded.org> wrote:
> > > From: Kai Kang <kai.kang@windriver.com>
> > >
> > > Check whether kernel config CONFIG_MODULES set or not before do_compile
> > > and do_install in module.bbclass. If not set, it cannot build and
> > > install external modules.
> > >
> >
> >
> > This isn't the place to do that check.
> >
> > If modules are disabled get modules_do_compile out of the tasks.
>
> Does it make sense to have something including module.bbclass which
> doesn't have CONFIG_MODULES set?
>
Yes, that's what I'm trying to say.
Don't even include it if you can't build modules. That puts
the conditional in a single place, and keeps the code cleaner
in the class.
Bruce
>
> Cheers,
>
> Richard
>
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
[-- Attachment #2: Type: text/html, Size: 2719 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-04 14:02 ` Bruce Ashfield
@ 2026-02-04 14:05 ` Richard Purdie
2026-02-04 14:10 ` Bruce Ashfield
0 siblings, 1 reply; 11+ messages in thread
From: Richard Purdie @ 2026-02-04 14:05 UTC (permalink / raw)
To: Bruce Ashfield; +Cc: kai.kang, openembedded-core
On Wed, 2026-02-04 at 09:02 -0500, Bruce Ashfield wrote:
> On Wed, Feb 4, 2026 at 8:58 AM Richard Purdie <richard.purdie@linuxfoundation.org> wrote:
> > On Wed, 2026-02-04 at 08:46 -0500, Bruce Ashfield via lists.openembedded.org wrote:
> > > On Tue, Feb 3, 2026 at 9:09 PM Kai Kang via lists.openembedded.org <kai.kang=windriver.com@lists.openembedded.org> wrote:
> > > > From: Kai Kang <kai.kang@windriver.com>
> > > >
> > > > Check whether kernel config CONFIG_MODULES set or not before do_compile
> > > > and do_install in module.bbclass. If not set, it cannot build and
> > > > install external modules.
> > > >
> > >
> > >
> > > This isn't the place to do that check.
> > >
> > > If modules are disabled get modules_do_compile out of the tasks.
> >
> > Does it make sense to have something including module.bbclass which
> > doesn't have CONFIG_MODULES set?
>
> Yes, that's what I'm trying to say.
>
> Don't even include it if you can't build modules. That puts
> the conditional in a single place, and keeps the code cleaner
> in the class.
I think we're talking cross purposes a bit.
The issue is that if you ever reach do_compile in something using
module.bbclass which does not have CONFIG_MODULES set, that is a
problem and a hard error.
So I'd argue that:
* we only need the check in do_compile
* it should be a fatal exit hard error, not a warning
which means the patch needs tweaking but not as you're suggesting.
I'm not sure skipping the tasks makes sense, I think what we're needing
is a sanity check for a configuration which stops the build if it ever
happens.
The rust check would then be similar. Stop and error if the
configuration would never work/doesn't make sense.
Cheers,
Richard
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-04 14:05 ` Richard Purdie
@ 2026-02-04 14:10 ` Bruce Ashfield
2026-02-04 15:53 ` Richard Purdie
0 siblings, 1 reply; 11+ messages in thread
From: Bruce Ashfield @ 2026-02-04 14:10 UTC (permalink / raw)
To: Richard Purdie; +Cc: kai.kang, openembedded-core
[-- Attachment #1: Type: text/plain, Size: 2331 bytes --]
On Wed, Feb 4, 2026 at 9:05 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:
> On Wed, 2026-02-04 at 09:02 -0500, Bruce Ashfield wrote:
> > On Wed, Feb 4, 2026 at 8:58 AM Richard Purdie <
> richard.purdie@linuxfoundation.org> wrote:
> > > On Wed, 2026-02-04 at 08:46 -0500, Bruce Ashfield via
> lists.openembedded.org wrote:
> > > > On Tue, Feb 3, 2026 at 9:09 PM Kai Kang via lists.openembedded.org
> <kai.kang=windriver.com@lists.openembedded.org> wrote:
> > > > > From: Kai Kang <kai.kang@windriver.com>
> > > > >
> > > > > Check whether kernel config CONFIG_MODULES set or not before
> do_compile
> > > > > and do_install in module.bbclass. If not set, it cannot build and
> > > > > install external modules.
> > > > >
> > > >
> > > >
> > > > This isn't the place to do that check.
> > > >
> > > > If modules are disabled get modules_do_compile out of the tasks.
> > >
> > > Does it make sense to have something including module.bbclass which
> > > doesn't have CONFIG_MODULES set?
> >
> > Yes, that's what I'm trying to say.
> >
> > Don't even include it if you can't build modules. That puts
> > the conditional in a single place, and keeps the code cleaner
> > in the class.
>
> I think we're talking cross purposes a bit.
>
> The issue is that if you ever reach do_compile in something using
> module.bbclass which does not have CONFIG_MODULES set, that is a
> problem and a hard error.
>
> So I'd argue that:
>
> * we only need the check in do_compile
> * it should be a fatal exit hard error, not a warning
>
> which means the patch needs tweaking but not as you're suggesting.
>
>
I don't have a strong opinion, so won't object.
I just don't think adding any conditionals for module support in
moduldes.bbclass makes sense. So one versus two checks
is a wash for me.
Bruce
> I'm not sure skipping the tasks makes sense, I think what we're needing
> is a sanity check for a configuration which stops the build if it ever
> happens.
>
> The rust check would then be similar. Stop and error if the
> configuration would never work/doesn't make sense.
>
> Cheers,
>
> Richard
>
>
>
>
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
[-- Attachment #2: Type: text/html, Size: 4151 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-04 14:10 ` Bruce Ashfield
@ 2026-02-04 15:53 ` Richard Purdie
2026-02-05 9:08 ` Kai
0 siblings, 1 reply; 11+ messages in thread
From: Richard Purdie @ 2026-02-04 15:53 UTC (permalink / raw)
To: Bruce Ashfield; +Cc: kai.kang, openembedded-core
On Wed, 2026-02-04 at 09:10 -0500, Bruce Ashfield wrote:
>
>
> On Wed, Feb 4, 2026 at 9:05 AM Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > On Wed, 2026-02-04 at 09:02 -0500, Bruce Ashfield wrote:
> > > On Wed, Feb 4, 2026 at 8:58 AM Richard Purdie
> > > <richard.purdie@linuxfoundation.org> wrote:
> > > > On Wed, 2026-02-04 at 08:46 -0500, Bruce Ashfield via
> > > > lists.openembedded.org wrote:
> > > > > On Tue, Feb 3, 2026 at 9:09 PM Kai Kang via
> > > > > lists.openembedded.org
> > > > > <kai.kang=windriver.com@lists.openembedded.org> wrote:
> > > > > > From: Kai Kang <kai.kang@windriver.com>
> > > > > >
> > > > > > Check whether kernel config CONFIG_MODULES set or not
> > > > > > before do_compile
> > > > > > and do_install in module.bbclass. If not set, it cannot
> > > > > > build and
> > > > > > install external modules.
> > > > > >
> > > > >
> > > > >
> > > > > This isn't the place to do that check.
> > > > >
> > > > > If modules are disabled get modules_do_compile out of the
> > > > > tasks.
> > > >
> > > > Does it make sense to have something including module.bbclass
> > > > which
> > > > doesn't have CONFIG_MODULES set?
> > >
> > > Yes, that's what I'm trying to say.
> > >
> > > Don't even include it if you can't build modules. That puts
> > > the conditional in a single place, and keeps the code cleaner
> > > in the class.
> >
> > I think we're talking cross purposes a bit.
> >
> > The issue is that if you ever reach do_compile in something using
> > module.bbclass which does not have CONFIG_MODULES set, that is a
> > problem and a hard error.
> >
> > So I'd argue that:
> >
> > * we only need the check in do_compile
> > * it should be a fatal exit hard error, not a warning
> >
> > which means the patch needs tweaking but not as you're suggesting.
> >
> >
>
>
> I don't have a strong opinion, so won't object.
>
> I just don't think adding any conditionals for module support in
> moduldes.bbclass makes sense. So one versus two checks
> is a wash for me.
I agree the warn conditional isn't quite right. I think it should be:
if [ CONFIG_MODULES not set in config ];
bberror Broken config, CONFIG_MODULES not set
exit 1
fi
so it is basically a sanity test that the config is valid.
I'm a bit worried about what I'm missing though :/
Cheers,
Richard
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-04 15:53 ` Richard Purdie
@ 2026-02-05 9:08 ` Kai
2026-02-05 12:58 ` Bruce Ashfield
2026-02-05 14:49 ` Richard Purdie
0 siblings, 2 replies; 11+ messages in thread
From: Kai @ 2026-02-05 9:08 UTC (permalink / raw)
To: Richard Purdie, Bruce Ashfield; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 2957 bytes --]
On 2/4/26 23:53, Richard Purdie wrote:
> On Wed, 2026-02-04 at 09:10 -0500, Bruce Ashfield wrote:
>>
>> On Wed, Feb 4, 2026 at 9:05 AM Richard Purdie
>> <richard.purdie@linuxfoundation.org> wrote:
>>> On Wed, 2026-02-04 at 09:02 -0500, Bruce Ashfield wrote:
>>>> On Wed, Feb 4, 2026 at 8:58 AM Richard Purdie
>>>> <richard.purdie@linuxfoundation.org> wrote:
>>>>> On Wed, 2026-02-04 at 08:46 -0500, Bruce Ashfield via
>>>>> lists.openembedded.org wrote:
>>>>>> On Tue, Feb 3, 2026 at 9:09 PM Kai Kang via
>>>>>> lists.openembedded.org
>>>>>> <kai.kang=windriver.com@lists.openembedded.org> wrote:
>>>>>>> From: Kai Kang<kai.kang@windriver.com>
>>>>>>>
>>>>>>> Check whether kernel config CONFIG_MODULES set or not
>>>>>>> before do_compile
>>>>>>> and do_install in module.bbclass. If not set, it cannot
>>>>>>> build and
>>>>>>> install external modules.
>>>>>>>
>>>>>>
>>>>>> This isn't the place to do that check.
>>>>>>
>>>>>> If modules are disabled get modules_do_compile out of the
>>>>>> tasks.
>>>>> Does it make sense to have something including module.bbclass
>>>>> which
>>>>> doesn't have CONFIG_MODULES set?
>>>> Yes, that's what I'm trying to say.
>>>>
>>>> Don't even include it if you can't build modules. That puts
>>>> the conditional in a single place, and keeps the code cleaner
>>>> in the class.
>>> I think we're talking cross purposes a bit.
>>>
>>> The issue is that if you ever reach do_compile in something using
>>> module.bbclass which does not have CONFIG_MODULES set, that is a
>>> problem and a hard error.
>>>
>>> So I'd argue that:
>>>
>>> * we only need the check in do_compile
>>> * it should be a fatal exit hard error, not a warning
>>>
>>> which means the patch needs tweaking but not as you're suggesting.
>>>
>>>
>>
>> I don't have a strong opinion, so won't object.
>>
>> I just don't think adding any conditionals for module support in
>> moduldes.bbclass makes sense. So one versus two checks
>> is a wash for me.
> I agree the warn conditional isn't quite right. I think it should be:
>
> if [ CONFIG_MODULES not set in config ];
> bberror Broken config, CONFIG_MODULES not set
> exit 1
> fi
>
> so it is basically a sanity test that the config is valid.
>
> I'm a bit worried about what I'm missing though :/
The original problem is kernel config_modules is disabled, then external
modules such as lttng-modules can't be built.
Recipe lttng-tools RRECOMMENDS on lttng-modules. If install lttng-tools
into image, it fails to build lttng-modules.
Kernel config CONFIG_MODULES couldn't be checked whether enabled or
disabled after bitbake parse. Then there is no chance to remove
lttng-module from the dependencies. That why I check the config during
the do_compile and do_install with bbnote and generate empty rpm package.
Regards,
Kai
>
> Cheers,
>
> Richard
>
>
>
--
Kai Kang
Wind River Linux
[-- Attachment #2: Type: text/html, Size: 4792 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-05 9:08 ` Kai
@ 2026-02-05 12:58 ` Bruce Ashfield
2026-02-05 14:49 ` Richard Purdie
1 sibling, 0 replies; 11+ messages in thread
From: Bruce Ashfield @ 2026-02-05 12:58 UTC (permalink / raw)
To: Kai; +Cc: Richard Purdie, openembedded-core
[-- Attachment #1: Type: text/plain, Size: 3355 bytes --]
On Thu, Feb 5, 2026 at 4:08 AM Kai <kai.kang@windriver.com> wrote:
> On 2/4/26 23:53, Richard Purdie wrote:
>
> On Wed, 2026-02-04 at 09:10 -0500, Bruce Ashfield wrote:
>
> On Wed, Feb 4, 2026 at 9:05 AM Richard Purdie<richard.purdie@linuxfoundation.org> <richard.purdie@linuxfoundation.org> wrote:
>
> On Wed, 2026-02-04 at 09:02 -0500, Bruce Ashfield wrote:
>
> On Wed, Feb 4, 2026 at 8:58 AM Richard Purdie<richard.purdie@linuxfoundation.org> <richard.purdie@linuxfoundation.org> wrote:
>
> On Wed, 2026-02-04 at 08:46 -0500, Bruce Ashfield vialists.openembedded.org wrote:
>
> On Tue, Feb 3, 2026 at 9:09 PM Kai Kang vialists.openembedded.org<kai.kang=windriver.com@lists.openembedded.org> <kai.kang=windriver.com@lists.openembedded.org> wrote:
>
> From: Kai Kang <kai.kang@windriver.com> <kai.kang@windriver.com>
>
> Check whether kernel config CONFIG_MODULES set or not
> before do_compile
> and do_install in module.bbclass. If not set, it cannot
> build and
> install external modules.
>
>
> This isn't the place to do that check.
>
> If modules are disabled get modules_do_compile out of the
> tasks.
>
> Does it make sense to have something including module.bbclass
> which
> doesn't have CONFIG_MODULES set?
>
> Yes, that's what I'm trying to say.
>
> Don't even include it if you can't build modules. That puts
> the conditional in a single place, and keeps the code cleaner
> in the class.
>
> I think we're talking cross purposes a bit.
>
> The issue is that if you ever reach do_compile in something using
> module.bbclass which does not have CONFIG_MODULES set, that is a
> problem and a hard error.
>
> So I'd argue that:
>
> * we only need the check in do_compile
> * it should be a fatal exit hard error, not a warning
>
> which means the patch needs tweaking but not as you're suggesting.
>
>
>
> I don't have a strong opinion, so won't object.
>
> I just don't think adding any conditionals for module support in
> moduldes.bbclass makes sense. So one versus two checks
> is a wash for me.
>
> I agree the warn conditional isn't quite right. I think it should be:
>
> if [ CONFIG_MODULES not set in config ];
> bberror Broken config, CONFIG_MODULES not set
> exit 1
> fi
>
> so it is basically a sanity test that the config is valid.
>
> I'm a bit worried about what I'm missing though :/
>
> The original problem is kernel config_modules is disabled, then external
> modules such as lttng-modules can't be built.
>
> Recipe lttng-tools RRECOMMENDS on lttng-modules. If install lttng-tools
> into image, it fails to build lttng-modules.
>
> Kernel config CONFIG_MODULES couldn't be checked whether enabled or
> disabled after bitbake parse. Then there is no chance to remove
> lttng-module from the dependencies. That why I check the config during the
> do_compile and do_install with bbnote and generate empty rpm package.
>
That's exactly why we had a patch to the lttng source code.
Someone updated that patch recently, so it has probably caused a regression.
Bruce
> Regards,
> Kai
>
> Cheers,
>
> Richard
>
>
>
>
>
> --
> Kai Kang
> Wind River Linux
>
>
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
[-- Attachment #2: Type: text/html, Size: 5545 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-05 9:08 ` Kai
2026-02-05 12:58 ` Bruce Ashfield
@ 2026-02-05 14:49 ` Richard Purdie
2026-02-12 6:48 ` Kai
1 sibling, 1 reply; 11+ messages in thread
From: Richard Purdie @ 2026-02-05 14:49 UTC (permalink / raw)
To: Kai, Bruce Ashfield; +Cc: openembedded-core
On Thu, 2026-02-05 at 17:08 +0800, Kai wrote:
> On 2/4/26 23:53, Richard Purdie wrote:
> I agree the warn conditional isn't quite right. I think it should
> > be:
> >
> > if [ CONFIG_MODULES not set in config ];
> > bberror Broken config, CONFIG_MODULES not set
> > exit 1
> > fi
> >
> > so it is basically a sanity test that the config is valid.
> >
> > I'm a bit worried about what I'm missing though :/
> >
> The original problem is kernel config_modules is disabled, then
> external modules such as lttng-modules can't be built.
>
> Recipe lttng-tools RRECOMMENDS on lttng-modules. If install lttng-
> tools into image, it fails to build lttng-modules.
>
> Kernel config CONFIG_MODULES couldn't be checked whether enabled or
> disabled after bitbake parse. Then there is no
> chance to remove lttng-module from the dependencies. That why I check
> the config during the do_compile and do_install
> with bbnote and generate empty rpm package.
That is a bit different to the problem I thought this was addressing (I
was coming from the rust patches angle).
In that case we probably need to have something like "kernel-modules"
in KERNEL_FEATURES and we check in the lttng-tools recipes if kernel-
modules are in KERNEL_FEATURES. The kernel itself can then error if the
feature is selected but not configured and lttng-modules can fail to
parse with an error if it isn't set?
lttng-tools is not useful without the module support.
Cheers,
Richard
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [OE-core] [PATCH] module.bbclass: check whether CONFIG_MODULES set
2026-02-05 14:49 ` Richard Purdie
@ 2026-02-12 6:48 ` Kai
0 siblings, 0 replies; 11+ messages in thread
From: Kai @ 2026-02-12 6:48 UTC (permalink / raw)
To: Richard Purdie, Bruce Ashfield; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1901 bytes --]
On 2/5/26 22:49, Richard Purdie wrote:
> On Thu, 2026-02-05 at 17:08 +0800, Kai wrote:
>> On 2/4/26 23:53, Richard Purdie wrote:
>> I agree the warn conditional isn't quite right. I think it should
>>> be:
>>>
>>> if [ CONFIG_MODULES not set in config ];
>>> bberror Broken config, CONFIG_MODULES not set
>>> exit 1
>>> fi
>>>
>>> so it is basically a sanity test that the config is valid.
>>>
>>> I'm a bit worried about what I'm missing though :/
>>>
>> The original problem is kernel config_modules is disabled, then
>> external modules such as lttng-modules can't be built.
>>
>> Recipe lttng-tools RRECOMMENDS on lttng-modules. If install lttng-
>> tools into image, it fails to build lttng-modules.
>>
>> Kernel config CONFIG_MODULES couldn't be checked whether enabled or
>> disabled after bitbake parse. Then there is no
>> chance to remove lttng-module from the dependencies. That why I check
>> the config during the do_compile and do_install
>> with bbnote and generate empty rpm package.
> That is a bit different to the problem I thought this was addressing (I
> was coming from the rust patches angle).
>
> In that case we probably need to have something like "kernel-modules"
> in KERNEL_FEATURES and we check in the lttng-tools recipes if kernel-
> modules are in KERNEL_FEATURES. The kernel itself can then error if the
> feature is selected but not configured and lttng-modules can fail to
> parse with an error if it isn't set?
I sent a patch to preset LTTNGMODULES with '?='. Then it could be
overridden from conf files to clear it. It should be the one who disable
kernel modules support to break the dependency betweenlttng-modules and
lttng-tools.
Thanks, Kai
>
> lttng-tools is not useful without the module support.
>
> Cheers,
>
> Richard
>
>
>
>
--
Kai Kang
Wind River Linux
[-- Attachment #2: Type: text/html, Size: 2847 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-02-12 6:48 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-04 2:09 [PATCH] module.bbclass: check whether CONFIG_MODULES set kai.kang
2026-02-04 13:46 ` [OE-core] " Bruce Ashfield
2026-02-04 13:58 ` Richard Purdie
2026-02-04 14:02 ` Bruce Ashfield
2026-02-04 14:05 ` Richard Purdie
2026-02-04 14:10 ` Bruce Ashfield
2026-02-04 15:53 ` Richard Purdie
2026-02-05 9:08 ` Kai
2026-02-05 12:58 ` Bruce Ashfield
2026-02-05 14:49 ` Richard Purdie
2026-02-12 6:48 ` Kai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox