diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/kernel-yocto.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/kernel.bbclass | 91 | ||||
-rw-r--r-- | meta/classes/kernelsrc.bbclass | 7 | ||||
-rw-r--r-- | meta/classes/linux-kernel-base.bbclass | 13 |
4 files changed, 21 insertions, 92 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index c3e24943bb..45bdc9670a 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass | |||
@@ -1,5 +1,3 @@ | |||
1 | S = "${WORKDIR}/linux" | ||
2 | |||
3 | # remove tasks that modify the source tree in case externalsrc is inherited | 1 | # remove tasks that modify the source tree in case externalsrc is inherited |
4 | SRCTREECOVEREDTASKS += "do_kernel_link_vmlinux do_kernel_configme do_validate_branches do_kernel_configcheck do_kernel_checkout do_patch" | 2 | SRCTREECOVEREDTASKS += "do_kernel_link_vmlinux do_kernel_configme do_validate_branches do_kernel_configcheck do_kernel_checkout do_patch" |
5 | 3 | ||
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 70ed95bbe0..bca34f4698 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass | |||
@@ -3,6 +3,8 @@ inherit linux-kernel-base kernel-module-split | |||
3 | PROVIDES += "virtual/kernel" | 3 | PROVIDES += "virtual/kernel" |
4 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native" | 4 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native" |
5 | 5 | ||
6 | S = "${STAGING_DIR_TARGET}/${KERNEL_SRC_PATH}" | ||
7 | |||
6 | # we include gcc above, we dont need virtual/libc | 8 | # we include gcc above, we dont need virtual/libc |
7 | INHIBIT_DEFAULT_DEPS = "1" | 9 | INHIBIT_DEFAULT_DEPS = "1" |
8 | 10 | ||
@@ -55,7 +57,7 @@ KERNEL_IMAGEDEST = "boot" | |||
55 | # | 57 | # |
56 | export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}" | 58 | export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}" |
57 | 59 | ||
58 | KERNEL_VERSION = "${@get_kernelversion('${B}')}" | 60 | KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}" |
59 | 61 | ||
60 | KERNEL_LOCALVERSION ?= "" | 62 | KERNEL_LOCALVERSION ?= "" |
61 | 63 | ||
@@ -221,93 +223,6 @@ kernel_do_install() { | |||
221 | # | 223 | # |
222 | 224 | ||
223 | echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion | 225 | echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion |
224 | |||
225 | # | ||
226 | # Store kernel image name to allow use during image generation | ||
227 | # | ||
228 | |||
229 | echo "${KERNEL_IMAGE_BASE_NAME}" >$kerneldir/kernel-image-name | ||
230 | |||
231 | # | ||
232 | # Copy the entire source tree. In case an external build directory is | ||
233 | # used, copy the build directory over first, then copy over the source | ||
234 | # dir. This ensures the original Makefiles are used and not the | ||
235 | # redirecting Makefiles in the build directory. | ||
236 | # | ||
237 | find . -depth -not -name "*.cmd" -not -name "*.o" -not -name "*.so.dbg" -not -name "*.so" -not -path "./Documentation*" -not -path "./source*" -not -path "./.*" -print0 | cpio --null -pdlu $kerneldir | ||
238 | cp .config $kerneldir | ||
239 | if [ "${S}" != "${B}" ]; then | ||
240 | pwd="$PWD" | ||
241 | cd "${S}" | ||
242 | find . -depth -not -path "./Documentation*" -not -path "./.*" -print0 | cpio --null -pdlu $kerneldir | ||
243 | cd "$pwd" | ||
244 | fi | ||
245 | |||
246 | # Test to ensure that the output file and image type are not actually | ||
247 | # the same file. If hardlinking is used, they will be the same, and there's | ||
248 | # no need to install. | ||
249 | ! [ ${KERNEL_OUTPUT} -ef $kerneldir/${KERNEL_IMAGETYPE} ] && install -m 0644 ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE} | ||
250 | install -m 0644 System.map $kerneldir/System.map-${KERNEL_VERSION} | ||
251 | |||
252 | # Dummy Makefile so the clean below works | ||
253 | mkdir $kerneldir/Documentation | ||
254 | touch $kerneldir/Documentation/Makefile | ||
255 | |||
256 | # | ||
257 | # Clean and remove files not needed for building modules. | ||
258 | # Some distributions go through a lot more trouble to strip out | ||
259 | # unecessary headers, for now, we just prune the obvious bits. | ||
260 | # | ||
261 | # We don't want to leave host-arch binaries in /sysroots, so | ||
262 | # we clean the scripts dir while leaving the generated config | ||
263 | # and include files. | ||
264 | # | ||
265 | oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts | ||
266 | |||
267 | # hide directories that shouldn't have their .c, s and S files deleted | ||
268 | for d in tools scripts lib; do | ||
269 | mv $kerneldir/$d $kerneldir/.$d | ||
270 | done | ||
271 | |||
272 | # delete .c, .s and .S files, unless we hid a directory as .<dir>. This technique is | ||
273 | # much faster than find -prune and -exec | ||
274 | find $kerneldir -not -path '*/\.*' -type f -name "*.[csS]" -delete | ||
275 | |||
276 | # put the hidden dirs back | ||
277 | for d in tools scripts lib; do | ||
278 | mv $kerneldir/.$d $kerneldir/$d | ||
279 | done | ||
280 | |||
281 | # As of Linux kernel version 3.0.1, the clean target removes | ||
282 | # arch/powerpc/lib/crtsavres.o which is present in | ||
283 | # KBUILD_LDFLAGS_MODULE, making it required to build external modules. | ||
284 | if [ ${ARCH} = "powerpc" ]; then | ||
285 | cp -l arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o | ||
286 | fi | ||
287 | |||
288 | # Necessary for building modules like compat-wireless. | ||
289 | if [ -f include/generated/bounds.h ]; then | ||
290 | cp -l include/generated/bounds.h $kerneldir/include/generated/bounds.h | ||
291 | fi | ||
292 | if [ -d arch/${ARCH}/include/generated ]; then | ||
293 | mkdir -p $kerneldir/arch/${ARCH}/include/generated/ | ||
294 | cp -flR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/ | ||
295 | fi | ||
296 | |||
297 | # Remove the following binaries which cause strip or arch QA errors | ||
298 | # during do_package for cross-compiled platforms | ||
299 | bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \ | ||
300 | arch/powerpc/boot/mktree scripts/kconfig/zconf.tab.o \ | ||
301 | scripts/kconfig/conf.o scripts/kconfig/kxgettext.o" | ||
302 | for entry in $bin_files; do | ||
303 | rm -f $kerneldir/$entry | ||
304 | done | ||
305 | |||
306 | # kernels <2.6.30 don't have $kerneldir/tools directory so we check if it exists before calling sed | ||
307 | if [ -f $kerneldir/tools/perf/Makefile ]; then | ||
308 | # Fix SLANG_INC for slang.h | ||
309 | sed -i 's#-I/usr/include/slang#-I=/usr/include/slang#g' $kerneldir/tools/perf/Makefile | ||
310 | fi | ||
311 | } | 226 | } |
312 | do_install[prefuncs] += "package_get_auto_pr" | 227 | do_install[prefuncs] += "package_get_auto_pr" |
313 | 228 | ||
diff --git a/meta/classes/kernelsrc.bbclass b/meta/classes/kernelsrc.bbclass new file mode 100644 index 0000000000..11f04e9612 --- /dev/null +++ b/meta/classes/kernelsrc.bbclass | |||
@@ -0,0 +1,7 @@ | |||
1 | S = "${STAGING_KERNEL_DIR}" | ||
2 | do_unpack[depends] += "virtual/kernel:do_patch" | ||
3 | do_package[depends] += "virtual/kernel:do_populate_sysroot" | ||
4 | KERNEL_VERSION = "${@get_kernelversion_file("${S}")}" | ||
5 | |||
6 | inherit linux-kernel-base | ||
7 | |||
diff --git a/meta/classes/linux-kernel-base.bbclass b/meta/classes/linux-kernel-base.bbclass index 4f2b0a4a98..89ce71605c 100644 --- a/meta/classes/linux-kernel-base.bbclass +++ b/meta/classes/linux-kernel-base.bbclass | |||
@@ -1,5 +1,5 @@ | |||
1 | # parse kernel ABI version out of <linux/version.h> | 1 | # parse kernel ABI version out of <linux/version.h> |
2 | def get_kernelversion(p): | 2 | def get_kernelversion_headers(p): |
3 | import re | 3 | import re |
4 | 4 | ||
5 | fn = p + '/include/linux/utsrelease.h' | 5 | fn = p + '/include/linux/utsrelease.h' |
@@ -9,7 +9,6 @@ def get_kernelversion(p): | |||
9 | if not os.path.isfile(fn): | 9 | if not os.path.isfile(fn): |
10 | fn = p + '/include/linux/version.h' | 10 | fn = p + '/include/linux/version.h' |
11 | 11 | ||
12 | import re | ||
13 | try: | 12 | try: |
14 | f = open(fn, 'r') | 13 | f = open(fn, 'r') |
15 | except IOError: | 14 | except IOError: |
@@ -24,6 +23,16 @@ def get_kernelversion(p): | |||
24 | return m.group(1) | 23 | return m.group(1) |
25 | return None | 24 | return None |
26 | 25 | ||
26 | |||
27 | def get_kernelversion_file(p): | ||
28 | fn = p + '/kernel-abiversion' | ||
29 | |||
30 | try: | ||
31 | with open(fn, 'r') as f: | ||
32 | return f.readlines()[0].strip() | ||
33 | except IOError: | ||
34 | return None | ||
35 | |||
27 | def linux_module_packages(s, d): | 36 | def linux_module_packages(s, d): |
28 | suffix = "" | 37 | suffix = "" |
29 | return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split())) | 38 | return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split())) |