summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/kernel-fitimage.bbclass20
-rw-r--r--meta/classes/kernel-grub.bbclass44
-rw-r--r--meta/classes/kernel-uimage.bbclass10
-rw-r--r--meta/classes/kernel.bbclass174
-rw-r--r--meta/conf/documentation.conf1
-rw-r--r--meta/recipes-kernel/linux/linux-dtb.inc49
6 files changed, 202 insertions, 96 deletions
diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass
index 298eda2a23..9a3caf5535 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -1,8 +1,8 @@
1inherit kernel-uboot uboot-sign 1inherit kernel-uboot uboot-sign
2 2
3python __anonymous () { 3python __anonymous () {
4 kerneltype = d.getVar('KERNEL_IMAGETYPE', True) 4 kerneltypes = d.getVar('KERNEL_IMAGETYPES', True) or ""
5 if kerneltype == 'fitImage': 5 if 'fitImage' in kerneltypes.split():
6 depends = d.getVar("DEPENDS", True) 6 depends = d.getVar("DEPENDS", True)
7 depends = "%s u-boot-mkimage-native dtc-native" % depends 7 depends = "%s u-boot-mkimage-native dtc-native" % depends
8 d.setVar("DEPENDS", depends) 8 d.setVar("DEPENDS", depends)
@@ -10,7 +10,9 @@ python __anonymous () {
10 # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal 10 # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
11 # to kernel.bbclass . We have to override it, since we pack zImage 11 # to kernel.bbclass . We have to override it, since we pack zImage
12 # (at least for now) into the fitImage . 12 # (at least for now) into the fitImage .
13 d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage") 13 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or ""
14 if 'fitImage' in typeformake.split():
15 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', 'zImage'))
14 16
15 image = d.getVar('INITRAMFS_IMAGE', True) 17 image = d.getVar('INITRAMFS_IMAGE', True)
16 if image: 18 if image:
@@ -187,7 +189,7 @@ EOF
187} 189}
188 190
189do_assemble_fitimage() { 191do_assemble_fitimage() {
190 if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then 192 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
191 kernelcount=1 193 kernelcount=1
192 dtbcount="" 194 dtbcount=""
193 rm -f fit-image.its arch/${ARCH}/boot/fitImage 195 rm -f fit-image.its arch/${ARCH}/boot/fitImage
@@ -265,14 +267,14 @@ addtask assemble_fitimage before do_install after do_compile
265kernel_do_deploy[vardepsexclude] = "DATETIME" 267kernel_do_deploy[vardepsexclude] = "DATETIME"
266kernel_do_deploy_append() { 268kernel_do_deploy_append() {
267 # Update deploy directory 269 # Update deploy directory
268 if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then 270 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
269 cd ${B} 271 cd ${B}
270 echo "Copying fit-image.its source file..." 272 echo "Copying fit-image.its source file..."
271 its_base_name="${KERNEL_IMAGETYPE}-its-${PV}-${PR}-${MACHINE}-${DATETIME}" 273 its_base_name="fitImage-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
272 its_symlink_name=${KERNEL_IMAGETYPE}-its-${MACHINE} 274 its_symlink_name=fitImage-its-${MACHINE}
273 install -m 0644 fit-image.its ${DEPLOYDIR}/${its_base_name}.its 275 install -m 0644 fit-image.its ${DEPLOYDIR}/${its_base_name}.its
274 linux_bin_base_name="${KERNEL_IMAGETYPE}-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}" 276 linux_bin_base_name="fitImage-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
275 linux_bin_symlink_name=${KERNEL_IMAGETYPE}-linux.bin-${MACHINE} 277 linux_bin_symlink_name=fitImage-linux.bin-${MACHINE}
276 install -m 0644 linux.bin ${DEPLOYDIR}/${linux_bin_base_name}.bin 278 install -m 0644 linux.bin ${DEPLOYDIR}/${linux_bin_base_name}.bin
277 279
278 cd ${DEPLOYDIR} 280 cd ${DEPLOYDIR}
diff --git a/meta/classes/kernel-grub.bbclass b/meta/classes/kernel-grub.bbclass
index a63f482a91..f7dcc0715a 100644
--- a/meta/classes/kernel-grub.bbclass
+++ b/meta/classes/kernel-grub.bbclass
@@ -10,41 +10,44 @@
10# updates the new kernel as the boot priority. 10# updates the new kernel as the boot priority.
11# 11#
12 12
13pkg_preinst_kernel-image_append () { 13python __anonymous () {
14 import re
15
16 preinst = '''
14 # Parsing confliction 17 # Parsing confliction
15 [ -f "$D/boot/grub/menu.list" ] && grubcfg="$D/boot/grub/menu.list" 18 [ -f "$D/boot/grub/menu.list" ] && grubcfg="$D/boot/grub/menu.list"
16 [ -f "$D/boot/grub/grub.cfg" ] && grubcfg="$D/boot/grub/grub.cfg" 19 [ -f "$D/boot/grub/grub.cfg" ] && grubcfg="$D/boot/grub/grub.cfg"
17 if [ -n "$grubcfg" ]; then 20 if [ -n "$grubcfg" ]; then
18 # Dereference symlink to avoid confliction with new kernel name. 21 # Dereference symlink to avoid confliction with new kernel name.
19 if grep -q "/${KERNEL_IMAGETYPE} \+root=" $grubcfg; then 22 if grep -q "/KERNEL_IMAGETYPE \+root=" $grubcfg; then
20 if [ -L "$D/boot/${KERNEL_IMAGETYPE}" ]; then 23 if [ -L "$D/boot/KERNEL_IMAGETYPE" ]; then
21 kimage=`realpath $D/boot/${KERNEL_IMAGETYPE} 2>/dev/null` 24 kimage=`realpath $D/boot/KERNEL_IMAGETYPE 2>/dev/null`
22 if [ -f "$D$kimage" ]; then 25 if [ -f "$D$kimage" ]; then
23 sed -i "s:${KERNEL_IMAGETYPE} \+root=:${kimage##*/} root=:" $grubcfg 26 sed -i "s:KERNEL_IMAGETYPE \+root=:${kimage##*/} root=:" $grubcfg
24 fi 27 fi
25 fi 28 fi
26 fi 29 fi
27 30
28 # Rename old kernel if it conflicts with new kernel name. 31 # Rename old kernel if it conflicts with new kernel name.
29 if grep -q "/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} \+root=" $grubcfg; then 32 if grep -q "/KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=" $grubcfg; then
30 if [ -f "$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}" ]; then 33 if [ -f "$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" ]; then
31 timestamp=`date +%s` 34 timestamp=`date +%s`
32 kimage="$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-$timestamp-back" 35 kimage="$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}-$timestamp-back"
33 sed -i "s:${KERNEL_IMAGETYPE}-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg 36 sed -i "s:KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg
34 mv "$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}" "$kimage" 37 mv "$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" "$kimage"
35 fi 38 fi
36 fi 39 fi
37 fi 40 fi
38} 41'''
39 42
40pkg_postinst_kernel-image_prepend () { 43 postinst = '''
41 get_new_grub_cfg() { 44 get_new_grub_cfg() {
42 grubcfg="$1" 45 grubcfg="$1"
43 old_image="$2" 46 old_image="$2"
44 title="Update ${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-${PV}" 47 title="Update KERNEL_IMAGETYPE-${KERNEL_VERSION}-${PV}"
45 if [ "${grubcfg##*/}" = "grub.cfg" ]; then 48 if [ "${grubcfg##*/}" = "grub.cfg" ]; then
46 rootfs=`grep " *linux \+[^ ]\+ \+root=" $grubcfg -m 1 | \ 49 rootfs=`grep " *linux \+[^ ]\+ \+root=" $grubcfg -m 1 | \
47 sed "s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"` 50 sed "s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`
48 51
49 echo "menuentry \"$title\" {" 52 echo "menuentry \"$title\" {"
50 echo " set root=(hd0,1)" 53 echo " set root=(hd0,1)"
@@ -52,7 +55,7 @@ pkg_postinst_kernel-image_prepend () {
52 echo "}" 55 echo "}"
53 elif [ "${grubcfg##*/}" = "menu.list" ]; then 56 elif [ "${grubcfg##*/}" = "menu.list" ]; then
54 rootfs=`grep "kernel \+[^ ]\+ \+root=" $grubcfg -m 1 | \ 57 rootfs=`grep "kernel \+[^ ]\+ \+root=" $grubcfg -m 1 | \
55 sed "s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"` 58 sed "s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`
56 59
57 echo "default 0" 60 echo "default 0"
58 echo "timeout 30" 61 echo "timeout 30"
@@ -87,5 +90,16 @@ pkg_postinst_kernel-image_prepend () {
87 mv $grubcfgtmp $grubcfg 90 mv $grubcfgtmp $grubcfg
88 echo "Caution! Update kernel may affect kernel-module!" 91 echo "Caution! Update kernel may affect kernel-module!"
89 fi 92 fi
93'''
94
95 imagetypes = d.getVar('KERNEL_IMAGETYPES', True)
96 imagetypes = re.sub(r'\.gz$', '', imagetypes)
97
98 for type in imagetypes.split():
99 typelower = type.lower()
100 preinst_append = preinst.replace('KERNEL_IMAGETYPE', type)
101 postinst_prepend = postinst.replace('KERNEL_IMAGETYPE', type)
102 d.setVar('pkg_preinst_kernel-image-' + typelower + '_append', preinst_append)
103 d.setVar('pkg_postinst_kernel-image-' + typelower + '_prepend', postinst_prepend)
90} 104}
91 105
diff --git a/meta/classes/kernel-uimage.bbclass b/meta/classes/kernel-uimage.bbclass
index 543f5432ba..2a187f5492 100644
--- a/meta/classes/kernel-uimage.bbclass
+++ b/meta/classes/kernel-uimage.bbclass
@@ -1,8 +1,7 @@
1inherit kernel-uboot 1inherit kernel-uboot
2 2
3python __anonymous () { 3python __anonymous () {
4 kerneltype = d.getVar('KERNEL_IMAGETYPE', True) 4 if "uImage" in (d.getVar('KERNEL_IMAGETYPES', True) or "").split():
5 if kerneltype == 'uImage':
6 depends = d.getVar("DEPENDS", True) 5 depends = d.getVar("DEPENDS", True)
7 depends = "%s u-boot-mkimage-native" % depends 6 depends = "%s u-boot-mkimage-native" % depends
8 d.setVar("DEPENDS", depends) 7 d.setVar("DEPENDS", depends)
@@ -13,11 +12,14 @@ python __anonymous () {
13 # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into 12 # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into
14 # the uImage . 13 # the uImage .
15 if d.getVar("KEEPUIMAGE", True) != 'yes': 14 if d.getVar("KEEPUIMAGE", True) != 'yes':
16 d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "vmlinux") 15 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or ""
16 if "uImage" in typeformake.split():
17 typeformake.replace('uImage', 'vmlinux')
18 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
17} 19}
18 20
19do_uboot_mkimage() { 21do_uboot_mkimage() {
20 if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then 22 if echo "${KERNEL_IMAGETYPES}" | grep -wq "uImage"; then
21 if test "x${KEEPUIMAGE}" != "xyes" ; then 23 if test "x${KEEPUIMAGE}" != "xyes" ; then
22 uboot_prep_kimage 24 uboot_prep_kimage
23 25
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index c5355cf37e..e7e2cb3963 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -16,12 +16,53 @@ INITRAMFS_IMAGE ?= ""
16INITRAMFS_TASK ?= "" 16INITRAMFS_TASK ?= ""
17INITRAMFS_IMAGE_BUNDLE ?= "" 17INITRAMFS_IMAGE_BUNDLE ?= ""
18 18
19# KERNEL_VERSION is extracted from source code. It is evaluated as
20# None for the first parsing, since the code has not been fetched.
21# After the code is fetched, it will be evaluated as real version
22# number and cause kernel to be rebuilt. To avoid this, make
23# KERNEL_VERSION_NAME and KERNEL_VERSION_PKG_NAME depend on
24# LINUX_VERSION which is a constant.
25KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION', True) or ""}"
26KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}"
27KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION', True))}"
28KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
29
19python __anonymous () { 30python __anonymous () {
20 import re 31 import re
21 32
22 kerneltype = d.getVar('KERNEL_IMAGETYPE', True) 33 # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
34 type = d.getVar('KERNEL_IMAGETYPE', True) or ""
35 alttype = d.getVar('KERNEL_ALT_IMAGETYPE', True) or ""
36 types = d.getVar('KERNEL_IMAGETYPES', True) or ""
37 if type not in types.split():
38 types = (type + ' ' + types).strip()
39 if alttype not in types.split():
40 types = (alttype + ' ' + types).strip()
41 d.setVar('KERNEL_IMAGETYPES', types)
42
43 typeformake = re.sub(r'\.gz', '', types)
44 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
45
46 for type in typeformake.split():
47 typelower = type.lower()
48
49 d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
50
51 d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '*')
52
53 d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
54
55 d.setVar('PKG_kernel-image-' + typelower, 'kernel-image-' + typelower + '-${KERNEL_VERSION_PKG_NAME}')
23 56
24 d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", re.sub(r'\.gz$', '', kerneltype)) 57 d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
58
59 imagedest = d.getVar('KERNEL_IMAGEDEST', True)
60 priority = d.getVar('KERNEL_PRIORITY', True)
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)
63
64 postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
65 d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
25 66
26 image = d.getVar('INITRAMFS_IMAGE', True) 67 image = d.getVar('INITRAMFS_IMAGE', True)
27 if image: 68 if image:
@@ -92,8 +133,8 @@ KERNEL_PRIORITY ?= "${@int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.
92 133
93KERNEL_RELEASE ?= "${KERNEL_VERSION}" 134KERNEL_RELEASE ?= "${KERNEL_VERSION}"
94 135
95# Where built kernel lies in the kernel tree 136# The directory where built kernel lies in the kernel tree
96KERNEL_OUTPUT ?= "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}" 137KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot"
97KERNEL_IMAGEDEST = "boot" 138KERNEL_IMAGEDEST = "boot"
98 139
99# 140#
@@ -162,23 +203,48 @@ copy_initramfs() {
162 echo "Finished copy of initramfs into ./usr" 203 echo "Finished copy of initramfs into ./usr"
163} 204}
164 205
165INITRAMFS_BASE_NAME = "${KERNEL_IMAGETYPE}-initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}" 206INITRAMFS_BASE_NAME = "initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}"
166INITRAMFS_BASE_NAME[vardepsexclude] = "DATETIME" 207INITRAMFS_BASE_NAME[vardepsexclude] = "DATETIME"
167do_bundle_initramfs () { 208do_bundle_initramfs () {
168 if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then 209 if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
169 echo "Creating a kernel image with a bundled initramfs..." 210 echo "Creating a kernel image with a bundled initramfs..."
170 copy_initramfs 211 copy_initramfs
171 if [ -e ${KERNEL_OUTPUT} ] ; then 212 # Backing up kernel image relies on its type(regular file or symbolic link)
172 mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.bak 213 tmp_path=""
173 fi 214 for type in ${KERNEL_IMAGETYPES} ; do
215 if [ -h ${KERNEL_OUTPUT_DIR}/$type ] ; then
216 linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$type`
217 realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$type`
218 mv -f $realpath $realpath.bak
219 tmp_path=$tmp_path" "$type"#"$linkpath"#"$realpath
220 elif [ -f ${KERNEL_OUTPUT_DIR}/$type ]; then
221 mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.bak
222 tmp_path=$tmp_path" "$type"##"
223 fi
224 done
174 use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio 225 use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
175 kernel_do_compile 226 kernel_do_compile
176 mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs 227 # Restoring kernel image
177 mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT} 228 for tp in $tmp_path ; do
229 type=`echo $tp|cut -d "#" -f 1`
230 linkpath=`echo $tp|cut -d "#" -f 2`
231 realpath=`echo $tp|cut -d "#" -f 3`
232 if [ -n "$realpath" ]; then
233 mv -f $realpath $realpath.initramfs
234 mv -f $realpath.bak $realpath
235 cd ${B}/${KERNEL_OUTPUT_DIR}
236 ln -sf $linkpath.initramfs
237 else
238 mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.initramfs
239 mv -f ${KERNEL_OUTPUT_DIR}/$type.bak ${KERNEL_OUTPUT_DIR}/$type
240 fi
241 done
178 # Update install area 242 # Update install area
179 echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT}.initramfs" 243 for type in ${KERNEL_IMAGETYPES} ; do
180 install -m 0644 ${B}/${KERNEL_OUTPUT}.initramfs ${D}/boot/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin 244 echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs"
181 echo "${B}/${KERNEL_OUTPUT}.initramfs" 245 install -m 0644 ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs ${D}/boot/$type-initramfs-${MACHINE}.bin
246 echo "${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs"
247 done
182 fi 248 fi
183} 249}
184 250
@@ -203,10 +269,15 @@ kernel_do_compile() {
203 copy_initramfs 269 copy_initramfs
204 use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio 270 use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
205 fi 271 fi
206 oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd 272 for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
207 if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}"; then 273 oe_runmake ${typeformake} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
208 gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" > "${KERNEL_OUTPUT}" 274 for type in ${KERNEL_IMAGETYPES} ; do
209 fi 275 if test "${typeformake}.gz" = "${type}"; then
276 gzip -9c < "${typeformake}" > "${KERNEL_OUTPUT_DIR}/${type}"
277 break;
278 fi
279 done
280 done
210} 281}
211 282
212do_compile_kernelmodules() { 283do_compile_kernelmodules() {
@@ -247,7 +318,9 @@ kernel_do_install() {
247 # 318 #
248 install -d ${D}/${KERNEL_IMAGEDEST} 319 install -d ${D}/${KERNEL_IMAGEDEST}
249 install -d ${D}/boot 320 install -d ${D}/boot
250 install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} 321 for type in ${KERNEL_IMAGETYPES} ; do
322 install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION}
323 done
251 install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} 324 install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
252 install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} 325 install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
253 install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION} 326 install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION}
@@ -375,12 +448,12 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
375PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules" 448PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
376FILES_${PN} = "" 449FILES_${PN} = ""
377FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin" 450FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
378FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*" 451FILES_kernel-image = ""
379FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build" 452FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
380FILES_kernel-vmlinux = "/boot/vmlinux*" 453FILES_kernel-vmlinux = "/boot/vmlinux*"
381FILES_kernel-modules = "" 454FILES_kernel-modules = ""
382RDEPENDS_kernel = "kernel-base" 455RDEPENDS_kernel = "kernel-base"
383# Allow machines to override this dependency if kernel image files are 456# Allow machines to override this dependency if kernel image files are
384# not wanted in images as standard 457# not wanted in images as standard
385RDEPENDS_kernel-base ?= "kernel-image" 458RDEPENDS_kernel-base ?= "kernel-image"
386PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}" 459PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
@@ -404,14 +477,6 @@ pkg_postinst_kernel-base () {
404 fi 477 fi
405} 478}
406 479
407pkg_postinst_kernel-image () {
408 update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
409}
410
411pkg_postrm_kernel-image () {
412 update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
413}
414
415PACKAGESPLITFUNCS_prepend = "split_kernel_packages " 480PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
416 481
417python split_kernel_packages () { 482python split_kernel_packages () {
@@ -432,13 +497,13 @@ do_kernel_link_vmlinux() {
432 497
433do_strip() { 498do_strip() {
434 if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then 499 if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then
435 if [ "${KERNEL_IMAGETYPE}" != "vmlinux" ]; then 500 if ! (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux"); then
436 bbwarn "image type will not be stripped (not supported): ${KERNEL_IMAGETYPE}" 501 bbwarn "image type(s) will not be stripped (not supported): ${KERNEL_IMAGETYPES}"
437 return 502 return
438 fi 503 fi
439 504
440 cd ${B} 505 cd ${B}
441 headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT} | \ 506 headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT_DIR}/vmlinux | \
442 grep "^ \{1,\}\[[0-9 ]\{1,\}\] [^ ]" | \ 507 grep "^ \{1,\}\[[0-9 ]\{1,\}\] [^ ]" | \
443 sed "s/^ \{1,\}\[[0-9 ]\{1,\}\] //" | \ 508 sed "s/^ \{1,\}\[[0-9 ]\{1,\}\] //" | \
444 gawk '{print $1}'` 509 gawk '{print $1}'`
@@ -448,7 +513,7 @@ do_strip() {
448 bbwarn "Section not found: $str"; 513 bbwarn "Section not found: $str";
449 fi 514 fi
450 515
451 "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT} 516 "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT_DIR}/vmlinux
452 }; done 517 }; done
453 518
454 bbnote "KERNEL_IMAGE_STRIP_EXTRA_SECTIONS is set, stripping sections:" \ 519 bbnote "KERNEL_IMAGE_STRIP_EXTRA_SECTIONS is set, stripping sections:" \
@@ -467,20 +532,22 @@ do_sizecheck() {
467 if [ -n "$invalid" ]; then 532 if [ -n "$invalid" ]; then
468 die "Invalid KERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integerx (The unit is Kbytes)" 533 die "Invalid KERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integerx (The unit is Kbytes)"
469 fi 534 fi
470 size=`du -ks ${B}/${KERNEL_OUTPUT} | awk '{ print $1}'` 535 for type in ${KERNEL_IMAGETYPES} ; do
471 if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then 536 size=`du -ks ${B}/${KERNEL_OUTPUT_DIR}/$type | awk '{print $1}'`
472 die "This kernel (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular." 537 if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
473 fi 538 warn "This kernel $type (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular."
539 fi
540 done
474 fi 541 fi
475} 542}
476do_sizecheck[dirs] = "${B}" 543do_sizecheck[dirs] = "${B}"
477 544
478addtask sizecheck before do_install after do_strip 545addtask sizecheck before do_install after do_strip
479 546
480KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" 547KERNEL_IMAGE_BASE_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
481# Don't include the DATETIME variable in the sstate package signatures 548# Don't include the DATETIME variable in the sstate package signatures
482KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" 549KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
483KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" 550KERNEL_IMAGE_SYMLINK_NAME ?= "${MACHINE}"
484MODULE_IMAGE_BASE_NAME ?= "modules-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" 551MODULE_IMAGE_BASE_NAME ?= "modules-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
485MODULE_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" 552MODULE_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
486MODULE_TARBALL_BASE_NAME ?= "${MODULE_IMAGE_BASE_NAME}.tgz" 553MODULE_TARBALL_BASE_NAME ?= "${MODULE_IMAGE_BASE_NAME}.tgz"
@@ -489,28 +556,37 @@ MODULE_TARBALL_SYMLINK_NAME ?= "modules-${MACHINE}.tgz"
489MODULE_TARBALL_DEPLOY ?= "1" 556MODULE_TARBALL_DEPLOY ?= "1"
490 557
491kernel_do_deploy() { 558kernel_do_deploy() {
492 install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin 559 for type in ${KERNEL_IMAGETYPES} ; do
560 base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
561 install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${DEPLOYDIR}/${base_name}.bin
562 done
493 if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then 563 if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
494 mkdir -p ${D}/lib 564 mkdir -p ${D}/lib
495 tar -cvzf ${DEPLOYDIR}/${MODULE_TARBALL_BASE_NAME} -C ${D} lib 565 tar -cvzf ${DEPLOYDIR}/${MODULE_TARBALL_BASE_NAME} -C ${D} lib
496 ln -sf ${MODULE_TARBALL_BASE_NAME} ${DEPLOYDIR}/${MODULE_TARBALL_SYMLINK_NAME} 566 ln -sf ${MODULE_TARBALL_BASE_NAME} ${DEPLOYDIR}/${MODULE_TARBALL_SYMLINK_NAME}
497 fi 567 fi
498 568
499 ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOYDIR}/${KERNEL_IMAGE_SYMLINK_NAME}.bin 569 for type in ${KERNEL_IMAGETYPES} ; do
500 ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOYDIR}/${KERNEL_IMAGETYPE} 570 base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
571 symlink_name=${type}-${KERNEL_IMAGE_SYMLINK_NAME}
572 ln -sf ${base_name}.bin ${DEPLOYDIR}/${symlink_name}.bin
573 ln -sf ${base_name}.bin ${DEPLOYDIR}/${type}
574 done
501 575
502 cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt 576 cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
503 577
504 cd ${B} 578 cd ${B}
505 # Update deploy directory 579 # Update deploy directory
506 if [ -e "${KERNEL_OUTPUT}.initramfs" ]; then 580 for type in ${KERNEL_IMAGETYPES} ; do
507 echo "Copying deploy kernel-initramfs image and setting up links..." 581 if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
508 initramfs_base_name=${INITRAMFS_BASE_NAME} 582 echo "Copying deploy ${type} kernel-initramfs image and setting up links..."
509 initramfs_symlink_name=${KERNEL_IMAGETYPE}-initramfs-${MACHINE} 583 initramfs_base_name=${type}-${INITRAMFS_BASE_NAME}
510 install -m 0644 ${KERNEL_OUTPUT}.initramfs ${DEPLOYDIR}/${initramfs_base_name}.bin 584 initramfs_symlink_name=${type}-initramfs-${MACHINE}
511 cd ${DEPLOYDIR} 585 install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}.initramfs ${DEPLOYDIR}/${initramfs_base_name}.bin
512 ln -sf ${initramfs_base_name}.bin ${initramfs_symlink_name}.bin 586 cd ${DEPLOYDIR}
513 fi 587 ln -sf ${initramfs_base_name}.bin ${initramfs_symlink_name}.bin
588 fi
589 done
514} 590}
515do_deploy[cleandirs] = "${DEPLOYDIR}" 591do_deploy[cleandirs] = "${DEPLOYDIR}"
516do_deploy[dirs] = "${DEPLOYDIR} ${B}" 592do_deploy[dirs] = "${DEPLOYDIR} ${B}"
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 4234d75fd2..dcc324c6cc 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -245,6 +245,7 @@ KERNEL_CLASSES[doc] = "A list of classes defining kernel image types that kernel
245KERNEL_EXTRA_ARGS[doc] = "Specifies additional make command-line arguments the OpenEmbedded build system passes on when compiling the kernel." 245KERNEL_EXTRA_ARGS[doc] = "Specifies additional make command-line arguments the OpenEmbedded build system passes on when compiling the kernel."
246KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kernel Git repository. The metadata you add through this variable includes config fragments and features descriptions." 246KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kernel Git repository. The metadata you add through this variable includes config fragments and features descriptions."
247KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'." 247KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'."
248KERNEL_IMAGETYPES[doc] = "The list of types of kernel to build for a device, usually set by the machine configuration files and defaults to KERNEL_IMAGETYPE."
248KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot" 249KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
249KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules" 250KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules"
250KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)." 251KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 651a19e4ae..74f5ef8ca8 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -34,9 +34,12 @@ do_install_append() {
34 for DTB in ${KERNEL_DEVICETREE}; do 34 for DTB in ${KERNEL_DEVICETREE}; do
35 DTB=`normalize_dtb "${DTB}"` 35 DTB=`normalize_dtb "${DTB}"`
36 DTB_BASE_NAME=`basename ${DTB} .dtb` 36 DTB_BASE_NAME=`basename ${DTB} .dtb`
37 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"` 37 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
38 DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"` 38 symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
39 install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb 39 DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
40 DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
41 install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
42 done
40 done 43 done
41} 44}
42 45
@@ -44,31 +47,39 @@ do_deploy_append() {
44 for DTB in ${KERNEL_DEVICETREE}; do 47 for DTB in ${KERNEL_DEVICETREE}; do
45 DTB=`normalize_dtb "${DTB}"` 48 DTB=`normalize_dtb "${DTB}"`
46 DTB_BASE_NAME=`basename ${DTB} .dtb` 49 DTB_BASE_NAME=`basename ${DTB} .dtb`
47 DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"` 50 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
48 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"` 51 base_name=${type}"-"${KERNEL_IMAGE_BASE_NAME}
49 DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"` 52 symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
50 install -d ${DEPLOYDIR} 53 DTB_NAME=`echo ${base_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
51 install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb 54 DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
52 ln -sf ${DTB_NAME}.dtb ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb 55 DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
56 install -d ${DEPLOYDIR}
57 install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
58 ln -sf ${DTB_NAME}.dtb ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb
59 done
53 done 60 done
54} 61}
55 62
56pkg_postinst_kernel-devicetree () { 63pkg_postinst_kernel-devicetree () {
57 cd /${KERNEL_IMAGEDEST} 64 cd /${KERNEL_IMAGEDEST}
58 for DTB in ${KERNEL_DEVICETREE} 65 for DTB in ${KERNEL_DEVICETREE}; do
59 do 66 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
60 DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print $1}'` 67 symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
61 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"` 68 DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print $1}'`
62 update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb /boot/devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true 69 DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
70 update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb /boot/devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
71 done
63 done 72 done
64} 73}
65 74
66pkg_postrm_kernel-devicetree () { 75pkg_postrm_kernel-devicetree () {
67 cd /${KERNEL_IMAGEDEST} 76 cd /${KERNEL_IMAGEDEST}
68 for DTB in ${KERNEL_DEVICETREE} 77 for DTB in ${KERNEL_DEVICETREE}; do
69 do 78 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
70 DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print $1}'` 79 symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
71 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"` 80 DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print $1}'`
72 update-alternatives --remove ${DTB_BASE_NAME}.dtb /boot/devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true 81 DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
82 update-alternatives --remove ${DTB_BASE_NAME}.dtb /boot/devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
83 done
73 done 84 done
74} 85}