Due to project requirements, we recently compiled a version of android4.0.4 on ubuntu12.04 64-bit machines. Note the following:
1. Install the basic library file
Please refer to the official Android website http://source.android.com/source/initializing.html:
Note:
Installing required packages (Ubuntu 12.04)
Building on Ubuntu 12.04 is currently only experimentally supported and is not guaranteed to work on branches other than master.
$ 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
2. Install JDK
Note the JDK version. If JDK 1.7.x cannot be compiled, the JDK version does not match. I use JDK 1.6.0_30.tar.gz, and the file is too large to be uploaded to csdn, when downloading the Ubuntu x64 bit version, you must add the JDK path in the compilation script, for example:
Export Path = $ PWD/jdk1.6.0 _ 30/bin: $ path
My jdk1.6.0 _ 30. folder is placed under the android source code directory.
In addition, the path of the cross compiler is added to the compilation script. This cross compiler comes with Android and does not require additional installation:
Export Path = $ PWD/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin: $ path
My compilation script (my platform is Samsung s5pv210 ):
Sec_product = 'smdkv210'
Export Path = $ PWD/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin: $ path
Export Path = $ PWD/jdk1.6.0 _ 30/bin: $ path
Set-e
Export CPUs = 'grep-C processor/proc/cpuinfo'
Start_time = 'date + % s'
# Forlinx add for compile android
Mkdir-P out/target/common/obj
CP-F vendor/Samsung/smdkv210/framework. aidl out/target/common/obj
# Start compile android4.0
Echo "Start build android4.0 ......"
Make-J $ {CPUs} host_cc = gcc-4.4 host_cxx = g ++-4.4 host_cpp = cpp-4.4 product-full _ $ SEC_PRODUCT-eng
End_time = 'date + % s'
Echo "Total compile time is $ ($ end_time-$ start_time)/60) minutes $ ($ end_time-$ start_time) % 60) seconds"
} 2> & 1 | tee build. Out
3 install gcc4.4
If you use ubuntu11.10 (including 12.04), you must downgrade GCC from 4.5 or later to 4.4. Otherwise, an error is returned.
For reference:
Sudo apt-Get install gcc-4.4 g ++-4.4g ++-4.4-multilib
CD/usr/bin
Sudo ln-SFP cpp-4.4 CPP
Sudo ln-SFP gcc-4.4 gcc
Sudo ln-SF g ++-4.4g ++
4. Compile V8
An error occurs when compiling to external/V8. compile it separately:
Make libv8
During compilation, note that you should add environment variables in the terminal window:
Export Path = $ PWD/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin: $ path
Export Path = $ PWD/jdk1.6.0 _ 30/bin: $ path
5 InstallationMkimage tool:
Android will use this tool to create an image file at the end of compilation. The tool source code is under uboot code tools. After uboot compilation is complete, the tool will be compiled, put it in the/usr/sbin/directory.