codec-engine: Added RREPLACES for dsplink packages - bumped PR
[vuplus_openembedded] / packages / dsplink / ti-codec-engine_2.21.bb
1 require dsplink.inc
2
3 DESCRIPTION = "Codec Engine for TI ARM/DSP processors"
4
5 DEPENDS = "virtual/kernel perl-native"
6 RDEPENDS = "update-modules"
7
8 inherit module
9
10 # tconf from xdctools dislikes '.' in pwd :/
11 PR = "r12"
12 PV = "221"
13
14 # Get CE tarball from TI website, place in sources and calculate
15 # md5sum
16 # Look for tarball at https://www-a.ti.com/downloads/sds_support/targetcontent/CE/index.html
17
18 SRC_URI = "http://install.tarball.in.source.dir/codec_engine_2_21.tar.gz \
19            file://cmem-class-device-27-and-sched-include-fix.patch;patch=1 \
20            file://dsplink-semaphore-27.patch;patch=1 \
21            file://lpm-device-create-and-semaphore-include-fix.patch;patch=1 \
22            file://lpm-make-symbol-warnings-fix.patch;patch=1 \
23            file://Makefile-dsplink-gpp \
24            file://Makefile-dsplink-dsp \
25 "
26
27 S = "${WORKDIR}/codec_engine_2_21"
28
29 require ti-paths.inc
30
31 export DSPLINK="${S}/cetools/packages/dsplink"
32
33 PARALLEL_MAKE = ""
34
35 # the include files on top define do_compile for the submodules 
36 do_compile_append() {
37
38 #dsplink already done from inclusion of require dsplink.inc
39
40 #lpm bits
41         if [ -e ${S}/cetools/packages/ti/bios/power/ ] ; then
42                 
43                 # Build the DSP power manager kernel module
44                 cd ${S}/cetools/packages/ti/bios/power/modules/${DSPPOWERSOC}/lpm
45
46                 # Still need to move this into the patch file
47                 if [ $(echo ${KERNEL_VERSION} | cut -c5,6) -gt 26 ] ; then
48                         sed -i -e s:asm/semaphore:linux/semaphore: lpm_driver.c
49                 fi
50
51                 #what is this for?
52                 rm -f *o
53                 
54                 # lpm also needs KERNEL_INSTALL_DIR and MVTOOL_PREFIX which come from ti-paths.inc
55                 export DSPLINK_REPO=${DSPLINK}/..
56                 # should move the clean step into the clean stage..
57                 #oe_runmake clean
58                 oe_runmake
59         fi
60
61 #cmemk bits
62         if [ -e ${S}/cetools/packages/ti/sdo/linuxutils/cmem ] ; then
63                 echo "MVTOOL_PREFIX=${TARGET_PREFIX}" > ${S}/Rules.make
64                 echo "UCTOOL_PREFIX=${TARGET_PREFIX}" >> ${S}/Rules.make
65                 echo "LINUXKERNEL_INSTALL_DIR=${STAGING_KERNEL_DIR}"  >> ${S}/Rules.make
66                 #export DSPLINK=${STAGING_DIR}/${MULTIMACH_TARGET_SYS}/dsplink
67
68                 # Build the cmem kernel module
69                 # We unset CFLAGS because kernel modules need different ones, this is basically a verbatim copy of kernel.bbclass and module-base.bbclass       
70                 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS  
71
72                 cd ${S}/cetools/packages/ti/sdo/linuxutils/cmem
73                 oe_runmake clean
74                 oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR}   \
75                 KERNEL_SRC=${STAGING_KERNEL_DIR}    \
76                 KERNEL_VERSION=${KERNEL_VERSION}    \
77                 CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
78                 AR="${KERNEL_AR}"
79         fi
80
81 #need to add other modules here, like SDMA, etc
82
83
84 #now build the CE examples
85         cd ${S}/examples
86
87         # Fix paths to arm crosstools, c6x codegen and x86 gcc
88         # Also disable uclibc and x86 builds
89         sed -i -e s:/db/toolsrc/library/tools/vendors/cs/arm/arm-2007q3:${CROSS_DIR}:g \
90         -e s:/db/toolsrc/library/tools/vendors/ti/c6x/6.0.16/Linux:${TITOOLSDIR}/${TICGTOOLSDIR}:g \
91         -e s:/db/toolsrc/library/tools/vendors/opensource/gcc/4.1.0/Linux/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu:/usr:g \
92         -e s:arm-none-linux-gnueabi-:${TARGET_PREFIX}:g \
93         -e 's:true, // build for uC Linux:false,:g' \
94         -e 's:true,  // build for PC Linux:false,:g' \
95         ${S}/examples/user.bld
96
97         # For now, remove all targets, except dm6446 and omap3530
98         sed -i \
99         -e '/evmDM357/d' \
100         -e '/evmDM6446/d' \
101         -e '/evmDM6467/d' \
102         -e '/evmDM355/d' \
103         -e '/evmDM6437/d' \
104         -e '/evmDM648/d' \
105         -e '/sdp3430/d' \
106         -e '/evm2530/d' \
107         ${S}/examples/user.bld
108
109         # Fix path to c6x codegen
110         sed -i -e s:/db/toolsrc/library/tools/vendors/ti/c6x/6.0.16/Linux:${TITOOLSDIR}/${TICGTOOLSDIR}:g \
111                 xdcpaths.mak
112         
113         # Start building the CE examples: codecs, extensions, servers (codec bundles) and ARM side apps 
114         # the DSP side uses CC to point to the c6x codegen, but would get the gcc tool
115         unset CC
116
117         # Make clean doesn't do what you'd expect, it only cleans stuff you've enabled, so some cruft remains   
118
119         # First clean
120         for i in codecs extensions servers apps ; do
121                 make -e -C ${S}/examples/ti/sdo/ce/examples/$i clean
122         done    
123
124         # Then build the examples
125         for i in codecs extensions servers apps ; do
126                 make -e -C ${S}/examples/ti/sdo/ce/examples/$i
127         done
128 }
129
130 do_install_append () {
131     #driver - kernel module
132         install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
133         cp ${S}/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp || true
134         cp ${S}/cetools/packages/ti/bios/power/modules/${DSPPOWERSOC}/lpm/*.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp || true
135
136     #library
137         #install -d ${D}/${libdir}
138         #install -m 0755 ${DSPLINK}/gpp/BUILD/EXPORT/RELEASE/dsplink.lib  ${D}/${libdir}
139
140     #sample apps - this is very 64x / v5T specific at the moment - we really need CE to give us this list...
141         install -d ${D}/${datadir}/ti-codec-engine
142         # we change pwd so that find gives us relative path to the files, which we use to create the same structure on the target
143         cd ${S}/examples/ti/sdo/ce
144
145         # first find all the app files named '.out'
146         for i in $(find . -name "*.out") ; do
147                 # first create the directory
148                 install -d ${D}/${datadir}/ti-codec-engine/`dirname ${i}`
149                 # now copy the file             
150                 install ${i} ${D}/${datadir}/ti-codec-engine/`dirname ${i}`
151         done
152
153         # next find all the app files named '.xv5T'
154         for i in $(find . -name "*.xv5T") ; do
155                 # first create the directory
156                 install -d ${D}/${datadir}/ti-codec-engine/`dirname ${i}`
157                 # now copy the file             
158                 install ${i} ${D}/${datadir}/ti-codec-engine/`dirname ${i}`
159         done
160
161         # then find all the app/server files named '.x64P'
162         for i in $(find . -name "*.x64P") ; do
163                 # first create the directory
164                 install -d ${D}/${datadir}/ti-codec-engine/`dirname ${i}`
165                 # now copy the file             
166                 install ${i} ${D}/${datadir}/ti-codec-engine/`dirname ${i}`
167         done
168
169         # finally find all the app files named '.dat'
170         for i in $(find . -name "*.dat") ; do
171                 # first create the directory
172                 install -d ${D}/${datadir}/ti-codec-engine/`dirname ${i}`
173                 # now copy the file             
174                 install ${i} ${D}/${datadir}/ti-codec-engine/`dirname ${i}`
175         done
176
177         # we should install the CMEM apps as well here
178
179         # finally, strip targets that we're not supporting here
180         # - TODO...
181 }
182
183 PACKAGES =+ "ti-lpm-module ti-cmem-module ti-codec-engine-apps"
184
185 FILES_ti-lpm-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/*lpm*ko"
186 FILES_ti-cmem-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/cmemk.ko"
187 FILES_ti-codec-engine-apps = "${datadir}/ti-codec-engine/*"
188
189 pkg_postinst_ti-lpm-module () {
190         if [ -n "$D" ]; then
191                 exit 1
192         fi
193         depmod -a
194         update-modules || true
195 }
196
197 pkg_postrm_ti-lpm-module () {
198         update-modules || true
199 }
200
201 pkg_postinst_ti-cmem-module () {
202         if [ -n "$D" ]; then        
203                 exit 1
204         fi
205         depmod -a
206         update-modules || true
207 }
208
209 pkg_postrm_ti-cmem-module () {
210         update-modules || true
211 }
212
213 INHIBIT_PACKAGE_STRIP = "1"
214
215 PACKAGE_ARCH = "${MACHINE_ARCH}"
216
217 #legacy upgrade helpers
218 RPROVIDES_ti-cmem-module += "ti-cmemk-module"
219 RREPLACES_ti-cmem-module += "ti-cmemk-module"
220
221
222 # ti-dsplink-module can be built by either codec-engine or standalone dsplink - tell it to use this one, else unwanted dependence
223 PREFERRED_PROVIDER_ti-dsplink-module = "ti-codec-engine"
224
225 #add run-time dependencies - note for kernel module we can only use RRECOMMENDS, since modules might be built into the kernel
226 RRECOMMENDS_ti-codec-engine-apps += "ti-dsplink-module ti-lpm-module ti-cmem-module"
227