summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/kernel-yocto.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-recipe/kernel-yocto.bbclass')
-rw-r--r--meta/classes-recipe/kernel-yocto.bbclass78
1 files changed, 50 insertions, 28 deletions
diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index 6468e8aa90..e53bf15194 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -25,6 +25,7 @@ KCONF_AUDIT_LEVEL ?= "1"
25KCONF_BSP_AUDIT_LEVEL ?= "0" 25KCONF_BSP_AUDIT_LEVEL ?= "0"
26KMETA_AUDIT ?= "yes" 26KMETA_AUDIT ?= "yes"
27KMETA_AUDIT_WERROR ?= "" 27KMETA_AUDIT_WERROR ?= ""
28KMETA_CONFIG_FEATURES ?= ""
28 29
29# returns local (absolute) path names for all valid patches in the 30# returns local (absolute) path names for all valid patches in the
30# src_uri 31# src_uri
@@ -62,8 +63,8 @@ def find_sccs(d):
62 63
63 return sources_list 64 return sources_list
64 65
65# check the SRC_URI for "kmeta" type'd git repositories. Return the name of 66# check the SRC_URI for "kmeta" type'd git repositories and directories. Return
66# the repository as it will be found in UNPACKDIR 67# the name of the repository or directory as it will be found in UNPACKDIR
67def find_kernel_feature_dirs(d): 68def find_kernel_feature_dirs(d):
68 feature_dirs=[] 69 feature_dirs=[]
69 fetch = bb.fetch2.Fetch([], d) 70 fetch = bb.fetch2.Fetch([], d)
@@ -71,13 +72,16 @@ def find_kernel_feature_dirs(d):
71 urldata = fetch.ud[url] 72 urldata = fetch.ud[url]
72 parm = urldata.parm 73 parm = urldata.parm
73 type="" 74 type=""
75 destdir = ""
74 if "type" in parm: 76 if "type" in parm:
75 type = parm["type"] 77 type = parm["type"]
76 if "destsuffix" in parm: 78 if "destsuffix" in parm:
77 destdir = parm["destsuffix"] 79 destdir = parm["destsuffix"]
78 if type == "kmeta": 80 elif urldata.type == "file":
79 feature_dirs.append(destdir) 81 destdir = urldata.basepath
80 82 if type == "kmeta" and destdir:
83 feature_dirs.append(destdir)
84
81 return feature_dirs 85 return feature_dirs
82 86
83# find the master/machine source branch. In the same way that the fetcher proceses 87# find the master/machine source branch. In the same way that the fetcher proceses
@@ -147,10 +151,6 @@ do_kernel_metadata() {
147 # from the source tree, into a common location and normalized "defconfig" name, 151 # from the source tree, into a common location and normalized "defconfig" name,
148 # where the rest of the process will include and incoroporate it into the build 152 # where the rest of the process will include and incoroporate it into the build
149 # 153 #
150 # If the fetcher has already placed a defconfig in UNPACKDIR (from the SRC_URI),
151 # we don't overwrite it, but instead warn the user that SRC_URI defconfigs take
152 # precendence.
153 #
154 if [ -n "${KBUILD_DEFCONFIG}" ]; then 154 if [ -n "${KBUILD_DEFCONFIG}" ]; then
155 if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then 155 if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then
156 if [ -f "${UNPACKDIR}/defconfig" ]; then 156 if [ -f "${UNPACKDIR}/defconfig" ]; then
@@ -158,12 +158,10 @@ do_kernel_metadata() {
158 # one already placed in UNPACKDIR 158 # one already placed in UNPACKDIR
159 cmp "${UNPACKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" 159 cmp "${UNPACKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}"
160 if [ $? -ne 0 ]; then 160 if [ $? -ne 0 ]; then
161 bbdebug 1 "detected SRC_URI or unpatched defconfig in UNPACKDIR. ${KBUILD_DEFCONFIG} copied over it" 161 bbdebug 1 "detected SRC_URI or patched defconfig in UNPACKDIR. ${KBUILD_DEFCONFIG} copied over it"
162 fi 162 fi
163 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${UNPACKDIR}/defconfig
164 else
165 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${UNPACKDIR}/defconfig
166 fi 163 fi
164 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${UNPACKDIR}/defconfig
167 in_tree_defconfig="${UNPACKDIR}/defconfig" 165 in_tree_defconfig="${UNPACKDIR}/defconfig"
168 else 166 else
169 bbfatal "A KBUILD_DEFCONFIG '${KBUILD_DEFCONFIG}' was specified, but not present in the source tree (${S}/arch/${ARCH}/configs/)" 167 bbfatal "A KBUILD_DEFCONFIG '${KBUILD_DEFCONFIG}' was specified, but not present in the source tree (${S}/arch/${ARCH}/configs/)"
@@ -234,8 +232,6 @@ do_kernel_metadata() {
234 for f in ${feat_dirs}; do 232 for f in ${feat_dirs}; do
235 if [ -d "${UNPACKDIR}/$f/kernel-meta" ]; then 233 if [ -d "${UNPACKDIR}/$f/kernel-meta" ]; then
236 includes="$includes -I${UNPACKDIR}/$f/kernel-meta" 234 includes="$includes -I${UNPACKDIR}/$f/kernel-meta"
237 elif [ -d "${UNPACKDIR}/../oe-local-files/$f" ]; then
238 includes="$includes -I${UNPACKDIR}/../oe-local-files/$f"
239 elif [ -d "${UNPACKDIR}/$f" ]; then 235 elif [ -d "${UNPACKDIR}/$f" ]; then
240 includes="$includes -I${UNPACKDIR}/$f" 236 includes="$includes -I${UNPACKDIR}/$f"
241 fi 237 fi
@@ -250,6 +246,9 @@ do_kernel_metadata() {
250 fi 246 fi
251 done 247 done
252 248
249 # allow in-tree config fragments to be used in KERNEL_FEATURES
250 includes="$includes -I${S}/arch/${ARCH}/configs -I${S}/kernel/configs"
251
253 # expand kernel features into their full path equivalents 252 # expand kernel features into their full path equivalents
254 bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE}) 253 bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE})
255 if [ -z "$bsp_definition" ]; then 254 if [ -z "$bsp_definition" ]; then
@@ -270,6 +269,9 @@ do_kernel_metadata() {
270 KERNEL_FEATURES_FINAL="" 269 KERNEL_FEATURES_FINAL=""
271 if [ -n "${KERNEL_FEATURES}" ]; then 270 if [ -n "${KERNEL_FEATURES}" ]; then
272 for feature in ${KERNEL_FEATURES}; do 271 for feature in ${KERNEL_FEATURES}; do
272 feature_as_specified="$feature"
273 feature="$(echo $feature_as_specified | cut -d: -f1)"
274 feature_specifier="$(echo $feature_as_specified | cut -d: -f2)"
273 feature_found=f 275 feature_found=f
274 for d in $includes; do 276 for d in $includes; do
275 path_to_check=$(echo $d | sed 's/^-I//') 277 path_to_check=$(echo $d | sed 's/^-I//')
@@ -287,7 +289,7 @@ do_kernel_metadata() {
287 bbfatal_log "Set KERNEL_DANGLING_FEATURES_WARN_ONLY to ignore this issue" 289 bbfatal_log "Set KERNEL_DANGLING_FEATURES_WARN_ONLY to ignore this issue"
288 fi 290 fi
289 else 291 else
290 KERNEL_FEATURES_FINAL="$KERNEL_FEATURES_FINAL $feature" 292 KERNEL_FEATURES_FINAL="$KERNEL_FEATURES_FINAL $feature_as_specified"
291 fi 293 fi
292 done 294 done
293 fi 295 fi
@@ -297,7 +299,11 @@ do_kernel_metadata() {
297 elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" 299 elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
298 if [ -n "${elements}" ]; then 300 if [ -n "${elements}" ]; then
299 echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition 301 echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition
300 scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL 302 echo "${KMETA_CONFIG_FEATURES}" | grep -q "prefer-modules"
303 if [ $? -eq 0 ]; then
304 scc_defines="-DMODULE_OR_Y=m"
305 fi
306 scc --force $scc_defines -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL
301 if [ $? -ne 0 ]; then 307 if [ $? -ne 0 ]; then
302 bbfatal_log "Could not generate configuration queue for ${KMACHINE}." 308 bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
303 fi 309 fi
@@ -345,6 +351,9 @@ do_patch() {
345 cd ${S} 351 cd ${S}
346 352
347 check_git_config 353 check_git_config
354 if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
355 reproducible_git_committer_author
356 fi
348 meta_dir=$(kgit --meta) 357 meta_dir=$(kgit --meta)
349 (cd ${meta_dir}; ln -sf patch.queue series) 358 (cd ${meta_dir}; ln -sf patch.queue series)
350 if [ -f "${meta_dir}/series" ]; then 359 if [ -f "${meta_dir}/series" ]; then
@@ -379,19 +388,19 @@ do_kernel_checkout() {
379 set +e 388 set +e
380 389
381 source_dir=`echo ${S} | sed 's%/$%%'` 390 source_dir=`echo ${S} | sed 's%/$%%'`
382 source_workdir="${WORKDIR}/git" 391 source_unpackdir="${UNPACKDIR}/${BB_GIT_DEFAULT_DESTSUFFIX}"
383 if [ -d "${WORKDIR}/git/" ]; then 392 if [ -d "${source_unpackdir}" ]; then
384 # case: git repository 393 # case: git repository
385 # if S is WORKDIR/git, then we shouldn't be moving or deleting the tree. 394 # if S is UNPACKDIR/BB_GIT_DEFAULT_DESTSUFFIX, then we shouldn't be moving or deleting the tree.
386 if [ "${source_dir}" != "${source_workdir}" ]; then 395 if [ "${source_dir}" != "${source_unpackdir}" ]; then
387 if [ -d "${source_workdir}/.git" ]; then 396 if [ -d "${source_unpackdir}/.git" ]; then
388 # regular git repository with .git 397 # regular git repository with .git
389 rm -rf ${S} 398 rm -rf ${S}
390 mv ${WORKDIR}/git ${S} 399 mv ${source_unpackdir} ${S}
391 else 400 else
392 # create source for bare cloned git repository 401 # create source for bare cloned git repository
393 git clone ${WORKDIR}/git ${S} 402 git clone ${source_unpackdir} ${S}
394 rm -rf ${WORKDIR}/git 403 rm -rf ${source_unpackdir}
395 fi 404 fi
396 fi 405 fi
397 cd ${S} 406 cd ${S}
@@ -427,6 +436,9 @@ do_kernel_checkout() {
427 rm -f .gitignore 436 rm -f .gitignore
428 git init 437 git init
429 check_git_config 438 check_git_config
439 if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
440 reproducible_git_committer_author
441 fi
430 git add . 442 git add .
431 git commit -q -n -m "baseline commit: creating repo for ${PN}-${PV}" 443 git commit -q -n -m "baseline commit: creating repo for ${PN}-${PV}"
432 git clean -d -f 444 git clean -d -f
@@ -434,7 +446,7 @@ do_kernel_checkout() {
434 446
435 set -e 447 set -e
436} 448}
437do_kernel_checkout[dirs] = "${S} ${WORKDIR}" 449do_kernel_checkout[dirs] = "${S} ${UNPACKDIR}"
438 450
439addtask kernel_checkout before do_kernel_metadata after do_symlink_kernsrc 451addtask kernel_checkout before do_kernel_metadata after do_symlink_kernsrc
440addtask kernel_metadata after do_validate_branches do_unpack before do_patch 452addtask kernel_metadata after do_validate_branches do_unpack before do_patch
@@ -442,8 +454,13 @@ do_kernel_metadata[depends] = "kern-tools-native:do_populate_sysroot"
442do_kernel_metadata[file-checksums] = " ${@get_dirs_with_fragments(d)}" 454do_kernel_metadata[file-checksums] = " ${@get_dirs_with_fragments(d)}"
443do_validate_branches[depends] = "kern-tools-native:do_populate_sysroot" 455do_validate_branches[depends] = "kern-tools-native:do_populate_sysroot"
444 456
445do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}binutils:do_populate_sysroot" 457# ${S} doesn't exist for us at unpack
446do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}gcc:do_populate_sysroot" 458do_qa_unpack() {
459 return
460}
461
462do_kernel_configme[depends] += "virtual/cross-binutils:do_populate_sysroot"
463do_kernel_configme[depends] += "virtual/cross-cc:do_populate_sysroot"
447do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot" 464do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot"
448do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot" 465do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
449do_kernel_configme[dirs] += "${S} ${B}" 466do_kernel_configme[dirs] += "${S} ${B}"
@@ -559,6 +576,11 @@ python do_config_analysis() {
559python do_kernel_configcheck() { 576python do_kernel_configcheck() {
560 import re, string, sys, subprocess 577 import re, string, sys, subprocess
561 578
579 audit_flag = d.getVar( "KMETA_AUDIT" )
580 if not audit_flag:
581 bb.note( "kernel config audit disabled, skipping .." )
582 return
583
562 s = d.getVar('S') 584 s = d.getVar('S')
563 585
564 # if KMETA isn't set globally by a recipe using this routine, use kgit to 586 # if KMETA isn't set globally by a recipe using this routine, use kgit to