summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/kernel-yocto.bbclass88
-rw-r--r--meta/recipes-kernel/kern-tools/kern-tools-native_git.bb2
2 files changed, 63 insertions, 27 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index f09d503b92..10a8d40d9c 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -80,8 +80,12 @@ do_patch() {
80 done 80 done
81 fi 81 fi
82 82
83 if [ "${kbranch}" != "${KBRANCH_DEFAULT}" ]; then
84 updateme_flags="--branch ${kbranch}"
85 fi
86
83 # updates or generates the target description 87 # updates or generates the target description
84 updateme --branch ${kbranch} -DKDESC=${KMACHINE}:${LINUX_KERNEL_TYPE} \ 88 updateme ${updateme_flags} -DKDESC=${KMACHINE}:${LINUX_KERNEL_TYPE} \
85 ${addon_features} ${ARCH} ${KMACHINE} ${sccs} ${patches} 89 ${addon_features} ${ARCH} ${KMACHINE} ${sccs} ${patches}
86 if [ $? -ne 0 ]; then 90 if [ $? -ne 0 ]; then
87 echo "ERROR. Could not update ${kbranch}" 91 echo "ERROR. Could not update ${kbranch}"
@@ -91,7 +95,19 @@ do_patch() {
91 # executes and modifies the source tree as required 95 # executes and modifies the source tree as required
92 patchme ${KMACHINE} 96 patchme ${KMACHINE}
93 if [ $? -ne 0 ]; then 97 if [ $? -ne 0 ]; then
94 echo "ERROR. Could not modify ${kbranch}" 98 echo "ERROR. Could not apply updates for ${KMACHINE}"
99 exit 1
100 fi
101
102 # Perform a final check. If something other than the default kernel
103 # branch was requested, and that's not where we ended up, then we
104 # should thrown an error, since we aren't building what was expected
105 final_branch="$(git symbolic-ref HEAD 2>/dev/null)"
106 final_branch=${final_branch##refs/heads/}
107 if [ "${kbranch}" != "${KBRANCH_DEFAULT}" ] &&
108 [ "${final_branch}" != "${kbranch}" ]; then
109 echo "ERROR: branch ${kbranch} was requested, but was not properly"
110 echo " configured to be built. The current branch is ${final_branch}"
95 exit 1 111 exit 1
96 fi 112 fi
97} 113}
@@ -199,10 +215,9 @@ python do_kernel_configcheck() {
199 bb.plain( "%s" % result ) 215 bb.plain( "%s" % result )
200} 216}
201 217
202
203# Ensure that the branches (BSP and meta) are on the locations specified by 218# Ensure that the branches (BSP and meta) are on the locations specified by
204# their SRCREV values. If they are NOT on the right commits, the branches 219# their SRCREV values. If they are NOT on the right commits, the branches
205# are reset to the correct commit. 220# are corrected to the proper commit.
206do_validate_branches() { 221do_validate_branches() {
207 cd ${S} 222 cd ${S}
208 223
@@ -213,39 +228,57 @@ do_validate_branches() {
213 return 228 return
214 fi 229 fi
215 230
216 # if the branches do not exist, then there's nothing to check either 231 # If something other than the default branch was requested, it must
232 # exist in the tree, and it's a hard error if it wasn't
217 git show-ref --quiet --verify -- "refs/heads/${KBRANCH}" 233 git show-ref --quiet --verify -- "refs/heads/${KBRANCH}"
218 if [ $? -eq 1 ]; then 234 if [ $? -eq 1 ]; then
219 return 235 if [ -n "${KBRANCH_DEFAULT}" ] &&
236 [ "${KBRANCH}" != "${KBRANCH_DEFAULT}" ]; then
237 echo "ERROR: branch ${KBRANCH} was set for kernel compilation, "
238 echo " but it does not exist in the kernel repository."
239 echo " Check the value of KBRANCH and ensure that it describes"
240 echo " a valid banch in the source kernel repository"
241 exit 1
242 fi
220 fi 243 fi
221 244
222 branch_head=`git show-ref -s --heads ${KBRANCH}`
223 if [ -z "${SRCREV_machine}" ]; then 245 if [ -z "${SRCREV_machine}" ]; then
224 target_branch_head="${SRCREV}" 246 target_branch_head="${SRCREV}"
225 else 247 else
226 target_branch_head="${SRCREV_machine}" 248 target_branch_head="${SRCREV_machine}"
227 fi 249 fi
228 250
251 # $SRCREV could have also been AUTOINC, so check again
229 if [ "${target_branch_head}" = "AUTOINC" ]; then 252 if [ "${target_branch_head}" = "AUTOINC" ]; then
230 return 253 return
231 fi 254 fi
232 255
233 # We have SRCREVs and we have branches so validation can continue! 256 containing_branches=`git branch --contains $target_branch_head | sed 's/^..//'`
234 current=`git branch |grep \*|sed 's/^\* //'` 257 if [ -z "$containing_branches" ]; then
235 if [ -n "$target_branch_head" ] && [ "$branch_head" != "$target_branch_head" ] && 258 echo "ERROR: SRCREV was set to \"$target_branch_head\", but no branches"
236 [ "$target_branch_head" != "AUTOINC" ]; then 259 echo " contain this commit"
237 ref=`git show ${target_branch_head} 2>&1 | head -n1 || true` 260 exit 1
238 if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then 261 fi
239 echo "ERROR ${target_branch_head} is not a valid commit ID." 262 ref=`git show ${target_branch_head} 2>&1 | head -n1 || true`
240 echo "The kernel source tree may be out of sync" 263 if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then
241 exit 1 264 echo "ERROR ${target_branch_head} is not a valid commit ID."
242 else 265 echo "The kernel source tree may be out of sync"
243 echo "Forcing branch $current to ${target_branch_head}" 266 exit 1
244 git branch -m $current $current-orig
245 git checkout -b $current ${target_branch_head}
246 fi
247 fi 267 fi
248 268
269 # force the SRCREV in each branch that contains the specified
270 # SRCREV (if it isn't the current HEAD of that branch)
271 git checkout -q master
272 for b in $containing_branches; do
273 branch_head=`git show-ref -s --heads ${b}`
274 if [ "$branch_head" != "$target_branch_head" ]; then
275 echo "[INFO] Setting branch $b to ${target_branch_head}"
276 git branch -D $b > /dev/null
277 git branch $b $target_branch_head > /dev/null
278 fi
279 done
280
281 ## KMETA branch validation
249 meta_head=`git show-ref -s --heads ${KMETA}` 282 meta_head=`git show-ref -s --heads ${KMETA}`
250 target_meta_head="${SRCREV_meta}" 283 target_meta_head="${SRCREV_meta}"
251 git show-ref --quiet --verify -- "refs/heads/${KMETA}" 284 git show-ref --quiet --verify -- "refs/heads/${KMETA}"
@@ -264,18 +297,21 @@ do_validate_branches() {
264 echo "The kernel source tree may be out of sync" 297 echo "The kernel source tree may be out of sync"
265 exit 1 298 exit 1
266 else 299 else
267 echo "Forcing branch meta to ${target_meta_head}" 300 echo "[INFO] Setting branch ${KMETA} to ${target_meta_head}"
268 git branch -m ${KMETA} ${KMETA}-orig 301 git branch -m ${KMETA} ${KMETA}-orig
269 git checkout -b ${KMETA} ${target_meta_head} 302 git checkout -q -b ${KMETA} ${target_meta_head}
270 if [ $? -ne 0 ];then 303 if [ $? -ne 0 ];then
271 echo "ERROR: could not checkout meta branch from known hash ${target_meta_head}" 304 echo "ERROR: could not checkout ${KMETA} branch from known hash ${target_meta_head}"
272 exit 1 305 exit 1
273 fi 306 fi
274 fi 307 fi
275 fi 308 fi
276 309
277 # restore the branch for builds 310 git show-ref --quiet --verify -- "refs/heads/${KBRANCH}"
278 git checkout -f ${KBRANCH} 311 if [ $? -eq 0 ]; then
312 # restore the branch for builds
313 git checkout -q -f ${KBRANCH}
314 fi
279} 315}
280 316
281# Many scripts want to look in arch/$arch/boot for the bootable 317# Many scripts want to look in arch/$arch/boot for the bootable
diff --git a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
index f47262f79f..0cb111c271 100644
--- a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
+++ b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
@@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://git/tools/kgit;beginline=5;endline=9;md5=d8d1d729a70c
4 4
5DEPENDS = "git-native guilt-native" 5DEPENDS = "git-native guilt-native"
6 6
7SRCREV = "b8dfd3d641400a8dfbf16868ee64f524508c80b7" 7SRCREV = "12c39b76eca4ed993b5ffb38cbe89e0608b216c3"
8PR = "r12" 8PR = "r12"
9PV = "0.1+git${SRCPV}" 9PV = "0.1+git${SRCPV}"
10 10