aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/kernel-yocto.bbclass17
-rw-r--r--meta/classes/kernel.bbclass67
2 files changed, 80 insertions, 4 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 1d447951c49..df147404693 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -292,16 +292,25 @@ do_kernel_configme() {
bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)"
fi
- CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1
- if [ $? -ne 0 ]; then
+ configs=$(echo "${configs}" | sed 's%.kernel-meta%${S}/.kernel-meta%g')
+ if [ -z "${configs}" ]; then
bbfatal_log "Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}"
fi
- echo "# Global settings from linux recipe" >> ${B}/.config
- echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
+ # put these in a place where the merge_config routine will find them, and use them
+ echo "${configs}" > ${WORKDIR}/kernel-cfgs
+}
+
+do_set_localversion() {
+ cd ${S}
+
+ echo "# Global settings from linux recipe" >> ${B}/.config
+ echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
}
addtask kernel_configme before do_configure after do_patch
+addtask merge_config before do_configure after do_kernel_configme
+addtask set_localversion after do_configure before do_compile
python do_kernel_configcheck() {
import re, string, sys
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 02a5e961cb8..e087093ae05 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -475,6 +475,73 @@ python check_oldest_kernel() {
check_oldest_kernel[vardepsexclude] += "OLDEST_KERNEL KERNEL_VERSION"
do_configure[prefuncs] += "check_oldest_kernel"
+# returns all the elements from the src uri that are .cfg or a defconfig
+def get_cfg_elements(d):
+ sources=src_patches(d, True)
+ sources_list=[]
+ for s in sources:
+ base, ext = os.path.splitext(os.path.basename(s))
+ if ext and ext in [".cfg"]:
+ sources_list.append(s)
+ elif base and base in 'defconfig':
+ sources_list.append(s)
+
+ return sources_list
+
+python () {
+ src_uri_frags=get_cfg_elements(d)
+
+ # if we find fragments on the SRC_URI:
+ # - enable the merge_config task
+ # - disable the old KERNEL_CONFIG_COMMAND .. but save a copy
+ if src_uri_frags:
+ bb.build.addtask( "do_merge_config", "do_configure", None, d )
+ d.appendVar( "KERNEL_CONFIG_FRAGMENTS", " %s" % ' '.join(src_uri_frags) )
+ d.setVar( 'KERNEL_CONFIG_COMMAND_SAVE', d.getVar('KERNEL_CONFIG_COMMAND') )
+ d.setVar( 'KERNEL_CONFIG_COMMAND', '' )
+ bb.note("Enabling merge config support for: %s" % d.getVar('KERNEL_CONFIG_FRAGMENTS'))
+}
+
+do_merge_config() {
+ # translate the kconfig_mode into something that merge_config.sh understands
+ config_flags=""
+ case ${KCONFIG_MODE} in
+ *allnoconfig)
+ config_flags="-n"
+ ;;
+ *alldefconfig)
+ config_flags=""
+ ;;
+ esac
+
+ if [ -f "${WORKDIR}/kernel-cfgs" ]; then
+ on_disk_frags=$(cat ${WORKDIR}/kernel-cfgs)
+ fi
+
+ config_fragments=""
+ for frag in ${KERNEL_CONFIG_FRAGMENTS} ${on_disk_frags}; do
+ full_frag=${frag}
+ if [ ! -f ${frag} ]; then
+ if [ ! -f ${WORKDIR}/${frag} ]; then
+ bbfatal_log "fragment ${frag} was specified, but not found"
+ else
+ full_frag="${WORKDIR}/${frag}"
+ fi
+ fi
+ config_fragments="${config_fragments} ${full_frag}"
+ done
+
+ if [ -n "${config_fragments}" ]; then
+ cd ${S}
+ echo "CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${config_fragments}" > ${WORKDIR}/merge_config.log 2>&1
+ CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${config_fragments} >> ${WORKDIR}/merge_config.log 2>&1
+ if [ $? -ne 0 ]; then
+ bbfatal_log "Could not merge configuration fragments, see ${WORKDIR}/merge_config.log for details "
+ fi
+ fi
+}
+do_merge_config[depends] = "kern-tools-native:do_populate_sysroot"
+
kernel_do_configure() {
# fixes extra + in /lib/modules/2.6.37+
# $ scripts/setlocalversion . => +