u-boot 2012.10: add the latest SDK 05.06 version from meta-arago
[glsdk/meta-ti-glsdk.git] / recipes-ti / local-power-manager / ti-local-power-manager.inc
1 DESCRIPTION = "TI Local Power Manager (LPM)"
2 HOMEPAGE = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/lpm"
3 SECTION = "devel"
4 LICENSE = "GPLv2"
6 LIC_FILES_CHKSUM = "file://gpl_2.0.txt;md5=ebb5c50ab7cab4baeffba14977030c07"
8 # TODO : Hardcoded path to evm3530 - need to fix when adding omap24xx/dm6446 (other lpm targets)
10 require ../includes/ti-paths.inc
11 require ../includes/ti-staging.inc
13 PROVIDES = "ti-lpm-module"
14 PROVIDES += "ti-lpm-utils"
16 # This package builds a kernel module, use kernel PR as base and append a local version
17 PR = "${MACHINE_KERNEL_PR}"
18 PR_append = "e"
20 S = "${WORKDIR}/local_power_manager_linux_${PV}"
22 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"
24 DEPENDS = "ti-dsplink ti-xdctools"
25 DEPENDS += "virtual/kernel"
27 # SOC_FAMILY configuration
29 LPMDSPPOWERSOC_omap3  = "omap3530"
30 LPMDSPPOWERSOC_dm6446 = "dm6446"
31 LPMDSPPOWERSOC       ?= "UNDEFINED_LPMDSPPOWERSOC"
33 XDC_PLATFORM_dm6446   = "ti.platforms.evmDM6446"
34 XDC_PLATFORM_omap3    = "ti.platforms.evm3530"
35 XDC_PLATFORM         ?= "UNDEFINED_XDC_PLATFORM"
37 do_configure () {
39     # Generate a config.bld for XDC
41     cat > ${S}/config.bld <<EOF
43 /* Generated by ti-local-power-manager.inc OE recipe */
45 var Build = xdc.useModule('xdc.bld.BuildEnvironment');
47 var GCArmv5T = xdc.useModule('gnu.targets.arm.GCArmv5T');
48 GCArmv5T.LONGNAME = "${TARGET_PREFIX}gcc";
49 GCArmv5T.rootDir = "${TOOLCHAIN_PATH}";
50 GCArmv5T.ccOpts.prefix += " -Wall -fno-strict-aliasing ";
51 GCArmv5T.lnkOpts.suffix = GCArmv5T.lnkOpts.suffix.replace("-lstdc++", "");
52 GCArmv5T.lnkOpts.suffix += " -lpthread ";
53 GCArmv5T.platform = null;
54 GCArmv5T.platforms = [
55     "${XDC_PLATFORM}"
56 ];
58 /* remove profiles we don't use */
59 delete GCArmv5T.profiles["coverage"];
60 delete GCArmv5T.profiles["profile"];
62 Build.targets.\$add(GCArmv5T);
63 EOF
65 }
67 do_prepsources () {
69     # Prepare the tree for rebuiling - generate makefiles and clean
70     XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc .make -PR .
71     XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc clean -PR .
72 }
74 addtask prepsources after do_configure before do_compile
76 do_compile () {
78     # Build the LPM kernel module
79     unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
80     cd ${S}/packages/ti/bios/power/modules/${LPMDSPPOWERSOC}/lpm
81     make \
82       DSPLINK_REPO="${LINK_INSTALL_DIR}" \
83       LINUXKERNEL_INSTALL_DIR="${STAGING_KERNEL_DIR}" \
84       MVTOOL_PREFIX="${TARGET_PREFIX}" \
85       clean default
87     # Build the user space library
88     # TODO
90     # Build the utilities (lpmON/OFF)
91     cd ${S}
92     XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc -PR .
93 }
95 KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}"
97 do_install () {
99     # Install the kernel module 
100     install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
101     install -m 0755 ${S}/packages/ti/bios/power/modules/${LPMDSPPOWERSOC}/lpm/*.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
103     # Install the Utilities
104     install -d ${D}/${installdir}/ti-lpm-utils
105     install -m 0755 ${S}/packages/ti/bios/power/utils/bin/$(echo ${XDC_PLATFORM} | tr . _)/linux/release/* ${D}/${installdir}/ti-lpm-utils
107     # Install/Stage the Source Tree 
108     install -d ${D}${LPM_INSTALL_DIR_RECIPE}
109     cp -pPrf ${S}/* ${D}${LPM_INSTALL_DIR_RECIPE}
112 PACKAGE_ARCH = "${MACHINE_ARCH}"
113 PACKAGES += "ti-lpm-module"
114 FILES_ti-lpm-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/*lpm*ko"
115 RDEPENDS_ti-lpm-module += "ti-dsplink-module"
116 RDEPENDS_ti-lpm-module += "update-modules"
118 pkg_postinst_ti-lpm-module_append () {
119         if [ -n "$D" ]; then
120                 exit 1
121         fi
122         depmod -a
123         update-modules || true
126 pkg_postrm_ti-lpm-module_append () {
127         update-modules || true
130 PACKAGES += "ti-lpm-utils"
131 RDEPENDS_ti-lpm-utils += "ti-lpm-module"
132 FILES_ti-lpm-utils = "${installdir}/ti-lpm-utils/*"
133 INSANE_SKIP_ti-lpm-utils = "1"