summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2010-11-18 16:09:02 -0500
committerSaul Wold <Saul.Wold@intel.com>2010-12-10 22:01:36 -0800
commit0e7d9956a0cbe95cfe2919d13fcfcac705c4b104 (patch)
treefaa2b5d6cb6cd2c1f9c27bac44986d88d074c4d8 /meta/recipes-kernel
parent3ca38b7c104e96716a89b40df797dd3277334fa8 (diff)
downloadpoky-0e7d9956a0cbe95cfe2919d13fcfcac705c4b104.tar.gz
yocto-kernel: factor common routes, update to 2.6.37 and branch renaming
In order to extend and create more kernel recipes based on the supported yocto kernel common routines need to be placed in re-usable blocks. To accomplish this meta/recipes-kernel/linux/linux-yocto_git.bb is broken into three parts: - meta/classes/kernel-yocto.bbclass: contains common routines for checking out and configuring a yocto kernel git repository. This should be inherited by recipes that need this functionality. - meta/recipes-kernel/linux/linux-yocto.inc: Contains the machine mappings, compatibility, build directives and common task definitions for a yocto kernel based recipe. This inherits kernel-yocto, and is the typical point of entry for other recipes. - meta/recipes-kernel/linux/linuux-tools.inc: tasks and function definitions for kernel recipes that want to build/export perf It also updates the linux-yocto recipe to default to 2.6.37. As part of the update to 2.6.37 the branch naming and conventions have been modified to show inheritance, and be more generic. For example: master meta yocto/base yocto/standard/arm_versatile_926ejs yocto/standard/base yocto/standard/beagleboard yocto/standard/common_pc/atom-pc yocto/standard/common_pc/base yocto/standard/common_pc_64 yocto/standard/fsl-mpc8315e-rdb yocto/standard/intel_atom_z530 yocto/standard/intel_core_qm57_pch yocto/standard/mti_malta32_be yocto/standard/preempt_rt/base yocto/standard/preempt_rt/common_pc yocto/standard/preempt_rt/common_pc_64 yocto/standard/preempt_rt/intel_atom_z530 yocto/standard/preempt_rt/intel_core_qm57_pch yocto/standard/qemu_ppc32 yocto/standard/routerstationpro In this structure: master: tracks the mainline kernel meta: meta information for the BSPs and kernel features yocto/base: baseline kernel branch yocto/standard/base: 'standard' kernel, contains features and configs for all BSPs yocto/standard/<machine>: represents a BSP with specific features or configurations The tools, tree and libc-headers have all been updated to deal with this new structure. Also in addition to dealing with the new structure, they continue to work with the existing tree and will adapt at runtime to the differences. The linux-yocto-stable_git.bb recipe continues to build the 2.6.34 based tree,and linux-yocto_git.bb builds 2.6.37. As boards are enabled for the new kernel they will move from -stable to the development kernel. As of now, only the emulated targets have moved to 2.6.37-rcX Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r--meta/recipes-kernel/linux-libc-headers/linux-libc-headers-yocto_git.bb4
-rw-r--r--meta/recipes-kernel/linux/linux-tools.inc19
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-stable_git.bb41
-rw-r--r--meta/recipes-kernel/linux/linux-yocto.inc23
-rw-r--r--meta/recipes-kernel/linux/linux-yocto_git.bb219
5 files changed, 99 insertions, 207 deletions
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers-yocto_git.bb b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers-yocto_git.bb
index 6ae6d5f642..3e3c1fa9ba 100644
--- a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers-yocto_git.bb
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers-yocto_git.bb
@@ -4,7 +4,7 @@ INHIBIT_DEFAULT_DEPS = "1"
4DEPENDS += "unifdef-native" 4DEPENDS += "unifdef-native"
5PROVIDES = "linux-libc-headers" 5PROVIDES = "linux-libc-headers"
6PV = "2.6.34+git-${SRCPV}" 6PV = "2.6.34+git-${SRCPV}"
7PR = "r0" 7PR = "r1"
8 8
9SRC_URI = "git://git.pokylinux.org/linux-2.6-windriver.git;fullclone=1" 9SRC_URI = "git://git.pokylinux.org/linux-2.6-windriver.git;fullclone=1"
10 10
@@ -45,7 +45,7 @@ do_compile () {
45 45
46do_install() { 46do_install() {
47 set_arch 47 set_arch
48 oe_runmake headers_install_all INSTALL_HDR_PATH=${D}${exec_prefix} ARCH=$ARCH 48 oe_runmake headers_install INSTALL_HDR_PATH=${D}${exec_prefix} ARCH=$ARCH
49} 49}
50 50
51BBCLASSEXTEND = "nativesdk" 51BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-kernel/linux/linux-tools.inc b/meta/recipes-kernel/linux/linux-tools.inc
new file mode 100644
index 0000000000..714207f860
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-tools.inc
@@ -0,0 +1,19 @@
1# included by kernel recipes if they want to build/provide
2# perf functionality from their tree.
3
4do_compile_perf() {
5 oe_runmake -C ${S}/tools/perf CC="${KERNEL_CC}" LD="${KERNEL_LD}" prefix=${prefix}
6}
7
8do_install_perf() {
9 oe_runmake -C ${S}/tools/perf CC="${KERNEL_CC}" LD="${KERNEL_LD}" prefix=${prefix} DESTDIR=${D} install
10}
11
12
13# perf tasks
14addtask compile_perf after do_compile before do_install
15addtask install_perf after do_install before do_package do_deploy
16
17do_compile_perf[depends] = "virtual/libc:do_populate_sysroot"
18do_compile_perf[depends] =+ "elfutils:do_populate_sysroot"
19RDEPENDS_perf += "python perl elfutils"
diff --git a/meta/recipes-kernel/linux/linux-yocto-stable_git.bb b/meta/recipes-kernel/linux/linux-yocto-stable_git.bb
new file mode 100644
index 0000000000..8ecd86fa9f
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-yocto-stable_git.bb
@@ -0,0 +1,41 @@
1inherit kernel
2require linux-yocto.inc
3
4KMACHINE_qemux86 = "common_pc/base"
5KMACHINE_qemux86-64 = "common_pc_64"
6KMACHINE_qemuppc = "qemu_ppc32"
7KMACHINE_qemumips = "mti_malta32_be"
8KMACHINE_qemuarm = "arm_versatile_926ejs"
9KMACHINE_atom-pc = "atom-pc"
10KMACHINE_routerstationpro = "routerstationpro"
11KMACHINE_mpc8315e-rdb = "fsl-mpc8315e-rdb"
12KMACHINE_beagleboard = "beagleboard"
13
14LINUX_VERSION ?= "2.6.34"
15LINUX_VERSION_EXTENSION ?= "-yocto-${LINUX_KERNEL_TYPE}"
16PR = "r0"
17PV = "${LINUX_VERSION}+git${SRCPV}"
18SRCREV_FORMAT = "meta_machine"
19
20# this performs a fixup on the SRCREV for new/undefined BSPs
21python __anonymous () {
22 import bb, re
23
24 rev = bb.data.getVar("SRCREV_machine", d, 1)
25 if rev == "standard":
26 bb.data.setVar("SRCREV_machine", "${SRCREV_meta}", d)
27}
28
29SRC_URI = "git://git.pokylinux.org/linux-2.6-windriver.git;protocol=git;fullclone=1;branch=${KBRANCH};name=machine \
30 git://git.pokylinux.org/linux-2.6-windriver.git;protocol=git;noclone=1;branch=wrs_meta;name=meta"
31
32
33# Functionality flags
34KERNEL_REVISION_CHECKING ?= "t"
35KERNEL_FEATURES=features/netfilter
36
37# extra tasks
38addtask kernel_link_vmlinux after do_compile before do_install
39addtask validate_branches before do_patch after do_kernel_checkout
40
41require linux-tools.inc
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
new file mode 100644
index 0000000000..095b3375fa
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -0,0 +1,23 @@
1DESCRIPTION = "Yocto Kernel"
2SECTION = "kernel"
3LICENSE = "GPL"
4
5# A KMACHINE is the mapping of a yocto $MACHINE to what is built
6# by the kernel. This is typically the branch that should be built,
7# and it can be specific to the machine or shared
8KMACHINE = "UNDEFINED"
9
10COMPATIBLE_MACHINE = "(qemuarm|qemux86|qemuppc|qemumips|qemux86-64|atom-pc|routerstationpro)"
11
12# Set this to 'preempt_rt' in the local.conf if you want a real time kernel
13LINUX_KERNEL_TYPE ?= standard
14
15do_patch[depends] = "kern-tools-native:do_populate_sysroot"
16
17addtask kernel_configme before do_configure after do_patch
18addtask kernel_configcheck after do_configure before do_compile
19
20# Pick up shared functions
21inherit kernel-yocto
22
23B = "${WORKDIR}/linux-${KMACHINE}-${LINUX_KERNEL_TYPE}-build"
diff --git a/meta/recipes-kernel/linux/linux-yocto_git.bb b/meta/recipes-kernel/linux/linux-yocto_git.bb
index ef005aefca..1e3df478eb 100644
--- a/meta/recipes-kernel/linux/linux-yocto_git.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_git.bb
@@ -1,21 +1,7 @@
1DESCRIPTION = "Yocto Kernel" 1inherit kernel
2SECTION = "kernel" 2require linux-yocto.inc
3LICENSE = "GPL"
4
5# Set this to 'preempt_rt' in the local.conf if you want a real time kernel
6LINUX_KERNEL_TYPE ?= standard
7SRCREV_FORMAT = "meta_machine"
8PV = "2.6.34+git${SRCPV}"
9
10# To use a staged, on-disk bare clone of a Wind River Kernel, use a
11# variant of the below
12# SRC_URI = "git://///path/to/kernel/default_kernel.git;fullclone=1"
13SRC_URI = "git://git.pokylinux.org/linux-2.6-windriver.git;protocol=git;fullclone=1;branch=${KBRANCH};name=machine \
14 git://git.pokylinux.org/linux-2.6-windriver.git;protocol=git;noclone=1;branch=wrs_meta;name=meta"
15 3
16# map the poky machine to a 'kernel machine' 4KMACHINE_qemux86 = "common_pc/base"
17KMACHINE = "UNDEFINED"
18KMACHINE_qemux86 = "common_pc"
19KMACHINE_qemux86-64 = "common_pc_64" 5KMACHINE_qemux86-64 = "common_pc_64"
20KMACHINE_qemuppc = "qemu_ppc32" 6KMACHINE_qemuppc = "qemu_ppc32"
21KMACHINE_qemumips = "mti_malta32_be" 7KMACHINE_qemumips = "mti_malta32_be"
@@ -25,199 +11,22 @@ KMACHINE_routerstationpro = "routerstationpro"
25KMACHINE_mpc8315e-rdb = "fsl-mpc8315e-rdb" 11KMACHINE_mpc8315e-rdb = "fsl-mpc8315e-rdb"
26KMACHINE_beagleboard = "beagleboard" 12KMACHINE_beagleboard = "beagleboard"
27 13
28# Determine which branch to fetch and build. Not all branches are in the 14LINUX_VERSION ?= "2.6.37"
29# upstream repo (but will be locally created after the fetchers run) so 15LINUX_VERSION_EXTENSION ?= "-yocto-${LINUX_KERNEL_TYPE}"
30# a fallback branch needs to be chosen. 16PR = "r14"
31# 17PV = "${LINUX_VERSION}+git${SRCPV}"
32# The default machine 'UNDEFINED'. If the machine is not set to a specific 18SRCREV_FORMAT = "meta_machine"
33# branch in this recipe or in a recipe extension, then we fallback to a
34# branch that is always present 'standard'. This sets the KBRANCH variable
35# and is used in the SRC_URI. The machine is then set back to ${MACHINE},
36# since futher processing will use that to create local branches
37python __anonymous () {
38 import bb, re
39
40 bb.data.setVar("KBRANCH", "${KMACHINE}-${LINUX_KERNEL_TYPE}", d)
41 mach = bb.data.getVar("KMACHINE", d, 1)
42 if mach == "UNDEFINED":
43 bb.data.setVar("KBRANCH", "standard", d)
44 bb.data.setVar("KMACHINE", "${MACHINE}", d)
45 # track the global configuration on a bootstrapped BSP
46 bb.data.setVar("SRCREV_machine", "${SRCREV_meta}", d)
47 bb.data.setVar("BOOTSTRAP", "t", d)
48}
49
50COMPATIBLE_MACHINE = "(qemuarm|qemux86|qemuppc|qemumips|qemux86-64|atom-pc|routerstationpro|mpc8315e-rdb|beagleboard)"
51 19
52LINUX_VERSION = "v2.6.34" 20SRC_URI = "git://git.pokylinux.org/linux-yocto-2.6.37;protocol=git;fullclone=1;branch=${KBRANCH};name=machine \
53LINUX_VERSION_EXTENSION = "-wr-${LINUX_KERNEL_TYPE}" 21 git://git.pokylinux.org/linux-yocto-2.6.37;protocol=git;noclone=1;branch=meta;name=meta"
54PR = "r13"
55 22
56S = "${WORKDIR}/linux"
57B = "${WORKDIR}/linux-${KMACHINE}-${LINUX_KERNEL_TYPE}-build"
58 23
59# functionality flags 24# Functionality flags
60KERNEL_REVISION_CHECKING ?= "t" 25KERNEL_REVISION_CHECKING ?= "t"
61KERNEL_FEATURES=features/netfilter 26KERNEL_FEATURES=features/netfilter
62 27
63do_patch() { 28# extra tasks
64 cd ${S}
65 if [ -f ${WORKDIR}/defconfig ]; then
66 defconfig=${WORKDIR}/defconfig
67 fi
68
69 # simply ensures that a branch of the right name has been created
70 createme ${ARCH} ${KMACHINE}-${LINUX_KERNEL_TYPE} ${defconfig}
71 if [ $? -ne 0 ]; then
72 echo "ERROR. Could not create ${KMACHINE}-${LINUX_KERNEL_TYPE}"
73 exit 1
74 fi
75
76 # updates or generates the target description
77 if [ -n "${KERNEL_FEATURES}" ]; then
78 addon_features="--features ${KERNEL_FEATURES}"
79 fi
80 updateme ${addon_features} ${ARCH} ${WORKDIR}
81 if [ $? -ne 0 ]; then
82 echo "ERROR. Could not update ${KMACHINE}-${LINUX_KERNEL_TYPE}"
83 exit 1
84 fi
85
86 # executes and modifies the source tree as required
87 patchme ${KMACHINE}-${LINUX_KERNEL_TYPE}
88 if [ $? -ne 0 ]; then
89 echo "ERROR. Could not modify ${KMACHINE}-${LINUX_KERNEL_TYPE}"
90 exit 1
91 fi
92}
93
94validate_branches() {
95 branch_head=`git show-ref -s --heads ${KBRANCH}`
96 meta_head=`git show-ref -s --heads wrs_meta`
97 target_branch_head="${SRCREV_machine}"
98 target_meta_head="${SRCREV_meta}"
99
100 if [ -n "$target_branch_head" ] && [ "$branch_head" != "$target_branch_head" ]; then
101 if [ -n "${KERNEL_REVISION_CHECKING}" ]; then
102 git show ${target_branch_head} > /dev/null 2>&1
103 if [ $? -eq 0 ]; then
104 echo "Forcing branch ${KMACHINE}-${LINUX_KERNEL_TYPE} to ${target_branch_head}"
105 git branch -m ${KMACHINE}-${LINUX_KERNEL_TYPE} ${KMACHINE}-${LINUX_KERNEL_TYPE}-orig
106 git checkout -b ${KMACHINE}-${LINUX_KERNEL_TYPE} ${target_branch_head}
107 else
108 echo "ERROR ${target_branch_head} is not a valid commit ID."
109 echo "The kernel source tree may be out of sync"
110 exit 1
111 fi
112 fi
113 fi
114
115 if [ "$meta_head" != "$target_meta_head" ]; then
116 if [ -n "${KERNEL_REVISION_CHECKING}" ]; then
117 git show ${target_meta_head} > /dev/null 2>&1
118 if [ $? -eq 0 ]; then
119 echo "Forcing branch wrs_meta to ${target_meta_head}"
120 git branch -m wrs_meta wrs_meta-orig
121 git checkout -b wrs_meta ${target_meta_head}
122 else
123 echo "ERROR ${target_meta_head} is not a valid commit ID"
124 echo "The kernel source tree may be out of sync"
125 exit 1
126 fi
127 fi
128 fi
129}
130
131do_kernel_checkout() {
132 if [ -d ${WORKDIR}/.git/refs/remotes/origin ]; then
133 echo "Fixing up git directory for ${KMACHINE}-${LINUX_KERNEL_TYPE}"
134 rm -rf ${S}
135 mkdir ${S}
136 mv ${WORKDIR}/.git ${S}
137
138 if [ -e ${S}/.git/packed-refs ]; then
139 cd ${S}
140 rm -f .git/refs/remotes/origin/HEAD
141IFS='
142';
143
144 for r in `git show-ref | grep remotes`; do
145 ref=`echo $r | cut -d' ' -f1`;
146 b=`echo $r | cut -d'/' -f4`;
147 echo $ref > .git/refs/heads/$b
148 done
149 cd ..
150 else
151 mv ${S}/.git/refs/remotes/origin/* ${S}/.git/refs/heads
152 rmdir ${S}/.git/refs/remotes/origin
153 fi
154 fi
155 cd ${S}
156
157 # checkout and clobber and unimportant files
158 git checkout -f ${KBRANCH}
159
160 if [ -z "${BOOTSTRAP}" ]; then
161 validate_branches
162 fi
163
164 # this second checkout is intentional, we want to leave ourselves
165 # on the branch to be built, but validate_branches could have changed
166 # our initial checkout. So we do it a second time to be sure
167 git checkout -f ${KBRANCH}
168}
169do_kernel_checkout[dirs] = "${S}"
170
171addtask kernel_checkout before do_patch after do_unpack
172
173do_kernel_configme() {
174 echo "Doing kernel configme"
175
176 cd ${S}
177 configme --reconfig
178 if [ $? -ne 0 ]; then
179 echo "ERROR. Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}"
180 exit 1
181 fi
182
183 echo "# CONFIG_WRNOTE is not set" >> ${B}/.config
184 echo "# Global settings from linux recipe" >> ${B}/.config
185 echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
186}
187
188do_kernel_configcheck() {
189 echo "[INFO] validating kernel configuration"
190 cd ${B}/..
191 kconf_check ${B}/.config ${B} ${S} ${B} ${LINUX_VERSION} ${KMACHINE}-${LINUX_KERNEL_TYPE}
192}
193
194do_kernel_link_vmlinux() {
195 if [ ! -d "${B}/arch/${ARCH}/boot" ]; then
196 mkdir ${B}/arch/${ARCH}/boot
197 fi
198 cd ${B}/arch/${ARCH}/boot
199 ln -sf ../../../vmlinux
200}
201
202do_compile_perf() {
203 oe_runmake -C ${S}/tools/perf CC="${KERNEL_CC}" LD="${KERNEL_LD}" prefix=${prefix}
204}
205
206do_install_perf() {
207 oe_runmake -C ${S}/tools/perf CC="${KERNEL_CC}" LD="${KERNEL_LD}" prefix=${prefix} DESTDIR=${D} install
208}
209
210do_patch[depends] = "kern-tools-native:do_populate_sysroot"
211addtask kernel_configme before do_configure after do_patch
212addtask kernel_link_vmlinux after do_compile before do_install 29addtask kernel_link_vmlinux after do_compile before do_install
213addtask kernel_configcheck after do_configure before do_compile 30addtask validate_branches before do_patch after do_kernel_checkout
214
215inherit kernel
216
217# perf tasks
218addtask compile_perf after do_compile before do_install
219addtask install_perf after do_install before do_package do_deploy
220 31
221do_compile_perf[depends] = "virtual/libc:do_populate_sysroot" 32require linux-tools.inc
222do_compile_perf[depends] =+ "elfutils:do_populate_sysroot"
223RDEPENDS_perf += "python perl elfutils"