Compiling Android for MIPS

Source: Internet
Author: User
Tags valgrind


 

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 cocould 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 obviusly 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 varous components of Android, otherwise you wowould need to go through each one of them manually.

 

Create a "bin" folder in your home:

 

Mkdir ~ /Bin
Cd ~ /Bin

 

Download repo and make sure it's executable:

 

Wget http://android.git.kernel.org/repo
Chmod + x Repo

 

Create a directory for the Android for MIPS sources:

Mkdir ~ /Mipsandroid
Cd ~ /Mipsandroid

 

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
~ /Bin/repo sync

 

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 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 shoshould 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
Sudo music mips-4.3/OPT

 

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
/Jdk-1_5_0_22-linux-i586.bin
Sudo music jdk-1_5_0_22 // OPT

 

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
Export java_home =/opt/jdk1.5.0 _ 22/JRE
Export android_java_home = $ java_home
Export Path =/opt/jdk1.5.0 _ 22/bin: $ path
Export Path =/opt/jdk1.5.0 _ 22/JRE/bin: $ path
Export Path =/opt/mips-4.3/bin: $ path
Export Path = ~ /Bin: $ path
Export Path = $ path :~ /Mipsandroid/out/host/linux-x86/bin/
Export target_product = generic
Export target_arch_version = mips32
Export target_arch = MIPS
Export android_product_out = ~ /Mipsandroid/out/target/product/generic
~ /Mipsandroid/build/envsetup. Sh

 

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 plugin build threads can make the building process more CPU intensive and make your entire system slow.

 

When building is finished, you shoshould 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 shoshould 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.