其實解壓、打包boot.img沒什麼難度一看就會咯!!
1.先下附件:工具。 點擊打開連接 6.0 KB, 下載次數: 60) 解壓到bin文件夾裏,方便之後使用。
2.解壓boot.img文件
去到boot.img所在的文件夾,輸入下面的命令:android
Page size: 2048 (0x00000800)
Kernel size: 2240184 (0x00222eb8)
Ramdisk size: 221504 (0x00036140)
Second size: 0 (0x00000000)
Board name:
Command line:androidboot.hardware=blade console=null g_android.product_id=0x1354 g_android.serial_number=Blade-CM7
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.
完了以後,你就會發現多了boot.img-kernel 和 boot.img-ramdisk.gz文件,這就是解壓出來的boot.img,其中boot.img-kernel 就是內核,boot.img-ramdisk.gz就是ramdisk。
3.打包boot.img文件
在替換和內核後,就要對boot.img打包了!!下是代碼:
web
命令中-cmdline‘xxx’,xxx就是解壓boot.img是Command line:xxx工具
new.img文件就是你修改後的boot.img文件了。改個名字替換到ROM裏面就能夠了。!!ui
new.img文件就是你修改後的boot.img文件了。改個名字替換到ROM裏面就能夠了。!!spa
# ./split_bootimg.pl boot.img Page size: 2048 (0x00000800) Kernel size: 1388548 (0x00153004) Ramdisk size: 141518 (0x000228ce) Second size: 0 (0x00000000) Board name: Command line: no_console_suspend=1 Writing boot.img-kernel ... complete. Writing boot.img-ramdisk.gz ... complete.
Extract the ramdisk.
# mkdir ramdisk # cd ramdisk # gzip -dc ../*-ramdisk.gz | cpio -i # cd ..
Make any changes necessary (e.g., set ro.secure=0 in default.prop).
Recreate the cpio archive using the mkbootfs binary produced from building the Android source code (The cpio utility in OS X does not recognize the newc format, therefore mkbootfs is the best option for OS X users).
# mkbootfs ./ramdisk | gzip > ramdisk-new.gz
Recreate the image file using the mkbootimg binary produced from building the Android source code.
# mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel boot.img-kernel --ramdisk ramdisk-new.gz -o boot-new.img --base 0x20000000.net
=======================================================================code
Make any changes necessary (e.g., set ro.secure=0 in default.prop).
Recreate the cpio archive using the mkbootfs binary produced from building the Android source code (The cpio utility in OS X does not recognize the newc format, therefore mkbootfs is the best option for OS X users).
# mkbootfs ./ramdisk | gzip > ramdisk-new.gz
Recreate the image file using the mkbootimg binary produced from building the Android source code.
# mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel boot.img-kernel --ramdisk ramdisk-new.gz -o boot-new.img --base 0x20000000orm
打包ramdisk.img : find . |cpio -ov -H newc |gzip > ../ramdisk.imgblog