Archive

Posts Tagged ‘java’

U-boot, Linux Kernel, and Android Patches for Freescale i.MX6 HDMI TV Dongles

February 6th, 2013 32 comments

We can now get some quad core Android mini PCs (e.g. Hi802, GK802) featuring Freescale i.MX6Q processor, Freescale has released full documentation and source code its development platforms, Hi802 / GK802 HDMI TV dongles are easily hackable, and there’s even an Ubuntu image for the devices. So it looks pretty good ,right? Well almost.. there are some patches and config for GK802 that have not been released by Richtechie, so we can’t modify the  bootloader and Linux kernel. But this may change, as ARMTvTech forum user hste noticed some Freescale i.MX6 HDMI dongle patches om IMX Community website. Even though I’m not sure those are fully compatible with Hi802 / GK802, this could be a starting point. Today, I’ll provide the instructions to build u-boot, the linux kernel and Android ICS with those patches in a machine running Linux 12.04 64-bit.

Patch Sets Descriptions

There are two set of patches that can be applied to R13.4-GA release:

  • hdmidongle_REVB_R13.4_patch-20121115.tgz -  Adds HDMI dongle support in U-boot, the Linux kernel and customize Android 4.0.4 for mini PCs.
  • hdmidongle_REVB_R13.4_patch-20130201.tgz -   Adds support for ldo bypass , uboot fastboot, ntfs, Bluetooth A2DP, fakes an alway full battery, removed the screen locker, and check the video mode. There are also patches for bug fixes for WifiDirect, Wi-Fi performance, uboot mmu, and system stability

A script (revb_dongle_patch_install.sh) is provided to apply 20121115 patches.

Getting Freescale i.MX6 U-boot, Linux kernel and Android source code (R13.4-GA)

Since those patches need to be applied against R13.4-GA, so we need to get the code first. The instructions are explained in section 5 “Get Android Source Code (Android/Kernel/U-Boot)” of R13.4-GA.01_Android_User_Guide.pdf.

First download IMX6_R13.4_ANDROID_SOURCE_CODE (171 MB). After download, you should get a file named imx-android-r13.4-ga.01.tar.gz that includes the documentation, patches, and Mfgtool for Android 4.0.4.

Let’s extract it, extract the (default) patches:

mkdir -p ~/edev/Freescale
tar xzvf imx-android-r13.4-ga.01.tar.gz
cd imx-android-r13.4-ga/code
tar xzvf r13.4-ga.tar.gz

If you don’t have it the repo tool yet download it, and add it to your path:

curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod 755 ~/bin/repo
export PATH=$PATH:~/bin

Now let’s create a working directory (myandroid) and get Android 4.0.4 r1.1 AOSP source code:

cd ~/edev/Freescale/imx-android-r13.4-ga
mkdir myandroid
cd myandroid

repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.4_r1.1
cp ../code/r13.4-ga/default.xml .repo/manifests/default.xml
repo sync

This will take a little while, after or while it’s progressing you can (also) get imx kernel and U-boot source code:

git clone git://git.freescale.com/imx/linux-2.6-imx.git kernel_imx
cd kernel_imx
git checkout imx-android-r13.4-ga
cd ../bootable/
mkdir bootloader
cd bootloader
git clone git://git.freescale.com/imx/uboot-imx.git uboot-imx
cd uboot-imx
git checkout imx-android-r13.4-ga
cd ../..

When checking out imx-android-r13.4 branch for the kernel and U-boot, you’ll get messages like:
HEAD is now at c9dfae3… ENGR00224938 HDMI audio: clear HDMI dma done bit before start
HEAD is now at 097643f… ENGR00224313:i.MX6 general:enable CONFIG_CMD_IMXOTP to fix the build error

It just shows the latest commit, so there’s no issue here.

After repo sync is complete, you’ll also need to get some more code:

cd external
git clone git://android.git.linaro.org/platform/external/alsa-lib.git
git clone git://android.git.linaro.org/platform/external/alsa-utils.git
cd ../hardware
git clone git://android.git.linaro.org/platform/hardware/alsa_sound.git
cd ..

