[meta-ti] [PATCH v2] multi-kernel: update to work with latest code
Denys Dmytriyenko
denis at denix.org
Thu Jan 8 15:34:19 PST 2015
From: Denys Dmytriyenko <denys at ti.com>
Handle multi-config kernel builds with separate namespaces to allow installing
them side by side safely.
Signed-off-by: Denys Dmytriyenko <denys at ti.com>
---
v2 - implement namespace separation and fix smaller naming issues
.../linux/linux-ti-staging-3.14/configs/systest | 1 +
recipes-kernel/linux/linux-ti-staging_3.14.bb | 13 +-
recipes-kernel/linux/multi-kernel.inc | 137 ++++++++++-----------
3 files changed, 76 insertions(+), 75 deletions(-)
create mode 100644 recipes-kernel/linux/linux-ti-staging-3.14/configs/systest
diff --git a/recipes-kernel/linux/linux-ti-staging-3.14/configs/systest b/recipes-kernel/linux/linux-ti-staging-3.14/configs/systest
new file mode 100644
index 0000000..cfe4f99
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti-staging-3.14/configs/systest
@@ -0,0 +1 @@
+use-combined-config=ti_config_fragments/system_test_defconfig_fragment
diff --git a/recipes-kernel/linux/linux-ti-staging_3.14.bb b/recipes-kernel/linux/linux-ti-staging_3.14.bb
index 2e89ace..6c0a352 100644
--- a/recipes-kernel/linux/linux-ti-staging_3.14.bb
+++ b/recipes-kernel/linux/linux-ti-staging_3.14.bb
@@ -7,6 +7,7 @@ inherit kernel
require recipes-kernel/linux/linux-dtb.inc
require recipes-kernel/linux/setup-defconfig.inc
+require recipes-kernel/linux/multi-kernel.inc
# Look in the generic major.minor directory for files
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-3.14:"
@@ -44,11 +45,11 @@ S = "${WORKDIR}/git"
BRANCH = "ti-linux-3.14.y"
-SRCREV = "4311f726041145161621593e5d67f106913c0f28"
+SRCREV = "6b7737373fad112d416781e83841732d33b0d1bd"
PV = "3.14.26"
# Append to the MACHINE_KERNEL_PR so that a new SRCREV will cause a rebuild
-MACHINE_KERNEL_PR_append = "c+gitr${SRCPV}"
+MACHINE_KERNEL_PR_append = "d+gitr${SRCPV}"
PR = "${MACHINE_KERNEL_PR}"
KERNEL_CONFIG_DIR = "${S}/ti_config_fragments"
@@ -56,8 +57,10 @@ KERNEL_CONFIG_DIR = "${S}/ti_config_fragments"
KERNEL_CONFIG_FRAGMENTS_append_ti33x = " ${KERNEL_CONFIG_DIR}/am33xx_only.cfg"
KERNEL_CONFIG_FRAGMENTS_append_ti43x = " ${KERNEL_CONFIG_DIR}/am43xx_only.cfg"
+MULTI_CONFIG_BASE_SUFFIX = ""
+
KERNEL_GIT_URI = "git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git"
KERNEL_GIT_PROTOCOL = "git"
-SRC_URI = "${KERNEL_GIT_URI};protocol=${KERNEL_GIT_PROTOCOL};branch=${BRANCH} \
- file://defconfig \
- "
+SRC_URI += "${KERNEL_GIT_URI};protocol=${KERNEL_GIT_PROTOCOL};branch=${BRANCH} \
+ file://defconfig \
+ "
diff --git a/recipes-kernel/linux/multi-kernel.inc b/recipes-kernel/linux/multi-kernel.inc
index e696c8b..93cf064 100644
--- a/recipes-kernel/linux/multi-kernel.inc
+++ b/recipes-kernel/linux/multi-kernel.inc
@@ -10,113 +10,110 @@
# sound, 20x2 character LCD, etc. To be able to easily test all of those you can
# use this .inc
#
-# To make it easier finding the original defconfig from a running kernel, this
-# also forcefully turns on CONFIG_IKCONFIG_PROC so people can do
-# 'zcat /proc/config.gz' on the target.
-#
# The function get_kernelversion uses generated header files to extract the
# version number. But those files are not available until do_compile, and
# do_compileconfigs is injected before that, hence the version becomes None
# and breaks in several places. Introduce a task do_preparekernel that calls
# "make prepare" in the kernel tree to generate all the necessary files.
-require linux.inc
-
SRC_URI += " \
file://configs "
MULTI_CONFIG_BASE_SUFFIX = "multi-config-"
MODULE_IMAGE_BASE_NAME ?= "modules-${PE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
+EXTRA_OEMAKE = "${PARALLEL_MAKE} "
+
do_preparekernel () {
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
- oe_runmake prepare CC="${KERNEL_CC}" LD="${KERNEL_LD}"
+ unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
+ oe_runmake prepare CC="${KERNEL_CC}" LD="${KERNEL_LD}"
}
addtask preparekernel after do_configure before do_compile
do_compileconfigs () {
+ # fixup for fetcher change
+ if [ -e ${WORKDIR}/configs/configs ] ; then
+ if [ -e ${WORKDIR}/configs/configs/empty ] ; then
+ mv ${WORKDIR}/configs/configs/empty ${WORKDIR}/configs/
+ fi
+ mv ${WORKDIR}/configs/configs/* ${WORKDIR}/configs/
+ rm -rf ${WORKDIR}/configs/configs
+ fi
- # fixup for fetcher change
- if [ -e ${WORKDIR}/configs/configs ] ; then
- if [ -e ${WORKDIR}/configs/configs/empty ] ; then
- mv ${WORKDIR}/configs/configs/empty ${WORKDIR}/configs/
- fi
- mv ${WORKDIR}/configs/configs/* ${WORKDIR}/configs/
- rm -rf ${WORKDIR}/configs/configs
- fi
-
- # Compile and Install additional kernel configs if found
- if [ -e ${WORKDIR}/configs/empty ] ; then
- echo "No configs found in configs/ directory, skipping to regular build"
- else
- echo "Multiple configs found, building those first"
-
- # Context Save the regular 'defconfig'
- cp ${WORKDIR}/defconfig ${WORKDIR}/defconfig.save
-
- for config in ${WORKDIR}/configs/* ; do
-
- # Copy in alternative config
+ # Compile and Install additional kernel configs if found
+ if [ -e ${WORKDIR}/configs/empty ] ; then
+ echo "No configs found in configs/ directory, skipping to regular build"
+ else
+ echo "Multiple configs found, building those first"
+
+ # Context Save the regular 'defconfig'
+ cp ${WORKDIR}/defconfig ${WORKDIR}/defconfig.save
+
+ for configname in ${WORKDIR}/configs/* ; do
+ # Copy in alternative config
+ cd ${S}
+ cp $configname ${WORKDIR}/defconfig
+
+ # Build and Install this alternative kernel
+ do_configure
+ echo ${KERNEL_LOCALVERSION}-$(basename $configname) > ${B}/.scmversion
+ echo ${KERNEL_LOCALVERSION}-$(basename $configname) > ${S}/.scmversion
+ kernel_do_compile
+ do_compile_kernelmodules
+ install -d "${D}/lib/modules/${KERNEL_VERSION}"
+ touch "${D}/lib/modules/${KERNEL_VERSION}/build"
+ touch "${D}/lib/modules/${KERNEL_VERSION}/source"
+ install -d "${D}/lib/modules/${KERNEL_VERSION}/kernel"
+ kernel_do_install
+ rm "${D}/lib/modules/${KERNEL_VERSION}-$(basename $configname)/build"
+ rm "${D}/lib/modules/${KERNEL_VERSION}-$(basename $configname)/source"
+ rmdir --ignore-fail-on-non-empty "${D}/lib/modules/${KERNEL_VERSION}-$(basename $configname)/kernel"
+ rmdir --ignore-fail-on-non-empty "${D}/lib/modules/${KERNEL_VERSION}"
+
+ # Drop the resulting images in the deploy dir
+ install -d ${DEPLOY_DIR_IMAGE}
+ install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).bin
+
+ if [ -d "${D}/lib" ]; then
+ tar --owner=root --group=root -cvzf ${DEPLOY_DIR_IMAGE}/${MODULE_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).tgz -C ${D} lib
+ fi
+
+ # Install the final config alongside the images
+ cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).config
+
+ # Create symlinks
+ cd ${DEPLOY_DIR_IMAGE}
+ rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).bin
+ ln -sf ${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).bin ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).bin
+ rm -f modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).tgz
+ ln -sf ${MODULE_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).tgz modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).tgz
+ rm -f config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).config
+ ln -sf config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).config config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $configname).config
+ done
+
+ # Restore the regular 'defconfig'
+ cp ${WORKDIR}/defconfig.save ${WORKDIR}/defconfig
cd ${S}
- cp $config ${WORKDIR}/defconfig
-
- # Enable config to be viewed on the target
- echo "CONFIG_IKCONFIG=y" >> ${WORKDIR}/defconfig
- echo "CONFIG_IKCONFIG_PROC=y" >> ${WORKDIR}/defconfig
-
- # Build and Install this alternative kernel
do_configure
- kernel_do_compile
- do_compile_kernelmodules
- kernel_do_install
-
- # Drop the resulting images in the deploy dir
- install -d ${DEPLOY_DIR_IMAGE}
- install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
-
- if [ -d "${D}/lib" ]; then
- tar --owner=root --group=root -cvzf ${DEPLOY_DIR_IMAGE}/${MODULE_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz -C ${D} lib
- fi
-
- # Install the final config alongside the images
- cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
-
- # Create symlinks
- cd ${DEPLOY_DIR_IMAGE}
- rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
- ln -sf ${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
- rm -f modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz
- ln -sf ${MODULE_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz
- rm -f config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
- ln -sf config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
-
- done
-
- # Restore the regular 'defconfig'
- cp ${WORKDIR}/defconfig.save ${WORKDIR}/defconfig
- cd ${S}
- do_configure
fi
}
# For reference, copy .config to deploy image
do_deploy_append () {
-
- install -d ${DEPLOY_DIR_IMAGE}
+ install -d ${DEPLOY_DIR_IMAGE}
# Drop the regular defconfig along side the others for consistency
cd ${S}
cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.config
# add symlink
- cd ${DEPLOY_DIR_IMAGE}
+ cd ${DEPLOY_DIR_IMAGE}
rm -f config-${MACHINE}.config
ln -s config-${PV}-${PR}-${MACHINE}.config config-${MACHINE}.config
rm -f modules-${MACHINE}.tgz
ln -sf ${MODULE_IMAGE_BASE_NAME}.tgz modules-${MACHINE}.tgz
-
}
do_compileconfigs[depends] += "u-boot-mkimage-native:do_populate_sysroot virtual/${TARGET_PREFIX}gcc:do_populate_sysroot"
--
2.2.0
More information about the meta-ti
mailing list