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.bbclass40
1 files changed, 20 insertions, 20 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index b779a767d3..fa598cff7f 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -22,18 +22,18 @@ INITRAMFS_IMAGE_BUNDLE ?= ""
22# number and cause kernel to be rebuilt. To avoid this, make 22# number and cause kernel to be rebuilt. To avoid this, make
23# KERNEL_VERSION_NAME and KERNEL_VERSION_PKG_NAME depend on 23# KERNEL_VERSION_NAME and KERNEL_VERSION_PKG_NAME depend on
24# LINUX_VERSION which is a constant. 24# LINUX_VERSION which is a constant.
25KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION', True) or ""}" 25KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION') or ""}"
26KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}" 26KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}"
27KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION', True))}" 27KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
28KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}" 28KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
29 29
30python __anonymous () { 30python __anonymous () {
31 import re 31 import re
32 32
33 # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES 33 # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
34 type = d.getVar('KERNEL_IMAGETYPE', True) or "" 34 type = d.getVar('KERNEL_IMAGETYPE') or ""
35 alttype = d.getVar('KERNEL_ALT_IMAGETYPE', True) or "" 35 alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or ""
36 types = d.getVar('KERNEL_IMAGETYPES', True) or "" 36 types = d.getVar('KERNEL_IMAGETYPES') or ""
37 if type not in types.split(): 37 if type not in types.split():
38 types = (type + ' ' + types).strip() 38 types = (type + ' ' + types).strip()
39 if alttype not in types.split(): 39 if alttype not in types.split():
@@ -56,15 +56,15 @@ python __anonymous () {
56 56
57 d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1') 57 d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
58 58
59 imagedest = d.getVar('KERNEL_IMAGEDEST', True) 59 imagedest = d.getVar('KERNEL_IMAGEDEST')
60 priority = d.getVar('KERNEL_PRIORITY', True) 60 priority = d.getVar('KERNEL_PRIORITY')
61 postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n' 61 postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
62 d.setVar('pkg_postinst_kernel-image-' + typelower, postinst) 62 d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
63 63
64 postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n' 64 postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
65 d.setVar('pkg_postrm_kernel-image-' + typelower, postrm) 65 d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
66 66
67 image = d.getVar('INITRAMFS_IMAGE', True) 67 image = d.getVar('INITRAMFS_IMAGE')
68 if image: 68 if image:
69 d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete') 69 d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
70 70
@@ -72,7 +72,7 @@ python __anonymous () {
72 # The preferred method is to set INITRAMFS_IMAGE, because 72 # The preferred method is to set INITRAMFS_IMAGE, because
73 # this INITRAMFS_TASK has circular dependency problems 73 # this INITRAMFS_TASK has circular dependency problems
74 # if the initramfs requires kernel modules 74 # if the initramfs requires kernel modules
75 image_task = d.getVar('INITRAMFS_TASK', True) 75 image_task = d.getVar('INITRAMFS_TASK')
76 if image_task: 76 if image_task:
77 d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}') 77 d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
78} 78}
@@ -101,15 +101,15 @@ inherit ${KERNEL_CLASSES}
101do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}" 101do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}"
102do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}" 102do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}"
103base_do_unpack_append () { 103base_do_unpack_append () {
104 s = d.getVar("S", True) 104 s = d.getVar("S")
105 if s[-1] == '/': 105 if s[-1] == '/':
106 # drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as directory name and fail 106 # drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as directory name and fail
107 s=s[:-1] 107 s=s[:-1]
108 kernsrc = d.getVar("STAGING_KERNEL_DIR", True) 108 kernsrc = d.getVar("STAGING_KERNEL_DIR")
109 if s != kernsrc: 109 if s != kernsrc:
110 bb.utils.mkdirhier(kernsrc) 110 bb.utils.mkdirhier(kernsrc)
111 bb.utils.remove(kernsrc, recurse=True) 111 bb.utils.remove(kernsrc, recurse=True)
112 if d.getVar("EXTERNALSRC", True): 112 if d.getVar("EXTERNALSRC"):
113 # With EXTERNALSRC S will not be wiped so we can symlink to it 113 # With EXTERNALSRC S will not be wiped so we can symlink to it
114 os.symlink(s, kernsrc) 114 os.symlink(s, kernsrc)
115 else: 115 else:
@@ -127,9 +127,9 @@ PACKAGES_DYNAMIC += "^kernel-firmware-.*"
127export OS = "${TARGET_OS}" 127export OS = "${TARGET_OS}"
128export CROSS_COMPILE = "${TARGET_PREFIX}" 128export CROSS_COMPILE = "${TARGET_PREFIX}"
129 129
130KERNEL_PRIORITY ?= "${@int(d.getVar('PV', True).split('-')[0].split('+')[0].split('.')[0]) * 10000 + \ 130KERNEL_PRIORITY ?= "${@int(d.getVar('PV').split('-')[0].split('+')[0].split('.')[0]) * 10000 + \
131 int(d.getVar('PV', True).split('-')[0].split('+')[0].split('.')[1]) * 100 + \ 131 int(d.getVar('PV').split('-')[0].split('+')[0].split('.')[1]) * 100 + \
132 int(d.getVar('PV', True).split('-')[0].split('+')[0].split('.')[-1])}" 132 int(d.getVar('PV').split('-')[0].split('+')[0].split('.')[-1])}"
133 133
134KERNEL_RELEASE ?= "${KERNEL_VERSION}" 134KERNEL_RELEASE ?= "${KERNEL_VERSION}"
135 135
@@ -140,7 +140,7 @@ KERNEL_IMAGEDEST = "boot"
140# 140#
141# configuration 141# configuration
142# 142#
143export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE", True) or "ttyS0"}" 143export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE") or "ttyS0"}"
144 144
145KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}" 145KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}"
146 146
@@ -430,14 +430,14 @@ sysroot_stage_all () {
430KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} O=${B} oldnoconfig || yes '' | oe_runmake -C ${S} O=${B} oldconfig" 430KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} O=${B} oldnoconfig || yes '' | oe_runmake -C ${S} O=${B} oldconfig"
431 431
432python check_oldest_kernel() { 432python check_oldest_kernel() {
433 oldest_kernel = d.getVar('OLDEST_KERNEL', True) 433 oldest_kernel = d.getVar('OLDEST_KERNEL')
434 kernel_version = d.getVar('KERNEL_VERSION', True) 434 kernel_version = d.getVar('KERNEL_VERSION')
435 tclibc = d.getVar('TCLIBC', True) 435 tclibc = d.getVar('TCLIBC')
436 if tclibc == 'glibc': 436 if tclibc == 'glibc':
437 kernel_version = kernel_version.split('-', 1)[0] 437 kernel_version = kernel_version.split('-', 1)[0]
438 if oldest_kernel and kernel_version: 438 if oldest_kernel and kernel_version:
439 if bb.utils.vercmp_string(kernel_version, oldest_kernel) < 0: 439 if bb.utils.vercmp_string(kernel_version, oldest_kernel) < 0:
440 bb.warn('%s: OLDEST_KERNEL is "%s" but the version of the kernel you are building is "%s" - therefore %s as built may not be compatible with this kernel. Either set OLDEST_KERNEL to an older version, or build a newer kernel.' % (d.getVar('PN', True), oldest_kernel, kernel_version, tclibc)) 440 bb.warn('%s: OLDEST_KERNEL is "%s" but the version of the kernel you are building is "%s" - therefore %s as built may not be compatible with this kernel. Either set OLDEST_KERNEL to an older version, or build a newer kernel.' % (d.getVar('PN'), oldest_kernel, kernel_version, tclibc))
441} 441}
442 442
443check_oldest_kernel[vardepsexclude] += "OLDEST_KERNEL KERNEL_VERSION" 443check_oldest_kernel[vardepsexclude] += "OLDEST_KERNEL KERNEL_VERSION"