kernel-devsrc: extend to provide all kernel source
[pti/rtp.git] / meta-stx / recipes-kernel / linux / kernel-devsrc.bbappend
1
2 do_install() {
3     kerneldir=${D}${KERNEL_SRC_PATH}
4     install -d $kerneldir
5
6     install -d ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}
7     (
8         cd ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}
9         rm -f source build
10         ln -s ${KERNEL_SRC_PATH} source
11         ln -s ${KERNEL_SRC_PATH} build
12     )
13
14     #
15     # Copy the staging dir source (and module build support) into the devsrc structure.
16     # We can keep this copy simple and take everything, since a we'll clean up any build
17     # artifacts afterwards, and the extra i/o is not significant
18     #
19     cd ${B}
20     find . -type d -name '.git*' -prune -o -path '.debug' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
21     cd ${S}
22     find . -type d -name '.git*' -prune -o -type d -name '.kernel-meta' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
23
24     # Explicitly set KBUILD_OUTPUT to ensure that the image directory is cleaned and not
25     # The main build artifacts. We clean the directory to avoid QA errors on mismatched
26     # architecture (since scripts and helpers are native format).
27     KBUILD_OUTPUT="$kerneldir"
28     oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts
29
30     # make clean generates an absolute path symlink called "source"
31     # in $kerneldir points to $kerneldir, which doesn't make any
32     # sense, so remove it.
33     if [ -L $kerneldir/source ]; then
34         bbnote "Removing $kerneldir/source symlink"
35         rm -f $kerneldir/source
36     fi
37
38     # As of Linux kernel version 3.0.1, the clean target removes
39     # arch/powerpc/lib/crtsavres.o which is present in
40     # KBUILD_LDFLAGS_MODULE, making it required to build external modules.
41     if [ ${ARCH} = "powerpc" ]; then
42             mkdir -p $kerneldir/arch/powerpc/lib/
43             cp ${B}/arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
44     fi
45
46     chown -R root:root ${D}
47 }
48
49 INSANE_SKIP_${PN} = "arch"