diff options
-rw-r--r-- | meta/classes/kernel.bbclass | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 35ddbeb869..059f787eb8 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass | |||
@@ -45,6 +45,7 @@ HOST_LD_KERNEL_ARCH ?= "${TARGET_LD_KERNEL_ARCH}" | |||
45 | KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc${KERNEL_CCSUFFIX} ${HOST_CC_KERNEL_ARCH}" | 45 | KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc${KERNEL_CCSUFFIX} ${HOST_CC_KERNEL_ARCH}" |
46 | KERNEL_LD = "${LD}${KERNEL_LDSUFFIX} ${HOST_LD_KERNEL_ARCH}" | 46 | KERNEL_LD = "${LD}${KERNEL_LDSUFFIX} ${HOST_LD_KERNEL_ARCH}" |
47 | 47 | ||
48 | # Where built kernel lies in the kernel tree | ||
48 | KERNEL_OUTPUT = "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}" | 49 | KERNEL_OUTPUT = "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}" |
49 | KERNEL_IMAGEDEST = "boot" | 50 | KERNEL_IMAGEDEST = "boot" |
50 | 51 | ||
@@ -63,6 +64,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" | |||
63 | 64 | ||
64 | # U-Boot support | 65 | # U-Boot support |
65 | UBOOT_ENTRYPOINT ?= "20008000" | 66 | UBOOT_ENTRYPOINT ?= "20008000" |
67 | UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" | ||
66 | 68 | ||
67 | kernel_do_compile() { | 69 | kernel_do_compile() { |
68 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE | 70 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE |
@@ -125,8 +127,14 @@ kernel_do_stage() { | |||
125 | if [ -e arch/${ARCH}/Makefile ]; then | 127 | if [ -e arch/${ARCH}/Makefile ]; then |
126 | install -d ${STAGING_KERNEL_DIR}/arch/${ARCH} | 128 | install -d ${STAGING_KERNEL_DIR}/arch/${ARCH} |
127 | install -m 0644 arch/${ARCH}/Makefile* ${STAGING_KERNEL_DIR}/arch/${ARCH} | 129 | install -m 0644 arch/${ARCH}/Makefile* ${STAGING_KERNEL_DIR}/arch/${ARCH} |
130 | # Otherwise check arch/x86/Makefile for i386 and x86_64 on kernels >= 2.6.24 | ||
131 | elif [ -e arch/x86/Makefile ]; then | ||
132 | install -d ${STAGING_KERNEL_DIR}/arch/x86 | ||
133 | install -m 0644 arch/x86/Makefile* ${STAGING_KERNEL_DIR}/arch/x86 | ||
128 | fi | 134 | fi |
129 | cp -fR include/config* ${STAGING_KERNEL_DIR}/include/ | 135 | cp -fR include/config* ${STAGING_KERNEL_DIR}/include/ |
136 | # Install kernel images and system.map to staging | ||
137 | [ -e vmlinux ] && install -m 0644 vmlinux ${STAGING_KERNEL_DIR}/ | ||
130 | install -m 0644 ${KERNEL_OUTPUT} ${STAGING_KERNEL_DIR}/${KERNEL_IMAGETYPE} | 138 | install -m 0644 ${KERNEL_OUTPUT} ${STAGING_KERNEL_DIR}/${KERNEL_IMAGETYPE} |
131 | install -m 0644 System.map ${STAGING_KERNEL_DIR}/System.map-${KERNEL_VERSION} | 139 | install -m 0644 System.map ${STAGING_KERNEL_DIR}/System.map-${KERNEL_VERSION} |
132 | [ -e Module.symvers ] && install -m 0644 Module.symvers ${STAGING_KERNEL_DIR}/ | 140 | [ -e Module.symvers ] && install -m 0644 Module.symvers ${STAGING_KERNEL_DIR}/ |
@@ -249,6 +257,8 @@ module_autoload_ipsec = "ipsec" | |||
249 | module_autoload_ircomm-tty = "ircomm-tty" | 257 | module_autoload_ircomm-tty = "ircomm-tty" |
250 | module_autoload_rfcomm = "rfcomm" | 258 | module_autoload_rfcomm = "rfcomm" |
251 | module_autoload_sa1100-rtc = "sa1100-rtc" | 259 | module_autoload_sa1100-rtc = "sa1100-rtc" |
260 | # sa1100-rtc was renamed in 2.6.23 onwards | ||
261 | module_autoload_rtc-sa1100 = "rtc-sa1100" | ||
252 | 262 | ||
253 | # alias defaults (alphabetically sorted) | 263 | # alias defaults (alphabetically sorted) |
254 | module_conf_af_packet = "alias net-pf-17 af_packet" | 264 | module_conf_af_packet = "alias net-pf-17 af_packet" |
@@ -405,7 +415,7 @@ python populate_packages_prepend () { | |||
405 | metapkg = "kernel-modules" | 415 | metapkg = "kernel-modules" |
406 | bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d) | 416 | bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d) |
407 | bb.data.setVar('FILES_' + metapkg, "", d) | 417 | bb.data.setVar('FILES_' + metapkg, "", d) |
408 | blacklist = [ 'kernel-dev', 'kernel-image', 'kernel-base' ] | 418 | blacklist = [ 'kernel-dev', 'kernel-image', 'kernel-base', 'kernel-vmlinux' ] |
409 | for l in module_deps.values(): | 419 | for l in module_deps.values(): |
410 | for i in l: | 420 | for i in l: |
411 | pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1)) | 421 | pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1)) |
@@ -424,45 +434,45 @@ python populate_packages_prepend () { | |||
424 | # Support checking the kernel size since some kernels need to reside in partitions | 434 | # Support checking the kernel size since some kernels need to reside in partitions |
425 | # with a fixed length or there is a limit in transferring the kernel to memory | 435 | # with a fixed length or there is a limit in transferring the kernel to memory |
426 | do_sizecheck() { | 436 | do_sizecheck() { |
427 | if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then | 437 | if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then |
428 | size=`ls -l arch/${ARCH}/boot/${KERNEL_IMAGETYPE} | awk '{ print $5}'` | 438 | size=`ls -l arch/${ARCH}/boot/${KERNEL_IMAGETYPE} | awk '{ print $5}'` |
429 | if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then | 439 | if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then |
430 | rm arch/${ARCH}/boot/${KERNEL_IMAGETYPE} | 440 | rm arch/${ARCH}/boot/${KERNEL_IMAGETYPE} |
431 | 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." | 441 | 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." |
432 | fi | 442 | fi |
433 | fi | 443 | fi |
434 | } | 444 | } |
435 | 445 | ||
436 | addtask sizecheck before do_install after do_compile | 446 | addtask sizecheck before do_install after do_compile |
437 | 447 | ||
438 | KERNEL_IMAGE_BASE_NAME = "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}" | 448 | KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}" |
439 | KERNEL_IMAGE_SYMLINK_NAME = "${KERNEL_IMAGETYPE}-${MACHINE}" | 449 | KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" |
440 | 450 | ||
441 | do_deploy() { | 451 | do_deploy() { |
442 | install -d ${DEPLOY_DIR_IMAGE} | 452 | install -d ${DEPLOY_DIR_IMAGE} |
443 | install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin | 453 | install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin |
444 | package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin | 454 | package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin |
445 | tar -cvzf ${DEPLOY_DIR_IMAGE}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib | 455 | tar -cvzf ${DEPLOY_DIR_IMAGE}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib |
446 | 456 | ||
447 | if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then | 457 | if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then |
448 | if test -e arch/${ARCH}/boot/compressed/vmlinux ; then | 458 | if test -e arch/${ARCH}/boot/compressed/vmlinux ; then |
449 | ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin | 459 | ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin |
450 | uboot-mkimage -A ${ARCH} -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE}-${DATETIME}.bin | 460 | uboot-mkimage -A ${ARCH} -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE}-${DATETIME}.bin |
451 | rm -f linux.bin | 461 | rm -f linux.bin |
452 | else | 462 | else |
453 | ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin | 463 | ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin |
454 | rm -f linux.bin.gz | 464 | rm -f linux.bin.gz |
455 | gzip -9 linux.bin | 465 | gzip -9 linux.bin |
456 | uboot-mkimage -A ${ARCH} -O linux -T kernel -C gzip -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE}-${DATETIME}.bin | 466 | uboot-mkimage -A ${ARCH} -O linux -T kernel -C gzip -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE}-${DATETIME}.bin |
457 | rm -f linux.bin.gz | 467 | rm -f linux.bin.gz |
458 | fi | 468 | fi |
459 | package_stagefile_shell ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE}-${DATETIME}.bin | 469 | package_stagefile_shell ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE}-${DATETIME}.bin |
460 | fi | 470 | fi |
461 | 471 | ||
462 | cd ${DEPLOY_DIR_IMAGE} | 472 | cd ${DEPLOY_DIR_IMAGE} |
463 | rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin | 473 | rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin |
464 | ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin | 474 | ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin |
465 | package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_SYMLINK_NAME}.bin | 475 | package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_SYMLINK_NAME}.bin |
466 | } | 476 | } |
467 | 477 | ||
468 | do_deploy[dirs] = "${S}" | 478 | do_deploy[dirs] = "${S}" |