日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

调试Android之system.img的来回切换。

發布時間:2024/9/5 Android 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 调试Android之system.img的来回切换。 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

同事讀啟動log信息,認為是系統掛載出問題了,在網上搜了一寫,對system.img的處理。

從一篇網文開始

step1

sdat2img.py <transfer_list> <system_new_file> <system_ext4>

- <transfer_list> = input, system.transfer.list from?rom?zip
- <system_new_file> = input, system.new.dat from?rom?zip
- <system_ext4> = output ext4 raw image?file

and a quick example:

sdat2img.py system.transfer.list system.new.dat system.img

by running this command you will get as output the?file?my_new_system.img which is the?raw ext4 image.

但第一步當時并不會做,因為兩個inout文件沒見到過,直到第四步昨晚發現竟然是一個循環步驟,此時搜了其他命令生成了raw的文件

/home/sun/rk3288work/RK3288_7.1_181121/out/host/linux-x86/bin/simg2img system.img system_raw.img

生成了system_raw.img

Step 2 - Decompress EXT4 (raw image) -> OUTPUT folder -> Compress EXT4 (raw image)
?

Now we need to?mount?or ext4 raw image into an output folder so we can see apks/jars etc.
To do this we need to type this command:

sudo?mount?-t ext4 -o loop system.img output/

As you can see there is a?new?folder called?output?which we can edit/modify/delete your?files?(not able to? see?here)

Now we need to compress it back to a raw ext4 image, to do this we need the?make_ext4fs?binary. Make sure you have the?file_contexts?file?(taken from the?Rom?zip) inside the make_ext4fs path. Then type this (got issues? see?here)

./make_ext4fs -T 0 -S file_contexts -l 1073741824 -a?system?system_new.img output/

You will get the?new?raw ext4 image called 'system_new.img' ready for the next step.

這一步吧第一步生成的文件掛載后,又用make_ext4fs打包了output文件夾下掛載的系統

做的步驟

root@sun:/home/sun/rk3288work/RK3288_7.1_181121/rockdev/Image-rk3288# mkdir output

root@sun:/home/sun/rk3288work/RK3288_7.1_181121/rockdev/Image-rk3288# cd output/

root@sun:/home/sun/rk3288work/RK3288_7.1_181121/rockdev/Image-rk3288# mount -t ext4 -o loop ../system_raw.img ./

root@sun:/home/sun/rk3288work/RK3288_7.1_181121/rockdev/Image-rk3288# ../../out/host/linux-x86/bin/make_ext4fs -T 0 -S ../../out/target/product/rk3288/root/file_contexts.bin -l 2048M -a system system_2th.img output/

Step 3 - Converting = EXT4 (raw image) -> IMG (sparse image)
?

Now we need to convert the ext4 raw image into a sparse image. For this you need img2simg binary you can find?here?(thx to @A.S._id).?
The usage is simple:

img2simg <raw_image_file> <sparse_image_file>

Pretty self-explanatory, the output will be a?new?sparse image (.img).

做了這種操作

這個操作的img2simg命令不能用,搜了一下發現SDK中有源碼,需要編譯執行變異的過程是

在SDK的根目錄下執行

source build/envsetup.sh

lunch??

選要變異的版本,我是14

make img2simg_host

之后這個命令就可用了

root@sun:/home/sun/rk3288work/RK3288_7.1_181121/rockdev/Image-rk3288# ../../out/host/linux-x86/bin/img2simg system_2th.img system_3th.img

接下來做第四步

Step 4 - Converting = IMG (sparse image) -> DAT (sparse?data)
?

Now we need the?img2sdat?binary, the usage is very simple (make sure you have?python?2.7+ installed):

./img2sdat.py <system_img>

- <system_img> = name of input sparse image?file?(from step 3)

As you can see the output is composed by system.transfer.list, (system.patch.dat) & system.new.dat, ready to be replaced inside your?Rom?zip.

第四步找不到命令,就看到文章下邊有那個命令的Python代碼

DOWNLOADs
sdat2img.py?
-?github.com
make_ext4fs
-?mega.co.nz
img2sdat.py
-?github.com

接下來就進去把命令克隆下來?

點擊進入img2sdat.py
-?github.com? 這個鏈接下,最好和之前編譯源文件的文件夾目錄一致,比如~/rk3288work/RK3288_7.1_181121/system/core/libdata$? 我在core/下新建了樂意libdata文件夾然后克隆了兩個命令文本

sun@sun:~/rk3288work/RK3288_7.1_181121/system/core/libdata$ git clone https://github.com/xpirt/img2sdat.git

sun@sun:~/rk3288work/RK3288_7.1_181121/system/core/libdata$ git clone https://github.com/xpirt/sdat2img.git

然后就直接運行了該目錄下的第四步的命令

root@sun:/home/sun/rk3288work/RK3288_7.1_181121/rockdev/Image-rk3288# ../../system/core/libdata/img2sdat/img2sdat.py system_3th.img

生成了3個文件

-rw-r--r-- ? 1 root root ?61K 12月 29 15:57 system.transfer.list
-rw-r--r-- ? 1 root root ? ?0 12月 29 15:57 system.patch.dat

-rw-r--r-- ? 1 root root 518M 12月 29 15:57 system.new.dat

至此四步做完了,然后忽然發現還有返回的命令,就做了一下操作,做完后,發現就是第一步的操作,發現這是格式的轉換過程。

root@sun:/home/sun/rk3288work/RK3288_7.1_181121/rockdev/Image-rk3288# ../../system/core/libdata/sdat2img/sdat2img.py system.transfer.list system.new.dat system_5th.img

總結

以上是生活随笔為你收集整理的调试Android之system.img的来回切换。的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。