How to download and compile Android kernel goldfish ?
Prerequisites
Assuming that we already downloaded the android-ndk-r12b and sdk.
w4118@w4118:~/utils$ ls
android-ndk-r12b android-sdk-linux bin goldfish nexus7
And then we need to set up the environment.
Or you can download the vm having been set up directly. [1]
1. Edit ~/.bashrc
# add Android SDK Tools to the path
export ANDROID_SDK=~/utils/android-sdk-linux
export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools
# add other custom utilities to the path
export PATH=$PATH:~/utils/bin
# set up debugging paths
export PATH=$PATH:~/utils/android-ndk-r12b/prebuilt/android-arm64/gdbserver/:~/utils/android-ndk-r12b/prebuilt/linux-x86_64/bin/
# add toolchain to the path
export PATH=$PATH:~/utils/android-ndk-r12b/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin:~/utils/android-ndk-r12b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin:~/utils/android-ndk-r12b/prebuilt/android-arm64:~/utils/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:~/utils/android-ndk-r12b:~/utils/arm-eabi-4.8/bin:~/utils/android-ndk-r10e
export A24_INCLUDE=~/utils/android-ndk-r12b/platforms/android-24/arch-arm64/usr/include/
export A24_LINK=~/utils/android-ndk-r12b/platforms/android-24/arch-arm64/usr/lib/
export A24_SYSROOT=~/utils/android-ndk-r12b/platforms/android-24/arch-arm64/
export A23_INCLUDE=~/utils/android-ndk-r12b/platforms/android-23/arch-arm64/usr/include/
export A23_LINK=~/utils/android-ndk-r12b/platforms/android-23/arch-arm64/usr/lib/
export A23_SYSROOT=~/utils/android-ndk-r12b/platforms/android-23/arch-arm64/
Then
$source ~/.bashrc
2. Download android-kernel-goldfish
$git clone http://android.googlesource.com/kernel/goldfish.git
$git branch -a
$git checkout -b debug-android-goldfish-3.18 remotes/origin/android-goldfish-3.18
3. Compile kernel
$make ARCH=arm64 ranchu_defconfig
$make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-android-
hint: adding an alias to your ~/.bashrc file:
alias armmake="make -j16 KCFLAGS=-ggdb3 ARCH=arm64 CROSS_COMPILE=aarch64-linux-android-"
4. Create the emulator
Create an Android Virtual Device (AVD), and install a custom 3.18 kernel in it.
Run android avd
from the terminal
Add a new AVD by clicking "Create"
Pick a suitable name (we chose w4118avd)
Choose a Galaxy Nexus device
Target and CPU/ABI should self populate
Pick a "Skin with dynamic hardware controls"
Give at least 1500MB of RAM and a 256MB VM Heap
Tick on "Use Host GPU"
Once your AVD is set up, you can start it from the terminal with
$emulator @avdname -show-kernel
You need to open it with default kernel firstly; otherwise, it cannot start it by above emulator command.
- Hardware acceleration must be enabled in your VM settings for the AVD to boot.
- The AVD can take up to 10 minutes to boot. If the AVD fails to boot, try restarting your VM and your Host machine and allocating more memory to the VM. Giving more RAM to the AVD can also be helpful.
- If the emulator shows a completely black screen with a "Process System isn't responding", click on Wait a few times and you will get to the home screen soon.
5. Start the emulator
After compiling, you can start the emulator again.
$emulator @w4118avd -kernel arch/arm64/boot/Image -show-kernel -no-window -verbose -netfast
On x86_64 emulator
$make ARCH=x86_64 x86_64_ranchu_defconfig
$make -j16 ARCH=x86_64 CROSS_COMPILE=x86_64-linux-android- 2>&1 |tee kernel_make.out
$emulator -verbose @x86 -kernel arch/x86/boot/bzImage -show-kernel -no-window -qemu --enable-kvm 2>&1 | tee boot_errors
On armv7-32bit
kernel : android-goldfish-3.10
rom : android 7.0
toolchain : arm-eabi-4.8 (doesn't include in ndk-r12b)
command :
$make ARCH=arm ranchu_defconfig
$make -j16 ARCH=arm KCFLAGS=-ggdb3 CROSS_COMPILE=arm-eabi-
$emulator @arm32 -kernel arch/arm/boot/zImage -show-kernel -no-window -verbose -netfast
On x86 (not used)
kernel : android-goldfish-3.10
rom : android 7.0
command :
edit .config:
│ [*] KGDB: kernel debugger --->
│ │ [*] Compile the kernel with debug info │ │
│ │ [*] Provide GDB scripts for kernel debugging
$make ARCH=x86 i386_ranchu_defconfig
$make -j7 KCFLAGS=-ggdb3 ARCH=x86
$emulator @x86 -kernel arch/x86/boot/bzImage -show-kernel -no-window -verbose -netfast
Kernel and ROM matched table
Other useful command
#### Android Stop Emulator from Command Line
adb emu kill
#### Get the kernel messages
adb shell dmesg
adb shell cat /proc/kmsg
#### Redirecting kernel logs:
For Windows:‐> adb shell cat /proc/kmsg > kernelmsg.txt
For Linux:‐‐> adb shell cat /proc/kmsg | tee ‐a kernelmsg.txt
stop-emulators.sh
#!/bin/bash
for ((PORT=5554; PORT<=5584; PORT+=2)); do
echo killing emulator-$PORT...
adb -s emulator-$PORT emu kill
done
ref :
[1] http://www.cs.columbia.edu/~nieh/teaching/w4118/homeworks/hmwk2.html
[2] http://blog.chinaunix.net/uid-29616823-id-4891227.html
[3] http://blog.csdn.net/mr_raptor/article/details/7954474
[4] https://github.com/openthos/openthos/wiki/AOSP-6.0-x86_64-kernel-3.10-in-ubuntu-15.04
[5] http://tic-le-polard.blogspot.fr/2015/06/android-building-android-kernel-for_6.html
How to download and compile Android kernel goldfish ?的更多相关文章
- [原]Ubuntu 14.04编译Android Kernel
如何编译android kernel参考官方文档:https://source.android.com/source/building-kernels.html 在Ubuntu 14.04上编译a ...
- Compile android source and kernel for emulator in Debian
1.download the android source code Reference from http://source.android.com/source/downloading.html ...
- 【Android 系统开发】下载 编译 Android源代码 和 Android kernel源代码
下载Android源码简要流程 : a. 获取repo文件: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo ...
- 下载 编译 Android源代码 和 Android kernel源代码
下载Android源码简要流程 : a. 获取repo文件: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo ...
- 下载Android kernel
方法一: https://source.android.com/setup/building-kernels 方法二: 在按照https://source.android.com/setup/down ...
- How to: Compile Linux kernel 2.6
Compiling custom kernel has its own advantages and disadvantages. However, new Linux user / admin ...
- Android Kernel save defalut config
/********************************************************************************* * Android Kernel ...
- Compile Linux Kernel on Ubuntu 12.04 LTS (Detailed)
This tutorial will outline the process to compile your own kernel for Ubuntu. It will demonstrate bo ...
- How to compile Linux kernel in fedora 6
前提:已裝好Fedora 6 core 2.6.18 ,在 Fedora 6 中compile linux kernel.1.下載 Fedora 6 core 2.6.18 http://www.ke ...
随机推荐
- js 中使用typeof
>typeof(null) <"object" 对null执行typeof预算,结果返回字符串'object',也就是说,可以将null认为是一个特殊的对象值,含义是“ ...
- js 复杂研究
function test_001() { var t =0; return t || out_str("t未定义"), //1 // 执行1句;在执行2句; t||null // ...
- 模板引擎ejs
1.网站 https://ejs.co/ https://ejs.bootcss.com/ 2.app.js var http=require("http"); var ejs = ...
- JSP如何实现文件断点上传和断点下载?
核心原理: 该项目核心就是文件分块上传.前后端要高度配合,需要双方约定好一些数据,才能完成大文件分块,我们在项目中要重点解决的以下问题. * 如何分片: * 如何合成一个文件: * 中断了从哪个分片开 ...
- linux 文本文件显示行数
一般的我们在使用linux编辑器编辑文本文件的时候是不会像其他编程软件一样显示行数 临时方法: 在命令模式下输入:set nu或者:set number都可以为vi设置行号,如果要取消的话,则输入:s ...
- [LeetCode]-algorithms-Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum lengt ...
- 数据结构和算法(Java版)快速学习(线性表)
线性表的基本特征: 第一个数据元素没有前驱元素: 最后一个数据元素没有后继元素: 其余每个数据元素只有一个前驱元素和一个后继元素. 线性表按物理存储结构的不同可分为顺序表(顺序存储)和链表(链式存储) ...
- eclipse经常卡死
修改eclipse.ini 将启动内存,最小内存,最大内存都增大 eclipse是内存不够再去申请,直到有最大内存的 若上述方法不行则换eclipse eclipse有的版本是不稳定的,我用Ke ...
- lua源码学习篇四:字节码指令
在llimits.h文件中定义了指令的类型.其实就是32个字节. typedef lu_int32 Instruction; 上节说到变量最终会存入proto的数组k中,返回的索引放在expdesc ...
- C#异常操作
C#异常处理子系统包括: Try:需要异常机制的函数在其中运行 Catch:捕获异常 Throw:抛出异常 Finally:在try结束实现 C#异常主要在Exception类中,而在CLR机制中的异 ...