work with Official SPRD U2S Diag Driver or LibUSB Driver.
spd_dump [OPTIONS] [COMMANDS] [EXIT COMMANDS]
One-line mode
spd_dump --wait 300 fdl /path/to/fdl1 fdl1_addr fdl /path/to/fdl2 fdl2_addr exec path savepath r all reset
Interactive mode
spd_dump --wait 300 fdl /path/to/fdl1 fdl1_addr fdl /path/to/fdl2 fdl2_addr exec
Then the prompt should display FDL2>.
-
--wait <seconds>Specifies the time to wait for the device to connect.
-
--stage <number>|-r|--reconnectTry to reconnect device in brom/fdl1/fdl2 stage. Any number behaves the same way.
(unstable, a device in brom/fdl1 stage can be reconnected infinite times, but only once in fdl2 stage)
-
--verbose <level>Sets the verbosity level of the output (supports 0, 1, or 2).
-
--kickConnects the device using the route
boot_diag -> cali_diag -> dl_diag. -
--kickto <mode>Connects the device using a custom route
boot_diag -> custom_diag. Supported modes are 0-127.(mode 0 =
--kickto 2on ums9621, mode 1 = cali_diag, mode 2 = dl_diag; not all devices support mode 2). -
-h|--help|helpShow help and usage information.
-
verbose levelSets the verbosity level of the output (supports 0, 1, or 2).
-
timeout msSets the command timeout (during read and write) in milliseconds.
-
baudrate [rate](Windows SPRD driver only, and brom/fdl2 stage only)Supported baudrates are 57600, 115200, 230400, 460800, 921600, 1000000, 2000000, 3250000, and 4000000.
While in u-boot/littlekernel source code, only 115200, 230400, 460800, and 921600 are listed.
-
exec_addr [addr](brom stage only)Sends
custom_exec_no_verify_addr.binto the specified memory address to bypass the signature verification by brom forsplloader/fdl1.Used for CVE-2022-38694.
-
fdl FILE addrSends a file (
splloader,fdl1,fdl2,sml,trustos,teecfg) to the specified memory address. -
loadexec FILE(addr_in_name)Set exec_addr with the address encoded in filename and save exec_file path.
-
loadfdl FILE(addr_in_name)Load FDL file to the address encoded in filename..
-
execExecutes a sent file in the fdl1 stage. Typically used with
smlorfdl2(also known as uboot/lk). -
path [save_location]Changes the save directory for commands like
r,read_part(s),read_flash, andread_mem. -
nand_id [id]Specifies the 4th NAND ID, affecting
read_part(s)size calculation, default value is 0x15. -
rawdata {0,1,2}(fdl2 stage only)Rawdata protocol helps speed up
wandwrite_part(s)commands, when rawdata > 0,blk_sizewill not effect write speed. (rawdata relays on u-boot/lk, so don't set it manually.) -
blk_size byte(fdl2 stage only)Sets the block size, with a maximum of 65535 bytes. This option helps speed up
r,w,read_part(s)andwrite_part(s)commands. -
r all|part_name|part_idWhen the partition table is available:
r all: full backup (excludes blackbox, cache, userdata)r all_lite: full backup (excludes inactive slot partitions, blackbox, cache, and userdata)- all/all_lite is not usable on NAND
When the partition table is unavailable:
rwill auto-calculate part size (supports emmc/ufs and NAND).
-
read_part part_name|part_id offset size FILEReads a specific partition to a file at the given offset and size.
(read ubi on nand)
read_part system 0 ubi40m system.bin -
read_parts partition_list_fileReads partitions from a list file (If the file name starts with "ubi", the size will be calculated using the NAND ID).
-
w|write_part part_name|part_id FILEWrites the specified file to a partition.
-
write_parts save_locationWrites all partitions dumped by
read_parts. Usewrite_parts_aorwrite_parts_bto flash slot forcely. -
wof part_name offset FILEWrites the specified file to a partition at the given offset.
-
wov part_name offset VALUEWrites the specified value (max is 0xFFFFFFFF) to a partition at the given offset.
-
e|erase_part part_name|part_idErases the specified partition.
-
erase_allErases all partitions. Use with caution!
-
partition_list FILERead the partition list on emmc/ufs, not all fdl2 supports this command.
-
repartition partition_list_xmlRepartitions based on partition list XML.
-
p|printPrints partition_list.
-
size_part|part_size part_nameDisplays the size of the specified partition.
-
check_part part_nameChecks if the specified partition exists.
-
verity {0,1}Disable or enable
dm-verityon android 10(+). -
set_active {a,b}Sets the active slot on VAB devices.
-
firstmode mode_idSets the mode the device will enter after reboot.
-
reboot-recoveryFDL2 only
-
reboot-fastbootFDL2 only
-
resetFDL2 and new FDL1
-
poweroffFDL2 and new FDL1
-
Install Termux-api and authorize self startup
-
Install dependency libraries and compile components
pkg install termux-api libusb clang git
- Pull source code
git clone https://github.com/TomKing062/spreadtrum_flash.git
cd spreadtrum_flash
- Build
make
Produce executable files: spd_dump
- Search OTG Device
termux-usb -l
[
"/dev/bus/usb/xxx/xxx"
]
- Authorize OTG devices
termux-usb -r /dev/bus/usb/xxx/xxx
Allow access to the target device
- Run SPD_SUMP
termux-usb -e './spd_dump --usb-fd' /dev/bus/usb/xxx/xxx