Now patch all those with R13.4-GA patches:

source ../code/r13.4-ga/and_patch.sh
c_patch ../code/r13.4-ga imx_r13.4-ga

After a lot of debug output (and warnings), you should see the following message to indicate patching was successful:
**************************************************************
Success: Now you can build the Android code for FSL i.MX platform
**************************************************************

We’re done for this part we now have all source for R13.4-GA release.

Patching R13.4-GA with HDMI dongle patches

We can now patch the code to add HDMI dongle support. I’ll assume you’ve downloaded all 3 files describe at the top of this post to ~/edev/Freescale/imx-android-r13.4-ga directory:

chmod a+x revb_dongle_patch_install.sh
tar xzvf hdmidongle_REVB_R13.4_patch-20121115.tgz
cd hdmidongle_REVB_R13.4_patch
../revb_dongle_patch_install.sh ~/edev/Freescale/imx-android-r13.4-ga/myandroid
cd ..
tar xzvf hdmidongle_REVB_R13.4_patch-20130131.tgz
cd ../myandroid
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0001-uboot_fastboot.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0002-LDOBYPASS.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0003-WifiDirect.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0004-ntfs_support.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0005-BT_enable.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0006-1G_boot_stable.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0007-battery_always_full.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0009-uboot-enable-mmu-fix.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0010-boot_disable_screenlocker.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0011-wm8326-DC_CONTROL_RATE.patch --verbose
git apply  ../hdmidongle_REVB_R13.4_patch-20130131/0012-Added-default-video-mode-check-make-sur.patch --verbose
rm -rf kernel_imx/drivers/net/wireless/rtl8192ce
tar xzvf ../hdmidongle_REVB_R13.4_patch-20130131/rtl8192ce_v4.0.0_6239.20121226_TPIOT1.tgz
tar xzvf ../hdmidongle_REVB_R13.4_patch-20130131/ntfs-3g.tar.gz -C external

For the second set of patches, you’ll noticed patches 0001 to 0012 have been applied, except 0008 since it’s not needed anymore.

One more step completed. Have a tea break, or drink a beer, since there’s still a bit more work to do.

Building U-Boot, the kernel and Android for Freescale i.MX6 HDMI TV Dongles

I’m probably missing some per-requisites in this part, and most required dependencies were already installed in my PC. You may want to have a look at the post “How to compile Android on Ubuntu 12.04“, and in particular the part about install Sun Java 6 JDK, where you need to download Sun Java 6 JDK, install it, and run update-alternatives:

chmod +x jdk-6u38-linux-x64.bin
sudo ./jdk-6u38-linux-x64.bin
sudo mv jdk1.6.0_38 /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_38/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_38/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_38/bin/javaws 1
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

Now we should be ready to build:

source build/envsetup.sh
lunch

Build Freescale imx6 hdmidongle lunch menu

We can select either hdmidongle_6dq-eng or hdmidongle_6dq-user for the build. The “eng(ineering)” build is a debug build, and the “user” build is a release version. I’ve gone with hdmidongle_6dq-user (15) to try it out.

In theory, we now just need to run make:

make -j8

However “in theory, there is no difference between theory and practice; In practice, there is”, and I’ve come across a few issues during the build, and if you build in Ubuntu 12.04 64-bit, you may want to perform the following steps before running make.

Some directories are duplicates in the source tree, and the build ends with error such as:

build/core/base_rules.mk:166: *** external/mtd-utils/mtd-utils/mkfs.ubifs: MODULE.HOST.EXECUTABLES.mkfs.ubifs already defined by external/mtd-utils/mkfs.ubifs.  Stop

I fixed it by deleting one of the duplicate in the source:

