dipcore / mstar-bin-tool

Scripts to manipulate Mstar firmware binaries (e.g. MstarUpgrade.bin, LetvUpgrade.bin etc)
273 stars 130 forks source link

a Mstar based TCL TV has a sparse_write command, which is not supported. #14

Open hpp0hpp opened 4 years ago

hpp0hpp commented 4 years ago

Hi, I got a Mstar based TCL TV has a sparse_write command, which is not supported. I try to modify some lines in utils and unpack.py, I finally got the img file but, when I use simg2img tool to convert to raw file, then lots of content lost.

I totally not sure what happened? I've been search every website for the solution but lack of information and solution, can you help with me about this? here is the script I got ~header_script.txt

here is the log info [i] Analizing header ... [i] Saving header script to unpacked~header_script ... [i] Parsing script ... [i] Partition: sboot Offset: 0x4000 Size 0x25400 (149.0 KB) -> unpacked\sboot.img [i] Partition: MBOOT Offset: 0x2a000 Size 0x271e00 (2.44 MB) -> unpacked\MBOOT.img [i] Partition: MBOOTBAK Offset: 0x29c000 Size 0x271e00 (2.44 MB) -> unpacked\MBOOTBAK.img [i] Partition: boot Offset: 0x50e000 Size 0x109d800 (16.62 MB) -> unpacked\boot.img [i] Parsing setenv bootcmd -> mmc read.p 0x23000000 dtb 0x00100000; mmc read.p 0x25000000 boot 0x01800000; bootm 0x25000000 [i] Partition: recovery Offset: 0x15ac000 Size 0x1d89800 (29.54 MB) -> unpacked\recovery.img [i] Parsing setenv recoverycmd -> mmc read.p 0x23000000 dtb 0x00100000; mmc read.p 0x25000000 recovery 0x04400000; bootm 0x25000000 [i] Partition: cache Offset: 0x3336000 Size 0x48e094 (4.55 MB) append to unpacked\cache.img [i] Partition: userdata Offset: 0x37c5000 Size 0x1800000 (24.0 MB) -> unpacked\userdata.img [i] Partition: armfw Offset: 0x4fc5000 Size 0xe460 (57.09 KB) -> unpacked\armfw.img [i] Partition: RTPM Offset: 0x4fd4000 Size 0x10000 (64.0 KB) -> unpacked\RTPM.img [i] Partition: dtb Offset: 0x4fe4000 Size 0x3aff (14.75 KB) -> unpacked\dtb.img [i] Partition: frc Offset: 0x4fe8000 Size 0x46010 (280.02 KB) -> unpacked\frc.img [i] Partition: optee Offset: 0x502f000 Size 0x1e4ca0 (1.89 MB) -> unpacked\optee.img [i] Partition: cm4 Offset: 0x5214000 Size 0x63181 (396.38 KB) -> unpacked\cm4.img [i] Partition: tclconfig Offset: 0x5278000 Size 0x5000000 (80.0 MB) -> unpacked\tclconfig.img[i] Partition: vendor Offset: 0xa278000 Size 0x93d13f4 (147.82 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x1364a000 Size 0x95ff970 (150.0 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x1cc4a000 Size 0x908d6d0 (144.55 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x25cd8000 Size 0x9042628 (144.26 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x2ed1b000 Size 0x84da4fc (132.85 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x371f6000 Size 0x95fdfdc (149.99 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x407f4000 Size 0x8ece7c0 (142.81 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x496c3000 Size 0x9560340 (149.38 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x52c24000 Size 0x94b91c0 (148.72 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x5c0de000 Size 0x8ced4e4 (140.93 MB) append to unpacked\vendor.img [i] Partition: vendor Offset: 0x64dcc000 Size 0x159c1e4 (21.61 MB) append to unpacked\vendor.img [i] Partition: system Offset: 0x66369000 Size 0x8fbd514 (143.74 MB) append to unpacked\system.img [i] Partition: system Offset: 0x6f327000 Size 0x942e9e8 (148.18 MB) append to unpacked\system.img [i] Partition: system Offset: 0x78756000 Size 0x95e7b50 (149.91 MB) append to unpacked\system.img [i] Partition: system Offset: 0x81d3e000 Size 0x95d1d44 (149.82 MB) append to unpacked\system.img [i] Partition: system Offset: 0x8b310000 Size 0x95e74a4 (149.9 MB) append to unpacked\system.img [i] Partition: system Offset: 0x948f8000 Size 0x8b8aa8c (139.54 MB) append to unpacked\system.img [i] Partition: system Offset: 0x9d483000 Size 0x1793604 (23.58 MB) append to unpacked\system.img [i] Partition: data Offset: 0x9ec17000 Size 0x503b628 (80.23 MB) append to unpacked\data.img [i] Partition: data Offset: 0xa3c53000 Size 0x8efebf8 (143.0 MB) append to unpacked\data.img [i] Partition: data Offset: 0xacb52000 Size 0x91136e4 (145.08 MB) append to unpacked\data.img [i] Parsing setenv bootargs -> console [i] Parsing setenv bootargs -> console=ttyS0,115200 androidboot.console=ttyS0 root=/dev/ram rw rootwait init=/init CORE_DUMP_PATH=/var/coredump.%e%p.gz KDebug=1 delaylogo=true platform=mI tee_mode=optee str_ignore_wakelock pm_path=/tvconfig/config/PM.bin quiet loglevel=0 [i] Parsing setenv bootlogo_gopidx -> 2 [i] Parsing setenv bootlogo_buffer -> E_MMAP_ID_BOOTLOGO_BUFFER [i] Parsing setenv OSD_BufferAddr -> E_MMAP_ID_JPD_WRITE_ADR [i] Parsing setenv str_crc -> 2 [i] Parsing setenv db_table -> 0 [i] Parsing setenv verify -> n [i] Parsing setenv sync_mmap -> 1 [i] Parsing setenv CONFIG_PATH -> /tvconfig/config [i] Parsing setenv mboot_default_env -> 0 [i] Parsing setenv close_log -> yes [i] Parsing setenv MstarUpgrade_complete -> 1 [i] Parsing setenv ENABLE_STR_FAIL_GO_DC -> 1 [i] Parsing setenv MstarUpgrade_complete -> 1 [i] Parsing setenv sync_mmap -> 1 [i] Parsing setenv db_table -> 0

sha-man-4pda commented 4 years ago

Try my fork of mstar-bin-tools, it should help - https://github.com/sha-man-4pda/mstar-bin-tool

dipcore commented 4 years ago

@sha-man-4pda nice job!

czqn8 commented 2 years ago

Try my fork of mstar-bin-tools, it should help - https://github.com/sha-man-4pda/mstar-bin-tool

Converting img to sparse error #25 @sha-man-4pda @dipcore

This is the firmware I downloaded: http://tss.koyoo.cn/upload/temp/V8-T652T03-LF1V105.rar,please copy to your browser to download

sha-man-4pda commented 2 years ago

please copy to your browser to download

ERR_CONNECTION_TIMED_OUT

czqn8 commented 2 years ago

https://mega.nz/file/ZzRUlLIS#8I2InPlA5u-MgWvc7TouN83tmQxIzfHtrBUNseiwkTc

@sha-man-4pda

sha-man-4pda commented 2 years ago

@czqn8 unpacked without any proplem. Probably you have FAT32 filesytem which doesn't allow files bigger then 4GB. Userdata partition is 7.7GB.

czqn8 commented 2 years ago

[i] Processing partition [i] Name: system [i] Create: False [i] Size: NOT_SET [i] Erase: True [i] Type: partitionImage [i] Image: ./unpacked/system.img [i] LZO: False [i] SPARSE: True [i] Memory Offset: NOT_SET [i] Empty Skip: False [i] Converting img to sparse ... sh: binsparseimg2simg.exe: command not found [i] Splitting sparse file... Traceback (most recent call last): File "/Users/alan/Desktop/Android_Tool/mstar-bin-tool-master/pack.py", line 193, in chunks = utils.sparse_split(sparseFile, tmpDir, chunkSize) File "/Users/alan/Desktop/Android_Tool/mstar-bin-tool-master/utils.py", line 85, in sparse_split if os.path.getsize(file) < chunksize or chunksize == 0: File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/genericpath.py", line 50, in getsize return os.stat(filename).st_size FileNotFoundError: [Errno 2] No such file or directory: 'tmp/system.sparse'

@sha-man-4pda

czqn8 commented 2 years ago

Sparse: conversion of cache_sparse.* to cache.img,system.img,vendor.img all failed

@sha-man-4pda

sha-man-4pda commented 2 years ago

@czqn8 this is not an unpack log. Are you trying pack FW under Linux? Then you will need sparse utilities first. I don't know which fork of mstar-bin-tool you're using but it's definitely not mine as I never added Linux support to my fork.