kernel-devsrc: extend to provide all kernel source 16/3716/1
authorJackie Huang <jackie.huang@windriver.com>
Fri, 15 May 2020 08:10:41 +0000 (16:10 +0800)
committerJackie Huang <jackie.huang@windriver.com>
Fri, 15 May 2020 15:37:45 +0000 (23:37 +0800)
* Add bbappend to re-write do_install to provide all kernel
  source, so it will:
  - Fix issues that dpdk fails to build in container.
  - Extend the ability of the recipe so it can rebuild kernel

* And add kernel-devsrc to image.

Issue-ID: INF-116
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: I20ab8c622bcbbfe2a8e5068dae5cb5fef5321dd8

meta-stx/conf/distro/files/pkglist/poky-stx-aio-pkg-list.cfg
meta-stx/conf/distro/files/pkglist/poky-stx-aio-rt-pkg-list.cfg
meta-stx/recipes-kernel/linux/kernel-devsrc.bbappend [new file with mode: 0644]
scripts/configs/local-stx.conf

index 754bc9b..d698a15 100644 (file)
@@ -35,6 +35,7 @@ bc-dev-1.07.1-r0.corei7_64
 bind-libs-9.11.5+P4-r0.corei7_64
 bind-utils-9.11.5+P4-r0.corei7_64
 binutils-2.32.0-r0.corei7_64
+bison-3.0.4-r0.corei7_64
 bluez5-5.50-r0.corei7_64
 boost-python-1.69.0-r0.corei7_64
 bridge-utils-1.6-r0.corei7_64
@@ -1722,6 +1723,7 @@ kbd-consolefonts-2.0.4-r0.corei7_64
 kbd-keymaps-2.0.4-r0.corei7_64
 kernel-5.0.19+git0+7f6e97c357_55dd15336b-r0.corei7_64_intel_common
 kernel-5.0.19-yocto-standard-5.0.19+git0+7f6e97c357_55dd15336b-r0.corei7_64_intel_common
+kernel-devsrc-1.0-r0.intel_corei7_64
 kernel-image-5.0.19-yocto-standard-5.0.19+git0+7f6e97c357_55dd15336b-r0.corei7_64_intel_common
 kernel-image-bzimage-5.0.19-yocto-standard-5.0.19+git0+7f6e97c357_55dd15336b-r0.corei7_64_intel_common
 kernel-module-6lowpan-5.0.19-yocto-standard-5.0.19+git0+7f6e97c357_55dd15336b-r0.corei7_64_intel_common
index fff7ac9..5459598 100644 (file)
@@ -35,6 +35,7 @@ bc-dev-1.07.1-r0.corei7_64
 bind-libs-9.11.5+P4-r0.corei7_64
 bind-utils-9.11.5+P4-r0.corei7_64
 binutils-2.32.0-r0.corei7_64
+bison-3.0.4-r0.corei7_64
 bluez5-5.50-r0.corei7_64
 boost-python-1.69.0-r0.corei7_64
 bridge-utils-1.6-r0.corei7_64
@@ -1722,6 +1723,7 @@ kbd-consolefonts-2.0.4-r0.corei7_64
 kbd-keymaps-2.0.4-r0.corei7_64
 kernel-5.0.19+git0+7f6e97c357_e6cb812b55-r0.corei7_64_intel_common
 kernel-5.0.19-rt11-yocto-preempt-rt-5.0.19+git0+7f6e97c357_e6cb812b55-r0.corei7_64_intel_common
+kernel-devsrc-1.0-r0.intel_corei7_64
 kernel-image-5.0.19-rt11-yocto-preempt-rt-5.0.19+git0+7f6e97c357_e6cb812b55-r0.corei7_64_intel_common
 kernel-image-bzimage-5.0.19-rt11-yocto-preempt-rt-5.0.19+git0+7f6e97c357_e6cb812b55-r0.corei7_64_intel_common
 kernel-module-6lowpan-5.0.19-rt11-yocto-preempt-rt-5.0.19+git0+7f6e97c357_e6cb812b55-r0.corei7_64_intel_common
diff --git a/meta-stx/recipes-kernel/linux/kernel-devsrc.bbappend b/meta-stx/recipes-kernel/linux/kernel-devsrc.bbappend
new file mode 100644 (file)
index 0000000..5f8cdc3
--- /dev/null
@@ -0,0 +1,49 @@
+
+do_install() {
+    kerneldir=${D}${KERNEL_SRC_PATH}
+    install -d $kerneldir
+
+    install -d ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}
+    (
+        cd ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}
+        rm -f source build
+        ln -s ${KERNEL_SRC_PATH} source
+        ln -s ${KERNEL_SRC_PATH} build
+    )
+
+    #
+    # Copy the staging dir source (and module build support) into the devsrc structure.
+    # We can keep this copy simple and take everything, since a we'll clean up any build
+    # artifacts afterwards, and the extra i/o is not significant
+    #
+    cd ${B}
+    find . -type d -name '.git*' -prune -o -path '.debug' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
+    cd ${S}
+    find . -type d -name '.git*' -prune -o -type d -name '.kernel-meta' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
+
+    # Explicitly set KBUILD_OUTPUT to ensure that the image directory is cleaned and not
+    # The main build artifacts. We clean the directory to avoid QA errors on mismatched
+    # architecture (since scripts and helpers are native format).
+    KBUILD_OUTPUT="$kerneldir"
+    oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts
+
+    # make clean generates an absolute path symlink called "source"
+    # in $kerneldir points to $kerneldir, which doesn't make any
+    # sense, so remove it.
+    if [ -L $kerneldir/source ]; then
+        bbnote "Removing $kerneldir/source symlink"
+        rm -f $kerneldir/source
+    fi
+
+    # As of Linux kernel version 3.0.1, the clean target removes
+    # arch/powerpc/lib/crtsavres.o which is present in
+    # KBUILD_LDFLAGS_MODULE, making it required to build external modules.
+    if [ ${ARCH} = "powerpc" ]; then
+            mkdir -p $kerneldir/arch/powerpc/lib/
+            cp ${B}/arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
+    fi
+
+    chown -R root:root ${D}
+}
+
+INSANE_SKIP_${PN} = "arch"
index 605c098..44cb5aa 100644 (file)
@@ -13,6 +13,10 @@ EXTRA_IMAGE_FEATURES = " \
     package-management \
 "
 
+IMAGE_INSTALL_append = " \
+    kernel-devsrc \
+"
+
 # For anaconda installer
 DISTRO_FEATURES_append = " anaconda-support"