Skip to contentSkip to conversation

kernel: relocate copy of module.lds to module compilation task

PATCH Superseded Bruce Ashfield 2 participants 5 messages Nov 17, 2020 – Nov 18, 2020 2 messages not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel: relocate copy of module.lds to module compilation task

From: Bruce Ashfield <[email protected]>

There were two copies of this patch floating around, and the merged variant has the copy in the wrong place.

module.lds is only created during modules_prepare, and that target is not invoked during our main build of the kernel. We aren't about to change the kernel build (there's no need), so we move the copy into the compile_kernelmodules task. After that runs, we have module.lds availble to copy.

This has been tested against clean kernel + out of tree module builds, and the dependencies are correct that the file is copied before the out of tree module build starts.

---

This is just a fixup to the patch [kernel: provide module.lds for out of tree builds in v5.10+], which v1 merged instead of v2.

Build tested locally.

 meta/classes/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel.bbclass +1 -1
index ccd74e61e8..af4c891de4 100644
@@ -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
@@ -494,7 +495,6 @@ do_shared_workdir () {
 	# Copy files required for module builds
 	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
 	[ -e Module.symvers ] && cp Module.symvers $kerneldir/
-	[ -e scripts/module.lds ] && install -Dm 0644 scripts/module.lds $kerneldir/scripts/module.lds
 	cp .config $kerneldir/
 	mkdir -p $kerneldir/include/config
 	cp include/config/kernel.release $kerneldir/include/config/kernel.release
Signature · 1 line
2.19.1
#1 lore raw

Hi Bruce

Quoted 32 lines · Bruce Ashfield

From: Bruce Ashfield <[email protected]>

There were two copies of this patch floating around, and the merged variant has the copy in the wrong place.

module.lds is only created during modules_prepare, and that target is not invoked during our main build of the kernel. We aren't about to change the kernel build (there's no need), so we move the copy into the compile_kernelmodules task. After that runs, we have module.lds availble to copy.

This has been tested against clean kernel + out of tree module builds, and the dependencies are correct that the file is copied before the out of tree module build starts.

---

This is just a fixup to the patch [kernel: provide module.lds for out of tree builds in v5.10+], which v1 merged instead of v2.

Build tested locally.

 meta/classes/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel.bbclass +0 -0
index ccd74e61e8..af4c891de4 100644

