summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-yocto.bbclass
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2012-03-22 16:00:08 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-08 16:06:42 +0100
commit921e67bc820c6d05c1c7ece6a511a6a5e1add22f (patch)
tree3cb7c9f8a582f5516124e5ccb42b6c369271fcd0 /meta/classes/kernel-yocto.bbclass
parent6636f840d42bf36a7e8b02aa548622a868affb2b (diff)
downloadpoky-921e67bc820c6d05c1c7ece6a511a6a5e1add22f.tar.gz
linux-yocto: streamline support for multiple upstream repo types
In order to support repositories of various types (with or without meta data, branched, pristine, custom, etc) information about the type of processing that is required was passed to the processing phases via variables. The combination of variables involved in coordinating the processing creates a learning curve and overly complicates recipe extensions. With minor tweaks to the kern-tools, adding flexibility and keying off the existence of the meta branch it is possible to remove all of the variables that were added to support different repository types. (From OE-Core rev: 06e5f45c8f38925cd5902a3a3f436f5e9451dd16) Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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