MTK6577---adb shell默认root登陆

2200阅读 0评论2014-06-13 badloong
分类:Android平台

一. 原理
原理很简单就是将/default.prop文件中的ro.secure=1 改为ro.secure=0
  1. root@android:/ # cat /default.prop
  2. #
  3. # ADDITIONAL_DEFAULT_PROPERTIES
  4. #
  5. ro.mh.product=a_b_c
  6. ro.mh.mtkversion=mt6577
  7. ro.mh.intenational=false
  8. ro.secure=0
  9. ro.allow.mock.location=1
  10. persist.mtk.aee.aed=on
  11. ro.debuggable=1
  12. persist.sys.usb.config=mass_storage,adb
  13. persist.service.acm.enable=0

二. 解压并打包boot.img
为了将default.prop这个文件修改,得需要将boot.img解包,修改,然后再打包,
最后烧进系统就可以直接root登adb shell了,步骤如下:
  1. //a.将解压出来的mkbootimg repack-MT65xx.pl unpack-MT65xx.pl这三个文件放在与boot.img同一个目录下
  2. lsun@ubuntu:/work/bootimg$ ls   
  3. boot.img mkbootimg repack-MT65xx.pl unpack-MT65xx.pl 

  4. //b.解压boot.img
  5. sun@ubuntu:/work/bootimg$ ./unpack-MT65xx.pl ./boot.img
  6. MTK-Tools by Bruno Martins
  7. MT65xx unpack script (last update: 31-07-2012)
  8. Valid Android signature found...
  9. Kernel written to ./boot.img-kernel.img
  10. Ramdisk written to ./boot.img-ramdisk.cpio.gz
  11. Ramdisk size: 2108 blocks
  12. Extracted ramdisk contents to directory ./boot.img-ramdisk
  13. Successfully unpacked kernel and ramdisk.

  14. //c.查看一下,多了boot.img-kernel.img 与 ramdisk的文件
  15. sun@ubuntu:/work/bootimg$ ls
  16. boot.img boot.img-kernel.img boot.img-ramdisk boot.img-ramdisk.cpio.gz mkbootimg repack-MT65xx.pl unpack-MT65xx.pl

  17. //d.修改defautl.prop文件,使adb shell可以直接用root登陆
  18. sun@ubuntu:/work/bootimg$ vi boot.img-ramdisk/default.prop 

  19. sun@ubuntu:/work/bootimg$ chmod 777 ./mkbootimg
  20. //e.将boot.img打包
  21. sun@ubuntu:/work/bootimg$ ./repack-MT65xx.pl -boot ./boot.img-kernel.img boot.img-ramdisk ./boot.img_new
  22. MTK-Tools by Bruno Martins
  23. MT65xx repack script (last update: 31-07-2012)
  24. Repacking boot image...
  25. Ramdisk size: 2108 blocks
  26. Can't exec "mkbootimg": No such file or directory at ./repack-MT65xx.pl line 82.
    Repacked boot image into ./boot.img_new

  27. //f.找不到mkbootimg则修改repack-Mt65xx.pl
    sun@ubuntu:/work/bootimg$ vi repack-MT65xx.pl 
  28. 将system ("mkbootimg --kernel $kernel --ramdisk new-ramdisk-repack.cpio.gz -o $outfile");改为
  29. system ("./mkbootimg --kernel $kernel --ramdisk new-ramdisk-repack.cpio.gz -o $outfile");

  30. //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

  31. //h.查看新生成的boot.img
  32. 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)
上一篇:Android系统Recovery流程
下一篇:没有了