kernel-devsrc: restructure for out of tree (and on target) module builds
PATCH v5 1/1 kernel-devsrc: restructure for out of tree (and on target) module builds
The existing kernel-devsrc package starts with a full copy of the kernel source and then starts to strip out elements that are not required.
This results in extra time (I/O) and extra space being taken up in the final package. The main purpose of the kernel-devsrc package has been to build modules against the running kernel, not to include a full copy of the source code for re-building the kernel. The end result was a 600M kernel-devsrc package.
This restructuring of the package uses an approach similar to other distros, where the kernel-devsrc package is for building against the running kernel and uses a curated set of copied infrastructure, versus a mass copy of the entire kernel.
The differences in this approach versus other is largely due to the architecture support and the split build/source directory of the kernel.
The result is a kernel-devsrc package of about 10M, which is capable of running "make scripts" and compiling kernel modules against the running kernel.
Along with the changes to the copying of the infrascture, we also have the following changes:
- a better/more explicit listing of dependencies for on-target builds of "make scripts" or "make modules_prepare"
- The kernel source is installed into /lib/modules/<version>/build and a symlink created from /usr/src/kernel to the new location. This aligns with the standard location for module support code
- There is also a symlink from /lib/modules/<version>/source -> build to reserve a spot for a new package that is simply the kernel source. That package is not part of this update.
---
Here's v5 of the devsrc re-work. mips64 was a bit trickier than expected, but I have been able to perform make scripts/prepare on target with this version of the patch (mips64 wants to re-run the missing syscall detection code as part of prepare and that requires more files and tools to be present. I also ran into a few 4.18+ changes with the recipe, and those fixes are commented in the code and are part of this version.
Bruce
v2: drop DEPENDS on perf. We no longer need to depend on
perf since the source is copied before modification.
v3: build fixes for:
- DESCEND objtool build failure
- No rule to make target 'arch/mips/boot/tools/relocs_32.c'
- No rule to make target 'arch/arm/tools/syscall.tbl'
- No rule to make target 'arch/arm64/kernel/vdso/vdso.lds'
v4: adjust build appliance and oeqa tests to the new build location
v5:
- added failure catch for x86 purgatory files which changed in 4.18 and hence are not universal across versions
- added explicity bison and flex rdepends for mips64 prepare phase
- added mips64 files required for scripts/prepare phase
- added files required for missing syscall support
meta/lib/oeqa/runtime/cases/stap.py | 2 +- .../images/build-appliance-image_15.0.0.bb | 6 +- meta/recipes-kernel/linux/kernel-devsrc.bb | 239 +++++++++++++++++---- 3 files changed, 197 insertions(+), 50 deletions(-)
meta/lib/oeqa/runtime/cases/stap.py +1 -1
@@ -25,7 +25,7 @@ class StapTest(OERuntimeTestCase): def test_stap(self): cmds = [ 'cd /usr/src/kernel && make scripts prepare', - 'cd /lib/modules/`uname -r` && (if [ ! -L build ]; then ln -s /usr/src/kernel build; fi)', + 'cd /lib/modules/`uname -r` && (if [ ! -e build ]; then ln -s /usr/src/kernel build; fi)', 'stap --disable-cache -DSTP_NO_VERREL_CHECK /tmp/hello.stp' ] for cmd in cmds:
meta/recipes-core/images/build-appliance-image_15.0.0.bb +4 -2
@@ -59,8 +59,10 @@ fakeroot do_populate_poky_src () { cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/ # Create a symlink, needed for out-of-tree kernel modules build - rm -f ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build - lnr ${IMAGE_ROOTFS}${KERNEL_SRC_PATH} ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build + if [ ! -e ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build ]; then + rm -f ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build + lnr ${IMAGE_ROOTFS}${KERNEL_SRC_PATH} ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build + fi echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf echo "export LC_ALL=en_US.utf8" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
meta/recipes-kernel/linux/kernel-devsrc.bb +192 -47
249 lines not on this page · raw message
Signature · 1 line
2.5.0
Quoted 8 lines · Bruce Ashfield
[...]
v5:
- added failure catch for x86 purgatory files which changed in 4.18 and hence are not universal across versions
- added explicity bison and flex rdepends for mips64 prepare phase
- added mips64 files required forscripts/preparephase
- added files required for missing syscall support
Tests passed so I've merged it, thanks for persevering, we finally got there! :)
Cheers,
Richard
Quoted 10 lines · On 08/19/2018 11:36 AM, [email protected] wrote:
Quoted 8 lines · Bruce Ashfield
[...]
v5:
- added failure catch for x86 purgatory files which changed in 4.18 and hence are not universal across versions
- added explicity bison and flex rdepends for mips64 prepare phase
- added mips64 files required forscripts/preparephase
- added files required for missing syscall support
Quoted 2 lines
Tests passed so I've merged it, thanks for persevering, we finally got there! :)
Excellent! I was hoping v6 wasn't going to be required :D
I'm sure that more corner cases will start popping up as it gets exercised in the tree.
When they do pop up, I can handle them (via bugs, or whatever), since I'm pretty familiar with this right now.
Onto 4.18, which I expect to have to you by mid-week.
Cheers,
Bruce
Quoted 5 lines
Cheers,
Richard
Hi Bruce
I just came across this the other day and I had one question:
Quoted 9 lines · NZDT Bruce Ashfield
The existing kernel-devsrc package starts with a full copy of the kernel source and then starts to strip out elements that are not required.
This results in extra time (I/O) and extra space being taken up in the final package. The main purpose of the kernel-devsrc package has been to build modules against the running kernel, not to include a full copy of the source code for re-building the kernel. The end result was a 600M kernel-devsrc package.
Quoted 8 lines
This restructuring of the package uses an approach similar to other distros, where the kernel-devsrc package is for building against the running kernel and uses a curated set of copied infrastructure, versus a mass copy of the entire kernel.
...
- There is also a symlink from /lib/modules/<version>/source -> build to reserve a spot for a new package that is simply the kernel source. That package is not part of this update.
Did you manage to get to this or is it still planned?
Thanks,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Quoted 23 lines · Paul Eggleton
Hi Bruce
I just came across this the other day and I had one question:
Quoted 9 lines · NZDT Bruce Ashfield
The existing kernel-devsrc package starts with a full copy of the kernel source and then starts to strip out elements that are not required.
This results in extra time (I/O) and extra space being taken up in the final package. The main purpose of the kernel-devsrc package has been to build modules against the running kernel, not to include a full copy of the source code for re-building the kernel. The end result was a 600M kernel-devsrc package.
Quoted 8 lines
This restructuring of the package uses an approach similar to other distros, where the kernel-devsrc package is for building against the running kernel and uses a curated set of copied infrastructure, versus a mass copy of the entire kernel.
...
- There is also a symlink from /lib/modules/<version>/source -> build to reserve a spot for a new package that is simply the kernel source. That package is not part of this update.
Quoted 1 line
Did you manage to get to this or is it still planned?
We did get to it, and it is in the 2.6 release.
Bruce
Quoted 4 lines
Thanks,
Paul