summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-yocto.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/kernel-yocto.bbclass')
-rw-r--r--meta/classes/kernel-yocto.bbclass143
1 files changed, 53 insertions, 90 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index a9d42053da..8650e55de7 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -119,77 +119,42 @@ do_kernel_metadata() {
119 patches="${@" ".join(find_patches(d))}" 119 patches="${@" ".join(find_patches(d))}"
120 feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}" 120 feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}"
121 121
122 # add any explicitly referenced features onto the end of the feature
123 # list that is passed to the kernel build scripts.
124 if [ -n "${KERNEL_FEATURES}" ]; then
125 for feat in ${KERNEL_FEATURES}; do
126 addon_features="$addon_features --feature $feat"
127 done
128 fi
129
130 # check for feature directories/repos/branches that were part of the 122 # check for feature directories/repos/branches that were part of the
131 # SRC_URI. If they were supplied, we convert them into include directives 123 # SRC_URI. If they were supplied, we convert them into include directives
132 # for the update part of the process 124 # for the update part of the process
133 if [ -n "${feat_dirs}" ]; then 125 for f in ${feat_dirs}; do
134 for f in ${feat_dirs}; do
135 if [ -d "${WORKDIR}/$f/meta" ]; then 126 if [ -d "${WORKDIR}/$f/meta" ]; then
136 includes="$includes -I${WORKDIR}/$f/meta" 127 includes="$includes -I${WORKDIR}/$f/meta"
137 elif [ -d "${WORKDIR}/$f" ]; then 128 elif [ -d "${WORKDIR}/$f" ]; then
138 includes="$includes -I${WORKDIR}/$f" 129 includes="$includes -I${WORKDIR}/$f"
139 fi 130 fi
140 done 131 done
141 fi 132 for s in ${sccs}; do
133 sdir=$(dirname $s)
134 includes="$includes -I${sdir}"
135 done
142 136
143 # updates or generates the target description 137 # expand kernel features into their full path equivalents
144 updateme ${updateme_flags} -DKDESC=${KMACHINE}:${LINUX_KERNEL_TYPE} \ 138 bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE})
145 ${includes} ${addon_features} ${ARCH} ${KMACHINE} ${sccs} ${patches} 139 meta_dir=$(kgit --meta)
146 if [ $? -ne 0 ]; then 140
147 bbfatal_log "Could not update ${machine_branch}" 141 # run1: pull all the configuration fragments, no matter where they come from
148 fi 142 scc --force -o ${S}/${meta_dir}:cfg,meta ${includes} ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES}
143
144 # run2: only generate patches for elements that have been passed on the SRC_URI
145 scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} ${KERNEL_FEATURES}
149} 146}
150 147
151do_patch() { 148do_patch() {
152 cd ${S} 149 cd ${S}
153 150
154 # executes and modifies the source tree as required 151 meta_dir=$(kgit --meta)
155 patchme ${KMACHINE} 152 (cd ${meta_dir}; ln -sf patch.queue series)
156 if [ $? -ne 0 ]; then 153 if [ -f "${meta_dir}/series" ]; then
157 bberror "Could not apply patches for ${KMACHINE}." 154 kgit-s2q --gen -v --patches .kernel-meta/
158 bbfatal_log "Patch failures can be resolved in the linux source directory ${S})" 155 if [ $? -ne 0 ]; then
159 fi 156 bberror "Could not apply patches for ${KMACHINE}."
160 157 bbfatal_log "Patch failures can be resolved in the linux source directory ${S})"
161 # check to see if the specified SRCREV is reachable from the final branch.
162 # if it wasn't something wrong has happened, and we should error.
163 machine_srcrev="${SRCREV_machine}"
164 if [ -z "${machine_srcrev}" ]; then
165 # fallback to SRCREV if a non machine_meta tree is being built
166 machine_srcrev="${SRCREV}"
167 # if SRCREV cannot be reached something is wrong.
168 if [ -z "${machine_srcrev}" ]; then
169 bbfatal "Neither SRCREV_machine or SRCREV was specified!"
170 fi
171 fi
172
173 if [ -n "${KMETA_AUDIT}" ]; then
174 current_branch=`git rev-parse --abbrev-ref HEAD`
175 machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
176 if [ "${current_branch}" != "${machine_branch}" ]; then
177 bbwarn "After meta data application, the kernel tree branch is ${current_branch}."
178 bbwarn "The SRC_URI specified branch ${machine_branch}."
179 bbwarn ""
180 bbwarn "The branch will be forced to ${machine_branch}, but this means the board meta data"
181 bbwarn "(.scc files) do not match the SRC_URI specification."
182 bbwarn ""
183 bbwarn "The meta data and branch ${machine_branch} should be inspected to ensure the proper"
184 bbwarn "kernel is being built."
185 git checkout -f ${machine_branch}
186 fi
187 fi
188
189 if [ "${machine_srcrev}" != "AUTOINC" ]; then
190 if ! [ "$(git rev-parse --verify ${machine_srcrev}~0)" = "$(git merge-base ${machine_srcrev} HEAD)" ]; then
191 bberror "SRCREV ${machine_srcrev} was specified, but is not reachable"
192 bbfatal "Check the BSP description for incorrect branch selection, or other errors."
193 fi 158 fi
194 fi 159 fi
195} 160}
@@ -258,26 +223,37 @@ do_kernel_metadata[depends] = "kern-tools-native:do_populate_sysroot"
258 223
259do_kernel_configme[dirs] += "${S} ${B}" 224do_kernel_configme[dirs] += "${S} ${B}"
260do_kernel_configme() { 225do_kernel_configme() {
261 bbnote "kernel configme" 226 set +e
262 export KMETA=${KMETA}
263 227
264 if [ -n "${KCONFIG_MODE}" ]; then 228 # translate the kconfig_mode into something that merge_config.sh
265 configmeflags=${KCONFIG_MODE} 229 # understands
266 else 230 case ${KCONFIG_MODE} in
267 # If a defconfig was passed, use =n as the baseline, which is achieved 231 allnoconfig)
268 # via --allnoconfig 232 config_flags="-n"
233 ;;
234 alldefconfig)
235 config_flags=""
236 ;;
237 *)
269 if [ -f ${WORKDIR}/defconfig ]; then 238 if [ -f ${WORKDIR}/defconfig ]; then
270 configmeflags="--allnoconfig" 239 config_flags="-n"
271 fi 240 fi
272 fi 241 ;;
242 esac
273 243
274 cd ${S} 244 cd ${S}
275 PATH=${PATH}:${S}/scripts/util 245
276 configme ${configmeflags} --reconfig --output ${B} ${LINUX_KERNEL_TYPE} ${KMACHINE} 246 meta_dir=$(kgit --meta)
247 configs="$(scc --configs -o ${meta_dir})"
248 if [ -z "${configs}" ]; then
249 bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)"
250 fi
251
252 ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1
277 if [ $? -ne 0 ]; then 253 if [ $? -ne 0 ]; then
278 bbfatal_log "Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}" 254 bbfatal_log "Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}"
279 fi 255 fi
280 256
281 echo "# Global settings from linux recipe" >> ${B}/.config 257 echo "# Global settings from linux recipe" >> ${B}/.config
282 echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config 258 echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
283} 259}
@@ -295,36 +271,23 @@ python do_kernel_configcheck() {
295 kmeta = "." + kmeta 271 kmeta = "." + kmeta
296 272
297 pathprefix = "export PATH=%s:%s; " % (d.getVar('PATH', True), "${S}/scripts/util/") 273 pathprefix = "export PATH=%s:%s; " % (d.getVar('PATH', True), "${S}/scripts/util/")
298 cmd = d.expand("cd ${S}; kconf_check -config %s/meta-series ${S} ${B}" % kmeta) 274
275 cmd = d.expand("scc --configs -o ${S}/.kernel-meta")
276 ret, configs = oe.utils.getstatusoutput("%s%s" % (pathprefix, cmd))
277
278 cmd = d.expand("cd ${S}; kconf_check --report -o ${S}/%s/cfg/ ${B}/.config ${S} %s" % (kmeta,configs))
299 ret, result = oe.utils.getstatusoutput("%s%s" % (pathprefix, cmd)) 279 ret, result = oe.utils.getstatusoutput("%s%s" % (pathprefix, cmd))
300 280
301 config_check_visibility = int(d.getVar( "KCONF_AUDIT_LEVEL", True ) or 0) 281 config_check_visibility = int(d.getVar( "KCONF_AUDIT_LEVEL", True ) or 0)
302 bsp_check_visibility = int(d.getVar( "KCONF_BSP_AUDIT_LEVEL", True ) or 0) 282 bsp_check_visibility = int(d.getVar( "KCONF_BSP_AUDIT_LEVEL", True ) or 0)
303 283
304 # if config check visibility is non-zero, report dropped configuration values 284 # if config check visibility is non-zero, report dropped configuration values
305 mismatch_file = "${S}/" + kmeta + "/" + "mismatch.cfg" 285 mismatch_file = d.expand("${S}/%s/cfg/mismatch.txt" % kmeta)
306 if os.path.exists(mismatch_file): 286 if os.path.exists(mismatch_file):
307 if config_check_visibility: 287 if config_check_visibility:
308 with open (mismatch_file, "r") as myfile: 288 with open (mismatch_file, "r") as myfile:
309 results = myfile.read() 289 results = myfile.read()
310 bb.warn( "[kernel config]: specified values did not make it into the kernel's final configuration:\n\n%s" % results) 290 bb.warn( "[kernel config]: specified values did not make it into the kernel's final configuration:\n\n%s" % results)
311
312 # if config check visibility is level 2 or higher, report non-hardware options
313 nonhw_file = "${S}/" + kmeta + "/" + "nonhw_report.cfg"
314 if os.path.exists(nonhw_file):
315 if config_check_visibility > 1:
316 with open (nonhw_file, "r") as myfile:
317 results = myfile.read()
318 bb.warn( "[kernel config]: BSP specified non-hw configuration:\n\n%s" % results)
319
320 bsp_desc = "${S}/" + kmeta + "/" + "top_tgt"
321 if os.path.exists(bsp_desc) and bsp_check_visibility > 1:
322 with open (bsp_desc, "r") as myfile:
323 bsp_tgt = myfile.read()
324 m = re.match("^(.*)scratch.obj(.*)$", bsp_tgt)
325 if not m is None:
326 bb.warn( "[kernel]: An auto generated BSP description was used, this normally indicates a misconfiguration.\n" +
327 "Check that your machine (%s) has an associated kernel description." % "${MACHINE}" )
328} 291}
329 292
330# Ensure that the branches (BSP and meta) are on the locations specified by 293# Ensure that the branches (BSP and meta) are on the locations specified by