diff options
Diffstat (limited to 'meta/classes/kernel.bbclass')
| -rw-r--r-- | meta/classes/kernel.bbclass | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 3630042dbd..8954b28b2c 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass @@ -1,7 +1,10 @@ inherit linux-kernel-base kernel-module-split PROVIDES += "virtual/kernel" -DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native lzop-native" +DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native lzop-native" +PACKAGE_WRITE_DEPS += "depmodwrapper-cross virtual/update-alternatives-native" + +do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot" S = "${STAGING_KERNEL_DIR}" B = "${WORKDIR}/build" @@ -13,6 +16,7 @@ INHIBIT_DEFAULT_DEPS = "1" KERNEL_IMAGETYPE ?= "zImage" INITRAMFS_IMAGE ?= "" +INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}-${MACHINE}', ''][d.getVar('INITRAMFS_IMAGE') == '']}" INITRAMFS_TASK ?= "" INITRAMFS_IMAGE_BUNDLE ?= "" @@ -164,34 +168,34 @@ copy_initramfs() { # In case the directory is not created yet from the first pass compile: mkdir -p ${B}/usr # Find and use the first initramfs image archive type we find - rm -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio + rm -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio for img in cpio cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz; do - if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then - cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img ${B}/usr/. + if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img" ]; then + cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/. case $img in *gz) echo "gzip decompressing image" - gunzip -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img + gunzip -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img break ;; *lz4) echo "lz4 decompressing image" - lz4 -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img + lz4 -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img break ;; *lzo) echo "lzo decompressing image" - lzop -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img + lzop -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img break ;; *lzma) echo "lzma decompressing image" - lzma -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img + lzma -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img break ;; *xz) echo "xz decompressing image" - xz -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img + xz -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img break ;; esac @@ -219,7 +223,7 @@ do_bundle_initramfs () { tmp_path=$tmp_path" "$type"##" fi done - use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio + use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio kernel_do_compile # Restoring kernel image for tp in $tmp_path ; do @@ -258,7 +262,7 @@ kernel_do_compile() { # The old style way of copying an prebuilt image and building it # is turned on via INTIRAMFS_TASK != "" copy_initramfs - use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio + use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio fi for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do oe_runmake ${typeformake} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd @@ -296,11 +300,11 @@ kernel_do_install() { # unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then - oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install - rm "${D}/lib/modules/${KERNEL_VERSION}/build" - rm "${D}/lib/modules/${KERNEL_VERSION}/source" + oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install + rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" + rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" # If the kernel/ directory is empty remove it to prevent QA issues - rmdir --ignore-fail-on-non-empty "${D}/lib/modules/${KERNEL_VERSION}/kernel" + rmdir --ignore-fail-on-non-empty "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" else bbnote "no modules to install" fi @@ -324,6 +328,10 @@ do_install[prefuncs] += "package_get_auto_pr" # Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile do_kernel_version_sanity_check() { + if [ "x${KERNEL_VERSION_SANITY_SKIP}" = "x1" ]; then + exit 0 + fi + # The Makefile determines the kernel version shown at runtime # Don't use KERNEL_VERSION because the headers it grabs the version from aren't generated until do_compile VERSION=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//) @@ -347,7 +355,7 @@ do_kernel_version_sanity_check() { reg="${reg}${EXTRAVERSION}" if [ -z `echo ${PV} | grep -E "${reg}"` ]; then - bbfatal "Package Version (${PV}) does not match of kernel being built (${vers}). Please update the PV variable to match the kernel source." + bbfatal "Package Version (${PV}) does not match of kernel being built (${vers}). Please update the PV variable to match the kernel source or set KERNEL_VERSION_SANITY_SKIP=\"1\" in your recipe." fi exit 0 } @@ -478,9 +486,9 @@ EXPORT_FUNCTIONS do_compile do_install do_configure # kernel-image becomes kernel-image-${KERNEL_VERSION} PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules" FILES_${PN} = "" -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin" +FILES_kernel-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin" FILES_kernel-image = "" -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build" +FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" FILES_kernel-vmlinux = "/boot/vmlinux-${KERNEL_VERSION_NAME}" FILES_kernel-modules = "" RDEPENDS_kernel = "kernel-base" @@ -511,7 +519,7 @@ pkg_postinst_kernel-base () { PACKAGESPLITFUNCS_prepend = "split_kernel_packages " python split_kernel_packages () { - do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') + do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex='^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') } # Many scripts want to look in arch/$arch/boot for the bootable @@ -527,7 +535,11 @@ do_kernel_link_images() { if [ -f ../../../vmlinuz ]; then ln -sf ../../../vmlinuz fi + if [ -f ../../../vmlinuz.bin ]; then + ln -sf ../../../vmlinuz.bin + fi } +addtask kernel_link_images after do_compile before do_strip do_strip() { if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then @@ -556,7 +568,7 @@ do_strip() { } do_strip[dirs] = "${B}" -addtask do_strip before do_sizecheck after do_kernel_link_images +addtask strip before do_sizecheck after do_kernel_link_images # Support checking the kernel size since some kernels need to reside in partitions # with a fixed length or there is a limit in transferring the kernel to memory @@ -607,8 +619,6 @@ kernel_do_deploy() { ln -sf ${base_name}.bin ${DEPLOYDIR}/${type} done - cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt - cd ${B} # Update deploy directory for type in ${KERNEL_IMAGETYPES} ; do |
