poky/meta/classes-recipe
Munehisa Kamata 5d567f14e9 kernel.bbclass: Set pkg-config variables for building modules
The pkg-config workaround has been applied for kernel image building, but
not for module building. So pkg-config variables are different between
do_compile and do_compile_kernelmodules tasks. It may unnecessary trigger
rebuilding of a few host tools at the later task.

Especially when CONFIG_DEBUG_INFO_BTF is enabled in the kernel, it may even
trigger rebuilding vmlinux at do_compile_kernelmodules due to the rebuilt
host tools such as certs/extract-cert or objtool (on x86). This eventually
creates an inconsistent set of kernel binaries.

Here is the repro steps:

 - Check out nanbield on x86
   - The unexpected rebuild happens on kirkstone or possibly earlier

 - Ensure that pahole is available (e.g. via meta-oe)

 - Set KERNEL_DEBUG to "True" to properly set up PAHOLE
   e.g.
   $ export KERNEL_DEBUG="True"
   $ export BB_ENV_PASSTHROUGH_ADDITIONS="${BB_ENV_PASSTHROUGH_ADDITIONS} KERNEL_DEBUG"

 - Enable CONFIG_DEBUG_INFO_BTF=y
   e.g.
   $ bitbake -c menuconfig virtual/kernel
    -> Kernel hacking
      -> Compile-time checks and compiler options
        -> Generate BTF typeinfo

 - Build the kernel
   e.g.
   $ bitbake virtual/kernel

The BTF information in the resulting bzImage and kernel modules are
inconsistent, because the module's BTF information is generated using the
"second" vmlinux that doesn't have the identical BTF to the "first" vmlinux.
These modules can't be loaded at runtime due to the BTF mismatch.

This also leads to a build-id mismatch between the installed bzImage and
vmlinux since the bzImage is created from the first vmlinux, but the
installed vmlinux is the second one.

  $ eu-readelf -n tmp/work/qemux86_64-poky-linux/linux-yocto/6.5.13+git/image/boot/{bzImage*,vmlinux*} | grep "Build ID"
   Build ID: 4a0d62ee7fef0244950f0f604253729875bea493
   Build ID: fb99b3d91399dbe42bf67ddee59e0f5a0c7f74d9

To avoid the unexpected rebuilding that results in such inconsistency, set
the same pkg-config variables when building kernel and modules. For kernel
5.19 and above, simply set the HOSTPKG_CONFIG in the make command line.

