Merge branch 'org.openembedded.dev' of git://git.openembedded.net/openembedded into...
[vuplus_openembedded] / packages / dsplink / ti-lpm-module_2.21.bb
1 DESCRIPTION = "Codec Engine for TI ARM/DSP processors - power module"
2
3 DEPENDS = "virtual/kernel perl-native dsplink"
4 RDEPENDS = "update-modules"
5
6 inherit module
7
8 # tconf from xdctools dislikes '.' in pwd :/
9 PR = "r1"
10 PV = "221"
11
12 # Get CE tarball from TI website, place in sources and calculate
13 # md5sum
14 # Look for tarball at https://www-a.ti.com/downloads/sds_support/targetcontent/CE/index.html
15
16 SRC_URI = "http://install.tarball.in.source.dir/codec_engine_2_21_00_06.tar.gz \
17            file://Makefile.dsplink \
18           "
19
20 S = "${WORKDIR}/codec_engine_2_21_00_06"
21
22 require ti-paths.inc
23
24 PARALLEL_MAKE = ""
25
26 do_compile() {
27         echo "MVTOOL_PREFIX=${TARGET_PREFIX}" > ${S}/Rules.make         
28         echo "UCTOOL_PREFIX=${TARGET_PREFIX}" >> ${S}/Rules.make
29         echo "LINUXKERNEL_INSTALL_DIR=${STAGING_KERNEL_DIR}"  >> ${S}/Rules.make
30
31         # Build the DSP power manager kernel module
32         cd ${S}/cetools/packages/ti/bios/power
33
34         # Unpack all kernel sources for the DSP power manager module
35         for dsp in $(ls | grep bld | awk -F, '{print $2}' | awk -F_ '{print $1}') ; do
36                 if ! [ -e $dsp ] ; then tar xf ti_bios_power,${dsp}_bld.tar ; fi
37         done            
38         
39         cd ${DSPPOWERSOC}/lpm
40
41         export KERNEL_DIR=${STAGING_KERNEL_DIR}
42         export TOOL_PREFIX=${TARGET_PREFIX} 
43
44         # Different SoCs use different toolchains by default, we just want them to use the OE one, so replace the entries because they can't be overloaded within the environment
45         sed -i -e s:/db/toolsrc/library/tools/vendors/mvl/arm/omap3/OMAP35x_SDK_0.9.7/src/linux/kernel_org/2.6_kernel:${STAGING_KERNEL_DIR}:g \
46            -e s:/db/toolsrc/library/tools/vendors/cs/arm/arm-2007q3/bin/arm-none-linux-gnueabi-:${TARGET_PREFIX}:g \
47            -e s:/db/atree/library/trees/power/power-d02x/imports:${STAGING_DIR}/${MULTIMACH_TARGET_SYS}:g \
48            -e s:/db/toolsrc/library/tools/vendors/mvl/arm/dm6446/REL_LSP_02_00_00_010/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.18_pro500:${STAGING_KERNEL_DIR}:g \
49            -e s:/db/toolsrc/library/tools/vendors/mvl/arm/mvl5.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-:${TARGET_PREFIX}:g \
50         Makefile
51
52         oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR}   \
53            KERNEL_SRC=${STAGING_KERNEL_DIR}    \
54            KERNEL_VERSION=${KERNEL_VERSION}    \
55            CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
56            AR="${KERNEL_AR}"
57 }
58
59
60 do_install() {
61                 install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
62                 cp ${S}/cetools/packages/ti/bios/power/${DSPPOWERSOC}/lpm/*.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp || true
63 }
64
65 INHIBIT_PACKAGE_STRIP = "1"
66
67 FILES_ti-lpm-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/*lpm*ko"
68
69 pkg_postinst_ti-lpm-module () {
70         if [ -n "$D" ]; then
71                 exit 1
72         fi
73         depmod -a
74         update-modules || true
75 }
76
77 pkg_postrm_ti-lpm-module () {
78         update-modules || true
79 }
80
81
82 PACKAGE_ARCH = "${MACHINE_ARCH}"