原文地址:http://blog.chinaunix.net/uid-26009923-id-3995783.html
一. 原理
原理很简单就是将/default.prop文件中的ro.secure=1 改为ro.secure=0
-
root@android:/ # cat /default.prop
-
#
-
# ADDITIONAL_DEFAULT_PROPERTIES
-
#
-
ro.mh.product=a_b_c
-
ro.mh.mtkversion=mt6577
-
ro.mh.intenational=false
-
ro.secure=0
-
ro.allow.mock.location=1
-
persist.mtk.aee.aed=on
-
ro.debuggable=1
-
persist.sys.usb.config=mass_storage,adb
-
persist.service.acm.enable=0
二. 解压并打包boot.img
为了将default.prop这个文件修改,得需要将boot.img解包,修改,然后再打包,
最后烧进系统就可以直接root登adb shell了,步骤如下:
-
//a.将解压出来的mkbootimg repack-MT65xx.pl unpack-MT65xx.pl这三个文件放在与boot.img同一个目录下
-
lsun@ubuntu:/work/bootimg$ ls
-
boot.img mkbootimg repack-MT65xx.pl unpack-MT65xx.pl
-
-
//b.解压boot.img
-
sun@ubuntu:/work/bootimg$ ./unpack-MT65xx.pl ./boot.img
-
MTK-Tools by Bruno Martins
-
MT65xx unpack script (last update: 31-07-2012)
-
Valid Android signature found...
-
Kernel written to ./boot.img-kernel.img
-
Ramdisk written to ./boot.img-ramdisk.cpio.gz
-
Ramdisk size: 2108 blocks
-
Extracted ramdisk contents to directory ./boot.img-ramdisk
-
Successfully unpacked kernel and ramdisk.
-
-
//c.查看一下,多了boot.img-kernel.img 与 ramdisk的文件
-
sun@ubuntu:/work/bootimg$ ls
-
boot.img boot.img-kernel.img boot.img-ramdisk boot.img-ramdisk.cpio.gz mkbootimg repack-MT65xx.pl unpack-MT65xx.pl
-
-
//d.修改defautl.prop文件,使adb shell可以直接用root登陆
-
sun@ubuntu:/work/bootimg$ vi boot.img-ramdisk/default.prop
-
-
sun@ubuntu:/work/bootimg$ chmod 777 ./mkbootimg
-
//e.将boot.img打包
-
sun@ubuntu:/work/bootimg$ ./repack-MT65xx.pl -boot ./boot.img-kernel.img boot.img-ramdisk ./boot.img_new
-
MTK-Tools by Bruno Martins
-
MT65xx repack script (last update: 31-07-2012)
-
Repacking boot image...
-
Ramdisk size: 2108 blocks
-
Can't exec "mkbootimg": No such file or directory at ./repack-MT65xx.pl line 82.
Repacked boot image into ./boot.img_new
-
-
//f.找不到mkbootimg则修改repack-Mt65xx.pl
sun@ubuntu:/work/bootimg$ vi repack-MT65xx.pl
-
将system ("mkbootimg --kernel $kernel --ramdisk new-ramdisk-repack.cpio.gz -o $outfile");改为
-
system ("./mkbootimg --kernel $kernel --ramdisk new-ramdisk-repack.cpio.gz -o $outfile");
-
-
//g.重新打包boot.img
sun@ubuntu:/work/bootimg$ ./repack-MT65xx.pl -boot ./boot.img-kernel.img boot.img-ramdisk ./boot.img_new
MTK-Tools by Bruno Martins
MT65xx repack script (last update: 31-07-2012)
Repacking boot image...
Ramdisk size: 2108 blocks
Repacked boot image into ./boot.img_new
-
-
//h.查看新生成的boot.img
-
sun@ubuntu:/work/bootimg$ ls
boot.img boot.img-kernel.img boot.img_new boot.img-ramdisk boot.img-ramdisk.cpio.gz mkbootimg repack-MT65xx.pl unpack-MT65xx.pl
工具下载:
mtk-tools.rar (下载后改名为: mtk-tools.tar.gz)
阅读(1031) | 评论(0) | 转发(0) |