4a57af25441a437360f88c759e3b5df59947ebd6
[pti/rtp.git] / meta-stx / recipes-kernel / linux / kernel-devsrc.bbappend
1 #
2 # Copyright (C) 2019 Wind River Systems, Inc.
3 #
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
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15
16
17 do_install() {
18     kerneldir=${D}${KERNEL_SRC_PATH}
19     install -d $kerneldir
20
21     install -d ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}
22     (
23         cd ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}
24         rm -f source build
25         ln -s ${KERNEL_SRC_PATH} source
26         ln -s ${KERNEL_SRC_PATH} build
27     )
28
29     #
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
33     #
34     cd ${B}
35     find . -type d -name '.git*' -prune -o -path '.debug' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
36     cd ${S}
37     find . -type d -name '.git*' -prune -o -type d -name '.kernel-meta' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
38
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
44
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
51     fi
52
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
59     fi
60
61     chown -R root:root ${D}
62 }
63
64 INSANE_SKIP_${PN} = "arch"