diff mbox series

[1/2] kernel-module-split: make autoload and probeconf distribution specific

Message ID 20230215130057.1923450-1-jose.quaresma@foundries.io
State New
Headers show
Series [1/2] kernel-module-split: make autoload and probeconf distribution specific | expand

Commit Message

Jose Quaresma Feb. 15, 2023, 1 p.m. UTC
The modules-load.d [1] - Configure kernel modules to load at boot
should install their configuration files in /usr/lib/modules-load.d.

The modprobe.d [2] - Configuration directory for modprobe
should install their configuration files in /lib/modprobe.d

[1] https://www.freedesktop.org/software/systemd/man/modules-load.d.html
[2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---
 .../kernel-module-split.bbclass               | 30 +++++++++----------
 1 file changed, 14 insertions(+), 16 deletions(-)

Comments

Otavio Salvador Feb. 15, 2023, 1:25 p.m. UTC | #1
Em qua., 15 de fev. de 2023 às 10:01, Jose Quaresma
<quaresma.jose@gmail.com> escreveu:
>
> The modules-load.d [1] - Configure kernel modules to load at boot
> should install their configuration files in /usr/lib/modules-load.d.
>
> The modprobe.d [2] - Configuration directory for modprobe
> should install their configuration files in /lib/modprobe.d
>
> [1] https://www.freedesktop.org/software/systemd/man/modules-load.d.html
> [2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html
>
> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>


Did you validate this using busybox only? Using sysv and busybox need
to be validated as well.
Jose Quaresma Feb. 15, 2023, 3:10 p.m. UTC | #2
Hi Octavio,

Otavio Salvador <otavio.salvador@ossystems.com.br> escreveu no dia quarta,
15/02/2023 à(s) 13:25:

> Em qua., 15 de fev. de 2023 às 10:01, Jose Quaresma
> <quaresma.jose@gmail.com> escreveu:
> >
> > The modules-load.d [1] - Configure kernel modules to load at boot
> > should install their configuration files in /usr/lib/modules-load.d.
> >
> > The modprobe.d [2] - Configuration directory for modprobe
> > should install their configuration files in /lib/modprobe.d
> >
> > [1] https://www.freedesktop.org/software/systemd/man/modules-load.d.html
> > [2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html
> >
> > Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
>
>
> Did you validate this using busybox only? Using sysv and busybox need
> to be validated as well.
>

Please drop this patch series because it doesn work with busybox.

Looks like busybox don't support other path than /etc:
https://git.busybox.net/busybox/tree/modutils/modprobe.c?id=669c40ed8ebf480c95ce36135104e474e361a7e6#n658

So I need to implement this in another way, maybe relocating the files from
/etc only when systemd is enabled.

Thanks for raising the issue.

Jose


> --
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750
>
Ola x Nilsson Feb. 16, 2023, 8:21 a.m. UTC | #3
On Wed, Feb 15 2023, Jose Quaresma wrote:

> Hi Octavio,
>
> Otavio Salvador <otavio.salvador@ossystems.com.br<mailto:otavio.salvador@ossystems.com.br>> escreveu no dia quarta, 15/02/2023 à(s) 13:25:
> Em qua., 15 de fev. de 2023 às 10:01, Jose Quaresma
> <quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com>> escreveu:
>>
>> The modules-load.d [1] - Configure kernel modules to load at boot
>> should install their configuration files in /usr/lib/modules-load.d.
>>
>> The modprobe.d [2] - Configuration directory for modprobe
>> should install their configuration files in /lib/modprobe.d
>>
>> [1] https://www.freedesktop.org/software/systemd/man/modules-load.d.html
>> [2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html
>>
>> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io<mailto:jose.quaresma@foundries.io>>
>
>
> Did you validate this using busybox only? Using sysv and busybox need
> to be validated as well.
>
> Please drop this patch series because it doesn work with busybox.
>
> Looks like busybox don't support other path than /etc:
> https://git.busybox.net/busybox/tree/modutils/modprobe.c?id=669c40ed8ebf480c95ce36135104e474e361a7e6#n658
>
> So I need to implement this in another way, maybe relocating the files from /etc only when systemd is enabled.
>
> Thanks for raising the issue.
>
> Jose
>

Hi,

Please consider https://bugzilla.yoctoproject.org/show_bug.cgi?id=12212
as well.
Jose Quaresma Feb. 16, 2023, 11:08 a.m. UTC | #4
Ola x Nilsson <ola.x.nilsson@axis.com> escreveu no dia quinta, 16/02/2023
à(s) 08:22:

>
> On Wed, Feb 15 2023, Jose Quaresma wrote:
>
> > Hi Octavio,
> >
> > Otavio Salvador <otavio.salvador@ossystems.com.br<mailto:
> otavio.salvador@ossystems.com.br>> escreveu no dia quarta, 15/02/2023
> à(s) 13:25:
> > Em qua., 15 de fev. de 2023 às 10:01, Jose Quaresma
> > <quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com>> escreveu:
> >>
> >> The modules-load.d [1] - Configure kernel modules to load at boot
> >> should install their configuration files in /usr/lib/modules-load.d.
> >>
> >> The modprobe.d [2] - Configuration directory for modprobe
> >> should install their configuration files in /lib/modprobe.d
> >>
> >> [1]
> https://www.freedesktop.org/software/systemd/man/modules-load.d.html
> >> [2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html
> >>
> >> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io<mailto:
> jose.quaresma@foundries.io>>
> >
> >
> > Did you validate this using busybox only? Using sysv and busybox need
> > to be validated as well.
> >
> > Please drop this patch series because it doesn work with busybox.
> >
> > Looks like busybox don't support other path than /etc:
> >
> https://git.busybox.net/busybox/tree/modutils/modprobe.c?id=669c40ed8ebf480c95ce36135104e474e361a7e6#n658
> >
> > So I need to implement this in another way, maybe relocating the files
> from /etc only when systemd is enabled.
> >
> > Thanks for raising the issue.
> >
> > Jose
> >
>
> Hi,
>
> Please consider https://bugzilla.yoctoproject.org/show_bug.cgi?id=12212
> as well.
>
> --
> Ola x Nilsson
>

Hi Ola,

We use usermerge too but I think the weird issue here is we need to have
this distribution specified only for systemd
excluding busybox and sysint as pointed out by Octavio.
The other solution is adding support on busybox and sysint if needed.

My idea is add a prefix variable with path "/etc" by default but
conditioned by systemd DISTRO_FEATURES

Thanks for the bug hint.
Peter Kjellerstedt Feb. 17, 2023, 10:52 a.m. UTC | #5
Wouldn’t the easiest solution be to define two variables:

modulesloaddir ??= "${sysconfdir}/modules-load.d "
modprobedir ??= "${sysconfdir}/modprobe.d "

then in init-manager-systemd.inc you could change them to:

modulesloaddir ?= "${nonarch_libdir}/modules-load.d"
modprobedir ?= "${nonarch_base_libdir}/modprobe.d"

Using a single prefix variable doesn’t really work since they need different paths in the latter case.

//Peter

From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Jose Quaresma
Sent: den 16 februari 2023 12:08
To: Ola x Nilsson <Ola.x.Nilsson@axis.com>
Cc: Otavio Salvador <otavio.salvador@ossystems.com.br>; Jose Quaresma <jose.quaresma@foundries.io>; openembedded-core@lists.openembedded.org
Subject: Re: [OE-core][PATCH 1/2] kernel-module-split: make autoload and probeconf distribution specific


Ola x Nilsson <ola.x.nilsson@axis.com<mailto:ola.x.nilsson@axis.com>> escreveu no dia quinta, 16/02/2023 à(s) 08:22:

On Wed, Feb 15 2023, Jose Quaresma wrote:

> Hi Octavio,
>
> Otavio Salvador <otavio.salvador@ossystems.com.br<mailto:otavio.salvador@ossystems.com.br><mailto:otavio.salvador@ossystems.com.br<mailto:otavio.salvador@ossystems.com.br>>> escreveu no dia quarta, 15/02/2023 à(s) 13:25:
> Em qua., 15 de fev. de 2023 às 10:01, Jose Quaresma
> <quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com><mailto:quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com>>> escreveu:
>>
>> The modules-load.d [1] - Configure kernel modules to load at boot
>> should install their configuration files in /usr/lib/modules-load.d.
>>
>> The modprobe.d [2] - Configuration directory for modprobe
>> should install their configuration files in /lib/modprobe.d
>>
>> [1] https://www.freedesktop.org/software/systemd/man/modules-load.d.html
>> [2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html<https://www.man7.org/linux/man-pages/man5/modprobe.d.5.html>
>>
>> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io<mailto:jose.quaresma@foundries.io><mailto:jose.quaresma@foundries.io<mailto:jose.quaresma@foundries.io>>>
>
>
> Did you validate this using busybox only? Using sysv and busybox need
> to be validated as well.
>
> Please drop this patch series because it doesn work with busybox.
>
> Looks like busybox don't support other path than /etc:
> https://git.busybox.net/busybox/tree/modutils/modprobe.c?id=669c40ed8ebf480c95ce36135104e474e361a7e6#n658
>
> So I need to implement this in another way, maybe relocating the files from /etc only when systemd is enabled.
>
> Thanks for raising the issue.
>
> Jose
>

Hi,

Please consider https://bugzilla.yoctoproject.org/show_bug.cgi?id=12212
as well.

--
Ola x Nilsson

Hi Ola,

We use usermerge too but I think the weird issue here is we need to have this distribution specified only for systemd
excluding busybox and sysint as pointed out by Octavio.
The other solution is adding support on busybox and sysint if needed.

My idea is add a prefix variable with path "/etc" by default but conditioned by systemd DISTRO_FEATURES

Thanks for the bug hint.
--
Best regards,

José Quaresma
Jose Quaresma Feb. 17, 2023, 4:53 p.m. UTC | #6
Hi Peter,

Peter Kjellerstedt <peter.kjellerstedt@axis.com> escreveu no dia sexta,
17/02/2023 à(s) 10:52:

> Wouldn’t the easiest solution be to define two variables:
>
>
>
> modulesloaddir ??= "${sysconfdir}/modules-load.d "
>
> modprobedir ??= "${sysconfdir}/modprobe.d "
>
>
>
> then in init-manager-systemd.inc you could change them to:
>
>
>
> modulesloaddir ?= "${nonarch_libdir}/modules-load.d"
>
> modprobedir ?= "${nonarch_base_libdir}/modprobe.d"
>
>
>
> Using a single prefix variable doesn’t really work since they need
> different paths in the latter case.
>

I was thinking of something similar to what you suggest but only on the
class:

modulesloaddir ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
'${nonarch_libdir}', '${sysconfdir}', d)}"
modprobedir ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
'${nonarch_base_libdir}', '${sysconfdir}', d)}"

Anyway your approach looks good to me too so i'll use yours, hope I can
test it next week.

Jose


>
>
> //Peter
>
>
>
> *From:* openembedded-core@lists.openembedded.org <
> openembedded-core@lists.openembedded.org> *On Behalf Of *Jose Quaresma
> *Sent:* den 16 februari 2023 12:08
> *To:* Ola x Nilsson <Ola.x.Nilsson@axis.com>
> *Cc:* Otavio Salvador <otavio.salvador@ossystems.com.br>; Jose Quaresma <
> jose.quaresma@foundries.io>; openembedded-core@lists.openembedded.org
> *Subject:* Re: [OE-core][PATCH 1/2] kernel-module-split: make autoload
> and probeconf distribution specific
>
>
>
>
>
> Ola x Nilsson <ola.x.nilsson@axis.com> escreveu no dia quinta, 16/02/2023
> à(s) 08:22:
>
>
> On Wed, Feb 15 2023, Jose Quaresma wrote:
>
> > Hi Octavio,
> >
> > Otavio Salvador <otavio.salvador@ossystems.com.br<mailto:
> otavio.salvador@ossystems.com.br>> escreveu no dia quarta, 15/02/2023
> à(s) 13:25:
> > Em qua., 15 de fev. de 2023 às 10:01, Jose Quaresma
> > <quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com>> escreveu:
> >>
> >> The modules-load.d [1] - Configure kernel modules to load at boot
> >> should install their configuration files in /usr/lib/modules-load.d.
> >>
> >> The modprobe.d [2] - Configuration directory for modprobe
> >> should install their configuration files in /lib/modprobe.d
> >>
> >> [1]
> https://www.freedesktop.org/software/systemd/man/modules-load.d.html
> >> [2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html
> <https://www.man7.org/linux/man-pages/man5/modprobe.d.5.html>
> >>
> >> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io<mailto:
> jose.quaresma@foundries.io>>
> >
> >
> > Did you validate this using busybox only? Using sysv and busybox need
> > to be validated as well.
> >
> > Please drop this patch series because it doesn work with busybox.
> >
> > Looks like busybox don't support other path than /etc:
> >
> https://git.busybox.net/busybox/tree/modutils/modprobe.c?id=669c40ed8ebf480c95ce36135104e474e361a7e6#n658
> >
> > So I need to implement this in another way, maybe relocating the files
> from /etc only when systemd is enabled.
> >
> > Thanks for raising the issue.
> >
> > Jose
> >
>
> Hi,
>
> Please consider https://bugzilla.yoctoproject.org/show_bug.cgi?id=12212
> as well.
>
> --
> Ola x Nilsson
>
>
> Hi Ola,
>
> We use usermerge too but I think the weird issue here is we need to have
> this distribution specified only for systemd
>
> excluding busybox and sysint as pointed out by Octavio.
>
> The other solution is adding support on busybox and sysint if needed.
>
> My idea is add a prefix variable with path "/etc" by default but
> conditioned by systemd DISTRO_FEATURES
>
> Thanks for the bug hint.
>
> --
>
> Best regards,
>
>
> José Quaresma
>
Peter Kjellerstedt June 16, 2023, 4:03 p.m. UTC | #7
Did anything ever become of this? This is a change that at least we would appreciate.

//Peter

From: Jose Quaresma <quaresma.jose@gmail.com>
Sent: den 17 februari 2023 17:53
To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Cc: Ola x Nilsson <Ola.x.Nilsson@axis.com>; Otavio Salvador <otavio.salvador@ossystems.com.br>; Jose Quaresma <jose.quaresma@foundries.io>; openembedded-core@lists.openembedded.org
Subject: Re: [OE-core][PATCH 1/2] kernel-module-split: make autoload and probeconf distribution specific

Hi Peter,

Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> escreveu no dia sexta, 17/02/2023 à(s) 10:52:
Wouldn’t the easiest solution be to define two variables:
modulesloaddir ??= "${sysconfdir}/modules-load.d "
modprobedir ??= "${sysconfdir}/modprobe.d "
then in init-manager-systemd.inc you could change them to:
modulesloaddir ?= "${nonarch_libdir}/modules-load.d"
modprobedir ?= "${nonarch_base_libdir}/modprobe.d"
Using a single prefix variable doesn’t really work since they need different paths in the latter case.

I was thinking of something similar to what you suggest but only on the class:

modulesloaddir ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${nonarch_libdir}', '${sysconfdir}', d)}<mailto:$%7b@bb.utils.contains('DISTRO_FEATURES',%20'systemd',%20'$%7bnonarch_libdir%7d',%20'$%7bsysconfdir%7d',%20d)%7d>"
modprobedir ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${nonarch_base_libdir}', '${sysconfdir}', d)}<mailto:$%7b@bb.utils.contains('DISTRO_FEATURES',%20'systemd',%20'$%7bnonarch_base_libdir%7d',%20'$%7bsysconfdir%7d',%20d)%7d>"

Anyway your approach looks good to me too so i'll use yours, hope I can test it next week.

Jose


//Peter

From: openembedded-core@lists.openembedded.org<mailto:openembedded-core@lists.openembedded.org> <openembedded-core@lists.openembedded.org<mailto:openembedded-core@lists.openembedded.org>> On Behalf Of Jose Quaresma
Sent: den 16 februari 2023 12:08
To: Ola x Nilsson <Ola.x.Nilsson@axis.com<mailto:Ola.x.Nilsson@axis.com>>
Cc: Otavio Salvador <otavio.salvador@ossystems.com.br<mailto:otavio.salvador@ossystems.com.br>>; Jose Quaresma <jose.quaresma@foundries.io<mailto:jose.quaresma@foundries.io>>; openembedded-core@lists.openembedded.org<mailto:openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core][PATCH 1/2] kernel-module-split: make autoload and probeconf distribution specific


Ola x Nilsson <ola.x.nilsson@axis.com<mailto:ola.x.nilsson@axis.com>> escreveu no dia quinta, 16/02/2023 à(s) 08:22:

On Wed, Feb 15 2023, Jose Quaresma wrote:

> Hi Octavio,
>
> Otavio Salvador <otavio.salvador@ossystems.com.br<mailto:otavio.salvador@ossystems.com.br><mailto:otavio.salvador@ossystems.com.br<mailto:otavio.salvador@ossystems.com.br>>> escreveu no dia quarta, 15/02/2023 à(s) 13:25:
> Em qua., 15 de fev. de 2023 às 10:01, Jose Quaresma
> <quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com><mailto:quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com>>> escreveu:
>>
>> The modules-load.d [1] - Configure kernel modules to load at boot
>> should install their configuration files in /usr/lib/modules-load.d.
>>
>> The modprobe.d [2] - Configuration directory for modprobe
>> should install their configuration files in /lib/modprobe.d
>>
>> [1] https://www.freedesktop.org/software/systemd/man/modules-load.d.html
>> [2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html<https://www.man7.org/linux/man-pages/man5/modprobe.d.5.html>
>>
>> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io<mailto:jose.quaresma@foundries.io><mailto:jose.quaresma@foundries.io<mailto:jose.quaresma@foundries.io>>>
>
>
> Did you validate this using busybox only? Using sysv and busybox need
> to be validated as well.
>
> Please drop this patch series because it doesn work with busybox.
>
> Looks like busybox don't support other path than /etc:
> https://git.busybox.net/busybox/tree/modutils/modprobe.c?id=669c40ed8ebf480c95ce36135104e474e361a7e6#n658
>
> So I need to implement this in another way, maybe relocating the files from /etc only when systemd is enabled.
>
> Thanks for raising the issue.
>
> Jose
>

Hi,

Please consider https://bugzilla.yoctoproject.org/show_bug.cgi?id=12212
as well.

--
Ola x Nilsson

Hi Ola,

We use usermerge too but I think the weird issue here is we need to have this distribution specified only for systemd
excluding busybox and sysint as pointed out by Octavio.
The other solution is adding support on busybox and sysint if needed.

My idea is add a prefix variable with path "/etc" by default but conditioned by systemd DISTRO_FEATURES

Thanks for the bug hint.
--
Best regards,

José Quaresma


--
Best regards,

José Quaresma
Jose Quaresma June 19, 2023, 11:20 p.m. UTC | #8
Peter Kjellerstedt <peter.kjellerstedt@axis.com> escreveu no dia sexta,
16/06/2023 à(s) 17:03:

> Did anything ever become of this? This is a change that at least we would
> appreciate.
>

Hi Pete,

V2 send with your suggestions:
https://lists.openembedded.org/g/openembedded-core/message/183123

Thanks for the remainder

Jose


>
>
> //Peter
>
>
>
> *From:* Jose Quaresma <quaresma.jose@gmail.com>
> *Sent:* den 17 februari 2023 17:53
> *To:* Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> *Cc:* Ola x Nilsson <Ola.x.Nilsson@axis.com>; Otavio Salvador <
> otavio.salvador@ossystems.com.br>; Jose Quaresma <
> jose.quaresma@foundries.io>; openembedded-core@lists.openembedded.org
> *Subject:* Re: [OE-core][PATCH 1/2] kernel-module-split: make autoload
> and probeconf distribution specific
>
>
>
> Hi Peter,
>
>
>
> Peter Kjellerstedt <peter.kjellerstedt@axis.com> escreveu no dia sexta,
> 17/02/2023 à(s) 10:52:
>
> Wouldn’t the easiest solution be to define two variables:
>
> modulesloaddir ??= "${sysconfdir}/modules-load.d "
> modprobedir ??= "${sysconfdir}/modprobe.d "
>
> then in init-manager-systemd.inc you could change them to:
>
> modulesloaddir ?= "${nonarch_libdir}/modules-load.d"
> modprobedir ?= "${nonarch_base_libdir}/modprobe.d"
>
> Using a single prefix variable doesn’t really work since they need
> different paths in the latter case.
>
>
> I was thinking of something similar to what you suggest but only on the
> class:
>
> modulesloaddir ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
> '${nonarch_libdir}', '${sysconfdir}', d)}"
> modprobedir ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
> '${nonarch_base_libdir}', '${sysconfdir}', d)}"
>
>
>
> Anyway your approach looks good to me too so i'll use yours, hope I can
> test it next week.
>
>
>
> Jose
>
>
>
>
>
> //Peter
>
>
>
> *From:* openembedded-core@lists.openembedded.org <
> openembedded-core@lists.openembedded.org> *On Behalf Of *Jose Quaresma
> *Sent:* den 16 februari 2023 12:08
> *To:* Ola x Nilsson <Ola.x.Nilsson@axis.com>
> *Cc:* Otavio Salvador <otavio.salvador@ossystems.com.br>; Jose Quaresma <
> jose.quaresma@foundries.io>; openembedded-core@lists.openembedded.org
> *Subject:* Re: [OE-core][PATCH 1/2] kernel-module-split: make autoload
> and probeconf distribution specific
>
>
>
>
>
> Ola x Nilsson <ola.x.nilsson@axis.com> escreveu no dia quinta, 16/02/2023
> à(s) 08:22:
>
>
> On Wed, Feb 15 2023, Jose Quaresma wrote:
>
> > Hi Octavio,
> >
> > Otavio Salvador <otavio.salvador@ossystems.com.br<mailto:
> otavio.salvador@ossystems.com.br>> escreveu no dia quarta, 15/02/2023
> à(s) 13:25:
> > Em qua., 15 de fev. de 2023 às 10:01, Jose Quaresma
> > <quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com>> escreveu:
> >>
> >> The modules-load.d [1] - Configure kernel modules to load at boot
> >> should install their configuration files in /usr/lib/modules-load.d.
> >>
> >> The modprobe.d [2] - Configuration directory for modprobe
> >> should install their configuration files in /lib/modprobe.d
> >>
> >> [1]
> https://www.freedesktop.org/software/systemd/man/modules-load.d.html
> >> [2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html
> <https://www.man7.org/linux/man-pages/man5/modprobe.d.5.html>
> >>
> >> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io<mailto:
> jose.quaresma@foundries.io>>
> >
> >
> > Did you validate this using busybox only? Using sysv and busybox need
> > to be validated as well.
> >
> > Please drop this patch series because it doesn work with busybox.
> >
> > Looks like busybox don't support other path than /etc:
> >
> https://git.busybox.net/busybox/tree/modutils/modprobe.c?id=669c40ed8ebf480c95ce36135104e474e361a7e6#n658
> >
> > So I need to implement this in another way, maybe relocating the files
> from /etc only when systemd is enabled.
> >
> > Thanks for raising the issue.
> >
> > Jose
> >
>
> Hi,
>
> Please consider https://bugzilla.yoctoproject.org/show_bug.cgi?id=12212
> as well.
>
> --
> Ola x Nilsson
>
>
> Hi Ola,
>
> We use usermerge too but I think the weird issue here is we need to have
> this distribution specified only for systemd
>
> excluding busybox and sysint as pointed out by Octavio.
>
> The other solution is adding support on busybox and sysint if needed.
>
> My idea is add a prefix variable with path "/etc" by default but
> conditioned by systemd DISTRO_FEATURES
>
> Thanks for the bug hint.
>
> --
>
> Best regards,
>
>
> José Quaresma
>
>
>
>
> --
>
> Best regards,
>
>
> José Quaresma
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-module-split.bbclass b/meta/classes-recipe/kernel-module-split.bbclass
index 50882c31a7..b70650888a 100644
--- a/meta/classes-recipe/kernel-module-split.bbclass
+++ b/meta/classes-recipe/kernel-module-split.bbclass
@@ -31,7 +31,8 @@  fi
 PACKAGE_WRITE_DEPS += "kmod-native depmodwrapper-cross"
 
 do_install:append() {
-	install -d ${D}${sysconfdir}/modules-load.d/ ${D}${sysconfdir}/modprobe.d/
+	install -d ${D}${libdir}/modules-load.d
+	install -d ${D}${nonarch_base_libdir}/modprobe.d
 }
 
 KERNEL_SPLIT_MODULES ?= "1"
@@ -93,8 +94,9 @@  python split_kernel_module_packages () {
 
         dvar = d.getVar('PKGD')
 
-        # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
+        # If autoloading is requested, output ${libdir}/modules-load.d/<name>.conf and append
         # appropriate modprobe commands to the postinst
+        autoloadpath = '%s/modules-load.d/%s.conf' % (d.getVar('libdir'), basename)
         autoloadlist = (d.getVar("KERNEL_MODULE_AUTOLOAD") or "").split()
         autoload = d.getVar('module_autoload_%s' % basename)
         if autoload and autoload == basename:
@@ -102,8 +104,7 @@  python split_kernel_module_packages () {
         if autoload and basename not in autoloadlist:
             bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename))
         if basename in autoloadlist:
-            name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
-            f = open(name, 'w')
+            f = open("%s%s" % (dvar, autoloadpath), 'w')
             if autoload:
                 for m in autoload.split():
                     f.write('%s\n' % m)
@@ -117,23 +118,19 @@  python split_kernel_module_packages () {
             d.setVar('pkg_postinst:%s' % pkg, postinst)
 
         # Write out any modconf fragment
+        modconfpath = '%s/modprobe.d/%s.conf' % (d.getVar('nonarch_base_libdir'), basename)
         modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()
         modconf = d.getVar('module_conf_%s' % basename)
         if modconf and basename in modconflist:
-            name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
-            f = open(name, 'w')
+            f = open("%s%s" % (dvar, modconfpath), 'w')
             f.write("%s\n" % modconf)
             f.close()
         elif modconf:
             bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename))
 
