Software Development FYT Firmware Workbench 2.0

Search This thread
# FYT-Firmware-Workbench

PLEASE DO NOT USE WITH T'EYES CC3 FIRMWARE

Scripts intended to mount the FYT UIS7862 firmware, make modifications and reassemble it back

They can retrieve the firmware from specified location and after modification, they can put the packed and signed firmware into another specified location

Files:

1-) config.ini = A file to setup parameters, paths for the original firmware and patched firmware, temp directory to work with firmware files and mount point to edit the firmware

2-) import_original.sh = Retrieves the ZIP file from the location specified in config.ini

3-) import_patched.sh = Retrieves the same files that 'import_original.sh' but from the patched location specified in the config.ini (normally a firmware that you've already patched before)

4-) unpack.sh = (autorun after import*) Unpack the imported firmware and create the mount moints (as specified in the config.ini file) to work with the firmware

5-) tweaker.sh = Allows change Locale, Language, Country and allows enabling ADB and OTG (if hardware supports it)

6-) inject_mods = Copies all contents of "_mods" folder into system partition, like gps.conf or even bootanimation, up to you to creat the same folder structure with your own files to inject

7-) repack.sh = Unmount the modified firmware from the mount points, delete the mount points, assembly the new ZIP file, sign it and move it to the patched directory as specified in config.ini

:cool: clean_local.sh = This script will unmount the firmware and delete it, it will also delete temporary files. as its name says, it cleans the local workbench !


N'joy it !

[CHANGELOG]

2.0 Introduces a different ZIP signature method

1.0 Initial release
 

Attachments

  • FYT-Firmware-Workbench.zip
    314 KB · Views: 746
Last edited:

surfer63

Senior Member
May 4, 2010
6,590
3,959
Zwolle
github.com
Did you already try to flash it? I seed that you sign with the test keys but does that now work on the 7862?
On the previous architectures the recovery did not allow self signed zips.
 

surfer63

Senior Member
May 4, 2010
6,590
3,959
Zwolle
github.com
Hi,

I tried your tools. Nice work.

