From e43e2ab5d7171488d50ddba13898b9b09e0500ef Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 4 Aug 2015 11:53:40 -0700 Subject: [PATCH] coreos-kernel: fix up build and source symlinks The symlinks the kernel build adds to the modules directory are always absolute, forever preserving the value of $ROOT a binary package was built with. Instead use a relative link for source, pointing to the location coreos-sources gets installed to. For build just create a directory containing .config which the linux-info eclass can use to check kernel features during builds, allowing us to migrate away from having to set up the /var/cache build directory even when the kernel wasn't built. For both cases they are irrelevant for production builds and can be confusing to users so mask them. This eclass now assumes it is used in conjunction with USE=symlink-usr and installs modules directly to /usr/lib/modules instead of depending on the /lib symlink. This makes no significant impact other than silencing a warning portage emits about the relative source symlink. --- .../coreos-overlay/eclass/coreos-kernel.eclass | 12 +++++++++++- .../coreos/targets/generic/prod/make.defaults | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-kernel.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-kernel.eclass index 7660d0be9f..48e4c17dea 100644 --- a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-kernel.eclass +++ b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-kernel.eclass @@ -193,12 +193,13 @@ coreos-kernel_src_compile() { coreos-kernel_src_install() { dodir /usr/boot kmake INSTALL_PATH="${D}/usr/boot" install + # Install modules to /usr, assuming USE=symlink-usr # Install firmware to a temporary (bogus) location. # The linux-firmware package will be used instead. # Stripping must be done here, not portage, to preserve sigs. # Uncomment vdso_install for easy access to debug symbols in gdb: # set debug-file-directory /lib/modules/4.0.7-coreos-r2/vdso/ - kmake INSTALL_MOD_PATH="${D}" \ + kmake INSTALL_MOD_PATH="${D}/usr" \ INSTALL_MOD_STRIP="--strip-unneeded" \ INSTALL_FW_PATH="${T}/fw" \ modules_install # vdso_install @@ -207,6 +208,15 @@ coreos-kernel_src_install() { dosym "vmlinuz-${version}" /usr/boot/vmlinuz dosym "config-${version}" /usr/boot/config + # build and source must cleaned up to avoid referencing $ROOT + rm "${D}/usr/lib/modules/${version}"/{build,source} || die + dosym "../../../src/linux-${version}" "/usr/lib/modules/${version}/source" + + # this is just here for linux-info.eclass, mask from prod images + dodir "/usr/lib/modules/${version}/build" + dosym "../../../../boot/config-${version}" \ + "/usr/lib/modules/${version}/build/.config" + save_config "${KBUILD_OUTPUT}/defconfig" shred_keys diff --git a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/targets/generic/prod/make.defaults b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/targets/generic/prod/make.defaults index 78d2ac8e77..4eb34f192b 100644 --- a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/targets/generic/prod/make.defaults +++ b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/targets/generic/prod/make.defaults @@ -25,3 +25,8 @@ INSTALL_MASK="${INSTALL_MASK} /usr/share/ncat /usr/share/nmap " + +# These kernel paths are just noise without sources +INSTALL_MASK="${INSTALL_MASK} + /usr/lib/modules/*/{build,source} +"