好久没更新文章了,一直加班加班加班,回家躺着就啥都不想干了。
今天难得下班早,想着优化一下手机系统,顺便折腾下内核,大概记录下过程吧。
配置java环境
百度下载一个jdk mac版本,我就下了个jdk1.8,直接安装就完事了。
装好后配置下环境
输入 /usr/libexec/java_home
查看JDK的安装位置
/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
配置JDK
在~/.bash_profile文件中配置JDK环境
输入nano ~/.bash_profile
然后在.bash_profile中加入你的java安装位置,就是上面获取的那个地址
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
export JAVA_HOME=$JAVA_HOME
这样就完事儿了。
在用brew安装个gcc编辑器,准备工作应该就差不多了。
现在看下官方的文档
Android build
- Download original android source code ( android-10.0.0_r15 ) from http://source.android.com ( $repo init -u
https://android.googlesource.com/platform/manifest -bandroid-10.0.0_r15
$repo sync -cdq -j12 --no-tags $repo start android-10.0.0_r15 --all )
- Then, merge the source into the android source code
- Run following scripts to build android
a) source build/envsetup.shb) lunch 1
c) make -j4
- When you compile the android source code, you have to add google original prebuilt source(toolchain) into the android directory.
- After build, you can find output at out/target/product/generic
Kernel Build
- Uncompress using following command at the android directory
a) tar -xvzf *_Kernel_Q.tar.gz
- When you compile the kernel source code, you have to add google original "prebuilt" source(toolchain) into the android directory.
Run following scripts to build kernel
a)cd kernel/msm-4.9 b)mkdir -p out c)export CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
d)make ARCH=arm64 O=./out judypn_lao_com-perf_defconfig e)make
ARCH=arm64 O=./out KERNEL_COMPRESSION_SUFFIX=gz -j16
* "-j16" : The number, 16, is the number of multiple jobs to be invoked simultaneously. - After build, you can find the build image(Image) at kernel/msm-4.9/out/arch/arm64/boot
本文作者为四文,转载请注明。