meta/classes/kernel.bbclass do_compile_kernelmodules() { · line 394

Quoted 4 lines
meta/classes/kernel.bbclass +1 -0
@@ -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

This change fails the task if file does not exist

make: Leaving directory '/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/linux-raspberrypi4_64-standard-build'
WARNING: /mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/temp/run.do_compile_kernelmodules.1515902:175 exit 1 from '[ -e /mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/linux-raspberrypi4_64-standard-build/scripts/module.lds ]'
WARNING: Backtrace (BB generated script):

        #1: main,

/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/temp/run.do_compile_kernelmodules.1515902, line 175

however if I change the above fragment to

if [ -f ${B}/scripts/module.lds ]; then
install -Dm 0644 ${B}/scripts/module.lds
${STAGING_KERNEL_BUILDDIR}/scripts/module.lds
fi

it works well.

and note I have used -f instead of -e since that appropriate check but it does not matter if we use -e or -f it fails in same
way with the check you proposed.

Quoted 17 lines
meta/classes/kernel.bbclass +0 -2
        else
                bbnote "no modules to compile"
        fi
@@ -494,7 +495,6 @@ do_shared_workdir () {
        # Copy files required for module builds
        cp System.map $kerneldir/System.map-${KERNEL_VERSION}
        [ -e Module.symvers ] && cp Module.symvers $kerneldir/
-       [ -e scripts/module.lds ] && install -Dm 0644 scripts/module.lds $kerneldir/scripts/module.lds
        cp .config $kerneldir/
        mkdir -p $kerneldir/include/config
        cp include/config/kernel.release $kerneldir/include/config/kernel.release
--

2.19.1

#2 lore raw
Quoted 67 lines · Khem Raj

Hi Bruce

Quoted 32 lines · Bruce Ashfield

From: Bruce Ashfield <[email protected]>

There were two copies of this patch floating around, and the merged variant has the copy in the wrong place.

module.lds is only created during modules_prepare, and that target is not invoked during our main build of the kernel. We aren't about to change the kernel build (there's no need), so we move the copy into the compile_kernelmodules task. After that runs, we have module.lds availble to copy.

This has been tested against clean kernel + out of tree module builds, and the dependencies are correct that the file is copied before the out of tree module build starts.

---

This is just a fixup to the patch [kernel: provide module.lds for out of tree builds in v5.10+], which v1 merged instead of v2.

Build tested locally.

 meta/classes/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel.bbclass +0 -0
index ccd74e61e8..af4c891de4 100644

meta/classes/kernel.bbclass do_compile_kernelmodules() { · line 394

Quoted 4 lines
meta/classes/kernel.bbclass +1 -0
@@ -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

This change fails the task if file does not exist

make: Leaving directory

'/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/linux-raspberrypi4_64-standard-build' WARNING:
/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/temp/run.do_compile_kernelmodules.1515902:175 exit 1 from '[ -e

/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/linux-raspberrypi4_64-standard-build/scripts/module.lds ]'
WARNING: Backtrace (BB generated script):

        #1: main,

/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/temp/run.do_compile_kernelmodules.1515902, line 175

however if I change the above fragment to

if [ -f ${B}/scripts/module.lds ]; then
install -Dm 0644 ${B}/scripts/module.lds
${STAGING_KERNEL_BUILDDIR}/scripts/module.lds
fi

Quoted 6 lines

it works well.

and note I have used -f instead of -e since that appropriate check but it does not matter if we use -e or -f it fails in same
way with the check you proposed.

That's really strange.

I tested this against a clean oe-core with kernel versions from 5.4 through 5.10.

What kernel and version are you building ?

Bruce

Quoted 20 lines

meta/classes/kernel.bbclass do_shared_workdir () { · line 497

Quoted 8 lines
meta/classes/kernel.bbclass +0 -1
        else
                bbnote "no modules to compile"
        fi
@@ -494,7 +495,6 @@ do_shared_workdir () {
        # Copy files required for module builds
        cp System.map $kerneldir/System.map-${KERNEL_VERSION}
        [ -e Module.symvers ] && cp Module.symvers $kerneldir/
-       [ -e scripts/module.lds ] && install -Dm 0644 scripts/module.lds

$kerneldir/scripts/module.lds

meta/classes/kernel.bbclass do_shared_workdir () {

Quoted 3 lines
meta/classes/kernel.bbclass +0 -0
        cp .config $kerneldir/
        mkdir -p $kerneldir/include/config
        cp include/config/kernel.release

$kerneldir/include/config/kernel.release

Quoted 6 lines

--
2.19.1

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
#4 lore raw
In reply to a message not in the archive
Quoted 78 lines · Bruce Ashfield via lists.openembedded.org
Quoted 67 lines · Khem Raj

Hi Bruce

Quoted 32 lines · Bruce Ashfield

From: Bruce Ashfield <[email protected]>

There were two copies of this patch floating around, and the merged variant has the copy in the wrong place.

module.lds is only created during modules_prepare, and that target is not invoked during our main build of the kernel. We aren't about to change the kernel build (there's no need), so we move the copy into the compile_kernelmodules task. After that runs, we have module.lds availble to copy.

This has been tested against clean kernel + out of tree module builds, and the dependencies are correct that the file is copied before the out of tree module build starts.

---

This is just a fixup to the patch [kernel: provide module.lds for out of tree builds in v5.10+], which v1 merged instead of v2.

Build tested locally.

 meta/classes/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel.bbclass +0 -0
index ccd74e61e8..af4c891de4 100644

meta/classes/kernel.bbclass do_compile_kernelmodules() { · line 394

Quoted 4 lines
meta/classes/kernel.bbclass +1 -0
@@ -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

This change fails the task if file does not exist

make: Leaving directory

'/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/linux-raspberrypi4_64-standard-build' WARNING:
/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/temp/run.do_compile_kernelmodules.1515902:175 exit 1 from '[ -e

/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/linux-raspberrypi4_64-standard-build/scripts/module.lds ]'
WARNING: Backtrace (BB generated script):

        #1: main,

/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/temp/run.do_compile_kernelmodules.1515902, line 175

however if I change the above fragment to

if [ -f ${B}/scripts/module.lds ]; then
install -Dm 0644 ${B}/scripts/module.lds
${STAGING_KERNEL_BUILDDIR}/scripts/module.lds
fi

Quoted 6 lines

it works well.

and note I have used -f instead of -e since that appropriate check but it does not matter if we use -e or -f it fails in same
way with the check you proposed.

Quoted 7 lines

That's really strange.

I tested this against a clean oe-core with kernel versions from 5.4 through 5.10.

What kernel and version are you building ?

ahah. I can figure that out from your log.

I'll send a v2 once I've retested against that config, as well as my other ones.

Bruce

Quoted 36 lines

Bruce

Quoted 9 lines

meta/classes/kernel.bbclass do_shared_workdir () { · line 497

Quoted 8 lines
meta/classes/kernel.bbclass +0 -1
        else
                bbnote "no modules to compile"
        fi
@@ -494,7 +495,6 @@ do_shared_workdir () {
        # Copy files required for module builds
        cp System.map $kerneldir/System.map-${KERNEL_VERSION}
        [ -e Module.symvers ] && cp Module.symvers $kerneldir/
-       [ -e scripts/module.lds ] && install -Dm 0644

scripts/module.lds $kerneldir/scripts/module.lds

Quoted 11 lines

meta/classes/kernel.bbclass do_shared_workdir () {

Quoted 3 lines
meta/classes/kernel.bbclass +0 -0
        cp .config $kerneldir/
        mkdir -p $kerneldir/include/config
        cp include/config/kernel.release

$kerneldir/include/config/kernel.release

Quoted 6 lines

--
2.19.1

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
#6 lore raw
In reply to a message not in the archive
Quoted 89 lines · Bruce Ashfield via lists.openembedded.org
Quoted 84 lines · Bruce Ashfield via lists.openembedded.org
Quoted 68 lines · Khem Raj

Hi Bruce

Quoted 12 lines · Bruce Ashfield

From: Bruce Ashfield <[email protected]>

There were two copies of this patch floating around, and the merged variant has the copy in the wrong place.

module.lds is only created during modules_prepare, and that target is not invoked during our main build of the kernel. We aren't about to change the kernel build (there's no need), so we move the copy into the compile_kernelmodules task. After that runs, we have module.lds availble to copy.

Quoted 8 lines

This has been tested against clean kernel + out of tree module builds, and the dependencies are correct that the file is copied before the out of tree module build starts.

---

This is just a fixup to the patch [kernel: provide module.lds for out

of

Quoted 12 lines

tree builds in v5.10+], which v1 merged instead of v2.

Build tested locally.

 meta/classes/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel.bbclass +0 -0
index ccd74e61e8..af4c891de4 100644

meta/classes/kernel.bbclass do_compile_kernelmodules() { · line 394

Quoted 4 lines
meta/classes/kernel.bbclass +1 -0
@@ -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

This change fails the task if file does not exist

make: Leaving directory

'/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/linux-raspberrypi4_64-standard-build' WARNING:
/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/temp/run.do_compile_kernelmodules.1515902:175 exit 1 from '[ -e

/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/linux-raspberrypi4_64-standard-build/scripts/module.lds ]'
WARNING: Backtrace (BB generated script):

        #1: main,

/mnt/b/yoe/master/build/tmp/work/raspberrypi4_64-yoe-linux/linux-raspberrypi/1_5.4.72+gitAUTOINC+5d52d9eea9_154de7bbd5-r0/temp/run.do_compile_kernelmodules.1515902, line 175

however if I change the above fragment to

if [ -f ${B}/scripts/module.lds ]; then
install -Dm 0644 ${B}/scripts/module.lds
${STAGING_KERNEL_BUILDDIR}/scripts/module.lds
fi

Quoted 6 lines

it works well.

and note I have used -f instead of -e since that appropriate check but it does not matter if we use -e or -f it fails in same
way with the check you proposed.

That's really strange.

I tested this against a clean oe-core with kernel versions from 5.4 through 5.10.

Quoted 9 lines
Quoted 2 lines

What kernel and version are you building ?

ahah. I can figure that out from your log.

I'll send a v2 once I've retested against that config, as well as my other ones.

I've got this fixed now.

It helps when you do your test builds on a branch that actually contains your patch!!

Bruce

Quoted 50 lines

Bruce

Quoted 27 lines

Bruce

Quoted 9 lines

meta/classes/kernel.bbclass do_shared_workdir () { · line 497

Quoted 8 lines
meta/classes/kernel.bbclass +0 -1
        else
                bbnote "no modules to compile"
        fi
@@ -494,7 +495,6 @@ do_shared_workdir () {
        # Copy files required for module builds
        cp System.map $kerneldir/System.map-${KERNEL_VERSION}
        [ -e Module.symvers ] && cp Module.symvers $kerneldir/
-       [ -e scripts/module.lds ] && install -Dm 0644

scripts/module.lds $kerneldir/scripts/module.lds

Quoted 11 lines

meta/classes/kernel.bbclass do_shared_workdir () {

Quoted 3 lines
meta/classes/kernel.bbclass +0 -0
        cp .config $kerneldir/
        mkdir -p $kerneldir/include/config
        cp include/config/kernel.release

$kerneldir/include/config/kernel.release

Quoted 6 lines

--
2.19.1

Quoted 9 lines

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II