1. Introduction
This article describes how to build an Android 4.2 compiling environment on an x86 64-bit host (CPU I5.
2. Install ubuntu12.10
Download PC from http://releases.ubuntu.com/quantal/
(Intel x86) desktop image, and then install it.
2.1 install Vim
Sudo apt-Get install Vim
2.2 set the root password and Root Login
Sudo passwd Root
You can use the root user to log on to the settings:
Vim/etc/lightdm. conf
Add a line at the end:
Greeter-show-manual-login = true
Save the file and restart the system.
2.3 install the SSH server
Sudo apt-Get install OpenSSH-Server
Restart the system.
2.4 install and configure samba
Sudo apt-Get install samba
Replace/etc/samba/smb. conf with the following smb. conf file and back up the original file. This configuration allows every user in the system to access Samba in their own root directory.
# smb.conf is the main Samba configuration file. You find a full commented# version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the# samba-doc package is installed.# Date: 2007-09-22[global]workgroup = WORKGROUPprinting = cupsprintcap name = cupsprintcap cache time = 750cups options = rawinclude = /etc/samba/dhcp.conflogon path = \\%L\profiles\.msprofilelogon home = \\%L\%U\.9xprofilelogon drive = P:#usershare allow guests = Yesdomain logons = Yesdomain master = Yeslocal master = Yesos level = 65preferred master = Yesnull passwords = yessecurity = shareguest ok = yesusershare max shares = 100security = userencrypt passwords = yessmb password file = /etc/samba/smbpasswd#root = jerry#[tim]#comment = tim #inherit acls = Yes#path = /home/tim#read only = No[homes] comment = Home Directories browseable = no writable = yes valid users = %S
2.5 create Linux and Samba users
The related commands are as follows:
// Create Linux user and root directory#adduser tim // Create samba user#mbpasswd -a tim// start samba service#service smbd restart
3. Build the android4.2 compiling environment
Android compilation environment requirements are as follows:
• Python 2.6 -- 2.7: available for download from python.org. ubuntu12.10 contains python2.7;
• GNU make 3.81 -- 3.82: It can be downloaded from gnu.org. Ubuntu 3.81 contains;
• JDK 6: Android or a later version, you can download the jdk-6u45-linux-x64.bin on Java SE 6 downloads, and then install;
• Git 1.7 or later: can be downloaded from the git-scm.com.
3.1 install necessary compilation kits
$ sudo apt-get install git gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw32 tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Installing the above will cause the desktop menu bar to disappear, and the following will be no problem.
$ apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
After testing, it was found that as long as the: APT-Get install libgl1-mesa-glx: i386 is executed, it will delete the following three modules, resulting in the Ubuntu Desktop disappeared from the surface.
The following packages will be REMOVED: libgl1-mesa-dri ubuntu-desktop xorg
3.2 install JDK 6
1) download jdk-6u45-linux-x64.bin
2) install JDK 6
chmod a+x jdk-6u45-linux-x64.binsudo mv jdk-6u38-linux-x64.bin /usr/javacd /usr/javasudo ./jdk-6u45-linux-x64.bin
3) modify the configuration file/root/. bashrc (valid for all users)
export JAVA_HOME=/usr/java/jdk1.6.0_45export PATH=$PATH:$JAVA_HOME:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
Restart the system and use Java -- version to check whether the Java version is 1.6.0 _ 45.
4. Install SDK and ndk4.1
1) download the SDK (e.g.: android-sdk_r22.0.5-linux.tgz) from the http://developer.android.com/sdk/index.html
2) copy the SDK to/usr/Android/
3) tar xvf android-sdk-r22.0.5-linux.tgz
4) modify the configuration file/root/. bashrc
export SDK_HOME=/usr/android/android-sdk-linuxexport PATH=$PATH:$SDK_HOME/tools:$SDK_HOME/platform-tools
5) Update the SDK: Tools/Android update SDK -- no-ui or tools/Android SDK (with an interface for selection)
4.2 install ndk
1) download ndk (e.g.: android-ndk-r9-linux-x86_64.tar.bz2)
From the following address:
Http://developer.android.com/tools/sdk/ndk/index.html
2) Copy ndk to/usr/Android/
3) tar xvf android-ndk-r9-linux-x86_64.tar.bz2
4) modify the configuration file/root/. bashrc
export PATH=$PATH:/usr/android/android-ndk-r9
Reference: http://source.android.com/source/initializing.html