android 系统怎么将修改好的kernel打包成boot.img

「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!!
复制代码

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值