summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/kernel.bbclass')
-rw-r--r--meta/classes/kernel.bbclass68
1 files changed, 34 insertions, 34 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index dc711f287a..12e0b83b94 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -11,15 +11,15 @@ INITRAMFS_IMAGE ?= ""
11INITRAMFS_TASK ?= "" 11INITRAMFS_TASK ?= ""
12 12
13python __anonymous () { 13python __anonymous () {
14 kerneltype = bb.data.getVar('KERNEL_IMAGETYPE', d, 1) or '' 14 kerneltype = d.getVar('KERNEL_IMAGETYPE', 1) or ''
15 if kerneltype == 'uImage': 15 if kerneltype == 'uImage':
16 depends = bb.data.getVar("DEPENDS", d, 1) 16 depends = d.getVar("DEPENDS", 1)
17 depends = "%s u-boot-mkimage-native" % depends 17 depends = "%s u-boot-mkimage-native" % depends
18 bb.data.setVar("DEPENDS", depends, d) 18 d.setVar("DEPENDS", depends)
19 19
20 image = bb.data.getVar('INITRAMFS_IMAGE', d, True) 20 image = d.getVar('INITRAMFS_IMAGE', True)
21 if image: 21 if image:
22 bb.data.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs', d) 22 d.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs')
23} 23}
24 24
25inherit kernel-arch deploy 25inherit kernel-arch deploy
@@ -31,7 +31,7 @@ PACKAGES_DYNAMIC += "kernel-firmware-*"
31export OS = "${TARGET_OS}" 31export OS = "${TARGET_OS}"
32export CROSS_COMPILE = "${TARGET_PREFIX}" 32export CROSS_COMPILE = "${TARGET_PREFIX}"
33 33
34KERNEL_PRIORITY = "${@bb.data.getVar('PV',d,1).split('-')[0].split('.')[-1]}" 34KERNEL_PRIORITY = "${@d.getVar('PV',1).split('-')[0].split('.')[-1]}"
35 35
36KERNEL_RELEASE ?= "${KERNEL_VERSION}" 36KERNEL_RELEASE ?= "${KERNEL_VERSION}"
37 37
@@ -56,7 +56,7 @@ KERNEL_IMAGEDEST = "boot"
56# 56#
57# configuration 57# configuration
58# 58#
59export CMDLINE_CONSOLE = "console=${@bb.data.getVar("KERNEL_CONSOLE",d,1) or "ttyS0"}" 59export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}"
60 60
61KERNEL_VERSION = "${@get_kernelversion('${B}')}" 61KERNEL_VERSION = "${@get_kernelversion('${B}')}"
62 62
@@ -75,7 +75,7 @@ EXTRA_OEMAKE = ""
75 75
76KERNEL_ALT_IMAGETYPE ??= "" 76KERNEL_ALT_IMAGETYPE ??= ""
77 77
78KERNEL_IMAGETYPE_FOR_MAKE = "${@(lambda s: s[:-3] if s[-3:] == ".gz" else s)(bb.data.getVar('KERNEL_IMAGETYPE', d, 1))}" 78KERNEL_IMAGETYPE_FOR_MAKE = "${@(lambda s: s[:-3] if s[-3:] == ".gz" else s)(d.getVar('KERNEL_IMAGETYPE', 1))}"
79 79
80kernel_do_compile() { 80kernel_do_compile() {
81 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE 81 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
@@ -306,10 +306,10 @@ module_conf_rfcomm = "alias bt-proto-3 rfcomm"
306python populate_packages_prepend () { 306python populate_packages_prepend () {
307 def extract_modinfo(file): 307 def extract_modinfo(file):
308 import tempfile, re 308 import tempfile, re
309 tempfile.tempdir = bb.data.getVar("WORKDIR", d, 1) 309 tempfile.tempdir = d.getVar("WORKDIR", 1)
310 tf = tempfile.mkstemp() 310 tf = tempfile.mkstemp()
311 tmpfile = tf[1] 311 tmpfile = tf[1]
312 cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (bb.data.getVar("PATH", d, 1), bb.data.getVar("HOST_PREFIX", d, 1) or "", file, tmpfile) 312 cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("PATH", 1), d.getVar("HOST_PREFIX", 1) or "", file, tmpfile)
313 os.system(cmd) 313 os.system(cmd)
314 f = open(tmpfile) 314 f = open(tmpfile)
315 l = f.read().split("\000") 315 l = f.read().split("\000")
@@ -328,18 +328,18 @@ python populate_packages_prepend () {
328 def parse_depmod(): 328 def parse_depmod():
329 import re 329 import re
330 330
331 dvar = bb.data.getVar('PKGD', d, 1) 331 dvar = d.getVar('PKGD', 1)
332 if not dvar: 332 if not dvar:
333 bb.error("PKGD not defined") 333 bb.error("PKGD not defined")
334 return 334 return
335 335
336 kernelver = bb.data.getVar('KERNEL_VERSION', d, 1) 336 kernelver = d.getVar('KERNEL_VERSION', 1)
337 kernelver_stripped = kernelver 337 kernelver_stripped = kernelver
338 m = re.match('^(.*-hh.*)[\.\+].*$', kernelver) 338 m = re.match('^(.*-hh.*)[\.\+].*$', kernelver)
339 if m: 339 if m:
340 kernelver_stripped = m.group(1) 340 kernelver_stripped = m.group(1)
341 path = bb.data.getVar("PATH", d, 1) 341 path = d.getVar("PATH", 1)
342 host_prefix = bb.data.getVar("HOST_PREFIX", d, 1) or "" 342 host_prefix = d.getVar("HOST_PREFIX", 1) or ""
343 343
344 cmd = "PATH=\"%s\" %sdepmod -n -a -r -b %s -F %s/boot/System.map-%s %s" % (path, host_prefix, dvar, dvar, kernelver, kernelver_stripped) 344 cmd = "PATH=\"%s\" %sdepmod -n -a -r -b %s -F %s/boot/System.map-%s %s" % (path, host_prefix, dvar, dvar, kernelver, kernelver_stripped)
345 f = os.popen(cmd, 'r') 345 f = os.popen(cmd, 'r')
@@ -377,9 +377,9 @@ python populate_packages_prepend () {
377 377
378 def get_dependencies(file, pattern, format): 378 def get_dependencies(file, pattern, format):
379 # file no longer includes PKGD 379 # file no longer includes PKGD
380 file = file.replace(bb.data.getVar('PKGD', d, 1) or '', '', 1) 380 file = file.replace(d.getVar('PKGD', 1) or '', '', 1)
381 # instead is prefixed with /lib/modules/${KERNEL_VERSION} 381 # instead is prefixed with /lib/modules/${KERNEL_VERSION}
382 file = file.replace("/lib/modules/%s/" % bb.data.getVar('KERNEL_VERSION', d, 1) or '', '', 1) 382 file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', 1) or '', '', 1)
383 383
384 if module_deps.has_key(file): 384 if module_deps.has_key(file):
385 import re 385 import re
@@ -398,40 +398,40 @@ python populate_packages_prepend () {
398 import re 398 import re
399 vals = extract_modinfo(file) 399 vals = extract_modinfo(file)
400 400
401 dvar = bb.data.getVar('PKGD', d, 1) 401 dvar = d.getVar('PKGD', 1)
402 402
403 # If autoloading is requested, output /etc/modutils/<name> and append 403 # If autoloading is requested, output /etc/modutils/<name> and append
404 # appropriate modprobe commands to the postinst 404 # appropriate modprobe commands to the postinst
405 autoload = bb.data.getVar('module_autoload_%s' % basename, d, 1) 405 autoload = d.getVar('module_autoload_%s' % basename, 1)
406 if autoload: 406 if autoload:
407 name = '%s/etc/modutils/%s' % (dvar, basename) 407 name = '%s/etc/modutils/%s' % (dvar, basename)
408 f = open(name, 'w') 408 f = open(name, 'w')
409 for m in autoload.split(): 409 for m in autoload.split():
410 f.write('%s\n' % m) 410 f.write('%s\n' % m)
411 f.close() 411 f.close()
412 postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) 412 postinst = d.getVar('pkg_postinst_%s' % pkg, 1)
413 if not postinst: 413 if not postinst:
414 bb.fatal("pkg_postinst_%s not defined" % pkg) 414 bb.fatal("pkg_postinst_%s not defined" % pkg)
415 postinst += bb.data.getVar('autoload_postinst_fragment', d, 1) % autoload 415 postinst += d.getVar('autoload_postinst_fragment', 1) % autoload
416 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) 416 d.setVar('pkg_postinst_%s' % pkg, postinst)
417 417
418 # Write out any modconf fragment 418 # Write out any modconf fragment
419 modconf = bb.data.getVar('module_conf_%s' % basename, d, 1) 419 modconf = d.getVar('module_conf_%s' % basename, 1)
420 if modconf: 420 if modconf:
421 name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) 421 name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
422 f = open(name, 'w') 422 f = open(name, 'w')
423 f.write("%s\n" % modconf) 423 f.write("%s\n" % modconf)
424 f.close() 424 f.close()
425 425
426 files = bb.data.getVar('FILES_%s' % pkg, d, 1) 426 files = d.getVar('FILES_%s' % pkg, 1)
427 files = "%s /etc/modutils/%s /etc/modutils/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename, basename) 427 files = "%s /etc/modutils/%s /etc/modutils/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename, basename)
428 bb.data.setVar('FILES_%s' % pkg, files, d) 428 d.setVar('FILES_%s' % pkg, files)
429 429
430 if vals.has_key("description"): 430 if vals.has_key("description"):
431 old_desc = bb.data.getVar('DESCRIPTION_' + pkg, d, 1) or "" 431 old_desc = d.getVar('DESCRIPTION_' + pkg, 1) or ""
432 bb.data.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"], d) 432 d.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"])
433 433
434 rdepends_str = bb.data.getVar('RDEPENDS_' + pkg, d, 1) 434 rdepends_str = d.getVar('RDEPENDS_' + pkg, 1)
435 if rdepends_str: 435 if rdepends_str:
436 rdepends = rdepends_str.split() 436 rdepends = rdepends_str.split()
437 else: 437 else:
@@ -443,29 +443,29 @@ python populate_packages_prepend () {
443 module_regex = '^(.*)\.k?o$' 443 module_regex = '^(.*)\.k?o$'
444 module_pattern = 'kernel-module-%s' 444 module_pattern = 'kernel-module-%s'
445 445
446 postinst = bb.data.getVar('pkg_postinst_modules', d, 1) 446 postinst = d.getVar('pkg_postinst_modules', 1)
447 postrm = bb.data.getVar('pkg_postrm_modules', d, 1) 447 postrm = d.getVar('pkg_postrm_modules', 1)
448 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') 448 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
449 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') 449 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
450 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') 450 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
451 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' % bb.data.getVar("KERNEL_VERSION", d, 1)) 451 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", 1))
452 452
453 import re 453 import re
454 metapkg = "kernel-modules" 454 metapkg = "kernel-modules"
455 bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d) 455 d.setVar('ALLOW_EMPTY_' + metapkg, "1")
456 bb.data.setVar('FILES_' + metapkg, "", d) 456 d.setVar('FILES_' + metapkg, "")
457 blacklist = [ 'kernel-dev', 'kernel-image', 'kernel-base', 'kernel-vmlinux', 'perf', 'perf-dbg', 'kernel-misc' ] 457 blacklist = [ 'kernel-dev', 'kernel-image', 'kernel-base', 'kernel-vmlinux', 'perf', 'perf-dbg', 'kernel-misc' ]
458 for l in module_deps.values(): 458 for l in module_deps.values():
459 for i in l: 459 for i in l:
460 pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1)) 460 pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1))
461 blacklist.append(pkg) 461 blacklist.append(pkg)
462 metapkg_rdepends = [] 462 metapkg_rdepends = []
463 packages = bb.data.getVar('PACKAGES', d, 1).split() 463 packages = d.getVar('PACKAGES', 1).split()
464 for pkg in packages[1:]: 464 for pkg in packages[1:]:
465 if not pkg in blacklist and not pkg in metapkg_rdepends: 465 if not pkg in blacklist and not pkg in metapkg_rdepends:
466 metapkg_rdepends.append(pkg) 466 metapkg_rdepends.append(pkg)
467 bb.data.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends), d) 467 bb.data.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends), d)
468 bb.data.setVar('DESCRIPTION_' + metapkg, 'Kernel modules meta package', d) 468 d.setVar('DESCRIPTION_' + metapkg, 'Kernel modules meta package')
469 packages.append(metapkg) 469 packages.append(metapkg)
470 bb.data.setVar('PACKAGES', ' '.join(packages), d) 470 bb.data.setVar('PACKAGES', ' '.join(packages), d)
471} 471}