public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH v2] kernel: provide module.lds for out of tree builds in v5.10+
@ 2020-11-14  5:27 Bruce Ashfield
  2020-11-16 19:50 ` [OE-core] " Scott Branden
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Ashfield @ 2020-11-14  5:27 UTC (permalink / raw)
  To: richard.purdie; +Cc: lili.li, openembedded-core

From: Bruce Ashfield <bruce.ashfield@gmail.com>

The upstream commit 596b0474d3d [kbuild: preprocess module linker
script], adds a dependency on module.lds for external module
building.

Since module.lds is generated as part of 'modules_prepare', we
must make it available with the other kernel artifacts in the
kernel shared workdir, otherwise out of tree builds fail.

This fixes errors like:

    | make[4]: *** No rule to make target 'scripts/module.lds', needed by
        'build/tmp/work/qemuarm64-poky-linux/cryptodev-module/1.11-r0/git/cryptodev.ko'.
        Stop.
    | make[4]: *** Waiting for unfinished jobs....

We also ensure that kernel-devsrc has a copy to support on
target module builds that are often prepared with 'make scripts
prepare'. Those targets won't regenerate it, so the build fails.
If 'make modules_prepare' is used, the file will be regenerated
and overwrite our copy (as expected).

Signed-off-by: Pan, Kris <kris.pan@intel.com>
Signed-off-by: Lili Li <lili.li@intel.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---

v2:
  - I was right that we really only should be copying this in one
    location, but it wasn't clear that the main kernel build no
    longer runs modules_prepare so the do_shared_workdir task will
    *never* fine module.lds on a clean run.

    So we just need the single copy after we've build our modules
    to ensure that the file is available.

    Tested against a clean kernel and module build, just building
    the module. Dependencies are correct and the file is copied
    for the module to build.

    We could do the same thing for Module.symvers, but historically
    it was generated during the main kernel build .. so we can leave
    it there for old kernel support.


 meta/classes/kernel.bbclass                | 1 +
 meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index be93a258f6..af4c891de4 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -391,6 +391,7 @@ do_compile_kernelmodules() {
 		# other kernel modules and will look at this
 		# file to do symbol lookups
 		cp ${B}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/
+		[ -e ${B}/scripts/module.lds ] && install -Dm 0644 ${B}/scripts/module.lds ${STAGING_KERNEL_BUILDDIR}/scripts/module.lds
 	else
 		bbnote "no modules to compile"
 	fi
diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 81b1e36041..5f0dedbdf7 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -100,6 +100,12 @@ do_install() {
 	# be dealt with.
 	# cp -a scripts $kerneldir/build
 
+	# although module.lds can be regenerated on target via 'make modules_prepare'
+	# there are several places where 'makes scripts prepare' is done, and that won't
+	# regenerate the file. So we copy it onto the target as a migration to using
+	# modules_prepare
+	cp -a --parents scripts/module.lds $kerneldir/build/ 2>/dev/null || :
+
         if [ -d arch/${ARCH}/scripts ]; then
 	    cp -a arch/${ARCH}/scripts $kerneldir/build/arch/${ARCH}
 	fi
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH v2] kernel: provide module.lds for out of tree builds in v5.10+
  2020-11-14  5:27 [PATCH v2] kernel: provide module.lds for out of tree builds in v5.10+ Bruce Ashfield
@ 2020-11-16 19:50 ` Scott Branden
  2020-11-16 21:08   ` Scott Branden
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Branden @ 2020-11-16 19:50 UTC (permalink / raw)
  To: Bruce Ashfield, richard.purdie; +Cc: lili.li, openembedded-core


[-- Attachment #1.1: Type: text/plain, Size: 3578 bytes --]

This version works better for me.

On 2020-11-13 9:27 p.m., Bruce Ashfield wrote:
> From: Bruce Ashfield <bruce.ashfield@gmail.com>
>
> The upstream commit 596b0474d3d [kbuild: preprocess module linker
> script], adds a dependency on module.lds for external module
> building.
>
> Since module.lds is generated as part of 'modules_prepare', we
> must make it available with the other kernel artifacts in the
> kernel shared workdir, otherwise out of tree builds fail.
>
> This fixes errors like:
>
>     | make[4]: *** No rule to make target 'scripts/module.lds', needed by
>         'build/tmp/work/qemuarm64-poky-linux/cryptodev-module/1.11-r0/git/cryptodev.ko'.
>         Stop.
>     | make[4]: *** Waiting for unfinished jobs....
>
> We also ensure that kernel-devsrc has a copy to support on
> target module builds that are often prepared with 'make scripts
> prepare'. Those targets won't regenerate it, so the build fails.
> If 'make modules_prepare' is used, the file will be regenerated
> and overwrite our copy (as expected).
>
> Signed-off-by: Pan, Kris <kris.pan@intel.com>
> Signed-off-by: Lili Li <lili.li@intel.com>
> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Tested-by: Scott Branden <scott.branden@broadcom.com>
> ---
>
> v2:
>   - I was right that we really only should be copying this in one
>     location, but it wasn't clear that the main kernel build no
>     longer runs modules_prepare so the do_shared_workdir task will
>     *never* fine module.lds on a clean run.
>
>     So we just need the single copy after we've build our modules
>     to ensure that the file is available.
>
>     Tested against a clean kernel and module build, just building
>     the module. Dependencies are correct and the file is copied
>     for the module to build.
>
>     We could do the same thing for Module.symvers, but historically
>     it was generated during the main kernel build .. so we can leave
>     it there for old kernel support.
>
>
>  meta/classes/kernel.bbclass                | 1 +
>  meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
>  2 files changed, 7 insertions(+)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index be93a258f6..af4c891de4 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -391,6 +391,7 @@ do_compile_kernelmodules() {
>  		# other kernel modules and will look at this
>  		# file to do symbol lookups
>  		cp ${B}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/
> +		[ -e ${B}/scripts/module.lds ] && install -Dm 0644 ${B}/scripts/module.lds ${STAGING_KERNEL_BUILDDIR}/scripts/module.lds
>  	else
>  		bbnote "no modules to compile"
>  	fi
> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
> index 81b1e36041..5f0dedbdf7 100644
> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
> @@ -100,6 +100,12 @@ do_install() {
>  	# be dealt with.
>  	# cp -a scripts $kerneldir/build
>  
> +	# although module.lds can be regenerated on target via 'make modules_prepare'
> +	# there are several places where 'makes scripts prepare' is done, and that won't
> +	# regenerate the file. So we copy it onto the target as a migration to using
> +	# modules_prepare
> +	cp -a --parents scripts/module.lds $kerneldir/build/ 2>/dev/null || :
> +
>          if [ -d arch/${ARCH}/scripts ]; then
>  	    cp -a arch/${ARCH}/scripts $kerneldir/build/arch/${ARCH}
>  	fi
>
> 
>


[-- Attachment #1.2: Type: text/html, Size: 4504 bytes --]

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4169 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH v2] kernel: provide module.lds for out of tree builds in v5.10+
  2020-11-16 19:50 ` [OE-core] " Scott Branden
