基于上一个android5.0版源码编译之02功能修改,里面编译了android-goldfish-2.6.29并成功应用 于android2.1的模拟器。
现在要搞4.4.2的源码,编译相应的内核。
依据之前的,当前已经执行了
git clone https://android.googlesource.com/kernel/goldfish.git
1,查看分支2,检出目标分支并创建本地分支,自动切换
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ git branch -a
- android-3.10
- * android-3.4
- android-goldfish-2.6.29
- master
- remotes/origin/HEAD -> origin/master
- remotes/origin/android-3.10
- remotes/origin/android-3.4
- remotes/origin/android-goldfish-2.6.29
- remotes/origin/android-goldfish-3.10
- remotes/origin/android-goldfish-3.4
- remotes/origin/linux-goldfish-3.0-wip
- remotes/origin/master
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ git checkout -b android-goldfish-3.4 remotes/origin/android-goldfish-3.4
- 分支 android-goldfish-3.4 设置为跟踪来自 origin 的远程分支 android-goldfish-3.4。
- 切换到一个新分支 'android-goldfish-3.4'
3,查看当前的分支情况
花花绿绿真好看
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ git map-branches
- origin/android-3.10
- android-3.10
- origin/android-3.4
- android-3.4
- origin/android-goldfish-2.6.29
- android-goldfish-2.6.29
- origin/android-goldfish-3.4
- android-goldfish-3.4 *
- origin/master
- master
4,配置交叉编译环境
之前5.0这个东西是arm-eabi-4.8,下了4.4.2之后这个的版本是4.7和4.6
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ export PATH=/home/senrsl/android/source/WORKING_DIRECTORY/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin:$PATH
5,配置参数并编译
senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ export ARCH=arm
senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ export SUBARCH=arm
senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ export CROSS_COMPILE=arm-eabi-
senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ make goldfish_armv7_defconfig
#
# configuration written to .config
#
senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ make
。。。。
AS arch/arm/boot/compressed/ashldi3.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$
编译完成
6,应用于android模拟器
启动成功,查看当前内核
- senrsl@senrsl-ubuntu:~/android/source/WORKING_DIRECTORY$ emulator -kernel /home/senrsl/android/source/kernel/goldfish/arch/arm/boot/zImage &
命令行查看
说明编译成功且正确。
- senrsl@senrsl-ubuntu:~$ adb shell
- root@generic:/ # cd /proc
- root@generic:/proc # cat version
- Linux version 3.4.67-gea97df6 (senrsl@senrsl-ubuntu) (gcc version 4.7 (GCC) ) #3 PREEMPT Fri Mar 20 15:35:41 CST 2015
附录
1,git查看分支
①git查看所有分支
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ git branch -a
- android-3.10
- * android-3.4
- android-goldfish-2.6.29
- master
- remotes/origin/HEAD -> origin/master
- remotes/origin/android-3.10
- remotes/origin/android-3.4
- remotes/origin/android-goldfish-2.6.29
- remotes/origin/android-goldfish-3.10
- remotes/origin/android-goldfish-3.4
- remotes/origin/linux-goldfish-3.0-wip
- remotes/origin/master
②git查看本地分支
③git查看本地分支与远程分支映射关系
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ git branch
- android-3.10
- * android-3.4
- android-goldfish-2.6.29
- master
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ git map-branches
- origin/android-3.10
- android-3.10
- origin/android-3.4
- android-3.4 *
- origin/android-goldfish-2.6.29
- android-goldfish-2.6.29
- origin/master
- master
2,编译完内核启动虚拟器无法启动
之前编译的时候使用的是
编译完启动不了,emulator一直黑屏,然后想手动创建个 -avd试试,建完后发现了这么个问题
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ make goldfish_defconfig
之前2.1的调用成功了goldfish2.6的那个arm,是以为他本身支持arm,选择创建4.4.2之后,在CPU里没有ARM,再去看 2.1的选项里,只有ARM,这就说明了问题。
于是重新编译一个
执行成功后,emulator就启动起来了
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ make goldfish_armv7_defconfig
- senrsl@senrsl-ubuntu:~/android/source/kernel/goldfish$ make
2015年03月20日15:47:15--
senRsl
2015年03月20日14:17:21
2015年03月20日14:17:21
没有评论 :
发表评论