diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/kernel-yocto.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/kernel.bbclass | 91 | ||||
-rw-r--r-- | meta/classes/kernelsrc.bbclass | 7 | ||||
-rw-r--r-- | meta/classes/linux-kernel-base.bbclass | 13 |
4 files changed, 21 insertions, 92 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index c3e24943bb..45bdc9670a 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass @@ -1,5 +1,3 @@ -S = "${WORKDIR}/linux" - # remove tasks that modify the source tree in case externalsrc is inherited SRCTREECOVEREDTASKS += "do_kernel_link_vmlinux do_kernel_configme do_validate_branches do_kernel_configcheck do_kernel_checkout do_patch" diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 70ed95bbe0..bca34f4698 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass @@ -3,6 +3,8 @@ 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" +S = "${STAGING_DIR_TARGET}/${KERNEL_SRC_PATH}" + # we include gcc above, we dont need virtual/libc INHIBIT_DEFAULT_DEPS = "1" @@ -55,7 +57,7 @@ KERNEL_IMAGEDEST = "boot" # export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}" -KERNEL_VERSION = "${@get_kernelversion('${B}')}" +KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}" KERNEL_LOCALVERSION ?= "" @@ -221,93 +223,6 @@ kernel_do_install() { # echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion - - # - # Store kernel image name to allow use during image generation - # - - echo "${KERNEL_IMAGE_BASE_NAME}" >$kerneldir/kernel-image-name - - # - # Copy the entire source tree. In case an external build directory is - # used, copy the build directory over first, then copy over the source - # dir. This ensures the original Makefiles are used and not the - # redirecting Makefiles in the build directory. - # - find . -depth -not -name "*.cmd" -not -name "*.o" -not -name "*.so.dbg" -not -name "*.so" -not -path "./Documentation*" -not -path "./source*" -not -path "./.*" -print0 | cpio --null -pdlu $kerneldir - cp .config $kerneldir - if [ "${S}" != "${B}" ]; then - pwd="$PWD" - cd "${S}" - find . -depth -not -path "./Documentation*" -not -path "./.*" -print0 | cpio --null -pdlu $kerneldir - cd "$pwd" - fi - - # Test to ensure that the output file and image type are not actually - # the same file. If hardlinking is used, they will be the same, and there's - # no need to install. - ! [ ${KERNEL_OUTPUT} -ef $kerneldir/${KERNEL_IMAGETYPE} ] && install -m 0644 ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE} - install -m 0644 System.map $kerneldir/System.map-${KERNEL_VERSION} - - # Dummy Makefile so the clean below works - mkdir $kerneldir/Documentation - touch $kerneldir/Documentation/Makefile - - # - # Clean and remove files not needed for building modules. - # Some distributions go through a lot more trouble to strip out - # unecessary headers, for now, we just prune the obvious bits. - # - # We don't want to leave host-arch binaries in /sysroots, so - # we clean the scripts dir while leaving the generated config - # and include files. - # - oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts - - # hide directories that shouldn't have their .c, s and S files deleted - for d in tools scripts lib; do - mv $kerneldir/$d $kerneldir/.$d - done - - # delete .c, .s and .S files, unless we hid a directory as .<dir>. This technique is - # much faster than find -prune and -exec - find $kerneldir -not -path '*/\.*' -type f -name "*.[csS]" -delete - - # put the hidden dirs back - for d in tools scripts lib; do - mv $kerneldir/.$d $kerneldir/$d - done - - # As of Linux kernel version 3.0.1, the clean target removes - # arch/powerpc/lib/crtsavres.o which is present in - # KBUILD_LDFLAGS_MODULE, making it required to build external modules. - if [ ${ARCH} = "powerpc" ]; then - cp -l arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o - fi - - # Necessary for building modules like compat-wireless. - if [ -f include/generated/bounds.h ]; then - cp -l include/generated/bounds.h $kerneldir/include/generated/bounds.h - fi - if [ -d arch/${ARCH}/include/generated ]; then - mkdir -p $kerneldir/arch/${ARCH}/include/generated/ - cp -flR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/ - fi - - # Remove the following binaries which cause strip or arch QA errors - # during do_package for cross-compiled platforms - bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \ - arch/powerpc/boot/mktree scripts/kconfig/zconf.tab.o \ - scripts/kconfig/conf.o scripts/kconfig/kxgettext.o" - for entry in $bin_files; do - rm -f $kerneldir/$entry - done - - # kernels <2.6.30 don't have $kerneldir/tools directory so we check if it exists before calling sed - if [ -f $kerneldir/tools/perf/Makefile ]; then - # Fix SLANG_INC for slang.h - sed -i 's#-I/usr/include/slang#-I=/usr/include/slang#g' $kerneldir/tools/perf/Makefile - fi } do_install[prefuncs] += "package_get_auto_pr" diff --git a/meta/classes/kernelsrc.bbclass b/meta/classes/kernelsrc.bbclass new file mode 100644 index 0000000000..11f04e9612 --- /dev/null +++ b/meta/classes/kernelsrc.bbclass @@ -0,0 +1,7 @@ +S = "${STAGING_KERNEL_DIR}" +do_unpack[depends] += "virtual/kernel:do_patch" +do_package[depends] += "virtual/kernel:do_populate_sysroot" +KERNEL_VERSION = "${@get_kernelversion_file("${S}")}" + +inherit linux-kernel-base + diff --git a/meta/classes/linux-kernel-base.bbclass b/meta/classes/linux-kernel-base.bbclass index 4f2b0a4a98..89ce71605c 100644 --- a/meta/classes/linux-kernel-base.bbclass +++ b/meta/classes/linux-kernel-base.bbclass @@ -1,5 +1,5 @@ # parse kernel ABI version out of <linux/version.h> -def get_kernelversion(p): +def get_kernelversion_headers(p): import re fn = p + '/include/linux/utsrelease.h' @@ -9,7 +9,6 @@ def get_kernelversion(p): if not os.path.isfile(fn): fn = p + '/include/linux/version.h' - import re try: f = open(fn, 'r') except IOError: @@ -24,6 +23,16 @@ def get_kernelversion(p): return m.group(1) return None + +def get_kernelversion_file(p): + fn = p + '/kernel-abiversion' + + try: + with open(fn, 'r') as f: + return f.readlines()[0].strip() + except IOError: + return None + def linux_module_packages(s, d): suffix = "" return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split())) |