libgles-omap3: detect cpu type and don't load modules if no SGX hardware
authorSteve Sakoman <steve@sakoman.com>
Thu, 3 Sep 2009 05:34:51 +0000 (22:34 -0700)
committerKoen Kooi <koen@openembedded.org>
Thu, 3 Sep 2009 08:33:47 +0000 (10:33 +0200)
recipes/powervr-drivers/libgles-omap3.inc
recipes/powervr-drivers/libgles-omap3/cputype [new file with mode: 0755]
recipes/powervr-drivers/libgles-omap3/rc.pvr

index d7f655d..c66309e 100644 (file)
@@ -1,6 +1,8 @@
 DESCRIPTION = "libGLES for the omap3"
 LICENCE = "proprietary-binary"
 
+RDEPENDS_${PN} += "devmem2"
+
 #HACK! These are binaries, so we can't guarantee that LDFLAGS match :(
 INSANE_SKIP_${PN} = True
 INSANE_SKIP_${PN}-tests = True
@@ -25,6 +27,7 @@ PROVIDES += "virtual/egl"
 # voila!
 
 SRC_URI = "file://OMAP35x_Graphics_SDK_setuplinux_${SGXPV}.bin \
+           file://cputype \
            file://rc.pvr \
            file://chameleonman.desktop \
            file://evilskull.desktop \
@@ -83,6 +86,8 @@ do_install () {
        cp -pP ${BINLOCATION}/*.so* ${D}${libdir}
 
        install -d ${D}${bindir}/
+       install -m 0755 ${WORKDIR}/cputype ${D}${bindir}/
+
        cp -pP ${BINLOCATION}/*_test ${D}${bindir}/
        cp -pP ${BINLOCATION}/gl2info ${D}${bindir}/
        cp -pP ${BINLOCATION}/gles1test1 ${D}${bindir}/
diff --git a/recipes/powervr-drivers/libgles-omap3/cputype b/recipes/powervr-drivers/libgles-omap3/cputype
new file mode 100755 (executable)
index 0000000..31fc89b
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+devmem2 0x4800244c | \
+grep 'Value at address' | \
+sed -e 's/.*): //' | \
+sed -e 's/0x5C00/OMAP3503/' -e 's/0x1C00/OMAP3515/' -e 's/0x4C00/OMAP3525/' -e 's/0x0C00/OMAP3530/'
index 244f480..20b5167 100755 (executable)
@@ -1,24 +1,30 @@
 #!/bin/sh
 
-#rmmod bc_example
-rmmod omaplfb
-rmmod pvrsrvkm
+CPUTYPE="$(cputype)"
 
-insmod $(busybox find /lib/modules/$(uname -r) -name "pvrsrvkm.ko")
-#modprobe bc_example
-modprobe omaplfb
+if ( $CPUTYPE == "OMAP3530"); then
 
-pvr_maj=`grep "pvrsrvkm$" /proc/devices | cut -b1,2,3`
+       rmmod omaplfb
+       rmmod pvrsrvkm
 
-if [ -e /dev/pvrsrvkm ] ; then 
-       rm -f /dev/pvrsrvkm
-fi
+       insmod $(busybox find /lib/modules/$(uname -r) -name "pvrsrvkm.ko")
+
+       modprobe omaplfb
+
+       pvr_maj=`grep "pvrsrvkm$" /proc/devices | cut -b1,2,3`
 
-mknod /dev/pvrsrvkm c $pvr_maj 0 
-chmod 666 /dev/pvrsrvkm
+       if [ -e /dev/pvrsrvkm ] ; then 
+               rm -f /dev/pvrsrvkm
+       fi
 
-/usr/bin/pvrsrvinit
+       mknod /dev/pvrsrvkm c $pvr_maj 0 
+       chmod 666 /dev/pvrsrvkm
 
-# Set SGX to full speed
-devmem2 0x48004b40 w 0
+       /usr/bin/pvrsrvinit
+
+       # Set SGX to full speed
+       devmem2 0x48004b40 w 0
+else
+       echo No SGX hardware, not starting pvrsinit
+fi