* [PATCH] kernel.bbclass, module.bbclass: Make update-modules optional
@ 2012-09-26 12:02 Phil Blundell
2012-09-26 12:14 ` Martin Jansa
2012-10-18 20:00 ` Saul Wold
0 siblings, 2 replies; 3+ messages in thread
From: Phil Blundell @ 2012-09-26 12:02 UTC (permalink / raw)
To: openembedded-core
The update-modules mechanism is something of a historical relic and it isn't
entirely clear that it has a great deal of value nowadays. Also, it causes a
problem when building a read-only rootfs since update-modules itself refuses
to configure offline.
Allow DISTROs to circumvent this whole thing by declaring (via DISTRO_FEATURES)
that they don't wish to use update-modules. This is backfilled for existing
distributions and will have to be marked as CONSIDERED by those who actually
don't want it.
Signed-off-by: Phil Blundell <pb@pbcl.net>
---
meta/classes/kernel.bbclass | 24 ++++++++++++++++--------
meta/classes/module.bbclass | 2 +-
meta/conf/bitbake.conf | 2 +-
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index fdef1be..d3af67c 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -398,10 +398,12 @@ python populate_packages_prepend () {
dvar = d.getVar('PKGD', True)
+ use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
+
# If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
# appropriate modprobe commands to the postinst
autoload = d.getVar('module_autoload_%s' % basename, True)
- if autoload:
+ if autoload and use_update_modules:
name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
f = open(name, 'w')
for m in autoload.split():
@@ -415,15 +417,16 @@ python populate_packages_prepend () {
# Write out any modconf fragment
modconf = d.getVar('module_conf_%s' % basename, True)
- if modconf:
+ if modconf and use_update_modules:
name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
f = open(name, 'w')
f.write("%s\n" % modconf)
f.close()
- files = d.getVar('FILES_%s' % pkg, True)
- files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
- d.setVar('FILES_%s' % pkg, files)
+ if use_update_modules:
+ files = d.getVar('FILES_%s' % pkg, True)
+ files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
+ d.setVar('FILES_%s' % pkg, files)
if vals.has_key("description"):
old_desc = d.getVar('DESCRIPTION_' + pkg, True) or ""
@@ -441,12 +444,17 @@ python populate_packages_prepend () {
module_regex = '^(.*)\.k?o$'
module_pattern = 'kernel-module-%s'
- postinst = d.getVar('pkg_postinst_modules', True)
- postrm = d.getVar('pkg_postrm_modules', True)
+ use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
+ if use_update_modules:
+ postinst = d.getVar('pkg_postinst_modules', True)
+ postrm = d.getVar('pkg_postrm_modules', True)
+ else:
+ postinst = None
+ postrm = None
do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
- do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % d.getVar("KERNEL_VERSION", True))
+ do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%skernel-%s' % (['', 'update-modules '][use_update_modules], d.getVar("KERNEL_VERSION", True)))
# If modules-load.d and modprobe.d are empty at this point, remove them to
# avoid warnings. removedirs only raises an OSError if an empty
diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
index c721202..e8d32eb 100644
--- a/meta/classes/module.bbclass
+++ b/meta/classes/module.bbclass
@@ -1,4 +1,4 @@
-RDEPENDS += "kernel-image update-modules"
+RDEPENDS_${PN} += "kernel-image ${@oe.utils.contains('DISTRO_FEATURES', 'update-modules', 'update-modules', '', d)}"
DEPENDS += "virtual/kernel"
inherit module-base
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 3496d2b..5196018 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -724,7 +724,7 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
-DISTRO_FEATURES_BACKFILL = "pulseaudio"
+DISTRO_FEATURES_BACKFILL = "pulseaudio update-modules"
DISTRO_FEATURES_append = "${@oe.utils.features_backfill("DISTRO_FEATURES",d)}"
MACHINE_FEATURES_BACKFILL = "rtc"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kernel.bbclass, module.bbclass: Make update-modules optional
2012-09-26 12:02 [PATCH] kernel.bbclass, module.bbclass: Make update-modules optional Phil Blundell
@ 2012-09-26 12:14 ` Martin Jansa
2012-10-18 20:00 ` Saul Wold
1 sibling, 0 replies; 3+ messages in thread
From: Martin Jansa @ 2012-09-26 12:14 UTC (permalink / raw)
To: Phil Blundell; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 6027 bytes --]
On Wed, Sep 26, 2012 at 01:02:26PM +0100, Phil Blundell wrote:
> The update-modules mechanism is something of a historical relic and it isn't
> entirely clear that it has a great deal of value nowadays. Also, it causes a
What's replacement of this nowadays? IIRC without g_ether autoload I
don't get working usb networking on first boot, which sucks.
Cheers,
> problem when building a read-only rootfs since update-modules itself refuses
> to configure offline.
>
> Allow DISTROs to circumvent this whole thing by declaring (via DISTRO_FEATURES)
> that they don't wish to use update-modules. This is backfilled for existing
> distributions and will have to be marked as CONSIDERED by those who actually
> don't want it.
>
> Signed-off-by: Phil Blundell <pb@pbcl.net>
> ---
> meta/classes/kernel.bbclass | 24 ++++++++++++++++--------
> meta/classes/module.bbclass | 2 +-
> meta/conf/bitbake.conf | 2 +-
> 3 files changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index fdef1be..d3af67c 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -398,10 +398,12 @@ python populate_packages_prepend () {
>
> dvar = d.getVar('PKGD', True)
>
> + use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
> +
> # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
> # appropriate modprobe commands to the postinst
> autoload = d.getVar('module_autoload_%s' % basename, True)
> - if autoload:
> + if autoload and use_update_modules:
> name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
> f = open(name, 'w')
> for m in autoload.split():
> @@ -415,15 +417,16 @@ python populate_packages_prepend () {
>
> # Write out any modconf fragment
> modconf = d.getVar('module_conf_%s' % basename, True)
> - if modconf:
> + if modconf and use_update_modules:
> name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
> f = open(name, 'w')
> f.write("%s\n" % modconf)
> f.close()
>
> - files = d.getVar('FILES_%s' % pkg, True)
> - files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
> - d.setVar('FILES_%s' % pkg, files)
> + if use_update_modules:
> + files = d.getVar('FILES_%s' % pkg, True)
> + files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
> + d.setVar('FILES_%s' % pkg, files)
>
> if vals.has_key("description"):
> old_desc = d.getVar('DESCRIPTION_' + pkg, True) or ""
> @@ -441,12 +444,17 @@ python populate_packages_prepend () {
> module_regex = '^(.*)\.k?o$'
> module_pattern = 'kernel-module-%s'
>
> - postinst = d.getVar('pkg_postinst_modules', True)
> - postrm = d.getVar('pkg_postrm_modules', True)
> + use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
> + if use_update_modules:
> + postinst = d.getVar('pkg_postinst_modules', True)
> + postrm = d.getVar('pkg_postrm_modules', True)
> + else:
> + postinst = None
> + postrm = None
> do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
> do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
> do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
> - do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % d.getVar("KERNEL_VERSION", True))
> + do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%skernel-%s' % (['', 'update-modules '][use_update_modules], d.getVar("KERNEL_VERSION", True)))
>
> # If modules-load.d and modprobe.d are empty at this point, remove them to
> # avoid warnings. removedirs only raises an OSError if an empty
> diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
> index c721202..e8d32eb 100644
> --- a/meta/classes/module.bbclass
> +++ b/meta/classes/module.bbclass
> @@ -1,4 +1,4 @@
> -RDEPENDS += "kernel-image update-modules"
> +RDEPENDS_${PN} += "kernel-image ${@oe.utils.contains('DISTRO_FEATURES', 'update-modules', 'update-modules', '', d)}"
> DEPENDS += "virtual/kernel"
>
> inherit module-base
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 3496d2b..5196018 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -724,7 +724,7 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
> IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
>
> -DISTRO_FEATURES_BACKFILL = "pulseaudio"
> +DISTRO_FEATURES_BACKFILL = "pulseaudio update-modules"
> DISTRO_FEATURES_append = "${@oe.utils.features_backfill("DISTRO_FEATURES",d)}"
>
> MACHINE_FEATURES_BACKFILL = "rtc"
> --
> 1.7.10.4
>
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
--
Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kernel.bbclass, module.bbclass: Make update-modules optional
2012-09-26 12:02 [PATCH] kernel.bbclass, module.bbclass: Make update-modules optional Phil Blundell
2012-09-26 12:14 ` Martin Jansa
@ 2012-10-18 20:00 ` Saul Wold
1 sibling, 0 replies; 3+ messages in thread
From: Saul Wold @ 2012-10-18 20:00 UTC (permalink / raw)
To: Phil Blundell; +Cc: openembedded-core
On 09/26/2012 05:02 AM, Phil Blundell wrote:
> The update-modules mechanism is something of a historical relic and it isn't
> entirely clear that it has a great deal of value nowadays. Also, it causes a
> problem when building a read-only rootfs since update-modules itself refuses
> to configure offline.
>
> Allow DISTROs to circumvent this whole thing by declaring (via DISTRO_FEATURES)
> that they don't wish to use update-modules. This is backfilled for existing
> distributions and will have to be marked as CONSIDERED by those who actually
> don't want it.
>
> Signed-off-by: Phil Blundell <pb@pbcl.net>
> ---
> meta/classes/kernel.bbclass | 24 ++++++++++++++++--------
> meta/classes/module.bbclass | 2 +-
> meta/conf/bitbake.conf | 2 +-
> 3 files changed, 18 insertions(+), 10 deletions(-)
>
Merged into OE-Core
Thanks
Sau!
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index fdef1be..d3af67c 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -398,10 +398,12 @@ python populate_packages_prepend () {
>
> dvar = d.getVar('PKGD', True)
>
> + use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
> +
> # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
> # appropriate modprobe commands to the postinst
> autoload = d.getVar('module_autoload_%s' % basename, True)
> - if autoload:
> + if autoload and use_update_modules:
> name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
> f = open(name, 'w')
> for m in autoload.split():
> @@ -415,15 +417,16 @@ python populate_packages_prepend () {
>
> # Write out any modconf fragment
> modconf = d.getVar('module_conf_%s' % basename, True)
> - if modconf:
> + if modconf and use_update_modules:
> name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
> f = open(name, 'w')
> f.write("%s\n" % modconf)
> f.close()
>
> - files = d.getVar('FILES_%s' % pkg, True)
> - files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
> - d.setVar('FILES_%s' % pkg, files)
> + if use_update_modules:
> + files = d.getVar('FILES_%s' % pkg, True)
> + files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
> + d.setVar('FILES_%s' % pkg, files)
>
> if vals.has_key("description"):
> old_desc = d.getVar('DESCRIPTION_' + pkg, True) or ""
> @@ -441,12 +444,17 @@ python populate_packages_prepend () {
> module_regex = '^(.*)\.k?o$'
> module_pattern = 'kernel-module-%s'
>
> - postinst = d.getVar('pkg_postinst_modules', True)
> - postrm = d.getVar('pkg_postrm_modules', True)
> + use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
> + if use_update_modules:
> + postinst = d.getVar('pkg_postinst_modules', True)
> + postrm = d.getVar('pkg_postrm_modules', True)
> + else:
> + postinst = None
> + postrm = None
> do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
> do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
> do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
> - do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % d.getVar("KERNEL_VERSION", True))
> + do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%skernel-%s' % (['', 'update-modules '][use_update_modules], d.getVar("KERNEL_VERSION", True)))
>
> # If modules-load.d and modprobe.d are empty at this point, remove them to
> # avoid warnings. removedirs only raises an OSError if an empty
> diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
> index c721202..e8d32eb 100644
> --- a/meta/classes/module.bbclass
> +++ b/meta/classes/module.bbclass
> @@ -1,4 +1,4 @@
> -RDEPENDS += "kernel-image update-modules"
> +RDEPENDS_${PN} += "kernel-image ${@oe.utils.contains('DISTRO_FEATURES', 'update-modules', 'update-modules', '', d)}"
> DEPENDS += "virtual/kernel"
>
> inherit module-base
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 3496d2b..5196018 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -724,7 +724,7 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
> IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
>
> -DISTRO_FEATURES_BACKFILL = "pulseaudio"
> +DISTRO_FEATURES_BACKFILL = "pulseaudio update-modules"
> DISTRO_FEATURES_append = "${@oe.utils.features_backfill("DISTRO_FEATURES",d)}"
>
> MACHINE_FEATURES_BACKFILL = "rtc"
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-18 20:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-26 12:02 [PATCH] kernel.bbclass, module.bbclass: Make update-modules optional Phil Blundell
2012-09-26 12:14 ` Martin Jansa
2012-10-18 20:00 ` Saul Wold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox