diff options
author | Tyler Hicks <tyhicks@linux.microsoft.com> | 2020-08-05 11:56:12 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-08-06 15:12:39 +0100 |
commit | b148043e0e2b10fc300c806b596d70397071b286 (patch) | |
tree | b4549eca2839cfd90544b1883f04d072ea97d003 | |
parent | 3488a38e60a48fd478f7acc42967c7317373ad43 (diff) | |
download | poky-b148043e0e2b10fc300c806b596d70397071b286.tar.gz |
kernel-devicetree: Fix intermittent build failures caused by DTB builds
Fix a build-time race condition that resulted in intermittent build
failures in the do_assemble_fitimage task. The race condition involved
the do_assemble_fitimage task reading the vmlinux file while the
do_compile_kernelmodules task was re-writing the vmlinux file.
This can be seen with an aarch64 image build that uses a 5.4 based
kernel and sets KERNEL_DEVICETREE. The problem is that the do_compile
snippet that the kernel-devicetree class appends did not specify the
full kernel build environment when building the DTB(s) from the kernel
tree. This resulted in CONFIG_CC_CAN_LINK=y being removed from the
kernel config file just before the do_compile task completed. The
CONFIG_CC_CAN_LINK=y line was then re-inserted into the kernel config
file as part of the do_compile_kernelmodules task.
In some cases, this resulted in the do_compile_kernelmodules task to
re-link vmlinux which sometimes occured at the same time that the
do_assemble_fitimage task was attempting to use vmlinux. The
do_assemble_fitimage task would fail with the following error message:
aarch64-poky-linux-objcopy:vmlinux: file format not recognized
We can use the pine-a64-lts machine, from the meta-pine64 layer, to show
that the kernel config file was changed between do_compile and
do_compile_kernelmodules:
$ C=tmp/work/pine_a64_lts-poky-linux/linux-pine64/5.7+gitAUTOINC+ae03bade3b-r0/linux-pine_a64_lts-standard-build/.config
$ bitbake -c do_kernel_configcheck virtual/kernel
...
$ md5sum $C; grep CC_CAN_LINK $C
32b133cf8a749a91f698a7ca8616c84f ...
CONFIG_CC_CAN_LINK=y
$ bitbake -c do_compile virtual/kernel
...
$ md5sum $C; grep CC_CAN_LINK $C
2fd2ec2a66eecc329dcb5afaf005eada ...
$ bitbake -c do_compile_kernelmodules virtual/kernel
...
$ md5sum $C; grep CC_CAN_LINK $C
32b133cf8a749a91f698a7ca8616c84f ...
CONFIG_CC_CAN_LINK=y
With this change, the do_compile snippet appended by the
kernel-devicetree class does not modify the kernel config. The kernel
config is unchanged across the do_compile and do_compile_kernelmodules
tasks and do_compile_kernelmodules will not attempt to re-link vmlinux.
(From OE-Core rev: 74619de0277471f446bf7a719f4c445359c823f6)
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/kernel-devicetree.bbclass | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass index 522c46575d..81dda8003f 100644 --- a/meta/classes/kernel-devicetree.bbclass +++ b/meta/classes/kernel-devicetree.bbclass | |||
@@ -52,7 +52,7 @@ do_configure_append() { | |||
52 | do_compile_append() { | 52 | do_compile_append() { |
53 | for dtbf in ${KERNEL_DEVICETREE}; do | 53 | for dtbf in ${KERNEL_DEVICETREE}; do |
54 | dtb=`normalize_dtb "$dtbf"` | 54 | dtb=`normalize_dtb "$dtbf"` |
55 | oe_runmake $dtb | 55 | oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} |
56 | done | 56 | done |
57 | } | 57 | } |
58 | 58 | ||