diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2012-03-22 16:00:08 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-08 16:06:42 +0100 |
commit | 921e67bc820c6d05c1c7ece6a511a6a5e1add22f (patch) | |
tree | 3cb7c9f8a582f5516124e5ccb42b6c369271fcd0 | |
parent | 6636f840d42bf36a7e8b02aa548622a868affb2b (diff) | |
download | poky-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>
-rw-r--r-- | meta/classes/kernel-yocto.bbclass | 115 | ||||
-rw-r--r-- | meta/recipes-kernel/kern-tools/kern-tools-native_git.bb | 2 | ||||
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto-rt_3.0.bb | 1 | ||||
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto-rt_3.2.bb | 2 | ||||
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto.inc | 7 | ||||
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto_2.6.37.bb | 2 | ||||
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto_3.0.bb | 23 | ||||
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto_3.2.bb | 2 |
8 files changed, 86 insertions, 68 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 | ||
46 | do_patch() { | 46 | do_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() { | |||
221 | do_validate_branches() { | 206 | do_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 | ||
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 754ebe5fb2..1af22f634d 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=e2bf4415f3d8 | |||
4 | 4 | ||
5 | DEPENDS = "git-native guilt-native" | 5 | DEPENDS = "git-native guilt-native" |
6 | 6 | ||
7 | SRCREV = "2bbbaaa00cc70887d6d6f745b9425890d522d240" | 7 | SRCREV = "369e67046a1b72b6447c208babd4d2065265a95e" |
8 | PR = "r12" | 8 | PR = "r12" |
9 | PV = "0.1+git${SRCPV}" | 9 | PV = "0.1+git${SRCPV}" |
10 | 10 | ||
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_3.0.bb b/meta/recipes-kernel/linux/linux-yocto-rt_3.0.bb index 36dcb6e67e..14af91dc31 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_3.0.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_3.0.bb | |||
@@ -13,6 +13,7 @@ KBRANCH_qemuppc = "yocto/standard/preempt-rt/qemu-ppc32" | |||
13 | 13 | ||
14 | LINUX_VERSION ?= "3.0.24" | 14 | LINUX_VERSION ?= "3.0.24" |
15 | LINUX_KERNEL_TYPE = "preempt-rt" | 15 | LINUX_KERNEL_TYPE = "preempt-rt" |
16 | KMETA = "meta" | ||
16 | 17 | ||
17 | SRCREV_machine ?= "cf280f1dc5877d4ca43d21307222326efa68bb27" | 18 | SRCREV_machine ?= "cf280f1dc5877d4ca43d21307222326efa68bb27" |
18 | SRCREV_machine_qemuppc ?= "afaa5baa6a9ca9c8a03a9a3eee2ba9fba089f416" | 19 | SRCREV_machine_qemuppc ?= "afaa5baa6a9ca9c8a03a9a3eee2ba9fba089f416" |
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_3.2.bb b/meta/recipes-kernel/linux/linux-yocto-rt_3.2.bb index 7e01efbc98..8ec366ceee 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_3.2.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_3.2.bb | |||
@@ -14,6 +14,8 @@ KBRANCH_qemuppc = "standard/preempt-rt/qemu-ppc32" | |||
14 | LINUX_VERSION ?= "3.2.11" | 14 | LINUX_VERSION ?= "3.2.11" |
15 | LINUX_KERNEL_TYPE = "preempt-rt" | 15 | LINUX_KERNEL_TYPE = "preempt-rt" |
16 | 16 | ||
17 | KMETA = "meta" | ||
18 | |||
17 | SRCREV_machine ?= "3ebf4d172cf4a41d2abf09e4036f0850e08064e7" | 19 | SRCREV_machine ?= "3ebf4d172cf4a41d2abf09e4036f0850e08064e7" |
18 | SRCREV_machine_qemuppc ?= "7cebfe717987f4ffa9ae90558c28f45049847c1c" | 20 | SRCREV_machine_qemuppc ?= "7cebfe717987f4ffa9ae90558c28f45049847c1c" |
19 | SRCREV_meta ?= "6b3d4e09aa2531e9649f3f03827b7efbccfcec03" | 21 | SRCREV_meta ?= "6b3d4e09aa2531e9649f3f03827b7efbccfcec03" |
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc index 2b61b7e2cc..0912beef5a 100644 --- a/meta/recipes-kernel/linux/linux-yocto.inc +++ b/meta/recipes-kernel/linux/linux-yocto.inc | |||
@@ -9,15 +9,14 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" | |||
9 | # and it can be specific to the machine or shared | 9 | # and it can be specific to the machine or shared |
10 | # KMACHINE = "UNDEFINED" | 10 | # KMACHINE = "UNDEFINED" |
11 | 11 | ||
12 | # Set this to 'preempt_rt' in the local.conf if you want a real time kernel | ||
13 | LINUX_KERNEL_TYPE ?= "standard" | 12 | LINUX_KERNEL_TYPE ?= "standard" |
14 | 13 | ||
15 | KMETA ?= "meta" | 14 | # KMETA ?= "" |
15 | KBRANCH ?= "master" | ||
16 | KMACHINE ?= "${MACHINE}" | ||
16 | SRCREV_FORMAT ?= "meta_machine" | 17 | SRCREV_FORMAT ?= "meta_machine" |
17 | 18 | ||
18 | LINUX_VERSION_EXTENSION ?= "-yocto-${LINUX_KERNEL_TYPE}" | 19 | LINUX_VERSION_EXTENSION ?= "-yocto-${LINUX_KERNEL_TYPE}" |
19 | KERNEL_REVISION_CHECKING ?= "t" | ||
20 | YOCTO_KERNEL_META_DATA ?= "t" | ||
21 | 20 | ||
22 | do_patch[depends] = "kern-tools-native:do_populate_sysroot" | 21 | do_patch[depends] = "kern-tools-native:do_populate_sysroot" |
23 | 22 | ||
diff --git a/meta/recipes-kernel/linux/linux-yocto_2.6.37.bb b/meta/recipes-kernel/linux/linux-yocto_2.6.37.bb index d3da75cfc6..3968c62f38 100644 --- a/meta/recipes-kernel/linux/linux-yocto_2.6.37.bb +++ b/meta/recipes-kernel/linux/linux-yocto_2.6.37.bb | |||
@@ -10,6 +10,8 @@ KMACHINE_qemuarm = "yocto/standard/arm-versatile-926ejs" | |||
10 | 10 | ||
11 | KBRANCH = "${KMACHINE}" | 11 | KBRANCH = "${KMACHINE}" |
12 | 12 | ||
13 | KMETA = "meta" | ||
14 | |||
13 | LINUX_VERSION ?= "2.6.37" | 15 | LINUX_VERSION ?= "2.6.37" |
14 | 16 | ||
15 | SRCREV_machine_qemuarm = "b3e53a090eaa23aa82e64fa0a563a93a2b4dbb5d" | 17 | SRCREV_machine_qemuarm = "b3e53a090eaa23aa82e64fa0a563a93a2b4dbb5d" |
diff --git a/meta/recipes-kernel/linux/linux-yocto_3.0.bb b/meta/recipes-kernel/linux/linux-yocto_3.0.bb index 074b1ede95..82a7224251 100644 --- a/meta/recipes-kernel/linux/linux-yocto_3.0.bb +++ b/meta/recipes-kernel/linux/linux-yocto_3.0.bb | |||
@@ -1,14 +1,21 @@ | |||
1 | inherit kernel | 1 | inherit kernel |
2 | require recipes-kernel/linux/linux-yocto.inc | 2 | require recipes-kernel/linux/linux-yocto.inc |
3 | 3 | ||
4 | KMACHINE = "yocto/standard/base" | 4 | KBRANCH = "yocto/standard/base" |
5 | KMACHINE_qemux86 = "yocto/standard/common-pc/base" | 5 | KBRANCH_qemux86 = "yocto/standard/common-pc/base" |
6 | KMACHINE_qemux86-64 = "yocto/standard/common-pc-64/base" | 6 | KBRANCH_qemux86-64 = "yocto/standard/common-pc-64/base" |
7 | KMACHINE_qemuppc = "yocto/standard/qemu-ppc32" | 7 | KBRANCH_qemuppc = "yocto/standard/qemu-ppc32" |
8 | KMACHINE_qemumips = "yocto/standard/mti-malta32-be" | 8 | KBRANCH_qemumips = "yocto/standard/mti-malta32-be" |
9 | KMACHINE_qemuarm = "yocto/standard/arm-versatile-926ejs" | 9 | KBRANCH_qemuarm = "yocto/standard/arm-versatile-926ejs" |
10 | 10 | ||
11 | KBRANCH = "${KMACHINE}" | 11 | # Temporary until 3.0 kernel tree is updated with machine mappings |
12 | KMACHINE_qemux86 = "common-pc" | ||
13 | KMACHINE_qemux86-64 = "common-pc-64" | ||
14 | KMACHINE_qemuppc = "qemu-ppc32" | ||
15 | KMACHINE_qemumips = "mti-malta32-be" | ||
16 | KMACHINE_qemuarm = "arm-versatile-926ejs" | ||
17 | |||
18 | KMETA = "meta" | ||
12 | 19 | ||
13 | LINUX_VERSION ?= "3.0.24" | 20 | LINUX_VERSION ?= "3.0.24" |
14 | 21 | ||
diff --git a/meta/recipes-kernel/linux/linux-yocto_3.2.bb b/meta/recipes-kernel/linux/linux-yocto_3.2.bb index 51119bb201..71290bddd4 100644 --- a/meta/recipes-kernel/linux/linux-yocto_3.2.bb +++ b/meta/recipes-kernel/linux/linux-yocto_3.2.bb | |||
@@ -28,6 +28,8 @@ SRCREV_meta ?= "6b3d4e09aa2531e9649f3f03827b7efbccfcec03" | |||
28 | PR = "r1" | 28 | PR = "r1" |
29 | PV = "${LINUX_VERSION}+git${SRCPV}" | 29 | PV = "${LINUX_VERSION}+git${SRCPV}" |
30 | 30 | ||
31 | KMETA = "meta" | ||
32 | |||
31 | SRC_URI = "git://git.yoctoproject.org/linux-yocto-3.2;protocol=git;bareclone=1;branch=${KBRANCH},meta;name=machine,meta" | 33 | SRC_URI = "git://git.yoctoproject.org/linux-yocto-3.2;protocol=git;bareclone=1;branch=${KBRANCH},meta;name=machine,meta" |
32 | 34 | ||
33 | COMPATIBLE_MACHINE = "(qemuarm|qemux86|qemuppc|qemumips|qemux86-64)" | 35 | COMPATIBLE_MACHINE = "(qemuarm|qemux86|qemuppc|qemumips|qemux86-64)" |