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.
This commit is contained in:
Michael Marineau 2015-08-04 11:53:40 -07:00
parent b67ed0e671
commit e43e2ab5d7
2 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -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}
"