(From OE-Core rev: d88e0fa7c5e6c8252f8f775996f512a37fea4818)

Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit cd2072e5d953af981339427028e19083257e6a92)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-03-13 03:59:26 -10:00
..
allarch.bbclass allarch: Fix allarch corner case 2024-02-22 04:34:14 -10:00
autotools-brokensep.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
autotools.bbclass autotools.bbclass: Add *.m4 to CONFIGURE_FILES 2023-10-06 11:51:11 +01:00
baremetal-image.bbclass baremetal-helloworld: Enable x86 and x86-64 ports 2023-01-12 23:08:58 +00:00
bash-completion.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
bin_package.bbclass Revert "bin_package.bbclass: Inhibit the default dependencies" 2023-11-24 05:01:37 -10:00
binconfig-disabled.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
binconfig.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
cargo_c.bbclass classes-recipe: add cargo_c.bbclass 2023-08-21 16:15:35 +01:00
cargo_common.bbclass cargo_common.bbclass: Handle Cargo.lock modifications for git dependencies 2023-08-09 13:22:00 +01:00
cargo-update-recipe-crates.bbclass cargo-update-recipe-crates.bbclass: Do not add name= to crate:// URIs 2023-04-06 14:28:59 +01:00
cargo.bbclass cargo.bbclass: Use --frozen flag for cargo operations 2023-08-09 13:22:00 +01:00
cmake.bbclass cmake.bbclass: Add *.cmake to CONFIGURE_FILES 2023-10-09 15:51:13 +01:00
cml1.bbclass cml1: Fix KCONFIG_CONFIG_COMMAND not conveyed fully in do_menuconfig 2023-09-02 11:47:50 +01:00
compress_doc.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
core-image.bbclass Fix missing leading whitespace with ':append' 2023-01-26 21:06:57 +00:00
cpan_build.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
cpan-base.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
cpan.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
cross-canadian.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
cross.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
crosssdk.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
deploy.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
devicetree.bbclass devicetree.bbclass: Allow selection of dts files to build 2023-05-04 12:37:00 +01:00
devupstream.bbclass recipes/classes/scripts: Drop SRCPV usage in OE-Core 2023-08-24 16:50:24 +01:00
distro_features_check.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
dos2unix.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
features_check.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
fontcache.bbclass fontcache.bbclass: avoid native recipes depending on target fontconfig 2023-09-20 23:51:11 +01:00
fs-uuid.bbclass classes/fs-uuid: Fix command output decoding issue 2023-01-26 22:22:53 +00:00
gconf.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
gettext.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
gi-docgen.bbclass gi-docgen: depend on qemu-usermode MACHINE_FEATURES 2023-08-21 11:34:12 +01:00
gio-module-cache.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
github-releases.bbclass github-releases: add a class that consolidates version checks 2022-09-28 08:01:10 +01:00
gnomebase.bbclass gnomebase.bbclass: return the whole version for tarball directory if it is a number 2022-11-11 13:43:41 +00:00
go-mod.bbclass go-mod.bbclass: Remove repeated word 2022-10-26 12:28:39 +01:00
go-ptest.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
go.bbclass go.bbclass: don't use test to check output from ls 2023-05-22 10:53:48 +01:00
goarch.bbclass goarch: Move Go architecture mapping to a library 2023-11-24 05:01:37 -10:00
gobject-introspection-data.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
gobject-introspection.bbclass gobject-introspection: always DEPEND on gobject-introspection-native 2023-05-22 10:53:48 +01:00
grub-efi-cfg.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
grub-efi.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
gsettings.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
gtk-doc.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
gtk-icon-cache.bbclass gtk-icon-cache: Fix GTKIC_CMD if-else condition 2022-09-29 08:05:24 +01:00
gtk-immodules-cache.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
image_types_wic.bbclass image-artifact-names: include ${IMAGE_NAME_SUFFIX} directly in both ${IMAGE_NAME} and ${IMAGE_LINK_NAME} 2023-06-29 11:28:32 +01:00
image_types.bbclass classes/image_types: Add vfat image type 2023-08-30 08:43:03 +01:00
image-artifact-names.bbclass image-artifact-names: include ${IMAGE_NAME_SUFFIX} directly in both ${IMAGE_NAME} and ${IMAGE_LINK_NAME} 2023-06-29 11:28:32 +01:00
image-combined-dbg.bbclass classes: Drop ';' delimiter from ROOTFS/IMAGE*COMMAND variables 2023-09-09 22:14:41 +01:00
image-container.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
image-live.bbclass image-artifact-names: include ${IMAGE_NAME_SUFFIX} directly in both ${IMAGE_NAME} and ${IMAGE_LINK_NAME} 2023-06-29 11:28:32 +01:00
image-postinst-intercepts.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
image.bbclass multilib: fix SSTATE_ARCHS for multilib usage 2023-09-20 23:51:11 +01:00
kernel-arch.bbclass kernel-arch: use ccache only for compiler 2024-01-04 04:09:43 -10:00
kernel-artifact-names.bbclass image-artifact-names: add IMAGE_MACHINE_SUFFIX variable 2023-03-22 13:53:29 +00:00
kernel-devicetree.bbclass kernel-devicetree: install dtb files without -${KERNEL_DTB_NAME} suffix 2023-06-29 11:28:32 +01:00
kernel-fitimage.bbclass kernel-fitImage: Strip path component from dtb 2023-09-28 12:37:47 +01:00
kernel-grub.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
kernel-module-split.bbclass kernel-module-split add systemd modulesloaddir and modprobedir config 2023-07-10 11:36:34 +01:00
kernel-uboot.bbclass kernel: Add kernel specific OBJDUMP 2023-03-01 21:29:31 +00:00
kernel-uimage.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
kernel-yocto.bbclass kernel-yocto: improve metadata patching 2023-12-15 03:54:00 -10:00
kernel.bbclass kernel.bbclass: Set pkg-config variables for building modules 2024-03-13 03:59:26 -10:00
kernelsrc.bbclass kernel: make LOCALVERSION consistent between recipes 2023-07-25 15:27:33 +01:00
lib_package.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
libc-package.bbclass class-recipe: add support for loongarch64 2023-03-23 22:36:46 +00:00
license_image.bbclass license/license_image: Fix license file layout to avoid overlapping files 2023-09-20 23:51:11 +01:00
linux-dummy.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
linux-kernel-base.bbclass kernel: make LOCALVERSION consistent between recipes 2023-07-25 15:27:33 +01:00
linuxloader.bbclass linuxloader/initramfs: Add support for loongarch64 2023-05-31 16:53:04 +01:00
live-vm-common.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
manpages.bbclass manpages: use an intercept to run mandb 2023-03-08 10:21:05 +00:00
meson-routines.bbclass class-recipe: add support for loongarch64 2023-03-23 22:36:46 +00:00
meson.bbclass meson: use correct targets for rust binaries 2023-12-15 03:54:00 -10:00
mime-xdg.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
mime.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
module-base.bbclass kernel: make LOCALVERSION consistent between recipes 2023-07-25 15:27:33 +01:00
module.bbclass kernel: Add kernel specific STRIP variable 2023-06-19 13:18:56 +01:00
multilib_header.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
multilib_script.bbclass multilib_script.bbclass: expand script name as well 2023-09-28 12:37:47 +01:00
native.bbclass native: Implement BBCLASSEXTEND PACKAGES_DYNAMIC handling 2023-01-26 21:06:57 +00:00
nativesdk.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
nopackages.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
npm.bbclass classe-recipes: npm: Add support for dependencies and devDependencies 2023-06-29 11:10:39 +01:00
overlayfs-etc.bbclass classes: Drop ';' delimiter from ROOTFS/IMAGE*COMMAND variables 2023-09-09 22:14:41 +01:00
overlayfs.bbclass overlayfs: Allow not used mount points 2022-10-26 12:28:37 +01:00
packagegroup.bbclass packagegroup: Handle SPDX signature issues 2023-06-06 23:41:13 +01:00
perl-version.bbclass perl-version: remove PERL* assignments 2023-05-04 12:34:30 +01:00
perlnative.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
pixbufcache.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
pkgconfig.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
populate_sdk_base.bbclass uninative-tarball.xz - reproducibility fix 2024-01-31 04:10:24 -10:00
populate_sdk_ext.bbclass classes: Drop ';' delimiter from ROOTFS/IMAGE*COMMAND variables 2023-09-09 22:14:41 +01:00
populate_sdk.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
ptest-cargo.bbclass ptest-cargo.bbclass: Support of cargo workspaces 2023-07-30 07:54:44 +01:00
ptest-gnome.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
ptest-perl.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
ptest.bbclass ptest-packagelists: Simplify ptest list/code 2023-03-14 07:17:47 +00:00
pypi.bbclass pypi.bbclass: Update the upstream checks to automatically replace '_' with '-' 2023-09-22 07:45:17 +01:00
python_flit_core.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
python_hatchling.bbclass python_hatchling: remove empty python sysroot dirs 2023-06-02 14:41:50 +01:00
python_pep517.bbclass python_pep517: use python3-build, not picobuild 2023-01-13 17:32:46 +00:00
python_poetry_core.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
python_pyo3.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
python_setuptools_build_meta.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
python_setuptools3_rust.bbclass python_setuptools3_rust: inherit ...build_meta 2023-07-25 15:27:33 +01:00
python3-dir.bbclass python3: update 3.10.6 -> 3.11.0 2022-10-29 16:28:36 +01:00
python3native.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
python3targetconfig.bbclass python3targetconfig.bbclass: Extend PYTHONPATH instead of overwriting 2023-05-05 11:07:25 +01:00
qemu.bbclass qemu.bbclass: fix a python TypeError 2024-02-07 04:00:02 -10:00
qemuboot.bbclass qemuboot: reduce default size of software I/O translation buffer 2023-10-09 15:51:13 +01:00
rootfs_deb.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
rootfs_ipk.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
rootfs_rpm.bbclass rootfs_rpm: don't depend on opkg-native for update-alternatives 2023-07-10 11:36:34 +01:00
rootfs-postcommands.bbclass sed -i destroys symlinks 2024-01-04 04:09:43 -10:00
rootfsdebugfiles.bbclass classes: Drop ';' delimiter from ROOTFS/IMAGE*COMMAND variables 2023-09-09 22:14:41 +01:00
rust-common.bbclass rust-common.bbclass: move musl-specific linking fix from rust-source.inc 2023-06-27 16:23:40 +01:00
rust-target-config.bbclass rust-target-config: Map rust target to OE target 2023-09-07 07:53:51 +01:00
rust.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
scons.bbclass scons.bbclass: Make MAXLINELENGTH overridable 2023-02-04 17:02:10 +00:00
setuptools3_legacy.bbclass python3targetconfig.bbclass: use PYTHONPATH to point to the target config 2022-12-07 14:56:54 +00:00
setuptools3-base.bbclass classes-recipe/setuptools3-base: clean up FILES assignments 2023-04-04 13:11:50 +01:00
setuptools3.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
siteinfo.bbclass base: add support for loongarch64 2023-02-04 17:02:10 +00:00
syslinux.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
systemd-boot-cfg.bbclass systemd-boot-cfg: add .conf suffix to default entry label 2023-09-26 10:35:28 +01:00
systemd-boot.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
systemd.bbclass systemd.bbclass: Add /usr/lib/systemd to searchpaths as well 2023-03-14 17:10:00 +00:00
testexport.bbclass testimage/oeqa: Drop testimage_dump_host functionality 2023-06-29 10:57:27 +01:00
testimage.bbclass testimage: Drop target_dumper and most of monitor_dumper 2024-01-04 04:09:44 -10:00
testsdk.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
texinfo.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
toolchain-scripts-base.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
toolchain-scripts.bbclass toolchain-scripts: Handle spaces within user $PATH 2023-03-11 00:08:41 +00:00
uboot-config.bbclass meta: introduce KCONFIG_CONFIG_ENABLE_MENUCONFIG 2023-06-09 13:55:21 +01:00
uboot-extlinux-config.bbclass uboot-extlinux-config.bbclass: fix missed override syntax migration 2023-10-05 21:09:10 +01:00
uboot-sign.bbclass uboot-sign: support 64bits address 2023-05-04 12:46:14 +01:00
update-alternatives.bbclass update-alternatives.bbclass: fix old override syntax 2023-05-03 07:33:18 +01:00
update-rc.d.bbclass recipes, classes: Avoid adding extra whitespace to PACKAGESPLITFUNCS 2023-01-12 23:08:58 +00:00
upstream-version-is-even.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
vala.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
waf.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00
xmlcatalog.bbclass classes: Update classes to match new bitbake class scope functionality 2022-08-12 15:27:17 +01:00