另一種root方法,Android boot.img破解

來源:互聯網
上載者:User

標籤:android   io   ar   使用   sp   檔案   bs   linux   as   

一、破解原理

Android手機獲得Root許可權,其實就是讓/system和/data分區獲得讀寫的許可權。這兩個分區的許可權配置,一般在根分區的init.rc檔案中,修改這個檔案可永久獲得root許可權。

眾所周知,市面上絕大部分的Android手機檔案系統有三個分區,分別是/,/system,/data。根分區(/)是打包為ramdisk.img後,再與kernel的zImage打包為boot.img。boot.img在EMMC/NAND中以RAW DATA的形式存在,且除使用燒寫工具外,無法讀寫。正因如此,根分區(/)在每次開機時都會從儲存空間中載入到RAM, 所以根分區(/)是難以不刷機破解的。

如何破解呢? 我們推薦的辦法是:獲得boot.img,解壓boot.img得到ramdisk.img, 再由ramdisk.img解壓得到root目錄(/),修改其中的init.rc檔案,再打包,最終得到新的boot.img。最後利用燒寫工具將boot.img燒寫到手機即可。

註: 現在的手機廠商都有提供升級軟體包,獲得boot.img和scatter file不是一件難事,。加之所有MTK手機廠商都採用flash tools工具。此方法具有較高的實戰性。

二、必備工具

1. linux運行環境。所有破解操作都是在linux下完成的。

2. split_bootimg.pl。 該工具用來分解boot.img

3. mkbootfs。 用來產生bootfs。

4. minigzip。 輕量級ZIP壓縮公用程式。

5. mkimage。用來產生帶標識頭(512位元組)的工具,有些廠家不使用該工具,如高通。

6. mkbootimg。用來產生boot.img的工具。

三、破解步驟

1.獲得boot.img.

2. 執行$./split_bootimg.plboot.img, 將boot.img解壓為zimage和ramdisk.img, 名字分別為boot.img-kernel, boot.img-ramdisk.gz。請記住這裡的Board name,後面打包的時候需要用到。

3. 執行$dd if=boot.img-ramdisk.gz skip=1 bs=512of=ramdisk.gz, 該命令從uRamdisk中獲得ramdisk鏡像。

4. $mkdir root, $cd root, $gzip -dc ../*-ramdisk.gz| cpio –i, 這三條命令最終將ramdisk.img.gz解壓到 root目錄下。

5. 修改root目錄下/system,/data分區的許可權。 許可權破解都在這一步。

6. $ ./mkbootfsroot | ./minigzip >new_ramdisk.img

7. $./mkimage new_ramdisk.img ROOTFS>u_new_ramdisk.img

8. $./mkbootimg --kernel boot.img-kernel --ramdisku_new_ramdisk.img --board [Board name]--output new_boot.img。注Board name見第2步描述。

9. 燒寫boot.img到手機。

10. ok!

另一種root方法,Android boot.img破解

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.