summaryrefslogtreecommitdiffstats
path: root/recipes-ti/local-power-manager/ti-local-power-manager.inc
blob: 2f2b52568d199835cc33ac2a611dc8b53bb94902 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
DESCRIPTION = "TI Local Power Manager (LPM)"
HOMEPAGE = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/lpm"
SECTION = "devel"
LICENSE = "GPLv2"

LIC_FILES_CHKSUM = "file://gpl_2.0.txt;md5=ebb5c50ab7cab4baeffba14977030c07"

# TODO : Hardcoded path to evm3530 - need to fix when adding omap24xx/dm6446 (other lpm targets)

require ../includes/ti-paths.inc
require ../includes/ti-staging.inc

PROVIDES = "ti-lpm-module"
PROVIDES += "ti-lpm-utils"

# This package builds a kernel module, use kernel PR as base and append a local version
PR = "${MACHINE_KERNEL_PR}"
PR_append = "e"

S = "${WORKDIR}/local_power_manager_linux_${PV}"

SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/lpm/${PV}/exports/local_power_manager_linux_${PV}.tar.gz;name=lpmtarball"

DEPENDS = "ti-dsplink ti-xdctools"
DEPENDS += "virtual/kernel"

# SOC_FAMILY configuration

LPMDSPPOWERSOC_omap3  = "omap3530"
LPMDSPPOWERSOC_dm6446 = "dm6446"
LPMDSPPOWERSOC       ?= "UNDEFINED_LPMDSPPOWERSOC"

XDC_PLATFORM_dm6446   = "ti.platforms.evmDM6446"
XDC_PLATFORM_omap3    = "ti.platforms.evm3530"
XDC_PLATFORM         ?= "UNDEFINED_XDC_PLATFORM"

do_configure () {

    # Generate a config.bld for XDC

    cat > ${S}/config.bld <<EOF

/* Generated by ti-local-power-manager.inc OE recipe */

var Build = xdc.useModule('xdc.bld.BuildEnvironment');

var GCArmv5T = xdc.useModule('gnu.targets.arm.GCArmv5T');
GCArmv5T.LONGNAME = "${TARGET_PREFIX}gcc";
GCArmv5T.rootDir = "${TOOLCHAIN_PATH}";
GCArmv5T.ccOpts.prefix += " -Wall -fno-strict-aliasing ";
GCArmv5T.lnkOpts.suffix = GCArmv5T.lnkOpts.suffix.replace("-lstdc++", "");
GCArmv5T.lnkOpts.suffix += " -lpthread ";
GCArmv5T.platform = null;
GCArmv5T.platforms = [
    "${XDC_PLATFORM}"
];

/* remove profiles we don't use */
delete GCArmv5T.profiles["coverage"];
delete GCArmv5T.profiles["profile"];

Build.targets.\$add(GCArmv5T);
EOF

}

do_prepsources () {

    # Prepare the tree for rebuiling - generate makefiles and clean
    XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc .make -PR .
    XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc clean -PR .
}

addtask prepsources after do_configure before do_compile

do_compile () {

    # Build the LPM kernel module
    unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
    cd ${S}/packages/ti/bios/power/modules/${LPMDSPPOWERSOC}/lpm
    make \
      DSPLINK_REPO="${LINK_INSTALL_DIR}" \
      LINUXKERNEL_INSTALL_DIR="${STAGING_KERNEL_DIR}" \
      MVTOOL_PREFIX="${TARGET_PREFIX}" \
      clean default

    # Build the user space library
    # TODO

    # Build the utilities (lpmON/OFF)
    cd ${S}
    XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc -PR .
}

KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}"

do_install () {

    # Install the kernel module 
    install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
    install -m 0755 ${S}/packages/ti/bios/power/modules/${LPMDSPPOWERSOC}/lpm/*.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp

    # Install the Utilities
    install -d ${D}/${installdir}/ti-lpm-utils
    install -m 0755 ${S}/packages/ti/bios/power/utils/bin/$(echo ${XDC_PLATFORM} | tr . _)/linux/release/* ${D}/${installdir}/ti-lpm-utils

    # Install/Stage the Source Tree 
    install -d ${D}${LPM_INSTALL_DIR_RECIPE}
    cp -pPrf ${S}/* ${D}${LPM_INSTALL_DIR_RECIPE}
}

PACKAGE_ARCH = "${MACHINE_ARCH}"
PACKAGES += "ti-lpm-module"
FILES_ti-lpm-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/*lpm*ko"
RDEPENDS_ti-lpm-module += "ti-dsplink-module"

PACKAGES += "ti-lpm-utils"
RDEPENDS_ti-lpm-utils += "ti-lpm-module"
FILES_ti-lpm-utils = "${installdir}/ti-lpm-utils/*"
INSANE_SKIP_ti-lpm-utils = "1"