@@ -117,10 +117,10 @@ kmake() {
117117 if gcc-specs-pie; then
118118 kernel_cflags=" -nopie -fstack-check=no ${kernel_cflags} "
119119 fi
120- emake " --directory=${S} /source " \
120+ emake " --directory=${KERNEL_DIR} " \
121121 ARCH=" ${kernel_arch} " \
122122 CROSS_COMPILE=" ${CHOST} -" \
123- KBUILD_OUTPUT=" .. /build" \
123+ KBUILD_OUTPUT=" ${S} /build" \
124124 KCFLAGS=" ${kernel_cflags} " \
125125 LDFLAGS=" " \
126126 " V=1" \
@@ -206,85 +206,6 @@ setup_keys() {
206206 popd
207207}
208208
209- # Populate /lib/modules/$(uname -r)/{build,source}
210- install_build_source () {
211- local kernel_arch=$( tc-arch-kernel)
212- local host_kernel_arch=$( tc-ninja_magic_to_arch kern " ${CBUILD} " )
213-
214- # NOTE: We have to get ${archabspaths} before removing symlinks under
215- # /usr/lib/modules. However, do not exclude "dt-bindings" for now,
216- # as it looks architecture-independent.
217- local archabspaths=($( ls -1d ${D} /usr/lib/modules/${KV_FULL} /source/scripts/dtc/include-prefixes/* \
218- | grep -v dt-bindings ) )
219-
220- # remove the broken symlinks referencing $ROOT
221- rm " ${D} /usr/lib/modules/${KV_FULL} /build" || die
222-
223- # Compose list of architectures to be excluded from the kernel modules
224- # tree in the final image. It is an array to be used as a pattern for
225- # grep command below at the end of "find source/scripts" command for
226- # fetching kernel modules list, e.g.:
227- # find source/scripts -follow -print \
228- # | grep -E -v -w "include-prefixes/arc|include-prefixes/xtensa"
229- declare -a excarchlist
230- local excarchstr
231-
232- for apath in " ${archabspaths[@]} " ; do
233- local arch
234- arch=$( basename " ${apath} " )
235- if [[ " ${arch} " != " ${kernel_arch} " ]]; then
236- excarchlist+=(" include-prefixes/${arch} " )
237-
238- # Do not append delimiter '|' in case of the last element.
239- if [[ " ${apath} " != " ${archabspaths[-1]} " ]]; then
240- excarchlist+=(" |" )
241- fi
242- fi
243- done
244-
245- # Remove every whitespace from the grep pattern string, to make pattern
246- # matching work well.
247- excarchstr=$( echo " ${excarchlist[@]} " | sed -e ' s/[[:space:]]*//g' )
248-
249- # Install a stripped source for out-of-tree module builds (Debian-derived)
250- #
251- # NOTE: we need to exclude unsupported architectures from source/scripts,
252- # to prevent the final image from having unnecessary directories under
253- # /usr/lib/modules/${KV_FULL}/source/scripts/dtc/include-prefixes.
254- # The grep must run with "-w" to exclude exact patterns like either arm
255- # or arm64.
256- {
257- echo source/Makefile
258- find source/arch/${host_kernel_arch} -follow -maxdepth 1 -name ' Makefile*' -print
259- find source/arch/${kernel_arch} -follow -maxdepth 1 -name ' Makefile*' -print
260- find source/arch/${kernel_arch} -follow \( -name ' module.lds' -o -name ' Kbuild.platforms' -o -name ' Platform' \) -print
261- find $( find source/arch/${kernel_arch} -follow \( -name include -o -name scripts \) -follow -type d -print) -print
262- find source/include -follow -print
263- find source/scripts -follow -print | grep -E -v -w " ${excarchstr} "
264- find build/ -print
265- } | cpio -pd \
266- --preserve-modification-time \
267- --owner=root:root \
268- --dereference \
269- " ${D} /usr/lib/modules/${KV_FULL} " || die
270- # ./build/source is a symbolic link so cpio ends up creating an empty dir.
271- # Restore the symlink.
272- pushd " ${D} /usr/lib/modules/${KV_FULL} "
273- rmdir build/source || die
274- ln -sr source build || die
275- # Symlink includes into the build directory to resemble Ubuntu's /lib/modules
276- # layout. This lets the Nvidia driver build when passing SYSSRC=/lib/modules/../build
277- # instead of requiring SYSOUT/SYSSRC.
278- {
279- find source/include -mindepth 1 -maxdepth 1 -type d
280- find source/arch/${kernel_arch} /include -mindepth 1 -maxdepth 1 -type d
281- } | while read src; do
282- dst=" ${src/ source/ build} "
283- ln -sr " ${src} " " ${dst} " || die
284- done || die
285- popd
286- }
287-
288209coreos-kernel_pkg_pretend () {
289210 [[ " ${MERGE_TYPE} " == binary ]] && return
290211
@@ -302,10 +223,7 @@ coreos-kernel_pkg_setup() {
302223}
303224
304225coreos-kernel_src_unpack () {
305- # we more or less reproduce the layout in /lib/modules/$(uname -r)/
306226 mkdir -p " ${S} /build" || die
307- mkdir -p " ${S} /source" || die
308- ln -s " ${KERNEL_DIR} " /* " ${S} /source/" || die
309227}
310228
311229coreos-kernel_src_configure () {
0 commit comments