rm -rf bootable/bootloader/uboot-imx/mtd-utils
rm -rf external/mtd-utils/mtd-utils/
rm -rf bootable/bootloader/uboot-imx/wpa_supplicant_8_rtl/
rm -rf external/wpa_supplicant_8_rtl/wpa_supplicant_8_rtl/
rm bootable/bootloader/uboot-imx/realtek/wlan/ -rf
rm -rf  hardware/realtek/realtek/

I found some dependencies missing, so you may have to install:

sudo apt-get install uuid-dev liblzo2-dev lib32ncurses5-dev uuid:i386 liblzo2-2:i386

But the build still failed, so here’s an ugly hack:

pushd /usr/lib
sudo ln -s /lib/i386-linux-gnu/libuuid.so.1 libuuid.so
sudo ln -s /usr/lib/i386-linux-gnu/liblzo2.so.2 liblzo2.so
popd

Then I got several errors:

error: “_FORTIFY_SOURCE” redefined [-Werror]
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1

The solution is to edit vi build/core/combo/HOST_linux-x86.mk and edit the corresponding line as follows:

HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

Source: http://code.google.com/p/android/issues/detail?id=20795

External/mesa3d/src/glsl/linker.cpp:1734:59: error: ‘offsetof’ was not declared in this scope make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1

Edit external/mesa3d/src/glsl/linker.cpp and add #include <stddef.h>
Source: http://code.google.com/p/android/issues/detail?id=23206

host C++: liboprofile_pp <= external/oprofile/libpp/arrange_profiles.cpp In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0: external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive] make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] Error 1

Edit external/oprofile/libpp/format_output.h and Remove ‘mutable’ from ‘mutable counts_t & counts;’ on line 94 => counts_t & counts;
Source: https://groups.google.com/forum/?fromgroups=#!msg/android-building/2EwtWQTqjdI/eBl1bK-KNM8J

external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11: error: ‘ptrdiff_t’ does not name a type

Edit external/gtest/include/gtest/internal/gtest-param-util.h and add one line:

#include <vector>
+#include <cstddef>
#include <gtest/internal/gtest-port.h>

Source: http://code.google.com/p/android/issues/detail?id=22005

