[TOOL] Huawei Update Extractor Linux/Perl

marco.minetti

Senior Member
Jun 11, 2006
56
23
0
www.marcominetti.net
Hi there, I recently started again playing with custom roms and I needed to extract official UPDATE.APP files in Linux. Here there is a perl script to extract and verify imgs from update packages.

How To Use
Code:
# copy splitupdate, crc and UPDATE.APP files
chmod +x splitupdate
chmod +x crc
./splitupdate UPDATE.APP
Sources/Download
The tool has been forked from JoeyJiao and available at https://github.com/marcominetti/split_updata.pl.

Windows GUI
If you prefer to use a GUI, you can use the excellent Huawei Update Extractor from @worstenbrood (http://forum.xda-developers.com/showthread.php?t=2433454).

As usual, you use it at your own risk.
 

desalesouche

Senior Member
Feb 6, 2012
3,651
4,294
0
i already found how to do it properly,notcomplicated at all, i will provide how-to asap provided by @Blefish( i am actually in two weeks holidays...so some patience is needed).
here is how-to:
I was able to use simg2img like this:

simg2img SYSTEM.img SYSTEM.img_raw

Then you can do
sudo mkdir /media/<username>/temp

and afterwards

sudo mount SYSTEM.img_raw /media/<username>/temp


open it via terminal such as

nautilus /media/<username>/temp

You should be able to copy out of the mounted directory.
You cannot make dirs and files in the mounted dir
But if there is a problem you can do

chown <username>:<username> /media/<username>/temp
 

millo1978

Senior Member
Mar 28, 2008
625
436
0
Milano / Horb am Neckar
Code:
./splitupdate UPDATE.APP
000000FE SHA256RSA 256.00B 2017.03.02 20.46.16
000000FE CRC 191.20KB 2017.03.02 20.46.16
F0FFFFFF CURVER 15.00B 2017.03.02 20.46.16
F1FFFFFF VERLIST 2.43KB 2017.03.02 20.46.16
00000000 EFI 17.00KB 2017.03.02 20.46.16
16000000 MODEMNVM_UPDATE 20.13MB 2017.03.02 20.46.16
19000000 SENSORHUB 416.44KB 2017.03.02 20.46.17
14000000 FW_HIFI 2.51MB 2017.03.02 20.46.17
0F000000 CUST 415.91MB 2017.03.02 20.46.17
extracting SYSTEM (2.36GB)...[B][COLOR="Red"]Negative length at ./splitupdate line 118.[/COLOR][/B]
What does it mean?

How to solve it?

Help me please :)
 

ante0

Senior Member
Dec 28, 2009
3,206
1,576
243
Stockholm
Hi there, I recently started again playing with custom roms and I needed to extract official UPDATE.APP files in Linux. Here there is a perl script to extract and verify imgs from update packages.

How To Use
Code:
# copy splitupdate, crc and UPDATE.APP files
chmod +x splitupdate
chmod +x crc
./splitupdate UPDATE.APP
Sources/Download
The tool has been forked from JoeyJiao and available at https://github.com/marcominetti/split_updata.pl.

Windows GUI
If you prefer to use a GUI, you can use the excellent Huawei Update Extractor from @worstenbrood (http://forum.xda-developers.com/showthread.php?t=2433454).

As usual, you use it at your own risk.
Sorry for reviving this thread, but this tool has helped me a ton.

I was wondering, do you have a source for the crc binary, or happen to know where it came from?
I'm porting this to Android, well I have already, but that executable doesn't run on Android. It works great without it but would be nice if it actually checked checksum xD
 

hackslash

Recognized Contributor
Feb 20, 2015
1,248
1,510
153
22
Islamabad
This is awesome. Really grateful to what you've done. I always used to switch to Windows just for extracting the update app. Can't thank you enough.
 

HifeFish

Member
Dec 4, 2017
5
0
0
I was trying to extract some UPDATE.APP files for the Huawei Ascend Y300, but all the files seem to be named "INPUT" leading to each file in ./output overwriting its predecessor. So I changed line 119 to

Code:
    open(OUTFILE, ">$BASEPATH$fileType$fileLoc.img") or die "Unable to create $fileType.img: $!\n";
to have unique filenames. I'm sure there is a more elegant way to do that, maybe by checking whether the file already exists, but this was the quickest fix I could think of.

Now I only need a way to find out what these files are. Any hints how to do that? I found an old thread with a similar script that had another script that "guessed" the files, but everything is dead google docs links (those seem to be a pattern on dated android-related projects...).
 

Nrin

Member
Apr 11, 2017
7
16
0
Hey guys,

The script works and thank you for your job. However, I don't like Perl and I decided to re-write this tool from scratch using Rust (as an exercise).

The script that I made is multi-threaded, i.e. faster in the extraction, and specially it doesn't require so much memory. In fact, I have a computer with a small amount of memory and I couldn't use your script, because it uses too much RAM (e.g. when it extracts SYSTEM.img that is big).
The negative aspect of my script is that actually the error handling is weak, so for example I don't even check the crc of the extracted files. Btw, it should work, also if I'm not gonna take any responsability.

The script is open-source, thus you can change it as you wish, submitting pull requests or forking it.

Click here to be redirected on the github page, there is also a pre-compiled version for Linux 64 bit.