2 # Copyright (C) 2019 Wind River Systems, Inc.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 kerneldir=${D}${KERNEL_SRC_PATH}
21 install -d ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}
23 cd ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}
25 ln -s ${KERNEL_SRC_PATH} source
26 ln -s ${KERNEL_SRC_PATH} build
30 # Copy the staging dir source (and module build support) into the devsrc structure.
31 # We can keep this copy simple and take everything, since a we'll clean up any build
32 # artifacts afterwards, and the extra i/o is not significant
35 find . -type d -name '.git*' -prune -o -path '.debug' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
37 find . -type d -name '.git*' -prune -o -type d -name '.kernel-meta' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
39 # Explicitly set KBUILD_OUTPUT to ensure that the image directory is cleaned and not
40 # The main build artifacts. We clean the directory to avoid QA errors on mismatched
41 # architecture (since scripts and helpers are native format).
42 KBUILD_OUTPUT="$kerneldir"
43 oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts
45 # make clean generates an absolute path symlink called "source"
46 # in $kerneldir points to $kerneldir, which doesn't make any
47 # sense, so remove it.
48 if [ -L $kerneldir/source ]; then
49 bbnote "Removing $kerneldir/source symlink"
50 rm -f $kerneldir/source
53 # As of Linux kernel version 3.0.1, the clean target removes
54 # arch/powerpc/lib/crtsavres.o which is present in
55 # KBUILD_LDFLAGS_MODULE, making it required to build external modules.
56 if [ ${ARCH} = "powerpc" ]; then
57 mkdir -p $kerneldir/arch/powerpc/lib/
58 cp ${B}/arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
61 chown -R root:root ${D}
64 INSANE_SKIP_${PN} = "arch"