All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard Purdie" <richard.purdie@linuxfoundation.org>
To: Charlie Davies <charles.davies@whitetree.xyz>,
	 openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH] [hardknott] module.bbclass: Improve kernel module dependency detection
Date: Sat, 11 Sep 2021 22:11:34 +0100	[thread overview]
Message-ID: <a02f5ca73dcb4fb2d9d8c76e6fc5f6f0001a2361.camel@linuxfoundation.org> (raw)
In-Reply-To: <20210911202850.24488-1-charles.davies@whitetree.xyz>

On Sat, 2021-09-11 at 21:28 +0100, Charlie Davies wrote:
> If a kernel module recipe specifies a DEPENDS on another
> kernel module currently the module being depended on
> must have a name starting with kernel-module- .
> 
> It is perfectly valid to name a package without the
> kernel-module- scheme and instead use:
> 
> RPROVIDES_${PN} += "kernel-module-my-module"
> 
> in the package's recipe to provide an alias package
> name.
> 
> This commit introduces functionality which will search
> through the RPROVIDES aliases of each dependency package
> to allow packages not named kernel-module- to be
> recognised as dependencies.
> 
> Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz>
> ---
>  meta/classes/module.bbclass | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
> index a09ec3ed1e..c4f052234d 100644
> --- a/meta/classes/module.bbclass
> +++ b/meta/classes/module.bbclass
> @@ -6,11 +6,25 @@ MODULES_INSTALL_TARGET ?= "modules_install"
>  MODULES_MODULE_SYMVERS_LOCATION ?= ""
>  
>  python __anonymous () {
> +    import oe.packagedata
> +
>      depends = d.getVar('DEPENDS')
>      extra_symbols = []
>      for dep in depends.split():
>          if dep.startswith("kernel-module-"):
>              extra_symbols.append("${STAGING_INCDIR}/" + dep + "/Module.symvers")
> +        else:
> +            if oe.packagedata.has_subpkgdata(dep, d):
> +                data = oe.packagedata.read_subpkgdata(dep, d)
> +                key = "RPROVIDES_%s" % dep
> +                rprovs = data.get(key)
> +
> +                if rprovs is not None:
> +                    for rprov in rprovs.split():
> +                        if rprov.startswith("kernel-module-"):
> +                            extra_symbols.append("${STAGING_INCDIR}/" + dep + "/Module.symvers")
> +                            break
> +
>      d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols))
>  }
> 

This looks a bit like a nasty determinism issue. The original code only looks at
DEPENDS which can be determined at parse time. The new code will depend on what
is in the pkgdata sysroot which may or may not be present leading to varying
values of KBUILD_EXTRA_SYMBOLS. It will also have a pretty heavy overhead though
reading extra files.

At the very least this code needs to be scope limited but I'm not sure how
KBUILD_EXTRA_SYMBOLS is being used to be able offer more advice on that.

Cheers,

Richard




  reply	other threads:[~2021-09-11 21:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-11 20:28 [PATCH] [hardknott] module.bbclass: Improve kernel module dependency detection Charlie Davies
2021-09-11 21:11 ` Richard Purdie [this message]
2021-09-11 22:30   ` Charlie Davies

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a02f5ca73dcb4fb2d9d8c76e6fc5f6f0001a2361.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=charles.davies@whitetree.xyz \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.