Implemented stone-unpack mode

This commit is contained in:
Luxferre
2021-12-31 00:51:42 +02:00
parent eb034239db
commit a3f4e558d3
4 changed files with 537 additions and 124 deletions
+16 -2
View File
@@ -2,7 +2,7 @@
## About
Cross-platform MediaTek feature phone dumping had been achieved long ago with [MTreader](https://gitlab.com/suborg/mtreader). Now it's time to do the same for Unisoc (ex-Spreadtrum) phones. And not only that, but also to be able to flash them!
Cross-platform MediaTek feature phone dumping had been achieved long ago with [MTreader](https://gitlab.com/suborg/mtreader). Now it's time to do the same for Unisoc (ex-Spreadtrum) phones. And not only that, but also to be able to flash them and extract their compressed firmware contents!
Unfortunately, the architecture of Unisoc chipset boot ROM doesn't allow us to get away without any loader blobs. So, some FDL binaries are also shipped in this repo.
@@ -18,7 +18,7 @@ For further dumped firmware unpacking/repacking, I recommend [bzpwork](https://g
Python 3.8+ and PyUSB.
## Usage
## Usage as a flasher/dumper
Run `python uniflash.py -h` to see all parameters. But there are several typical scenarios that UniFlash officially supports.
@@ -70,6 +70,20 @@ For single-FDL targets, the FDL file name must be `[targetname]_[load_addr]_sing
For example, if you have found signed FDL loaders for Nokia 105 2019 somewhere and want to add this phone as a target, you know that they are loaded into `0x40004000` and `0x14000000` respectively, so you can rename them, for instance, to `sc6531efm_nokia105_0x40004000_fdl1.bin` and `sc6531efm_nokia105_0x14000000_fdl2.bin`, place them into `fdls/` and then just use `-t sc6531efm_nokia105` in your commands. This signed target, by the way, has already been added as an example.
## Usage as a stone image unpacker
The main syntax is as follows: `python uniflash.py stone-unpack [stone-file.bin] [-d target_dir]`
The firmware is going to be unpacked into the following files in the target directory (specified with `-d` parameter, defaults to the same directory as the source stone image file):
- `ps.bin` - protocol station image, always uncompressed, the first in the binary;
- `kern.bin` (optional) - single-block LZMA-SPD compressed kernel partition;
- `user.bin` - multi-block LZMA-SPD compressed user firmware partition;
- `rsrc.bin` - multi-block LZMA-SPD compressed user resources partition;
- `blk_xxxxxxxx` (optional) - any of the additional LZMA-SPD or standard LZMA compressed sections found in the image.
LZMA-SPD, also known as LZMA-B3, is a proprietary modification of LZMA algorithm with simplified literal encoder/decoder.
## Credits
Created by Luxferre in 2021. All files except the FDL blobs are public domain.