首页 > 代码库 > 编译andorid内核

编译andorid内核

昨天编译完系统,今天编译内核

首先下载源码

git clone http://android.googlesource.com/kernel/goldfish.git  

然后查看分支

git  branch -a 

然后check下来

git checkout remotes/origin/android-goldfish-2.6.29  

但是因为被墙了,所以网页下载的2.6.29版本

https://android.googlesource.com/kernel/goldfish.git/+/android-goldfish-2.6.29

然后交叉编译,设置编译器

export PATH=$PATH:~/WORKING_DIRECTORY/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin 

然后改一下makefile文件

gedit Makefile 
 # ARCH ?= (SUBARCH)
 # CROSS_COMPILE?=
修改为:
ARCH ?= arm
CROSS_COMPILE     ?= arm-eabi-

如果直接编译,会出个问题 时间不对,整体更新下时间

find /dir -type f|xargs touch

编译

make goldfish_armv7_defconfig  
$ make  -j4

编译完成的zImage.img在

/WORKING_DICRORY/goldfish.git-android-goldfish-2.6.29/arch/arm/boot

启动模拟器,在系统源码路径下

 emulator -kernel ~/WORKING_DIRECTORY/goldfish.git-android-goldfish-2.6.29/arch/arm/boot/zImage &   

完成!

  

编译andorid内核