Compile android source and kernel for emulator in Debian
1、download the android source code
Reference from
http://source.android.com/source/downloading.html
follow the reference:
Create the dir and export the PATH
$ mkdir ~/bin$ PATH=~/bin:$PATH
Download the repo
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo$ chmod 775 ~/bin/repo
Repo init the code version you want
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
finally sync the codes
$ repo sync// better way$ repo sync -j16
if try to stop the repo, just try
Ctrl + z
and continue the repo
$ repo sync // or $ repo sync -j16
after download, must enter "repo sync" to check the code again.
2、download the kernel
Reference from
https://android.googlesource.com/
click the kernel/common, there would be a instruction on the top:
git clone https://android.googlesource.com/kernel/common
the version for emulator
git clone https://android.googlesource.com/kernel/goldfish
3、Compile the source code
1) check the build environment
http://source.android.com/source/initializing.html
2) compile
$ cd ~/Android/source_code/$ make// or $ make -j4
3) there would be the files in the following dir
$ ls out/host/linux-x86/bin/ | grep emulatoremulatoremulator64-armemulator64-mipsemulator64-x86emulator-armemulator-mipsemulator_rendereremulator-uiemulator-x86$ ls out/target/product/generic/ | grep imgramdisk.imgsystem.imguserdata.img
4、 Compile the kernel
$ cd goldfish/$ ls
but there is no files now.
checkout for the real codes.
$ git checkout android-goldfish-2.6.29 master origin/linux-goldfish-3.0-wip android-goldfish-3.4 origin/android-goldfish-2.6.29 origin/master HEAD origin/android-goldfish-3.4 linux-goldfish-3.0-wip origin/HEAD
choose the version you want
$ git checkout android-goldfish-2.6.29 Checking out files: 100% (26821/26821), done.Branch android-goldfish-2.6.29 set up to track remote branch android-goldfish-2.6.29 from origin.切换到一个新分支 'android-goldfish-2.6.29'
then
$ lsarch CREDITS drivers include Kbuild MAINTAINERS net samples soundblock crypto firmware init kernel Makefile README scripts usrCOPYING Documentation fs ipc lib mm REPORTING-BUGS security virt
compile the kernel
1) crrect the Mafile
$ vim Makefile//correct the following messenge#ARCH ?= $(SUBARCH)ARCH ?= armCROSS_COMPILE ?= arm-none-linux-gnueabi-
2) make menuconfig
$ make menuconfig>> Save an Alternate Configuration File
3) make
TIPS : there would be error without libnucurses
$ sudo apt-get install libncurses5 libncurses5-dev// in AMD64$ sudo apt-get install libncurses5 libncurses5-dev$ sudo apt-get install ia32-libs $ sudo apt-get install lib32ncurses5 lib32ncurses5-dev
更多相关文章
- 使用U3D 实现 Android(安卓)Launcher(提供源码)
- Android(安卓)RIL CDMA分支总结(1)
- 获取android源代码
- Android(安卓)6编译环境搭建 (Marshmallow)
- Android(安卓)CDMA分支
- android源码/内核下载
- Android(安卓)项目多版本管理
- Android(安卓)lunch分析以及产品分支构建
- Android(安卓)4.0 分页指示器 Android(安卓)ViewPagerIndicator