@ 2020-11-16 21:08   ` Scott Branden
  0 siblings, 0 replies; 3+ messages in thread
From: Scott Branden @ 2020-11-16 21:08 UTC (permalink / raw)
  To: Bruce Ashfield, richard.purdie; +Cc: lili.li, openembedded-core


[-- Attachment #1.1: Type: text/plain, Size: 3847 bytes --]


On 2020-11-16 11:50 a.m., Scott Branden wrote:
> This version works better for me.
*when the kernel is devtool checked out.  When the kernel is not checked out it fails to compile the external kernel module.
>
> On 2020-11-13 9:27 p.m., Bruce Ashfield wrote:
>> From: Bruce Ashfield <bruce.ashfield@gmail.com>
>>
>> The upstream commit 596b0474d3d [kbuild: preprocess module linker
>> script], adds a dependency on module.lds for external module
>> building.
>>
>> Since module.lds is generated as part of 'modules_prepare', we
>> must make it available with the other kernel artifacts in the
>> kernel shared workdir, otherwise out of tree builds fail.
>>
>> This fixes errors like:
>>
>>     | make[4]: *** No rule to make target 'scripts/module.lds', needed by
>>         'build/tmp/work/qemuarm64-poky-linux/cryptodev-module/1.11-r0/git/cryptodev.ko'.
>>         Stop.
>>     | make[4]: *** Waiting for unfinished jobs....
>>
>> We also ensure that kernel-devsrc has a copy to support on
>> target module builds that are often prepared with 'make scripts
>> prepare'. Those targets won't regenerate it, so the build fails.
>> If 'make modules_prepare' is used, the file will be regenerated
>> and overwrite our copy (as expected).
>>
>> Signed-off-by: Pan, Kris <kris.pan@intel.com>
>> Signed-off-by: Lili Li <lili.li@intel.com>
>> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> Tested-by: Scott Branden <scott.branden@broadcom.com>
>> ---
>>
>> v2:
>>   - I was right that we really only should be copying this in one
>>     location, but it wasn't clear that the main kernel build no
>>     longer runs modules_prepare so the do_shared_workdir task will
>>     *never* fine module.lds on a clean run.
>>
>>     So we just need the single copy after we've build our modules
>>     to ensure that the file is available.
>>
>>     Tested against a clean kernel and module build, just building
>>     the module. Dependencies are correct and the file is copied
>>     for the module to build.
>>
>>     We could do the same thing for Module.symvers, but historically
>>     it was generated during the main kernel build .. so we can leave
>>     it there for old kernel support.
>>
>>
>>  meta/classes/kernel.bbclass                | 1 +
>>  meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
>> index be93a258f6..af4c891de4 100644
>> --- a/meta/classes/kernel.bbclass
>> +++ b/meta/classes/kernel.bbclass
>> @@ -391,6 +391,7 @@ do_compile_kernelmodules() {
>>  		# other kernel modules and will look at this
>>  		# file to do symbol lookups
>>  		cp ${B}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/
>> +		[ -e ${B}/scripts/module.lds ] && install -Dm 0644 ${B}/scripts/module.lds ${STAGING_KERNEL_BUILDDIR}/scripts/module.lds
>>  	else
>>  		bbnote "no modules to compile"
>>  	fi
>> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
>> index 81b1e36041..5f0dedbdf7 100644
>> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
>> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
>> @@ -100,6 +100,12 @@ do_install() {
>>  	# be dealt with.
>>  	# cp -a scripts $kerneldir/build
>>  
>> +	# although module.lds can be regenerated on target via 'make modules_prepare'
>> +	# there are several places where 'makes scripts prepare' is done, and that won't
>> +	# regenerate the file. So we copy it onto the target as a migration to using
>> +	# modules_prepare
>> +	cp -a --parents scripts/module.lds $kerneldir/build/ 2>/dev/null || :
>> +
>>          if [ -d arch/${ARCH}/scripts ]; then
>>  	    cp -a arch/${ARCH}/scripts $kerneldir/build/arch/${ARCH}
>>  	fi
>>
>> 
>>
>


[-- Attachment #1.2: Type: text/html, Size: 5226 bytes --]

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4169 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-16 21:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-14  5:27 [PATCH v2] kernel: provide module.lds for out of tree builds in v5.10+ Bruce Ashfield
2020-11-16 19:50 ` [OE-core] " Scott Branden
2020-11-16 21:08   ` Scott Branden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox