「Android」Huawei U8825d(G330d)内核编译过程实录

1. 下载内核源代码,放到任意地方(建议放在Ext4格式的盘符上)

https://github.com/derekhe/huawei-g330d-u8825d-kernel

2. 下载后解压,打开里边HOW-TO-BUILD,查看如何进行编译

第一步:去Google查看相关编译过程,对于我们比较直接有用的就是把prebuilt通过git弄回来,其他不需要了,如果已经同步过ICS源代码,可直接略过这一步

第二步:git回来的prebuilt,export相关编译需要的工具到系统

vim ~/.bashrc
# 在最后一行加入,prebuilt的位置根据git回来位置而定
export PATH=/home/scue/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/:$PATH
source ~/.bashrc

第三步:Setup compiler toolchain

export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
export ENABLE_BTLA_VER30=true

第四步:开始编译,整个编译过程大约十分钟就可以了

make hw_g330d_defconfig
make -j4
# 编译得到的内核位置 arch/arm/boot/zImage

第五步:打包内核,并刷入手机系统

复制代码
# 下载解打包工具 https://github.com/derekhe/u8825d-bootimg-scripts
# 解压到任意地方后,从手机上获取得你现在正使用的boot.img放到解压出来的目录
# 1. 解压现有的boot.img
./unpack-bootimg.pl boot.img
# 2. 拷贝编译的zImage文件到此目录,路径自己确定
cp ../kernel-github/arch/arm/boot/zImage ./
# 3. 打包zImage和ramdisk目录
mv boot.img boot.img.bak
./repack-bootimg.pl zImage boot.img-ramdisk boot.img
# 4. 刷入boot.img,手机重启的瞬间要记得按音量减键
./adb shell reboot
./fastboot devices
./fastboot erase boot
./fastboot flash boot boot.img
./fastboot reboot
# 一切OK!!
复制代码

最后,发挥你的想像,去定制属于一个自己所需要的强大的内核吧~

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