summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2012-11-29 10:59:08 +0100
committerKoen Kooi <koen@dominion.thruhere.net>2012-11-29 11:03:35 +0100
commit5b62eff1d759bbf27a6548f4ccefa0573a4d36c3 (patch)
treef24f512be54ae4115dadd52550d479703177bc52
parentf58e6aa8e8a2cfd1713594e51d864d302d11a24e (diff)
downloadmeta-openembedded-5b62eff1d759bbf27a6548f4ccefa0573a4d36c3.tar.gz
kernel bbclass: delete
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
-rw-r--r--meta-oe/classes/kernel.bbclass555
1 files changed, 0 insertions, 555 deletions
diff --git a/meta-oe/classes/kernel.bbclass b/meta-oe/classes/kernel.bbclass
deleted file mode 100644
index 25c5f6460..000000000
--- a/meta-oe/classes/kernel.bbclass
+++ /dev/null
@@ -1,555 +0,0 @@
1inherit linux-kernel-base module_strip
2
3PROVIDES += "virtual/kernel"
4DEPENDS += "virtual/${TARGET_PREFIX}gcc kmod-native virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX} update-modules"
5
6# we include gcc above, we dont need virtual/libc
7INHIBIT_DEFAULT_DEPS = "1"
8
9KERNEL_IMAGETYPE ?= "zImage"
10INITRAMFS_IMAGE ?= ""
11INITRAMFS_TASK ?= ""
12
13python __anonymous () {
14 kerneltype = d.getVar('KERNEL_IMAGETYPE', True) or ''
15 if kerneltype == 'uImage':
16 depends = d.getVar("DEPENDS", True)
17 depends = "%s u-boot-mkimage-native" % depends
18 d.setVar("DEPENDS", depends)
19
20 image = d.getVar('INITRAMFS_IMAGE', True)
21 if image:
22 d.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs')
23
24 machine_kernel_pr = d.getVar('MACHINE_KERNEL_PR', True)
25
26 if machine_kernel_pr:
27 d.setVar('PR', machine_kernel_pr)
28}
29
30inherit kernel-arch deploy
31
32PACKAGES_DYNAMIC += "kernel-module-*"
33PACKAGES_DYNAMIC += "kernel-image-*"
34PACKAGES_DYNAMIC += "kernel-firmware-*"
35
36export OS = "${TARGET_OS}"
37export CROSS_COMPILE = "${TARGET_PREFIX}"
38
39KERNEL_PRIORITY ?= "${@int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[0]) * 10000 + \
40 int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[1]) * 100 + \
41 int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[-1])}"
42
43KERNEL_RELEASE ?= "${KERNEL_VERSION}"
44
45KERNEL_CCSUFFIX ?= ""
46KERNEL_LDSUFFIX ?= ""
47
48# Set TARGET_??_KERNEL_ARCH in the machine .conf to set architecture
49# specific options necessary for building the kernel and modules.
50#FIXME: should be this: TARGET_CC_KERNEL_ARCH ?= "${TARGET_CC_ARCH}"
51TARGET_CC_KERNEL_ARCH ?= ""
52HOST_CC_KERNEL_ARCH ?= "${TARGET_CC_KERNEL_ARCH}"
53TARGET_LD_KERNEL_ARCH ?= ""
54HOST_LD_KERNEL_ARCH ?= "${TARGET_LD_KERNEL_ARCH}"
55
56KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc${KERNEL_CCSUFFIX} ${HOST_CC_KERNEL_ARCH}${TOOLCHAIN_OPTIONS}"
57KERNEL_LD = "${HOST_PREFIX}ld${KERNEL_LDSUFFIX} ${HOST_LD_KERNEL_ARCH}${TOOLCHAIN_OPTIONS}"
58
59# Where built kernel lies in the kernel tree
60KERNEL_OUTPUT ?= "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}"
61KERNEL_IMAGEDEST = "boot"
62
63#
64# configuration
65#
66export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}"
67
68KERNEL_VERSION = "${@get_kernelversion('${B}')}"
69
70KERNEL_LOCALVERSION ?= ""
71
72# kernels are generally machine specific
73PACKAGE_ARCH = "${MACHINE_ARCH}"
74
75# U-Boot support
76UBOOT_ENTRYPOINT ?= "20008000"
77UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
78
79# For the kernel, we don't want the '-e MAKEFLAGS=' in EXTRA_OEMAKE.
80# We don't want to override kernel Makefile variables from the environment
81EXTRA_OEMAKE = ""
82
83KERNEL_ALT_IMAGETYPE ??= ""
84
85# Define where the kernel headers are installed on the target as well as where
86# they are staged.
87KERNEL_SRC_PATH = "/usr/src/kernel"
88
89KERNEL_IMAGETYPE_FOR_MAKE = "${@(lambda s: s[:-3] if s[-3:] == ".gz" else s)(d.getVar('KERNEL_IMAGETYPE', True))}"
90
91kernel_do_compile() {
92 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
93 oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}"
94 if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}"; then
95 gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" > "${KERNEL_OUTPUT}"
96 fi
97}
98
99do_compile_kernelmodules() {
100 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
101 if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
102 oe_runmake ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" LD="${KERNEL_LD}"
103 else
104 bbnote "no modules to compile"
105 fi
106}
107addtask compile_kernelmodules after do_compile before do_install
108
109kernel_do_install() {
110 #
111 # First install the modules
112 #
113 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
114 if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
115 oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install
116 rm -f "${D}/lib/modules/${KERNEL_VERSION}/modules.order"
117 rm -f "${D}/lib/modules/${KERNEL_VERSION}/modules.builtin"
118 rm "${D}/lib/modules/${KERNEL_VERSION}/build"
119 rm "${D}/lib/modules/${KERNEL_VERSION}/source"
120 else
121 bbnote "no modules to install"
122 fi
123
124 #
125 # Install various kernel output (zImage, map file, config, module support files)
126 #
127 install -d ${D}/${KERNEL_IMAGEDEST}
128 install -d ${D}/boot
129 install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
130 install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
131 install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
132 install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION}
133 [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION}
134 install -d ${D}/etc/modules-load.d
135 install -d ${D}/etc/modprobe.d
136
137 #
138 # Support for external module building - create a minimal copy of the
139 # kernel source tree.
140 #
141 kerneldir=${D}${KERNEL_SRC_PATH}
142 install -d $kerneldir
143
144 #
145 # Store the kernel version in sysroots for module-base.bbclass
146 #
147
148 echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
149
150 #
151 # Store kernel image name to allow use during image generation
152 #
153
154 echo "${KERNEL_IMAGE_BASE_NAME}" >$kerneldir/kernel-image-name
155
156 #
157 # Copy the entire source tree. In case an external build directory is
158 # used, copy the build directory over first, then copy over the source
159 # dir. This ensures the original Makefiles are used and not the
160 # redirecting Makefiles in the build directory.
161 #
162 # work and sysroots can be on different partitions, so we can't rely on
163 # hardlinking, unfortunately.
164 #
165 cp -fR * $kerneldir
166 cp .config $kerneldir
167 if [ "${S}" != "${B}" ]; then
168 cp -fR ${S}/* $kerneldir
169 fi
170 install -m 0644 ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE}
171 install -m 0644 System.map $kerneldir/System.map-${KERNEL_VERSION}
172
173 #
174 # Clean and remove files not needed for building modules.
175 # Some distributions go through a lot more trouble to strip out
176 # unecessary headers, for now, we just prune the obvious bits.
177 #
178 # We don't want to leave host-arch binaries in /sysroots, so
179 # we clean the scripts dir while leaving the generated config
180 # and include files.
181 #
182 oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean
183 make -C $kerneldir _mrproper_scripts
184 find $kerneldir -path $kerneldir/lib -prune -o -path $kerneldir/tools -prune -o -path $kerneldir/scripts -prune -o -name "*.[csS]" -exec rm '{}' \;
185 find $kerneldir/Documentation -name "*.txt" -exec rm '{}' \;
186
187 # As of Linux kernel version 3.0.1, the clean target removes
188 # arch/powerpc/lib/crtsavres.o which is present in
189 # KBUILD_LDFLAGS_MODULE, making it required to build external modules.
190 if [ ${ARCH} = "powerpc" ]; then
191 cp arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
192 fi
193
194 # Necessary for building modules like compat-wireless.
195 cp include/generated/bounds.h $kerneldir/include/generated/bounds.h
196
197 # Remove the following binaries which cause strip or arch QA errors
198 # during do_package for cross-compiled platforms
199 bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \
200 arch/powerpc/boot/mktree scripts/kconfig/zconf.tab.o \
201 scripts/kconfig/conf.o scripts/kconfig/kxgettext.o"
202 for entry in $bin_files; do
203 rm -f $kerneldir/$entry
204 done
205}
206
207sysroot_stage_all_append() {
208 sysroot_stage_dir ${D}${KERNEL_SRC_PATH} ${SYSROOT_DESTDIR}${KERNEL_SRC_PATH}
209}
210
211kernel_do_configure() {
212 # fixes extra + in /lib/modules/2.6.37+
213 # $ scripts/setlocalversion . => +
214 # $ make kernelversion => 2.6.37
215 # $ make kernelrelease => 2.6.37+
216 touch ${B}/.scmversion ${S}/.scmversion
217
218 # Copy defconfig to .config if .config does not exist. This allows
219 # recipes to manage the .config themselves in do_configure_prepend().
220 if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
221 cp "${WORKDIR}/defconfig" "${B}/.config"
222 fi
223 yes '' | oe_runmake oldconfig
224
225 if [ ! -z "${INITRAMFS_IMAGE}" ]; then
226 for img in cpio.gz cpio.lzo cpio.lzma cpio.xz; do
227 if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then
228 cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" initramfs.$img
229 fi
230 done
231 fi
232}
233
234do_configure[depends] += "${INITRAMFS_TASK}"
235
236do_savedefconfig() {
237 oe_runmake savedefconfig
238}
239do_savedefconfig[nostamp] = "1"
240addtask savedefconfig after do_configure
241
242pkg_postinst_kernel-base () {
243 cd /${KERNEL_IMAGEDEST}; update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
244}
245
246pkg_postrm_kernel-base () {
247 cd /${KERNEL_IMAGEDEST}; update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
248}
249
250inherit cml1
251
252EXPORT_FUNCTIONS do_compile do_install do_configure
253
254# kernel-base becomes kernel-${KERNEL_VERSION}
255# kernel-image becomes kernel-image-${KERNEL_VERISON}
256PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev"
257FILES = ""
258FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
259FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH}"
260FILES_kernel-vmlinux = "/boot/vmlinux*"
261RDEPENDS_kernel = "kernel-base"
262# Allow machines to override this dependency if kernel image files are
263# not wanted in images as standard
264RDEPENDS_kernel-base ?= "kernel-image"
265PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
266PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
267RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
268ALLOW_EMPTY_kernel = "1"
269ALLOW_EMPTY_kernel-base = "1"
270ALLOW_EMPTY_kernel-image = "1"
271
272pkg_postinst_kernel-image () {
273if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
274 mkdir -p $D/lib/modules/${KERNEL_VERSION}
275fi
276if [ -n "$D" ]; then
277 depmod -a -b $D -F ${STAGING_KERNEL_DIR}/System.map-${KERNEL_VERSION} ${KERNEL_VERSION}
278else
279 depmod -a ${KERNEL_VERSION}
280fi
281}
282
283pkg_postinst_modules () {
284if [ -z "$D" ]; then
285 depmod -a ${KERNEL_VERSION}
286 update-modules || true
287fi
288}
289
290pkg_postrm_modules () {
291update-modules || true
292}
293
294autoload_postinst_fragment() {
295if [ x"$D" = "x" ]; then
296 modprobe %s || true
297fi
298}
299
300# autoload defaults (alphabetically sorted)
301module_autoload_hidp = "hidp"
302module_autoload_ipv6 = "ipv6"
303module_autoload_ipsec = "ipsec"
304module_autoload_ircomm-tty = "ircomm-tty"
305module_autoload_rfcomm = "rfcomm"
306module_autoload_sa1100-rtc = "sa1100-rtc"
307# sa1100-rtc was renamed in 2.6.23 onwards
308module_autoload_rtc-sa1100 = "rtc-sa1100"
309
310# alias defaults (alphabetically sorted)
311module_conf_af_packet = "alias net-pf-17 af_packet"
312module_conf_bluez = "alias net-pf-31 bluez"
313module_conf_bnep = "alias bt-proto-4 bnep"
314module_conf_hci_uart = "alias tty-ldisc-15 hci_uart"
315module_conf_l2cap = "alias bt-proto-0 l2cap"
316module_conf_sco = "alias bt-proto-2 sco"
317module_conf_rfcomm = "alias bt-proto-3 rfcomm"
318
319python populate_packages_prepend () {
320 def extract_modinfo(file):
321 import tempfile, re, subprocess
322 tempfile.tempdir = d.getVar("WORKDIR", True)
323 tf = tempfile.mkstemp()
324 tmpfile = tf[1]
325 cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("PATH", True), d.getVar("HOST_PREFIX", True) or "", file, tmpfile)
326 subprocess.call(cmd, shell=True)
327 f = open(tmpfile)
328 l = f.read().split("\000")
329 f.close()
330 os.close(tf[0])
331 os.unlink(tmpfile)
332 exp = re.compile("([^=]+)=(.*)")
333 vals = {}
334 for i in l:
335 m = exp.match(i)
336 if not m:
337 continue
338 vals[m.group(1)] = m.group(2)
339 return vals
340
341 def parse_depmod():
342 import re
343
344 dvar = d.getVar('PKGD', True)
345 if not dvar:
346 bb.error("PKGD not defined")
347 return
348
349 kernelver = d.getVar('KERNEL_VERSION', True)
350 kernelver_stripped = kernelver
351 m = re.match('^(.*-hh.*)[\.\+].*$', kernelver)
352 if m:
353 kernelver_stripped = m.group(1)
354 path = d.getVar("PATH", True)
355
356 cmd = "PATH=\"%s\" depmod -n -a -b %s -F %s/boot/System.map-%s %s" % (path, dvar, dvar, kernelver, kernelver_stripped)
357 f = os.popen(cmd, 'r')
358
359 deps = {}
360 pattern0 = "^(.*\.k?o):..*$"
361 pattern1 = "^(.*\.k?o):\s*(.*\.k?o)\s*$"
362 pattern2 = "^(.*\.k?o):\s*(.*\.k?o)\s*\\\$"
363 pattern3 = "^\t(.*\.k?o)\s*\\\$"
364 pattern4 = "^\t(.*\.k?o)\s*$"
365
366 line = f.readline()
367 while line:
368 if not re.match(pattern0, line):
369 line = f.readline()
370 continue
371 m1 = re.match(pattern1, line)
372 if m1:
373 deps[m1.group(1)] = m1.group(2).split()
374 else:
375 m2 = re.match(pattern2, line)
376 if m2:
377 deps[m2.group(1)] = m2.group(2).split()
378 line = f.readline()
379 m3 = re.match(pattern3, line)
380 while m3:
381 deps[m2.group(1)].extend(m3.group(1).split())
382 line = f.readline()
383 m3 = re.match(pattern3, line)
384 m4 = re.match(pattern4, line)
385 deps[m2.group(1)].extend(m4.group(1).split())
386 line = f.readline()
387 f.close()
388 return deps
389
390 def get_dependencies(file, pattern, format):
391 # file no longer includes PKGD
392 file = file.replace(d.getVar('PKGD', True) or '', '', 1)
393 # instead is prefixed with /lib/modules/${KERNEL_VERSION}
394 file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', True) or '', '', 1)
395
396 if module_deps.has_key(file):
397 import re
398 dependencies = []
399 for i in module_deps[file]:
400 m = re.match(pattern, os.path.basename(i))
401 if not m:
402 continue
403 on = legitimize_package_name(m.group(1))
404 dependency_pkg = format % on
405 dependencies.append(dependency_pkg)
406 return dependencies
407 return []
408
409 def frob_metadata(file, pkg, pattern, format, basename):
410 import re
411 vals = extract_modinfo(file)
412
413 dvar = d.getVar('PKGD', True)
414
415 # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
416 # appropriate modprobe commands to the postinst
417 autoload = d.getVar('module_autoload_%s' % basename, True)
418 if autoload:
419 name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
420 f = open(name, 'w')
421 for m in autoload.split():
422 f.write('%s\n' % m)
423 f.close()
424 postinst = d.getVar('pkg_postinst_%s' % pkg, True)
425 if not postinst:
426 bb.fatal("pkg_postinst_%s not defined" % pkg)
427 postinst += d.getVar('autoload_postinst_fragment', True) % autoload
428 d.setVar('pkg_postinst_%s' % pkg, postinst)
429
430 # Write out any modconf fragment
431 modconf = d.getVar('module_conf_%s' % basename, True)
432 if modconf:
433 name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
434 f = open(name, 'w')
435 f.write("%s\n" % modconf)
436 f.close()
437
438 files = d.getVar('FILES_%s' % pkg, True)
439 files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
440 d.setVar('FILES_%s' % pkg, files)
441
442 if vals.has_key("description"):
443 old_desc = d.getVar('DESCRIPTION_' + pkg, True) or ""
444 d.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"])
445
446 rdepends_str = d.getVar('RDEPENDS_' + pkg, True)
447 if rdepends_str:
448 rdepends = rdepends_str.split()
449 else:
450 rdepends = []
451 rdepends.extend(get_dependencies(file, pattern, format))
452 d.setVar('RDEPENDS_' + pkg, ' '.join(rdepends))
453
454 module_deps = parse_depmod()
455 module_regex = '^(.*)\.k?o$'
456 module_pattern = 'kernel-module-%s'
457
458 postinst = d.getVar('pkg_postinst_modules', True)
459 postrm = d.getVar('pkg_postrm_modules', True)
460 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
461 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
462 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
463 do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % d.getVar("KERNEL_VERSION", True))
464
465 # If modules-load.d and modprobe.d are empty at this point, remove them to
466 # avoid warnings. removedirs only raises an OSError if an empty
467 # directory cannot be removed.
468 dvar = d.getVar('PKGD', True)
469 for dir in ["%s/etc/modprobe.d" % (dvar), "%s/etc/modules-load.d" % (dvar), "%s/etc" % (dvar)]:
470 if len(os.listdir(dir)) == 0:
471 os.rmdir(dir)
472
473 import re
474 metapkg = "kernel-modules"
475 d.setVar('ALLOW_EMPTY_' + metapkg, "1")
476 d.setVar('FILES_' + metapkg, "")
477 blacklist = [ 'kernel-dev', 'kernel-image', 'kernel-base', 'kernel-vmlinux' ]
478 for l in module_deps.values():
479 for i in l:
480 pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1))
481 blacklist.append(pkg)
482 metapkg_rdepends = []
483 packages = d.getVar('PACKAGES', True).split()
484 for pkg in packages[1:]:
485 if not pkg in blacklist and not pkg in metapkg_rdepends:
486 metapkg_rdepends.append(pkg)
487 d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
488 d.setVar('DESCRIPTION_' + metapkg, 'Kernel modules meta package')
489 packages.append(metapkg)
490 d.setVar('PACKAGES', ' '.join(packages))
491}
492
493# Support checking the kernel size since some kernels need to reside in partitions
494# with a fixed length or there is a limit in transferring the kernel to memory
495do_sizecheck() {
496 if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then
497 size=`ls -l ${KERNEL_OUTPUT} | awk '{ print $5}'`
498 if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
499 rm ${KERNEL_OUTPUT}
500 die "This kernel (size=$size > ${KERNEL_IMAGE_MAXSIZE}) is too big for your device. Please reduce the size of the kernel by making more of it modular."
501 fi
502 fi
503}
504
505addtask sizecheck before do_install after do_compile
506
507KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
508# Don't include the DATETIME variable in the sstate package signatures
509KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
510KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
511
512do_uboot_mkimage() {
513 if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
514 if test "x${KEEPUIMAGE}" = "x" ; then
515 ENTRYPOINT=${UBOOT_ENTRYPOINT}
516 if test -n "${UBOOT_ENTRYSYMBOL}"; then
517 ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
518 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
519 fi
520 if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
521 ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
522 uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
523 rm -f linux.bin
524 else
525 ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
526 rm -f linux.bin.gz
527 gzip -9 linux.bin
528 uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
529 rm -f linux.bin.gz
530 fi
531 fi
532 fi
533}
534
535addtask uboot_mkimage before do_install after do_compile
536
537kernel_do_deploy() {
538 install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
539 if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
540 tar -cvzf ${DEPLOYDIR}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib
541 fi
542
543 cd ${DEPLOYDIR}
544 rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin
545 ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin
546 ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGETYPE}
547
548 cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
549}
550do_deploy[dirs] = "${DEPLOYDIR} ${B}"
551
552addtask deploy before do_build after do_install
553
554EXPORT_FUNCTIONS do_deploy
555