使用自定义构建内核

时间:2017-11-07 12:51:50

标签: android android-emulator kernel android-source

我尝试使用Ubuntu 16.04中的自定义构建内核运行android模拟器。 构建内核的步骤:

git clone https://android.googlesource.com/kernel/goldfish/ -b android-goldfish-3.18
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9
cd goldfish
export CROSS_COMPILE=x86_64-linux-android-
export ARCH=x86_64
export PATH=$PATH:/path/to/x86_64-linux-android-4.9/bin
make x86_64_ranchu_defconfig
make -j4

然后,当我尝试使用此图像运行模拟器时:

emulator -avd Nexus_5_API_24 -kernel /path/to/goldfish/arch/x86/boot/bzImage -show-kernel

模拟器窗口启动,我看到" Android"徽标,但没有其他事情发生。它是bootloop,在控制台中我一次又一次地看到这条消息:

[   22.396836] init: Starting service 'netd'... 
[   22.397460] init: Starting service 'media'... 
[   22.397919] init: Starting service 'zygote'... 
[   22.808059] zygote[2021]: segfault at bf833000 ip afba292a sp bf8528f0 error 4 in libart.so[af66d000+745000] 
[   22.809470] init: Service 'zygote' (pid 2021) killed by signal 11 
[   22.809940] init: Service 'zygote' (pid 2021) killing any children in process group 
[   22.810545] init: write_file: Unable to open '/sys/android_power/request_state': No such file or directory 
[   22.811288] init: write_file: Unable to write to '/sys/power/state': Invalid argument 
[   22.811881] init: Service 'media' is being killed... 
[   22.812608] init: Service 'netd' is being killed... 
[   22.813030] init: Service 'media' (pid 2020) killed by signal 9 
[   22.813482] init: Service 'media' (pid 2020) killing any children in process group 
[   22.814085] init: Service 'netd' (pid 2019) killed by signal 9 
[   22.814533] init: Service 'netd' (pid 2019) killing any children in process group 
[   22.815129] init: Untracked pid 2129 killed by signal 9

我在这里找到了一些答案: https://gist.github.com/yan12125/78a9004acb1bed5faf2ffd442163e2ef

但我不想构建ASOP并为thread.cc添加修复程序,因为我只需要来自Google的自定义内核和官方图片。

如何构建内核以避免此错误,或者,运行模拟器时可能是一些选项?

P.S。我还尝试了另一个金鱼分支(android-goldfish-3.10),但结果相同。

感谢您的回答!

1 个答案:

答案 0 :(得分:0)

我有同样的问题,我切换到分支" origin / android-goldfish-3.10-n-dev",使用Android 7.0 x86_64图像,模拟器效果很好。

cd goldfish
git checkout -b mybranch origin/android-goldfish-3.10-n-dev