mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-23 23:41:10 +02:00
Merge pull request #1663 from vcaputo/cater_to_out_of_tree_modules
coreos-kernel: populate /lib/modules/$(uname -r)/build
This commit is contained in:
commit
d9f5c09dad
@ -114,10 +114,10 @@ kmake() {
|
|||||||
fi
|
fi
|
||||||
# this can be removed once it is exported globally again
|
# this can be removed once it is exported globally again
|
||||||
export CCACHE_BASEDIR="${S}"
|
export CCACHE_BASEDIR="${S}"
|
||||||
emake \
|
emake "--directory=${S}/source" \
|
||||||
ARCH="${kernel_arch}" \
|
ARCH="${kernel_arch}" \
|
||||||
CROSS_COMPILE="${CHOST}-" \
|
CROSS_COMPILE="${CHOST}-" \
|
||||||
KBUILD_OUTPUT="build" \
|
KBUILD_OUTPUT="../build" \
|
||||||
KCFLAGS="${kernel_cflags}" \
|
KCFLAGS="${kernel_cflags}" \
|
||||||
LDFLAGS="" \
|
LDFLAGS="" \
|
||||||
"$@"
|
"$@"
|
||||||
@ -131,9 +131,50 @@ shred_keys() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Populate /lib/modules/$(uname -r)/{build,source}
|
||||||
|
prepare-lib-modules-release-dirs() {
|
||||||
|
# build and source must cleaned up to avoid referencing $ROOT
|
||||||
|
rm "${D}/usr/lib/modules/${version}"/{build,source} || die
|
||||||
|
|
||||||
|
# XXX: For some reason tc-arch-kernel is returning x86_64 on > 2.6.24
|
||||||
|
local kernel_arch=$(tc-arch-kernel)
|
||||||
|
if [ "${kernel_arch}" == "x86_64" ]; then
|
||||||
|
kernel_arch="x86"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install a stripped source for out-of-tree module builds (Debian-derived)
|
||||||
|
{
|
||||||
|
echo source/Makefile
|
||||||
|
find source/arch/${kernel_arch} -follow -maxdepth 1 -name 'Makefile*' -print
|
||||||
|
find source/arch/${kernel_arch} -follow \( -name 'module.lds' -o -name 'Kbuild.platforms' -o -name 'Platform' \) -print
|
||||||
|
find $(find source/arch/${kernel_arch} -follow \( -name include -o -name scripts \) -follow -type d -print) -print
|
||||||
|
find source/include source/scripts -follow -print
|
||||||
|
} | cpio -pd \
|
||||||
|
--preserve-modification-time \
|
||||||
|
--owner=root:root \
|
||||||
|
--dereference \
|
||||||
|
"${D}/usr/lib/modules/${version}" || die
|
||||||
|
|
||||||
|
# Clean up the build tree and install for out-of-tree module builds
|
||||||
|
kmake clean
|
||||||
|
find "build/" -type d -empty -delete || die
|
||||||
|
rm --recursive \
|
||||||
|
"build/bootengine.cpio" \
|
||||||
|
"build/.config.old" \
|
||||||
|
"build/certs" \
|
||||||
|
|| die
|
||||||
|
|
||||||
|
find "build/" -print | cpio -pd \
|
||||||
|
--preserve-modification-time \
|
||||||
|
--owner=root:root \
|
||||||
|
"${D}/usr/lib/modules/${version}" || die
|
||||||
|
}
|
||||||
|
|
||||||
coreos-kernel_src_unpack() {
|
coreos-kernel_src_unpack() {
|
||||||
|
# we more or less reproduce the layout in /lib/modules/$(uname -r)/
|
||||||
mkdir -p "${S}/build" || die
|
mkdir -p "${S}/build" || die
|
||||||
ln -s "${KERNEL_DIR}"/* "${S}/" || die
|
mkdir -p "${S}/source" || die
|
||||||
|
ln -s "${KERNEL_DIR}"/* "${S}/source/" || die
|
||||||
}
|
}
|
||||||
|
|
||||||
coreos-kernel_src_prepare() {
|
coreos-kernel_src_prepare() {
|
||||||
@ -211,16 +252,7 @@ coreos-kernel_src_install() {
|
|||||||
dosym "vmlinuz-${version}" /usr/boot/vmlinuz
|
dosym "vmlinuz-${version}" /usr/boot/vmlinuz
|
||||||
dosym "config-${version}" /usr/boot/config
|
dosym "config-${version}" /usr/boot/config
|
||||||
|
|
||||||
# build and source must cleaned up to avoid referencing $ROOT
|
prepare-lib-modules-release-dirs
|
||||||
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 build/defconfig
|
|
||||||
|
|
||||||
shred_keys
|
shred_keys
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
EAPI=5
|
EAPI=5
|
||||||
COREOS_SOURCE_REVISION=""
|
COREOS_SOURCE_REVISION="-r1"
|
||||||
inherit coreos-kernel
|
inherit coreos-kernel
|
||||||
|
|
||||||
DESCRIPTION="CoreOS Linux kernel"
|
DESCRIPTION="CoreOS Linux kernel"
|
@ -37,5 +37,6 @@ UNIPATCH_LIST="
|
|||||||
${PATCH_DIR}/0019-net-wireless-wl18xx-Add-missing-MODULE_FIRMWARE.patch \
|
${PATCH_DIR}/0019-net-wireless-wl18xx-Add-missing-MODULE_FIRMWARE.patch \
|
||||||
${PATCH_DIR}/0020-overlayfs-use-a-minimal-buffer-in-ovl_copy_xattr.patch \
|
${PATCH_DIR}/0020-overlayfs-use-a-minimal-buffer-in-ovl_copy_xattr.patch \
|
||||||
${PATCH_DIR}/0021-net-switchdev-fix-return-code-of-fdb_dump-stub.patch \
|
${PATCH_DIR}/0021-net-switchdev-fix-return-code-of-fdb_dump-stub.patch \
|
||||||
|
${PATCH_DIR}/0022-kbuild-derive-relative-path-for-KBUILD_SRC-from-CURD.patch \
|
||||||
"
|
"
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
From 3348a15e9733c3ffb56ad7f9e9729a919f61eee9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vito Caputo <vito.caputo@coreos.com>
|
||||||
|
Date: Wed, 25 Nov 2015 02:59:45 -0800
|
||||||
|
Subject: [PATCH 22/22] kbuild: derive relative path for KBUILD_SRC from CURDIR
|
||||||
|
|
||||||
|
This enables relocating source and build trees to different roots,
|
||||||
|
provided they stay reachable relative to one another. Useful for
|
||||||
|
builds done within a sandbox where the eventual root is prefixed
|
||||||
|
by some undesirable path component.
|
||||||
|
---
|
||||||
|
Makefile | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index d5b3739..f64d968 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -143,7 +143,8 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
|
||||||
|
@:
|
||||||
|
|
||||||
|
sub-make: FORCE
|
||||||
|
- $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
|
||||||
|
+ $(Q)$(MAKE) -C $(KBUILD_OUTPUT) \
|
||||||
|
+ KBUILD_SRC=$(shell realpath --relative-to=$(KBUILD_OUTPUT) $(CURDIR)) \
|
||||||
|
-f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
|
||||||
|
|
||||||
|
# Leave processing to above invocation of make
|
||||||
|
--
|
||||||
|
2.4.6
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user