You may have heard about Google TV that is coming soon in our homes, through Android set-top boxes. It's expected to come out this fall, but the source code of the MIPS port is already available to the public. It is important to note that Android was originally designed for smartphones, which commonly use ARM processors. However, in the set-top box market, MIPS-based systems are quite popular. This is why the announcement of Google TV at the last Google IO conference was associated with the announcement of a reference development board and SDK for the Sigma SMP8654. A brochure on the Android platform support for Sigma media processors is also available.
Ok, this is all nice and beautiful, but how do we get started? If you go on mips.com/android you will be told to register on the main website of the Android MIPS port, mipsandroid.com. I suggest you register now, as your account needs to be activated manually by the site administrator, and that can take a while. In my case, it took a week before I could log in, but then I couldn't access the forums or the wiki. That took an additional two days before it got activated. Being registered gives you access to a lot of interesting documentation and resources you might need. You can still get started right now as you can fetch the sources from their public git server without being registered.
The first step is obviously to fetch the sources. For this purpose you will need git installed (sudo apt-get install git-core) and a wrapper on top of git provided by google, called repo. repo is there to automatically fetch the sources for the large number of git servers used for the various components of Android, otherwise you would need to go through each one of them manually.
Create a "bin" folder in your home:
mkdir ~/bin
Download repo and make sure it's executable:
wget http://android.git.kernel.org/repo
Create a directory for the Android for MIPS sources:
Initialize your local repository, and then sync with the remote git servers:
~/bin/repo init -u git://public.mipsandroid.com/platform/manifest.git -b mips-eclair
Downloading all the sources will take a while, so be patient.
While the sources are downloading, install the packages you will need later:
On Ubuntu 64-bit: sudo apt-get install gcc build-essential ia32-libs git-core libreadline-dev zip curl wget valgrind python eclipse ecj flex bison gperf libsdl-dev libwxgtk2.6-dev libgmp3-dev libc6-dev-i386 libsds-dev clearsilver-dev libclearsilver-perl python-clearsilver gcc-multilib g++-multilib lib32stdc++6-4.4-dbg
On Ubuntu 32-bit: sudo apt-get install gcc build-essential git-core libreadline-dev zip curl wget valgrind python eclipse ecj flex bison gperf libsdl-dev libwxgtk2.6-dev libgmp3-dev libsds-dev clearsilver-dev libclearsilver-perl python-clearsilver gcc-multilib g++-multilib
The above package listings have been tested on Ubuntu 9.10 and 10.04, and on 32-bit and 64-bit versions as well. Instructions for Debian should be close enough.
You will also need to download a MIPS toolchain (be prepared, that FTP server can be very slow):
wget ftp://ftp.mips.com/pub/tools/software/android/mips-4.3.tar.gz
and then install it in your /opt folder:
tar zxvf mips-4.3.tar.gz
You will also need a special version of Sun's JDK, as Android doesn't work with the latest versions. Google for jdk-1_5_0_22-linux-i586.bin. You need the 32-bit version and not the 64-bit version even if you are on 64-bit Ubuntu, otherwise Android will fail to build, most likely with errors related to clearsilver. Also, if the extraction of the jdk fails on 64-bit Ubuntu, make sure that you have ia32-libs installed.
Once you downloaded it, you can verify the md5 sum: df5dae6d50d2abeafb472dde6d9a17f3 jdk-1_5_0_22-linux-i586.bin
Add execute permissions, extract and install to your /opt directory:
chmod +x jdk-1_5_0_22-linux-i586.bin
Once you have downloaded and installed everything described above, edit your /etc/profile to add the following lines:
export J2RE_HOME=/opt/jdk1.5.0_22/jre
Of course, if you've chosen names different from the ones I've used, you need to make some adjustments.
Also make sure that ~/mipsandroid/build/envsetup.sh is executable:
chmod +x ~/mipsandroid/build/envsetup.sh
Once this is done, move to your mipsandroid folder, and use the following command to use the profile you've just defined:
source /etc/profile
If everything went fine up to now, you should now be ready to build Android for MIPS. Simply type "make" and let it build. I suggest you use the -j option, which enables multiple build threads and reduces total build time. I usually put twice the number of cores of the processor in use:
make -j 8
Beware that using too many build threads can make the building process more CPU intensive and make your entire system slow.
When building is finished, you should now be able to launch the emulator with your built Android image (the location of the built Android image is given by ANDROID_PRODUCT_OUT which we defined in our profile):
emulator
The emulator is located in ~/mipsandroid/out/host/linux-x86/bin/, but typing all that is long for nothing so we've added it to our path in our profile too.
If you're lucky, you should now see the Android emulator appear, with Android booting shortly after. If the build failed, the emulator won't show up at all, and you'll have an error in your terminal saying that your build is incomplete:
That's it, you now have Android for MIPS :) You can start playing with it while waiting for Google TV to come out. |