]> code.ossystems Code Review - openembedded-core.git/commitdiff
kernel-devsrc: fix on-target module build for v5.8+
authorBruce Ashfield <bruce.ashfield@gmail.com>
Fri, 17 Jul 2020 12:56:34 +0000 (08:56 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 20 Jul 2020 07:37:35 +0000 (08:37 +0100)
The kernel build is now more sensitive to changing build inputs,
like the compiler, linker, source tree location, versions, file
timestamps, etc.

When a difference is detected, the kernel build invokes a syncconfig
to update/regenerate files as required. That process may prompt, and
hence breaks automated tested and other workflows.

By default, we don't want this to happen so we make sure that auto*
timestamps are newer or equal to the .config timestap, we ensure that
autoconf.h is in the filesystem and that we've substituted the
cross tools used to build the kernel with the names that will be
on the target.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-kernel/linux/kernel-devsrc.bb

index 5940cc90eaa311493b3691ca58e9bf4aaf5f2f4e..0c98535f75810b3408db08e255a7b9daa307913a 100644 (file)
@@ -108,6 +108,11 @@ do_install() {
        fi
 
        cp -a include $kerneldir/build/include
+
+       # we don't usually copy generated files, since they can be rebuilt on the target,
+       # but without this file, we get a forced syncconfig run in v5.8+, which prompts and
+       # breaks workflows.
+       cp -a --parents include/generated/autoconf.h $kerneldir/build 2>/dev/null || :
     )
 
     # now grab the chunks from the source tree that we need
@@ -249,6 +254,17 @@ do_install() {
     # Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
     cp $kerneldir/build/.config $kerneldir/build/include/config/auto.conf
 
+    # make sure these are at least as old as the .config, or rebuilds will trigger
+    touch -r $kerneldir/build/.config $kerneldir/build/include/generated/autoconf.h 2>/dev/null || :
+    touch -r $kerneldir/build/.config $kerneldir/build/include/config/auto.conf* 2>/dev/null || :
+
+    if [ -e "$kerneldir/build/include/config/auto.conf.cmd" ]; then
+        sed -i 's/ifneq "$(CC)" ".*-linux-gcc.*$/ifneq "$(CC)" "gcc"/' "$kerneldir/build/include/config/auto.conf.cmd"
+        sed -i 's/ifneq "$(LD)" ".*-linux-ld.bfd.*$/ifneq "$(LD)" "ld"/' "$kerneldir/build/include/config/auto.conf.cmd"
+        sed -i 's/ifneq "$(CC_VERSION_TEXT)".*\(gcc.*\)"/ifneq "$(CC_VERSION_TEXT)" "\1"/' "$kerneldir/build/include/config/auto.conf.cmd"
+        sed -i 's/ifneq "$(srctree)" ".*"/ifneq "$(srctree)" "."/' "$kerneldir/build/include/config/auto.conf.cmd"
+    fi
+
     # make the scripts python3 safe. We won't be running these, and if they are
     # left as /usr/bin/python rootfs assembly will fail, since we only have python3
     # in the RDEPENDS (and the python3 package does not include /usr/bin/python)