summaryrefslogtreecommitdiff
path: root/recipes-kernel/linux/linux-common.inc
blob: 0af22a1256bf8805b779867f5b3d18c5cff55dba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright (C) 2014-2015 PHYTEC Messtechnik GmbH,
# Author: Stefan Mueller-Klieser <s.mueller-klieser@phytec.de>
DESCRIPTION = "Linux Kernel Phytec common base"
SECTION = "kernel"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"

inherit kernel
inherit kconfig
require recipes-kernel/linux/linux-dtb.inc

INC_PR = "r0"

DEPENDS += "lzop-native lz4-native"
PATCHTOOL = "git"

SRCTREECOVEREDTASKS ?= "do_unpack do_fetch"

# Copy .dts iand .dtsi from SRC_URI to the kernel boot/dts path
# This should go to poky/meta/recipes-kernel/linux/linux-dtb.inc
# returns all the elements from the src uri that are .dts or .dtsi files
def find_dtss(d):
    sources=src_patches(d, True)
    dtss_list=[]
    for s in sources:
        base, ext = os.path.splitext(s)
        if ext in [".dtsi", ".dts"]:
            dtss_list.append(s)

    return dtss_list

do_patch_append () {
    import shutil
    srcdir = d.getVar('STAGING_KERNEL_DIR', True)
    arch = d.getVar('ARCH', True)
    for dts in find_dtss(d):
        cptarget=os.path.join(srcdir, "arch", arch, "boot", "dts",
                             os.path.basename(dts))
        bb.note("copying dts from: %s to: %s" % (dts, cptarget))
        shutil.copyfile(dts, cptarget)
}

# This fixes the broken upstream kernel recipe. In the kernel.bbclass we still
# have a missing fix of:
# addtask shared_workdir after do_compile_kernelmodules before do_strip
# which is refused to be merged because of the crazy yocto-kernel design.
python() {
    d.setVarFlag("do_compile_kernelmodules", "deps", ['do_compile'])
    d.setVarFlag("do_shared_workdir", "deps", ['do_compile_kernelmodules'])
    d.setVarFlag("do_strip", "deps", ['do_shared_workdir', 'do_kernel_link_vmlinux'])
}

KERNEL_IMAGE_BASE_NAME = "${KERNEL_IMAGETYPE}-${PN}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
do_deploy_append() {
    install -m 644 ${B}/.config ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.config
    ln -sf ${KERNEL_IMAGE_BASE_NAME}.config ${DEPLOYDIR}/${KERNEL_IMAGETYPE}.config
}