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.bbclass115
1 files changed, 60 insertions, 55 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index c995a2ef57..c6425b2b69 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -45,9 +45,6 @@ def find_urls(d):
45 45
46do_patch() { 46do_patch() {
47 cd ${S} 47 cd ${S}
48 if [ -f ${WORKDIR}/defconfig ]; then
49 defconfig=${WORKDIR}/defconfig
50 fi
51 48
52 # if kernel tools are available in-tree, they are preferred 49 # if kernel tools are available in-tree, they are preferred
53 # and are placed on the path before any external tools. Unless 50 # and are placed on the path before any external tools. Unless
@@ -59,16 +56,13 @@ do_patch() {
59 fi 56 fi
60 57
61 kbranch=${KBRANCH} 58 kbranch=${KBRANCH}
62 if [ -n "${YOCTO_KERNEL_EXTERNAL_BRANCH}" ]; then
63 # switch from a generic to a specific branch
64 kbranch=${YOCTO_KERNEL_EXTERNAL_BRANCH}
65 fi
66 59
67 # simply ensures that a branch of the right name has been created 60 # if we have a defined/set meta branch we should not be generating
68 if [ -n "${YOCTO_KERNEL_META_DATA}" ]; then 61 # any meta data. The passed branch has what we need.
62 if [ -n "${KMETA}" ]; then
69 createme_flags="--disable-meta-gen" 63 createme_flags="--disable-meta-gen"
70 fi 64 fi
71 createme ${createme_flags} ${ARCH} ${kbranch} ${defconfig} 65 createme ${createme_flags} ${ARCH} ${kbranch}
72 if [ $? -ne 0 ]; then 66 if [ $? -ne 0 ]; then
73 echo "ERROR. Could not create ${kbranch}" 67 echo "ERROR. Could not create ${kbranch}"
74 exit 1 68 exit 1
@@ -95,7 +89,7 @@ do_patch() {
95 fi 89 fi
96 90
97 # executes and modifies the source tree as required 91 # executes and modifies the source tree as required
98 patchme ${kbranch} 92 patchme ${KMACHINE}
99 if [ $? -ne 0 ]; then 93 if [ $? -ne 0 ]; then
100 echo "ERROR. Could not modify ${kbranch}" 94 echo "ERROR. Could not modify ${kbranch}"
101 exit 1 95 exit 1
@@ -122,7 +116,7 @@ do_kernel_checkout() {
122 mv ${WORKDIR}/git/.git ${S} 116 mv ${WORKDIR}/git/.git ${S}
123 rm -rf ${WORKDIR}/git/ 117 rm -rf ${WORKDIR}/git/
124 cd ${S} 118 cd ${S}
125 if [ -n "${YOCTO_KERNEL_META_DATA}" ] && [ -n "${KMETA}" ]; then 119 if [ -n "${KMETA}" ]; then
126 git branch -a | grep -q ${KMETA} 120 git branch -a | grep -q ${KMETA}
127 if [ $? -ne 0 ]; then 121 if [ $? -ne 0 ]; then
128 echo "ERROR. The branch '${KMETA}' is required and was not" 122 echo "ERROR. The branch '${KMETA}' is required and was not"
@@ -131,15 +125,6 @@ do_kernel_checkout() {
131 exit 1 125 exit 1
132 fi 126 fi
133 fi 127 fi
134 if [ -z "${YOCTO_KERNEL_EXTERNAL_BRANCH}" ] && [ -n "${KBRANCH}" ] ; then
135 git branch -a | grep -q ${KBRANCH}
136 if [ $? -ne 0 ]; then
137 echo "ERROR. The branch '${KBRANCH}' is required and was not"
138 echo "found. Ensure that the SRC_URI points to a valid linux-yocto"
139 echo "kernel repository"
140 exit 1
141 fi
142 fi
143 fi 128 fi
144 if [ -d "${WORKDIR}/git/" ] && [ ! -d "${WORKDIR}/git/.git" ]; then 129 if [ -d "${WORKDIR}/git/" ] && [ ! -d "${WORKDIR}/git/.git" ]; then
145 # we build out of {S}, so ensure that ${S} is clean and present 130 # we build out of {S}, so ensure that ${S} is clean and present
@@ -192,7 +177,7 @@ do_kernel_configme() {
192 177
193 cd ${S} 178 cd ${S}
194 PATH=${PATH}:${S}/scripts/util 179 PATH=${PATH}:${S}/scripts/util
195 configme ${configmeflags} --reconfig --output ${B} ${KBRANCH} ${KMACHINE} 180 configme ${configmeflags} --reconfig --output ${B} ${LINUX_KERNEL_TYPE} ${KMACHINE}
196 if [ $? -ne 0 ]; then 181 if [ $? -ne 0 ]; then
197 echo "ERROR. Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}" 182 echo "ERROR. Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}"
198 exit 1 183 exit 1
@@ -221,51 +206,71 @@ python do_kernel_configcheck() {
221do_validate_branches() { 206do_validate_branches() {
222 cd ${S} 207 cd ${S}
223 208
224 # nothing to do if bootstrapping 209 set +e
225 if [ -n "${YOCTO_KERNEL_EXTERNAL_BRANCH}" ]; then 210 # if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to
226 return 211 # check and we can exit early
227 fi
228
229 # nothing to do if SRCREV is AUTOREV
230 if [ "${SRCREV_machine}" = "AUTOINC" ]; then 212 if [ "${SRCREV_machine}" = "AUTOINC" ]; then
231 # restore the branch for builds 213 return
232 git checkout -f ${KBRANCH} 214 fi
215
216 # if the branches do not exist, then there's nothing to check either
217 git show-ref --quiet --verify -- "refs/heads/${KBRANCH}"
218 if [ $? -eq 1 ]; then
233 return 219 return
234 fi 220 fi
235 221
236 branch_head=`git show-ref -s --heads ${KBRANCH}` 222 branch_head=`git show-ref -s --heads ${KBRANCH}`
237 meta_head=`git show-ref -s --heads ${KMETA}` 223 if [ -z "${SRCREV_machine}" ]; then
238 target_branch_head="${SRCREV_machine}" 224 target_branch_head="${SRCREV}"
239 target_meta_head="${SRCREV_meta}" 225 else
226 target_branch_head="${SRCREV_machine}"
227 fi
228
229 if [ "${target_branch_head}" = "AUTOINC" ]; then
230 return
231 fi
240 232
233 # We have SRCREVs and we have branches so validation can continue!
241 current=`git branch |grep \*|sed 's/^\* //'` 234 current=`git branch |grep \*|sed 's/^\* //'`
242 if [ -n "$target_branch_head" ] && [ "$branch_head" != "$target_branch_head" ]; then 235 if [ -n "$target_branch_head" ] && [ "$branch_head" != "$target_branch_head" ] &&
243 if [ -n "${KERNEL_REVISION_CHECKING}" ]; then 236 [ "$target_branch_head" != "AUTOINC" ]; then
244 ref=`git show ${target_meta_head} 2>&1 | head -n1 || true` 237 ref=`git show ${target_branch_head} 2>&1 | head -n1 || true`
245 if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then 238 if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then
246 echo "ERROR ${target_branch_head} is not a valid commit ID." 239 echo "ERROR ${target_branch_head} is not a valid commit ID."
247 echo "The kernel source tree may be out of sync" 240 echo "The kernel source tree may be out of sync"
248 exit 1 241 exit 1
249 else 242 else
250 echo "Forcing branch $current to ${target_branch_head}" 243 echo "Forcing branch $current to ${target_branch_head}"
251 git branch -m $current $current-orig 244 git branch -m $current $current-orig
252 git checkout -b $current ${target_branch_head} 245 git checkout -b $current ${target_branch_head}
253 fi
254 fi 246 fi
255 fi 247 fi
256 248
249 meta_head=`git show-ref -s --heads ${KMETA}`
250 target_meta_head="${SRCREV_meta}"
251 git show-ref --quiet --verify -- "refs/heads/${KMETA}"
252 if [ $? -eq 1 ]; then
253 return
254 fi
255
256 if [ "${target_meta_head}" = "AUTOINC" ]; then
257 return
258 fi
259
257 if [ "$meta_head" != "$target_meta_head" ]; then 260 if [ "$meta_head" != "$target_meta_head" ]; then
258 if [ -n "${KERNEL_REVISION_CHECKING}" ]; then 261 ref=`git show ${target_meta_head} 2>&1 | head -n1 || true`
259 ref=`git show ${target_meta_head} 2>&1 | head -n1 || true` 262 if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then
260 if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then 263 echo "ERROR ${target_meta_head} is not a valid commit ID"
261 echo "ERROR ${target_meta_head} is not a valid commit ID" 264 echo "The kernel source tree may be out of sync"
262 echo "The kernel source tree may be out of sync" 265 exit 1
266 else
267 echo "Forcing branch meta to ${target_meta_head}"
268 git branch -m ${KMETA} ${KMETA}-orig
269 git checkout -b ${KMETA} ${target_meta_head}
270 if [ $? -ne 0 ];then
271 echo "ERROR: could not checkout meta branch from known hash ${target_meta_head}"
263 exit 1 272 exit 1
264 else 273 fi
265 echo "Forcing branch meta to ${target_meta_head}"
266 git branch -m ${KMETA} ${KMETA}-orig
267 git checkout -b ${KMETA} ${target_meta_head}
268 fi
269 fi 274 fi
270 fi 275 fi
271 276