Android 4.4系統擷取root許可權的方法

來源:互聯網
上載者:User

標籤:otf   需要   boot   掛載   android   ls -l   tab   wait   cpi   

1. 準備工作:

準備一台ubuntu機器,將boot.img複製到該機器上,下載必要的工具
sudo apt-get install abootimg
git clone https://github.com/anestisb/android-simg2img.git
cd android-simg2img
make
sudo cp simg2img /usr/bin

2. 解壓縮boot鏡像
abootimg -x boot.img
mkdir ramdisk
cd ramdisk
gunzip -c ../initrd.img | cpio -i

3. 修改default.prop檔案,使得
ro.secure=0
ro.debuggable=1

4. 修改init.rc,使得
on property:ro.debuggable=1
start console

service adbd /sbin/adbd
class core
socket adbd stream 660 system system
disabled
seclabel u:r:su:s0

on post-fs
# once everything is setup, no need to modify /
mount rootfs rootfs / rw remount

5. 修改fstab.freescale,使得掛載許可權可寫
/dev/block/mmcblk0p5 /system ext4 rw wait

6. 重新打包ramdisk檔案
cd ramdisk/
find . | cpio –o –H newc | gzip > ../new-ramdisk.img

7. 產生新的boot.img
由於解壓縮後再打包,new-randisk.img檔案大小會與原來的initrd.img大小不同,
如果比原來大,需要重新設定boot.img的大小,
查看原來的大小
cat bootimg.cfg,
第一行是原來的boot.img的大小,
使用ls -l 查看initrd.img和new-ramdisk.img兩個檔案的大小,
在原來boot.img的大小基礎上加上兩個檔案的大小差(NEWSIZE-BYTES),注意增加的位元組數最好是block的整數倍,例如4096位元組等等。
然後使用命令產生新的鏡像:
abootimg --create new-boot.img -f bootimg.cfg -k zImage -r new-ramdisk.img -c “bootsize=NEWSIZE-BYTES”

8. 將產生的new-boot.img作為boot.img重新刷入開發板,
重啟後進入系統,system分區變成可寫了。

Android 4.4系統擷取root許可權的方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.