1.前言
如果你拿到一个USB升级包,你会发现升级包的结构基本相似。
但是里面并不是直接就有包括system.img、boot.img和recovery.img在内的镜像文件。
如果我们需要在Android手机上获取Magisk。提取内核(boot.img)就至关重要。当然其他镜像根据你的需要也有其他用处。
这时,如果你需要这些镜像文件,怎么做呢?
关注 "升级包>update.zip>payload.bin"。我们这篇的博客的目的就是从payload.bin中提取出镜像文件。
2. 环境准备的提取步骤
2.1 下载payload_dumper
打开
- GitHub - vm03/payload_dumper: Android OTA payload dumper
获取程序的压缩包解压放置合适的目录
2.2 安装库文件
从压缩包里检查requirements.txt,里面有需要的python库的版本:
protobuf>=3.19.3, <=3.20.1
six>=1.16.0
bsdiff4>=1.1.5
安装指定版本的python库:
D:\zyy\payload_dumper-master\payload_dumper-master>pip install bsdiff4
Collecting bsdiff4
Downloading bsdiff4-1.2.3-cp39-cp39-win_amd64.whl (18 kB)
Installing collected packages: bsdiff4
Successfully installed bsdiff4-1.2.3
D:\Users\zhangyy\AppData\Local\Programs\Python\Python39\Lib\site-packages\protobuf-python-3.20.1\protobuf-3.20.1>pip install protobuf==3.20.1
Collecting protobuf==3.20.1
Downloading protobuf-3.20.1-cp39-cp39-win_amd64.whl (904 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 904.1/904.1 kB 202.8 kB/s eta 0:00:00
Installing collected packages: protobuf
Successfully installed protobuf-3.20.1
[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: python.exe -m pip install --upgrade pip
检查是否都安装成功:
D:\Users\zhangyy\AppData\Local\Programs\Python\Python39\Lib\site-packages\protobuf-python-3.20.1\protobuf-3.20.1>pip lis
t
Package Version
------------ -------
asgiref 3.5.2
bcrypt 4.0.1
bsdiff4 1.2.3
cffi 1.15.1
cryptography 38.0.4
Django 4.1.3
paramiko 2.12.0
pip 22.3.1
protobuf 3.20.1
pycparser 2.21
PyNaCl 1.5.0
setuptools 56.0.0
six 1.16.0
sqlparse 0.4.3
tzdata 2022.6
OK,都安装成功而且版本合适。
2.3 执行镜像提取
将USB升级包的update.zip解压后拖到payload_dumper.py的同级目录执行
D:\zyy\payload_dumper-master\payload_dumper-master>python payload_dumper.py ota_package_update\payload.bin
Processing abl partition.Done
Processing bluetooth partition.Done
Processing boot partition................................Done
Processing cmnlib partition.Done
Processing cmnlib64 partition.Done
Processing devcfg partition.Done
Processing dsp partition................Done
Processing dtbo partition....Done
Processing hyp partition.Done
Processing imagefv partition.Done
Processing keymaster partition.Done
Processing modem partition....................................................Done
Processing product partition........................................................................................................................Done
Processing qupfw partition.Done
Processing recovery partition................................................Done
Processing rpm partition.Done
Processing system partition............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Done
Processing tz partition.Done
Processing uefisecapp partition.Done
Processing vbmeta partition.Done
Processing vbmeta_system partition.Done
Processing vendor partition....................................................................................................................................................................................................................................................Done
Processing xbl partition..Done
Processing xbl_config partition.Done
执行完成后查看output目录
OK,这样就成功了,是不是很简单。
3.总结
安卓系统USB升级包里其实是有镜像信息的,需要你做一个提取。