libgcrypt: update to 1.4.6
[openembedded.git] / recipes / ti / 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"
5
6 # TODO : Hardcoded path to evm3530 - need to fix when adding omap24xx/dm6446 (other lpm targets)
7
8 require ti-paths.inc
9 require ti-staging.inc
10
11 PROVIDES = "ti-lpm-module"
12 PROVIDES += "ti-lpm-utils"
13
14 # This package builds a kernel module, use kernel PR as base and append a local version
15 PR = "${MACHINE_KERNEL_PR}"
16 PR_append = "e"
17
18 S = "${WORKDIR}/local_power_manager_linux_${PV}"
19
20 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"
21
22 DEPENDS = "ti-dsplink ti-xdctools"
23 DEPENDS += "virtual/kernel"
24
25 # SOC_FAMILY configuration
26
27 LPMDSPPOWERSOC_omap3  = "omap3530"
28 LPMDSPPOWERSOC_dm6446 = "dm6446"
29 LPMDSPPOWERSOC       ?= "<UNDEFINED_LPMDSPPOWERSOC>"
30
31 XDC_PLATFORM_dm6446   = "ti.platforms.evmDM6446"
32 XDC_PLATFORM_omap3    = "ti.platforms.evm3530"
33 XDC_PLATFORM         ?= "<UNDEFINED_XDC_PLATFORM>"
34
35 do_configure () {
36
37     # Generate a config.bld for XDC
38
39     cat > ${S}/config.bld <<EOF
40
41 /* Generated by ti-local-power-manager.inc OE recipe */
42
43 var Build = xdc.useModule('xdc.bld.BuildEnvironment');
44
45 var GCArmv5T = xdc.useModule('gnu.targets.arm.GCArmv5T');
46 GCArmv5T.LONGNAME = "bin/${TARGET_PREFIX}gcc";
47 GCArmv5T.rootDir = "${TOOLCHAIN_PATH}";
48 GCArmv5T.ccOpts.prefix += " -Wall -fno-strict-aliasing ";
49 GCArmv5T.lnkOpts.suffix = GCArmv5T.lnkOpts.suffix.replace("-lstdc++", "");
50 GCArmv5T.lnkOpts.suffix += " -lpthread ";
51 GCArmv5T.platform = null;
52 GCArmv5T.platforms = [
53     "${XDC_PLATFORM}"
54 ];
55
56 /* remove profiles we don't use */
57 delete GCArmv5T.profiles["coverage"];
58 delete GCArmv5T.profiles["profile"];
59
60 Build.targets.\$add(GCArmv5T);
61 EOF
62
63 }
64
65 do_prepsources () {
66
67     # Prepare the tree for rebuiling - generate makefiles and clean
68     XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc .make -PR .
69     XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc clean -PR .
70 }
71
72 addtask prepsources after do_configure before do_compile
73
74 do_compile () {
75
76     # Build the LPM kernel module
77     unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
78     cd ${S}/packages/ti/bios/power/modules/${LPMDSPPOWERSOC}/lpm
79     make \
80       DSPLINK_REPO="${LINK_INSTALL_DIR}" \
81       LINUXKERNEL_INSTALL_DIR="${STAGING_KERNEL_DIR}" \
82       MVTOOL_PREFIX="${TARGET_PREFIX}" \
83       clean default
84
85     # Build the user space library
86     # TODO
87
88     # Build the utilities (lpmON/OFF)
89     cd ${S}
90     XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc -PR .
91 }
92
93 KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}"
94
95 do_install () {
96
97     # Install the kernel module 
98     install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
99     install -m 0755 ${S}/packages/ti/bios/power/modules/${LPMDSPPOWERSOC}/lpm/*.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
100
101     # Install the Utilities
102     install -d ${D}/${installdir}/ti-lpm-utils
103     install -m 0755 ${S}/packages/ti/bios/power/utils/bin/$(echo ${XDC_PLATFORM} | sed s:\\.:_:g)/linux/release/* ${D}/${installdir}/ti-lpm-utils
104
105     # Install/Stage the Source Tree 
106     install -d ${D}${LPM_INSTALL_DIR_RECIPE}
107     cp -pPrf ${S}/* ${D}${LPM_INSTALL_DIR_RECIPE}
108 }
109
110 PACKAGES += "ti-lpm-module"
111 FILES_ti-lpm-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/*lpm*ko"
112 RDEPENDS_ti-lpm-module += "ti-dsplink-module"
113 RDEPENDS_ti-lpm-module += "update-modules"
114
115 pkg_postinst_ti-lpm-module_append () {
116         if [ -n "$D" ]; then
117                 exit 1
118         fi
119         depmod -a
120         update-modules || true
121 }
122
123 pkg_postrm_ti-lpm-module_append () {
124         update-modules || true
125 }
126
127 PACKAGES += "ti-lpm-utils"
128 RDEPENDS_ti-lpm-utils += "ti-lpm-module"
129 FILES_ti-lpm-utils = "${installdir}/ti-lpm-utils/*"
130 INSANE_SKIP_ti-lpm-utils = True