/home/jaufranc/edev/Freescale/imx-android-r13.4-ga/myandroid/external/llvm/lib/Support/Mutex.cpp:143: undefined reference to `pthread_mutex_trylock’
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] Error 1

Edit vi frameworks/compile/linkloader/Android.mk and rename LOCAL_LDFLAGS to LOCAL_LDLIBS.
Source: https://bugs.launchpad.net/linaro-android/+bug/1018832/comments/6

frameworks/compile/slang/slang_rs_export_foreach.cpp:249:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] Error 1

Edit frameworks/compile/slang/Android.mk and remove -Werror
Source: http://code.google.com/p/android/issues/detail?id=22006

After all those changes, I was finally able to complete the build with the output in out/target/product/hdmidongle_6dq including the following directories and files:

  • root/ – Root file system (including init, init.rc, etc). Mounted at /
  • system/ – Android system binary/libraries. Mounted at /system.
  • data/ – Android data area. Mounted at /data.
  • recovery/ – Root file system when booting in “recovery” mode.
  • boot.img – Image which includes the kernel zImage, ramdisk, and boot parameters.
  • ramdisk.img – Ramdisk image generated from “root/”.
  • system.img – EXT4 image generated from “system/”. It can be programmed to “SYSTEM” partition on SD/eMMC card with “dd”.
  • userdata.img – EXT4 image generated from “data/”.
  • recovery.img – EXT4 image generated from “recovery/”. It can be programmed to “RECOVERY” partition on SD/eMMC card with “dd”.
  • u-boot-6q.bin – U-Boot image with padding for i.MX 6Quad version of the HDMI dongle.
  • u-boot-6dl.bin – U-Boot image with padding for i.MX 6Dual version of the HDMI dongle.
  • uImage – Kernel image

If you just want to build U-boot and/or the Kernel follow section 5.3 and 5.4 in R13.4-GA.01_Android_User_Guide.pdf. For the kernel there are 5 configs which all seem quite different from GK802 config:

  • imx6_android_defconfig – Android kernel config
  • imx6_defconfig – Linux kernel config
  • imx6_nand_android_defconfig
  • imx6_nand_updater_defconfig
  • imx6_updater_defconfig

To build U-boot for Freescale HDMI dongles, there are over 12 config (6 for i.MX6 dual, 6 for i.MX6 Quad), but the most interesting appear to be mx6q_hdmidongle_android_config and mx6q_hdmidongle_nand_android_config.

That’s all for today, I’ll post more if I, or somebody else, make progress trying it or/and building it for GK802 / Hi802 mini PC.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Collabora and Fluendo Release GStreamer SDK for Android

December 3rd, 2012 No comments

Collabora and Fluendo have recently announced the availability of GStreamer’s Software Development Kit for Android, which allows developers to create multimedia playback applications for Android smartphones and tablets using Gstreamer and the Android NDK..

The GStreamer SDK for Android targets Android 2.3.1 Gingerbread or higher (API Level 9 or greater). However, due to some of the restrictions of previous versions of Android, some features such as hardware acceleration are only available on Android 4.1 Jelly Bean (API Level 16 up).

Normally, you’d need the GStreamer SDK which can be installed on Linux (Ubuntu, Fedora and Debian), Windows (XP/Vista/7/8) and Mac OS X (10.6 to 10.8). But for developing Android applications using Gstreamer, you don’t. What you do need first is a typical Android development environment with the latest Android SDK, the latest Android NDK, and optionally, but recommended, the Eclipse IDE with Android ADT and NDK plugins. Once everything is setup correctly, and you have made sure you can build NDK apps, you can download and install GStreamer SDK for Android (ARM only).

I’ve tried the instructions in Eclipse 4.2.1 with Android NDK 8b and Android Tools SDK 21 following the the instructions to install GStreamer for Android development. In Eclipse IDE, make sure the Android SDK and NDK paths are correctly setup (Window->Preferences->Android->NDK), and set  GSTREAMER_SDK_ROOT_ANDROID to the folder where you unzipped the SDK, by going to Window->Preferences->C/C++->Build->Build Variables and defining GSTREAMER_SDK_ROOT_ANDROID.

There are 5 tutorials provided in the GStreamer SDK for Android:

  • Tutorial 1: Link against GStreamer
  • Tutorial 2: A running pipeline
  • Tutorial 3: Video
  • Tutorial 4: A basic media player
  • Tutorial 5: A Complete media player

Eventually, it will be possible to add GStreamer code to Java apps, but language bindings for the GStreamer API are not complete yet. The tutorial are written in both C and Java code with Java used for the User Interface, and C for the GStreamer code, with both parts interacting through JNI.

To import a tutorial into the Eclipse workspace, click on File->New->Project… ->Android->Android Project from Existing Code, and select the folder android-tutorial-1 in GSTREAMER_SDK_ROOT_ANDROID/share/gst-sdk/tutorials.

At this stage, Eclipse might complain about missing files, but this is normal, and we need to add native development support by right-clicking on the project tutorial1 and selecting Android tools->Add Native Support… The NDK plugin should ask for a library name, just keep the default (libTutorial1.so) and accept. Click on Project->Build Project in the top menu. Once the build is complete, run the project: Run->Run, and after a little while, the demo should appear in the emulator or your Android device.

You should be able to reproduce the same steps with tutorial 2 to 5. Details are available on GStreamer’s Android tutorials page.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Oracle releases JDK for Linux ARM (Soft-Float Only)

August 15th, 2012 3 comments

Oracle announced the availability of JDK 7 Update 6 which introduces a JDK for Linux on ARM v6 and v7 architecture. This JDK is aimed at “general purpose” ARM systems, such as ARM micro-servers and ARM development platforms. This new JDK for Linux on ARM is licensed under the Oracle Binary Code License, and can be downloaded at no cost for development and production use on general-purpose platforms. For embedded use such as an industrial controller or a kiosk appliance, a commercial license would be required.

Here’s how Oracle summarizes the ARM Linux JDK features:

This port provides 32-bit binary for ARMv6 and v7, with full support for Swing/AWT, both client (C1) and server (C2) compilers and runs on most Linux distributions. One caveat is that the current binary is softfloat ABI only, so it won’t work with (for example) the Raspbian distribution which uses the hardfloat ABI. We are planning to add hardfloat support in an upcoming JDK release, as well as support for JavaFX on ARM.

This new JDK is different from Java SE Embedded which supports ARMv5 architectures and above, x86, and PPC, is optimized for small footprint devices and licensed commercially for embedded use.

There are 2 downloads (No direct links as this goes via a license agreement):

  1. Java SE Development Kit 7u6 (jdk-7u6-linux-arm-sfp.tar.gz)
  2. Java SE Development Kit 7u6 Demos and Samples Downloads (jdk-7u6-linux-arm-sfp-demos.tar.gz)

Oracle must not have paid attention to the latest ARM developments, and force a soft-float (armel) release upon us, which means you won’t be able to use any armhf rootfs/distributions such as Raspbian or the Ubuntu images released by Linaro, and make sure you install a soft-float distribution/rootfs. If you want to keep using armhf distros, Oracle Java is not the only option to get Java on ARM, and you can already use OpenJDK. But not is all bad, as at last, you’ll be able to get some coffee with your raspberry pi.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Categories: Linux Tags: arm, java, raspberry pi, sdk

Installing Android SDK on Ubuntu 12.04

July 14th, 2012 5 comments

The official instructions to install Android SDK do not appear to be really up-to-date for Ubuntu 12.04, so I’ll post how I’ve installed the Android SDK and Eclipse on Ubuntu 12.04.

First download and decompress Android SDK for Linux:

wget http://dl.google.com/android/android-sdk_r20-linux.tgz
tar xzvf android-sdk_r20-linux.tgz

on 64-bit Ubuntu:

apt-get install ia32-libs

Sun Java is not part of Ubuntu packages anymore, so you’ll need to use openjdk instead

apt-get install openjdk-6-jdk

Now install the SDK

cd android-sdk-linux/tools
./android sdk

Android SDK Manager should show up.

Android SDK Manager in Ubuntu 12.04

Use the default recommended packages and platforms, as well as any extra packages you may need, and click on Install x packages, accept all licenses and after installation is complete, the Android SDK is installed.

Eclipse IDE is optional, but it’s the most widely used IDE to develop Android apps. You can install Eclipse as follows:

sudo apt-get install eclipse-jdt

Once both Android packages and platforms, and eclipse are installed, start eclipse:

eclipse

Then in the top menu, click on Help->Install New Software, then click on Add and enter “ADT Plugin” for the Name and the following URL for the Location:

https://dl-ssl.google.com/android/eclipse/

Click on OK, and Check “Developer Tools” and click Next, and complete a few more easy steps until the installation completes.

The final step after you’ve installed ADT and restarted Eclipse, is to set the location of the Android SDK directory. Select Window->Preferences…, select  Android and click on Browse to set the location of your Android SDK directory (android-sdk-linux), then click on Apply and you should see a list of Android SDK targets.

Click on OK. That’s it, you’ve now installed and configured the Android SDK and Eclipse in Ubuntu, and are ready to get started with App development.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Detect Mobile Devices with WURFL in Websites and Mobile Apps

May 7th, 2012 No comments

WURFL LogoWhen designing a mobile application or webpage, you may want to know exactly to know what devices access your site or run your application for example to differentiate automatically between desktops, laptops, tablets and smartphones and provide a user interface which is appropriate for a given screen size.

This can be achieved with WURFL (Wireless Universal Resource FiLe), a Device Description Repository (DDR). This software component maps HTTP Request headers to the profile of the HTTP client (Desktop, Mobile Device, Tablet, etc.) and provides a description of the capability of the device that made the request.

WURFL repository is an xml file (wurfl.xml – Direct links to version 2.3.1:  wurfl-2.3.1.zip or wurfl-2.3.1.xml.tar) containing the definition of thousand of devices which can be access using the WURFL APIs.  Several large Internet companies such as Facebook and Google are using WURFL, and ScientiaMobile, the company behind WURFL, claims that it is the most popular DDR by far. Other DDRs include OpenDDR and the maDDR project.

The WURFL API has a dual license model:

  • Affero GPL V3 license. This license requires that all code linked to the WURFL API is made available under a compatible FOSS license even when the code itself is not modified.
  • Commercial License for companies that want to keep their source closed. Commercial licensees also have access to more properties and more frequent database updates.

The XML data is divided in groups (product_info,  display,  playback, etc…) and capabilities within each group. The number of groups available and capabilities reported appear to depend on the device. For example, here’s the record for the Samsung Galaxy Nexus smartphone in wurfl.xml:

<device id=”samsung_galaxy_nexus_ver1″ user_agent=”Mozilla/5.0 (Linux; U; Android 4.0; es-es; Galaxy Nexus Build/IFL10C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30″ fall_back=”generic_android_ver4″ actual_device_root=”true”>
<group id=”product_info”>
<capability name=”model_name” value=”Galaxy Nexus”/>
<capability name=”brand_name” value=”Samsung”/>
</group>
<group id=”display”>
<capability name=”max_image_width” value=”360″/>
<capability name=”resolution_width” value=”720″/>
<capability name=”resolution_height” value=”1280″/>
<capability name=”max_image_height” value=”640″/>
</group>
</device>

Compared that to the much more detailed record for the Nokia C6-01:

<device id=”nokia_c6_01_ver1″ user_agent=”Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaC6-01/011.010; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.7.2 3gpp-gba” fall_back=”nokia_generic_symbian3″ actual_device_root=”true”>
<group id=”product_info”>
<capability name=”mobile_browser” value=”Nokia BrowserNG”/>
<capability name=”pointing_method” value=”touchscreen”/>
<capability name=”mobile_browser_version” value=”7.2″/>
<capability name=”uaprof” value=”http://nds.nokia.com/uaprof/NC6-01r100.xml”/>
<capability name=”model_name” value=”C6-01″/>
<capability name=”brand_name” value=”Nokia”/>
<capability name=”marketing_name” value=”C6″/>
<capability name=”release_date” value=”2010_september”/>
</group>
<group id=”wml_ui”>
<capability name=”softkey_support” value=”true”/>
<capability name=”table_support” value=”true”/>
</group>
<group id=”markup”>
<capability name=”wml_1_3″ value=”true”/>
</group>
<group id=”display”>
<capability name=”physical_screen_height” value=”71″/>
<capability name=”columns” value=”17″/>
<capability name=”physical_screen_width” value=”40″/>
<capability name=”max_image_width” value=”340″/>
<capability name=”rows” value=”13″/>
<capability name=”resolution_width” value=”360″/>
<capability name=”resolution_height” value=”640″/>
<capability name=”max_image_height” value=”600″/>
</group>
<group id=”image_format”>
<capability name=”jpg” value=”true”/>
<capability name=”gif” value=”true”/>
<capability name=”bmp” value=”true”/>
<capability name=”wbmp” value=”true”/>
<capability name=”png” value=”true”/>
<capability name=”colors” value=”16777216″/>
<capability name=”tiff” value=”true”/>
</group>
<group id=”wta”>
<capability name=”nokia_voice_call” value=”true”/>
<capability name=”wta_phonebook” value=”true”/>
</group>
<group id=”storage”>
<capability name=”max_deck_size” value=”357000″/>
</group>
<group id=”streaming”>
<capability name=”streaming_vcodec_h264_bp” value=”1″/>
<capability name=”streaming_vcodec_mpeg4_sp” value=”0″/>
</group>
<group id=”wap_push”>
<capability name=”wap_push_support” value=”true”/>
</group>
<group id=”mms”>
<capability name=”mms_png” value=”true”/>
<capability name=”mms_max_size” value=”614400″/>
<capability name=”mms_rmf” value=”true”/>
<capability name=”mms_max_width” value=”2048″/>
<capability name=”mms_spmidi” value=”true”/>
<capability name=”mms_max_height” value=”1536″/>
<capability name=”mms_gif_static” value=”true”/>
<capability name=”mms_wav” value=”true”/>
<capability name=”mms_vcard” value=”true”/>
<capability name=”mms_nokia_ringingtone” value=”true”/>
<capability name=”mms_jad” value=”true”/>
<capability name=”mms_midi_monophonic” value=”true”/>
<capability name=”mms_wmlc” value=”true”/>
<capability name=”mms_bmp” value=”true”/>
<capability name=”mms_wbmp” value=”true”/>
<capability name=”mms_jar” value=”true”/>
<capability name=”mms_amr” value=”true”/>
<capability name=”mms_jpeg_baseline” value=”true”/>
</group>
<group id=”sound_format”>
<capability name=”wav” value=”true”/>
<capability name=”nokia_ringtone” value=”true”/>
<capability name=”aac” value=”true”/>
<capability name=”sp_midi” value=”true”/>
<capability name=”amr” value=”true”/>
<capability name=”midi_monophonic” value=”true”/>
</group>
<group id=”bearer”>
<capability name=”max_data_rate” value=”10200″/>
</group>
<group id=”j2me”>
<capability name=”j2me_cldc_1_1″ value=”true”/>
</group>
<group id=”object_download”>
<capability name=”picture_colors” value=”24″/>
</group>
<group id=”playback”>
<capability name=”playback_acodec_aac” value=”lc”/>
<capability name=”playback_acodec_amr” value=”wb”/>
<capability name=”playback_wmv” value=”9″/>
<capability name=”playback_real_media” value=”10″/>
</group>
</device>

The WURFL API is available for Java, PHP, PHP + Database or .NET. There is also a C++ API which is only available to commercial licensees. Beyond those standalone APIs, you can also use WURFL Cloud with both free (up to 5000 requests a month) and paid accounts available. This service allows you to make requests to WURFL servers without having to store the WURFL xml file in your own server and get the latest data available. You can access the WURFL Cloud via Java, PHP or .NET APIs.

I’ve registered for a free WURFL Cloud account, downloaded & installed the PHP Client in cnx-software.com and selected “ux_full_desktop” and “marketing_name” capabilities in order to detect whether the client is a desktop or a mobile device, and for the latter display its name.

Here’s the code (Sorry for the lack of tabulation, WordPress really likes to mess with code):

// Include the WURFL Cloud Client
// You'll need to edit this path
require_once './Client/Client.php';

// Create a configuration object
$config = new WurflCloud_Client_Config();

// Set your WURFL Cloud API Key
$config->api_key = 'xxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

// Create the WURFL Cloud Client
$client = new WurflCloud_Client_Client($config);

// Detect your device
$client->detectDevice();

// Use the capabilities
if ($client->getDeviceCapability('ux_full_desktop')) {
echo "This is a desktop web browser";
} else {
$marketing = $client->getDeviceCapability('marketing_name');
if ($marketing) {
echo "This is a mobile device ($marketing)";
} else {
echo "This is a mobile device";
}
}
?>

Go ahead, you can also try it out. It detects my Nokia C6-01 as a mobile device (good!) and says its marketing name is C6 (somewhat disappointing).

You can visit http://wurfl.sourceforge.net/ for more information.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Xamarin Ported Android to C#. Results: Massive Performance Improvements over Dalvik

May 2nd, 2012 No comments

Xamarin has been providing Mono, a C# framework that can work on Linux for some years, and more recently they have also launched Mono for Android and iOS so that you can write or re-use existing C# application on the most common samrtphone platforms.

But their latest project “XobotOS Research Project” goes much further, as they have entirely re-written Android Dalvik engine based on Java with C#. Considering the million of lines of code in Android, they have found a tool to automatize the Java to C# conversion. This tool is an Eclipse plugin called is Sharpen, and Xamarin has made further improvements to Sharpen which are available on Github.

They already have ported Android 2.x and Android 4.0 to C#. If you wonder why they would do that, look at the “benchmarks” below showing Mono vs. Dalvik implementation of Android for binary tree, jovian and hashtags.

Massive difference in the performance of structs and generics in binary tree implementation in Java and C#

Mono vs Dalvik Android Benchmarks

Since the company focuses on mobile apps, Xamarin amazingly explains that this implementation has just been done for “fun” and they have released XobotOS source code. However, this was not done in vain and some of the work will be implemented in their future products namely:

  • Direct Graphics Access to Skia: Mono for Android currently accesses the graphics libraries through Java, but thanks to the code written for XobotOS, Mono will be able to access the native rendering code in Skia.
  • Java to C# tooling:  As mentioned above, a new  improved version of Sharpen is available as part of XobotOS release.
  • Replacing Java code with C# code: They will be able to replace some chunks of Java code with C# code to improve performance.

You can read Xamarin’s Android Ported to C# blog post for further details.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Java SE Server Compiler now Available on ARM

January 31st, 2012 No comments

Hardware and software development is going full-steam ahead for ARM servers.  After Calxeda and AppliedMicro server SoCs – based respectively on Cortex A9 and ARMv8 architecture – have been announced and Ubuntu focusing further ARM development on Servers (Calxeda, Marvell and ARMv8), Oracle has released the Java SE server compiler – a throughput optimizing JIT compiler -  for ARMv7. The ARMv7 server compiler is part of Java SE for Embedded 7 Update 2.

First, some quick explanations on the 2 JIT compilers available for Java SE:

  • Client: The client compiler is a fast start-up, lightly optimizing compiler. It’s better suited for smaller footprint systems and those running applications that require fast start-up such as Android applications.
  • Server:  The server compiler is optimizing code for throughput and produces highly-optimized code but incurs a start-up cost in achieving that.

The server compiler only works on ARMv7 processors with hardfloat (VFPv3 FPU), and  initial server compiler tests on ARMv7 showed improvements between 19 to 40% compared with the client compiler.

Oracle Server Compiler Benchnark

CaffeineMark 3 Benchmark Client vs Server JIT on Pandaboard (Click to Enlarge)

There are even individual test results that show an insane 152 times performance improvement between the server and client compiler (CaffeineMark 3 Logic Test on Pandaboard).

Java SE for Embedded 7u2 also contains serviceability enhancements, performance improvements and bug fixes. Oracle also released Java SE for Embedded 6u30 (ARMv6/ARMv7) which includes performance improvements and bug fixes.

The two releases of Java SE for Embedded for ARM support the following:

  • Latest features and fixes of standard SE
  • Headless support for ARMv5 soft-float and ARMv6/v7 hard-float
  • Headful support for ARMv7
  • Multi-core support for ARMv7
  • Server JIT compiler support for ARMv7 (7u2 release only)

You can download  Java SE Embedded 7u2 and 6u30 to run them on your ARM board(s).

Here are the requirements to run the latest JAVA SE for embedded 7 on different ARM architecture:

Java SE for Embedded 7 on ARM EABI, Little-Endian, Linux

CPU ARM v5 ARM v6/v7 ARM v7

OS* Linux: kernel 2.6.28 or higher; glibc 2.9 or higher Linux: kernel 2.6.28 or higher; glibc 2.9 or higher Linux: kernel 2.6.28 or higher; glibc 2.9 or higher

FP Soft Float Hard Float (VFP) Hard Float (VFP)

Headful No No Yes. X11R6 or higher

RAM 32MB or more for Java 32MB or more for Java 64MB or more for Java

ROM/Flash/Disk 41MB or more for Java 41MB or more for Java 48MB or more for Java

For further details,  you can read the release notes for Java SE Embedded 7u2 and Java SE Embedded 6u30 on Oracle website.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter