Since the latest version of android is 3.0 and above, it is quiet necessary for us to set up a building enviroment for gingerbread and above.
1 install the operation system.
(remember if you want to compile honeycomb with ubuntu 11.04, you will meet a system bug with the error below:
n file included from external/qemu/target-i386/kvm.c:19:
/usr/include/linux/kvm.h:215: error: field 'arch' has incomplete type
/usr/include/linux/kvm.h:383: error: field 'arch' has incomplete type
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/emulator-target-i386_intermediates/target-i386/kvm.o] 错误 1
the solution is as this blog:
http://www.blogjava.net/jayslong/archive/2011/05/12/fix_the_problem_that_android_source_code_wont_compile_in_ubuntu_11_04.html
看来这个问题是只有在用 Ubuntu 11.04 版本编译的时候才会出现的问题,
幸好有好心人做了个补丁解决了这个问题.
只要在下载源码的目录下执行下面这句,然后再make就不会再出现这个错误了:
repo download platform/external/qemu 22776/1
but i didn't try it.
)
Downloaded Ubuntu 11.04 32-bit iso, from http://www.ubuntu.com/download/ubuntu/download.
Install it. I don't think there is any necessary to say something about this procedure. But if you install it with a wmware tool, remember , try give more wm disk for you virtual system.
2 install the necessary building tools for the ubuntu.
Use the default sourcelist and run "apt-get update".
run the fellowing command to install the packages:
(some packages are already installed on the ubuntu1104 , as marked below)
sudo apt-get install python (no necessary)
sudo apt-get install zlib1g-dev
sudo apt-get install git-core gnupg
sudo apt-get install flex bison gperf libsdl-dev libesd0-dev(no necessary) libwxgtk2.6-dev build-essential(not necessary) zip(not necessary) curl
sudo apt-get install sun-java6-jdk
if we use the default sources.list, the java6 can't be found, we need change the sourcelist.
edit the file /etc/apt/sources.list, find the two lines, remove the comment
"#deb http://archive.canonical.com/ubuntu lucid partner
#deb-src http://archive.canonical.com/ubuntu lucid partner"
to
"deb http://archive.canonical.com/ubuntu lucid partner
deb-src http://archive.canonical.com/ubuntu lucid partner"
then, apt-get update, apt-get install sun-java6-jdk
3 after that, for your better use of the system , you'd better install such tools
ssh,samba,subversion,use the command below
apt-get install ssh
apt-get install samba (for windows share, if it doesn't work well, try use "apt-get install samba-common" as additional)
apt-get install samba-common-bin(necessry for ubuntu 10.10)
apt-get subversion
4 download the source code of gingerbread
use curl download the repo tools
curl http://android.git.kernel.org/repo > /bin/repo
chmod a+x /bin/repo
setting the branch of repo
enter your project direction and down
cd /opt/gingerbread
repo init -u git://android.git.kernel.org/platform/manifest.git -b gingerbreadrepo sync
wait for the downloading, it may need quiet a long time if your network status is no good.
5 compile the sourcecode
cd /opt/gingerbread/build
. envsetup
cd /opt/gingerbread
make
the go to sleep, leave the things to the cpu.