I first did the "import_original.sh" and then the "unpack.sh". I did use this on a RPi4 running Debian Linux. All my Linux machines are currently RPi boxes and I use my headless server RPi4 for most stuff I do myself on images. (Next to that I have a Chromebook running Linux as well, but that one doesn't allow me to mount images in the linux sandbox.)

In the unpack.sh I get errors after brotli on the resizing of all the images:
Bash:
**********************************************
 
 Processing 'system' image ...
 
BROTLI -- Handling system.new.dat.br...
Converting system.new.dat file into system.img file
When tring the "Converting .." is where it goes wrong without error message. The sdat2img is using "#!/usr/bin/env python" which, on an python3 only system gives "/usr/bin/env: ‘python’: No such file or directory"
When I change the call to "python3 sdat2img.py <etcetera>" it works. It might be better to use something like
Code:
if [ `which python` ]; then
    ./tools/sdat2img.py
elif [ `which python3`]; then
    python3 ./tools/sdat2img.py
else
    printf "\n\nNo python found!!\n\n"
    exit 1
fi
Otherwise your created dat file is 0 bytes (simply an echo of 0 bytes to a new file), then giving corrupt empty images of 128 MB when trying to resize them.

And about the resizing/shrinking of the images: Why do you do that?
Simply leave the img as is and mount it read-write, not read-only.
Please use
Code:
mount -t ext4 -o loop,rw $unzippedPath$i.img $MOUNTPOINT/$i
and then simply copy (as root) your stuff in or make the modifications directly (as root). After unmounting you can immediately repack and brotli-compress it again. No extra intermediate steps necessary.

****
And some other remarks (actually a bit of nit-picking, please don't feel offended. I think you did a great job):
You use and pack a 64bit jdk with it, which is of course very convenient in most cases but doesn't work on my ARM raspberry pi.
I would put something in the shell script like
Bash:
echo "Singning '${FIRMWAREZIPFILENAME}' file..."
if [ -n `which java` ]; then
    # Not found. Use packed version and hope it is a 64bit system
    tools/jdk64/bin/java -jar tools/SignApkv2.jar <etcetera>
else
    # Use system version
    java -jar <etcetera>
fi

You also use
Bash:
echo " "
echo "READY !!!."
echo " "
Why not use
Code:
printf "\n\nREADY !!!\n\n"
 
Don't feel offended at all fellow, that's normal you're improving the scripts so suit your needs, that's normal, and your code (above) seems much more adapted than mine, I packed a 64bit java 8 cause java 11 does not sign the ZIP, (or at least I didn't reach the sign correctly)

Y have a giltab at home with that projects (FYT, TS10 etc....) y you want to participate and pull-request your changes, os help me improving that scripts, you're welcome and I'll send you the link via PM
 
  • Like
Reactions: hanichl

j-5

Senior Member
Jun 5, 2013
154
33
I finally got my images to mount. (had to sudo)
I used the modifications @surfer63 suggested. (python3 was the trick here)

edit: are the mountpoints supposed to be RO? I'm getting "no space.." error running the tweaker.
 
Last edited:
I finally got my images to mount. (had to sudo)
I used the modifications @surfer63 suggested. (python3 was the trick here)

edit: are the mountpoints supposed to be RO? I'm getting "no space.." error running the tweaker.
No, they shoud have 128Mb + each uhntil repack

NOTE: before running FYT Firmware Workbench do a "sudo su" (you must run as ROOT) that's why it didn't work flawlessly, I'll modify the scripts to ask for sudo su if needed !
 
  • Like
Reactions: marchnz

j-5

Senior Member
Jun 5, 2013
154
33
No, they shoud have 128Mb + each uhntil repack

NOTE: before running FYT Firmware Workbench do a "sudo su" (you must run as ROOT) that's why it didn't work flawlessly, I'll modify the scripts to ask for sudo su if needed !
OK, got it.
I had commented out the "expand' part, my bad .
 
Last edited:
  • Like
Reactions: mariodantas

jp08

Member
Apr 24, 2011
16
0
I'll release some fixes soon !
this is very good, thanks for your hard work!
I am also having trouble parsing the system.new.dat.br file (I only chose to edit it in config). After changing to python3, file began to be mounted and repack. But I get an error on the device in the middle of installation related to "dynamic_partitions_op_list" even though I didn't change anything
 

ahmed123

Senior Member
Jan 14, 2006
126
6
@mariodantas The CC3 Firmware Tools don't seem to work with the January firmware. The error when using them on the January firmware is:

Code:
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open _tmp/_firmware/elable.img

Any chance of this being fixed please?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    # FYT-Firmware-Workbench

    PLEASE DO NOT USE WITH T'EYES CC3 FIRMWARE

    Scripts intended to mount the FYT UIS7862 firmware, make modifications and reassemble it back

    They can retrieve the firmware from specified location and after modification, they can put the packed and signed firmware into another specified location

    Files:

    1-) config.ini = A file to setup parameters, paths for the original firmware and patched firmware, temp directory to work with firmware files and mount point to edit the firmware

    2-) import_original.sh = Retrieves the ZIP file from the location specified in config.ini

    3-) import_patched.sh = Retrieves the same files that 'import_original.sh' but from the patched location specified in the config.ini (normally a firmware that you've already patched before)

    4-) unpack.sh = (autorun after import*) Unpack the imported firmware and create the mount moints (as specified in the config.ini file) to work with the firmware

    5-) tweaker.sh = Allows change Locale, Language, Country and allows enabling ADB and OTG (if hardware supports it)

    6-) inject_mods = Copies all contents of "_mods" folder into system partition, like gps.conf or even bootanimation, up to you to creat the same folder structure with your own files to inject

    7-) repack.sh = Unmount the modified firmware from the mount points, delete the mount points, assembly the new ZIP file, sign it and move it to the patched directory as specified in config.ini

    :cool: clean_local.sh = This script will unmount the firmware and delete it, it will also delete temporary files. as its name says, it cleans the local workbench !


    N'joy it !

    [CHANGELOG]

    2.0 Introduces a different ZIP signature method

    1.0 Initial release
    3
    thx @surfer63

    edit unpack.sh :
    python3 ./tools/sdat2img.py $unzippedPath$i.transfer.list $unzippedPath$i.new.dat $unzippedPath$i.img > /dev/null 2>&1

    edit repack.sh :
    python3 ./tools/img2sdat.py $unzippedPath$i.new -v 4 -o $unzippedPath -p $i #> /dev/null 2>&1

    @mariodantas: The sdat2img.py and img2sdat.py are quite old and not testing for python2 or python3.
    The simplest way to adapt that is in your unpack.sh script and not in the python files, by using something like:

    Bash:
            echo "$(tput setaf 6)Converting $i.new.dat file into $i.img file$(tput setaf 7)"
            if  [ ! -e /usr/bin/python3 ]
            then
                # No python3 binary found. We have python2
                ./tools/sdat2img.py $unzippedPath$i.transfer.list $unzippedPath$i.new.dat $unzippedPath$i.img > /dev/null 2>&1
            else
                # Yes. python3 exists. Use it
                python3 ./tools/sdat2img.py $unzippedPath$i.transfer.list $unzippedPath$i.new.dat $unzippedPath$i.img > /dev/null 2>&1
            fi
            rm $unzippedPath$i.new.dat

    and then do the same for the img2sdat line.
    You can of course do the same in python using the sys.sys_info tuple, but that is less simple. And you need to adapt the shebang line.
    2
    in the last modification teyes CC32K the engineer of teyes company understanding why many programs not work correctly , because the program in oem block cant have any primation due to a lot of application worked slowly or did not work at all , it was decided to move all applications to elable block , i understand the elable its not original block for google firmware i move it to product /
    ok, i see you are not just familiar enough with this platform yet. i do not know what you mean saying "google firmware" but chinese oem software are definitely, at least in part, path-dependent to elable/oem partitions, and there is nothing from google in these partitions, except heavily modified system ui

    The Google software is always in the product partition.
    The FYT application layer is in the elable partition inside the kernel on T'eyes.
    On all other FYTs the Application layer is in the AllAppUpdate.bin and flashed to /oem.

    There are design documents where which applications/software should be installed in which partition. Technically it does not really matter like older firmwares simply show.
    2
    What did you change to make it work?
    thx @surfer63

    edit unpack.sh :
    python3 ./tools/sdat2img.py $unzippedPath$i.transfer.list $unzippedPath$i.new.dat $unzippedPath$i.img > /dev/null 2>&1

    edit repack.sh :
    python3 ./tools/img2sdat.py $unzippedPath$i.new -v 4 -o $unzippedPath -p $i #> /dev/null 2>&1
    1
    Yes it works well, of course I flashed a modified 6315_1 befor make this post. You can trust the scripts, take a look at the tweaker.sh who allow you to modify some settings, Locale,Region, Coutry, and more to come !