summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/kernel-yocto.bbclass72
1 files changed, 43 insertions, 29 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index fa8466e587..96ea612258 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -87,6 +87,13 @@ def get_machine_branch(d, default):
87 87
88do_kernel_metadata() { 88do_kernel_metadata() {
89 set +e 89 set +e
90
91 if [ -n "$1" ]; then
92 mode="$1"
93 else
94 mode="patch"
95 fi
96
90 cd ${S} 97 cd ${S}
91 export KMETA=${KMETA} 98 export KMETA=${KMETA}
92 99
@@ -120,14 +127,13 @@ do_kernel_metadata() {
120 if [ -n "${KBUILD_DEFCONFIG}" ]; then 127 if [ -n "${KBUILD_DEFCONFIG}" ]; then
121 if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then 128 if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then
122 if [ -f "${WORKDIR}/defconfig" ]; then 129 if [ -f "${WORKDIR}/defconfig" ]; then
123 # If the two defconfig's are different, warn that we didn't overwrite the 130 # If the two defconfig's are different, warn that we overwrote the
124 # one already placed in WORKDIR by the fetcher. 131 # one already placed in WORKDIR
125 cmp "${WORKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" 132 cmp "${WORKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}"
126 if [ $? -ne 0 ]; then 133 if [ $? -ne 0 ]; then
127 bbwarn "defconfig detected in WORKDIR. ${KBUILD_DEFCONFIG} skipped" 134 bbdebug 1 "detected SRC_URI or unpatched defconfig in WORKDIR. ${KBUILD_DEFCONFIG} copied over it"
128 else
129 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
130 fi 135 fi
136 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
131 else 137 else
132 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig 138 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
133 fi 139 fi
@@ -137,17 +143,19 @@ do_kernel_metadata() {
137 fi 143 fi
138 fi 144 fi
139 145
140 # was anyone trying to patch the kernel meta data ?, we need to do 146 if [ "$mode" = "patch" ]; then
141 # this here, since the scc commands migrate the .cfg fragments to the 147 # was anyone trying to patch the kernel meta data ?, we need to do
142 # kernel source tree, where they'll be used later. 148 # this here, since the scc commands migrate the .cfg fragments to the
143 check_git_config 149 # kernel source tree, where they'll be used later.
144 patches="${@" ".join(find_patches(d,'kernel-meta'))}" 150 check_git_config
145 for p in $patches; do 151 patches="${@" ".join(find_patches(d,'kernel-meta'))}"
146 ( 152 for p in $patches; do
147 cd ${WORKDIR}/kernel-meta 153 (
148 git am -s $p 154 cd ${WORKDIR}/kernel-meta
149 ) 155 git am -s $p
150 done 156 )
157 done
158 fi
151 159
152 sccs_from_src_uri="${@" ".join(find_sccs(d))}" 160 sccs_from_src_uri="${@" ".join(find_sccs(d))}"
153 patches="${@" ".join(find_patches(d,''))}" 161 patches="${@" ".join(find_patches(d,''))}"
@@ -237,13 +245,15 @@ do_kernel_metadata() {
237 done 245 done
238 fi 246 fi
239 247
240 # run1: pull all the configuration fragments, no matter where they come from 248 if [ "$mode" = "config" ]; then
241 elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" 249 # run1: pull all the configuration fragments, no matter where they come from
242 if [ -n "${elements}" ]; then 250 elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
243 echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition 251 if [ -n "${elements}" ]; then
244 scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL 252 echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition
245 if [ $? -ne 0 ]; then 253 scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL
246 bbfatal_log "Could not generate configuration queue for ${KMACHINE}." 254 if [ $? -ne 0 ]; then
255 bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
256 fi
247 fi 257 fi
248 fi 258 fi
249 259
@@ -254,12 +264,14 @@ do_kernel_metadata() {
254 sccs="${bsp_definition} ${sccs}" 264 sccs="${bsp_definition} ${sccs}"
255 fi 265 fi
256 266
257 # run2: only generate patches for elements that have been passed on the SRC_URI 267 if [ "$mode" = "patch" ]; then
258 elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" 268 # run2: only generate patches for elements that have been passed on the SRC_URI
259 if [ -n "${elements}" ]; then 269 elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
260 scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} $KERNEL_FEATURES_FINAL 270 if [ -n "${elements}" ]; then
261 if [ $? -ne 0 ]; then 271 scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} $KERNEL_FEATURES_FINAL
262 bbfatal_log "Could not generate configuration queue for ${KMACHINE}." 272 if [ $? -ne 0 ]; then
273 bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
274 fi
263 fi 275 fi
264 fi 276 fi
265} 277}
@@ -363,6 +375,8 @@ do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_po
363do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot" 375do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
364do_kernel_configme[dirs] += "${S} ${B}" 376do_kernel_configme[dirs] += "${S} ${B}"
365do_kernel_configme() { 377do_kernel_configme() {
378 do_kernel_metadata config
379
366 # translate the kconfig_mode into something that merge_config.sh 380 # translate the kconfig_mode into something that merge_config.sh
367 # understands 381 # understands
368 case ${KCONFIG_MODE} in 382 case ${KCONFIG_MODE} in