-        files = d.getVar('FILES:%s' % pkg)
-        files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
-        d.setVar('FILES:%s' % pkg, files)
-
-        conffiles = d.getVar('CONFFILES:%s' % pkg)
-        conffiles = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (conffiles, basename, basename)
-        d.setVar('CONFFILES:%s' % pkg, conffiles)
+        appendfiles = " %s %s" % (autoloadpath, modconfpath)
+        d.appendVar('FILES:%s' % pkg, appendfiles)
+        d.appendVar('CONFFILES:%s' % pkg, appendfiles)
 
         if "description" in vals:
             old_desc = d.getVar('DESCRIPTION:' + pkg) or ""
@@ -167,10 +164,11 @@  python split_kernel_module_packages () {
     splitmods = d.getVar('KERNEL_SPLIT_MODULES')
     postinst = d.getVar('pkg_postinst:modules')
     postrm = d.getVar('pkg_postrm:modules')
+    nonarch_base_libdir = d.getVar("nonarch_base_libdir")
+    libdir = d.getVar("libdir")
 
     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('FILES:' + metapkg, '%s/modules-load.d/ %s/modprobe.d/ %s/modules/' % (libdir, nonarch_base_libdir, nonarch_base_libdir))
         d.appendVar('pkg_postinst:%s' % metapkg, postinst)
         d.prependVar('pkg_postrm:%s' % metapkg, postrm);
         return
@@ -189,7 +187,7 @@  python split_kernel_module_packages () {
     # avoid warnings. removedirs only raises an OSError if an empty
     # directory cannot be removed.
     dvar = d.getVar('PKGD')
-    for dir in ["%s/etc/modprobe.d" % (dvar), "%s/etc/modules-load.d" % (dvar), "%s/etc" % (dvar)]:
+    for dir in ["%s%s/modprobe.d" % (dvar, nonarch_base_libdir), "%s%s/modules-load.d" % (dvar, libdir)]:
         if len(os.listdir(dir)) == 0:
             os.rmdir(dir)
 }