Unpacking NBH image from RUU update - G1 Android Development

As I had to do this today, maybe someone will find it usefull.
Instructions are for Linux.
Download http://code.google.com/p/htc-flasher/
to unpack nbh.
Install (with dpkg for debian based systems, or just build from source).
Than run
1. yang -X rom.nbh
Than, download this tool: http://forum.xda-developers.com/showthread.php?t=298327
You will need wine, or windows machine (wine works perfectly with this program).
2. wine NBSplit.exe -kaiser 05_LinuxSystem_0xb02.nb
3. wine ImgfsFromNb.exe 05_LinuxSystem_0xb02.nb.payload 05_LinuxSystem_0xb02.nb
Of course, you can follow steps 2 and 3 for other partitions than system.
And than unyaffs .bin file.
Voila!

1. yang -X rom.nbh
This tells me that my nbh is not valid, I have tried with several, any ideas or alternatives?

aaraya1516 said:
1. yang -X rom.nbh
This tells me that my nbh is not valid, I have tried with several, any ideas or alternatives?
Click to expand...
Click to collapse
The same happens to me.

Related

Dumping the pharos rom: help needed...

I tried to dump my pharos rom for a guy who needs it: http://forum.xda-developers.com/showthread.php?t=417330
While editing the registry HKLM\Security\Policies\Policies valuename '00001001' I changed it to dword:1
So far no problems
In the next step I tried to check that all the partition sizes reported by pdocread were correct. Here I got the first error message (see screenshot).
I tried to skip the verification of the partition sizes reported by pdocread and tried to go on with the reported partition sizes. But here it's the same error message again and I can't go on with further steps (see screenshot).
My pharos is not modified in any way, has no sim lock and the original shipped rom. No HardSPL so far.
in the command line you need to change "FLASHDR" with "DSK1:"
this is the right command:
pdocread -w -d DSK1: -p Part00 0 0x313400 Part00.raw
remember that the the os is Part02.raw
bye
Copy the files included in this zip to your tools directory and use this bat file to dump the firmware. You will get the SYS and OEM folders on the dump directory. It only dumps part02.
I'm trying to do a automated dumper like elf's one, but it isn't finished.
Files missing..
Thanks to both of you for your help.
@jose_sonseca: Your tool is absolutly fantastic ****many thanks****
But I still need two files, one is something like ...prepare_imgfs...
Where can I find them...?
You need itsutils (if you have pdocread, it's ok), and imgfs tools -> http://forum.xda-developers.com/showthread.php?t=249836 Download imgfs_tools_182.zip
They include prepare_imgfs and viewimgfs. DMP2PKG tool is included in my zip file.
jose_sonseca said:
You need itsutils (if you have pdocread, it's ok), and imgfs tools -> http://forum.xda-developers.com/showthread.php?t=249836 Download imgfs_tools_182.zip
They include prepare_imgfs and viewimgfs. DMP2PKG tool is included in my zip file.
Click to expand...
Click to collapse
Thank you - Great
Very nice job!!!
I search this to my Touch PRO
Thx a lot!!

[HELP] Repacking boot.img on windows

been following amon's instructions (the one that was used for cyanogen's 32a mod)... modifying them a bit for windows... downloaded strawberry perl and when i run repack-H.pl i get an error saying it can't find the mkbootimg-H file... so i was wondering where i should put this so that strawberry perl can get at it
Thanks a lot... first time developer here
I keep it in my /tools/ dir with the repack script.
ok so i've navigated to my folder with boot.img-kernel and the boot.img-ramdisk folder and i'm running the command
perl C:\Users\*my user name *\Desktop\aoeu\android\tools\repack-H.pl boot.img-kernel boot.img-ramdisk boot.img
and i'm getting 2 errors...
'cpio' is not recognized as an internal or external command, operable program or batch file (i figure this is because i'm on windows... haven't found a solution for this yet but i'm sure i can get cpio for windows somewhere)
and 'mkbootimg-H' is not recognized as an internal or external command, operable program or batch file.
would love help in any way... as i've said i'm running windows 7 with strawberry perl installed...
*edit* if this helps i'm trying to put together a rom that has hofo kernel v2 on top of jacheroski 2.1
I don't think you can repack ROM's in Windows. You can get VirtualBox and install a Linux distro using it.
hotweiss said:
I don't think you can repack ROM's in Windows. You can get VirtualBox and install a Linux distro using it.
Click to expand...
Click to collapse
damn lol i did my best to make it work... virtualbox here i come!
Phil_McRevis said:
damn lol i did my best to make it work... virtualbox here i come!
Click to expand...
Click to collapse
Install Linux Mint in virtualbox, as it has most of the things you need out of the box.
www.linuxmint.com
Download the port tools:
http://www.4shared.com/file/122118622/fd190fe1/PortTools.html
Download the Linux Android SDK.
Go into your home folder and type this in:
sudo gedit .bashrc
Click to expand...
Click to collapse
Add this line at the end:
export PATH=${PATH}:/home/phil/android-sdk-linux_x86-1.5_r3/tools
Click to expand...
Click to collapse
Copy all of the port tools in your tools directory, except the sign app.
Right-click on them and make them executable.
Repack and unpack as you please.
When you sign them, you have to copy the three signing files in the directory with the zip.
That's the most of it.
PS-VirtualBox is a bit lacking when on a Windows 7 host. Your USB devices might not be seen, and folder sharing is very difficult to set-up. So you'll most likely have to do all of your work on the Linux guest, upload it, and then download it on your Windows host.
Phil_McRevis said:
been following amon's instructions (the one that was used for cyanogen's 32a mod)... modifying them a bit for windows... downloaded strawberry perl and when i run repack-H.pl i get an error saying it can't find the mkbootimg-H file... so i was wondering where i should put this so that strawberry perl can get at it
Thanks a lot... first time developer here
Click to expand...
Click to collapse
mkbootimg-H is a linux binary, it will not run on Window$
Just install Ubuntu using wubi instead of a virtualbox.
Wubi allows you to install and uninstall Ubuntu as any other Windows application. This is a much easier approach as a slow virtualbox.
http://www.whylinuxisbetter.net/

[DEV] MAC OS Tools ... (and may be Linux)

Hi,
I start this thread for all mac user.
Purpose it's to list existing tools for our OS to root, flash, deodex, deblur and so on Defy phone.
Some shell scripts may be used by linux users.
Multi functions tools
1) MWB_Deodexer shell scripts (compatible macos and linux) I've been writing.
At beginning I wrote scripts to deodex rom, and step by step I added more functions.
Some bug could be present and I'm not a professional dev !!! so be indulgent with me.
#########################################
# MWB_Deodexer by MisterWB #
# Scripts to manage Motorola Defy phone #
# Version 0.1 - may 2011 #
#########################################
OS detected is 'Darwin'
0. Exit
1. Get apk from phone with adb (/system/app)
2. Get jar from phone with adb (/system/framework)
3. Get apk and jar from a nandroid (unyaffs system.img)
4. Deoxed apk
5. Deoxed jar
6. Deoxed all
7. Create 'signed-update.zip' file
8. Push 'signed-update.zip' file to phone
9. Flash sbf rom
10. Get Root
11. Install bootmenu+clockworkmod
12. Deblur Motorola phone
Choice [0..12] ?
Click to expand...
Click to collapse
Item 11. and 12. are still in developpment.
How to use it ?
1. Extract zip file on your computer (ie on Desktop)
2. Go to MWB_Deodexer directory (ie 'cd ~/Desktop/MWB_Deodexer').
3. If it's first time you install MWB_Deodexer, then type 'sh install.sh' (don't take care if you have some warning message)
4. Next type './menu' or 'sh menu' to launch main menu
2) QtADB is window app based on adb.it lets you to copy,remove etc your files and apps from PC and Android Phone
This app is under developing so be tolerant for any bug...
visit QtADB website: http://qtadb.wordpress.com/
xda Post: http://forum.xda-developers.com/showthread.php?t=683223
How to flash SBF rom
1) Use sbf_flash (last version is compatible linux and macos)
Home Page: http://blog.opticaldelusion.org/search/label/sbf_flash
Last version: http://dl.opticaldelusion.org/sbf_flash
sbf_flash support has been added for the Defy, Charm and possibly the Atrix.
sbf_flash [options] [sbf file]
-f - force; attempt to continue on error
-v - verbose output (of CDT)
-r - read CDT information from the phone
-x - extract sbf file
-d - download cg from phone
--cgname [file] - upload/download cgname
matches any cgname shown with -r
optional file arg for contents
Click to expand...
Click to collapse
On my mac I faced issue with sbf_flash, scripts freeze on " >> waiting for phone " message.
It seems USB driver behavior varie with Mac model
I'm looking for any help about.
2) Use RSD Lite 4.9, but it's an win32 exe !!! Fortunaly virtualization is here
I sucessfuly launched Windows on my Mac with Virtualbox and flash rom with RSD Lite.
How to depack/repack an SBF rom
To depack we can use sbf_flash:
Code:
sbf_flash -x <rom_name.sbf> (thanks to dedraks)
To repack I don't know tools to do that. Maybe sbf_flash could help.
Purpose it's to create Fixed SBF.
As previous §, we can use win32 depacker into Virtualbox as sbfrecalc (split and repack sbf file) or motoandroidDepacker! (thanks iaio72)
SBF-Recalc Win32: http://www.motorolafans.com/forums/...81-sbf-recalc-v1-2-8-sbf-recalc-1.2.8.exe.zip
SBF-Recalc Linux: http://www.motorolafans.com/forums/...f-recalc-v1-2-8-sbf-recalc-1.2.8.-lin.bin.zip
MotoAndroidDepacker: http://www.filecrop.com/37983754/index.html
How to Root Defy
Use MWB_Deodexer.
How extract a nandroid backup
With unyaffs
Usage: unyaffs <filename.img> , ie unyaffs system.img
How to Deodex a rom and create a signed-update.zip file
Use MWB_Deodexer.
Hope this post 'll help a lot of xda members. Thanks to be indulgent with me, I don't consider me like a professional dev !
PS: Thanks to iaio72, dedraks for helping
How to depack an SBF rom
I don't know tools to do that. Maybe sbf_flash could help.
Purpose it's to create Fixed SBF.
for sbf file (rom...)
in vindows virtualization you can use sbfrecalc (split and repack sbf file) or motoandroidDepacker!
Thanks iaio72,
I update first post.
To depack just make the command bellow:
Code:
sbf_flash -x ROM.sbf

Auto APK/ZIP Signer in Windows

Hi XDA.
I have created automatic version of this One Click Signer:
(Click to thanx here FIRST! ->) http://forum.xda-developers.com/showthread.php?t=822388 (<- Click to thanx here FIRST!)
This version Works for Quantum of files at same time.
There are two DIRs:
Input - move here all APK and ZIP files to sign.
Output - here comes Signed APKs and ZIPs.
How to use?
1. Download auto-sign.zip from this thread.
2. Unzip it.
3. Run once autosign.bat.
4. Now, Input and Output folders was created.
5. Move all your Unsigned APK and ZIP files into Input folder.
6. Run autosign.bat again.
7. Wait until CMD windows closes.
8. Now you have Signed Your APKs and ZIPs in Output folder.
Click to expand...
Click to collapse
If you think, that is virus, or any harmful file,
you can right click on any .bat or .cmd file, and use EDIT option.
Here you can see all code, that files do.
Thanx to ASimmons, and dont forget to hit "Thanks!" button on his thread too! (link above)
Sorry for my BAD English.
//ANY PROBLEMS?
1. Output DIR is empty.
- move your auto-sign folder to root of C: drive, maybe run it as administrator.
2. Files are in output folder, but not signed
- check if you have Java Runtime SE Library, try to reinstall it.
if you have 64 bit system, and 64 bit Java, try to install 32 bit java too.
Thanks, gouster3.
Very easy to use Signer. However, using it to create an 'update.zip' package for my tablet was unsuccessful due to the 'zipalign' step at the end. So I reversed the steps as follows in "do2.cmd", then it was accepted (although this way the ZIP isn't fully aligned) :
Code:
setlocal EnableDelayedExpansion
@ECHO off
SET rom=%1
copy !rom! x!rom!
cd lib
rem zip align
zipalign -f 4 ..\x!rom! ..\signed-!rom!
rem sign the rom
java -Xmx512m -jar signapk.jar -w testkey.x509.pem testkey.pk8 ..\signed-!rom! ..\signed-!rom!
cd ..\
del x!rom!
Joe.

[BINWALK] Firmware Forensic Tool

[BINWALK] Firmware Forensic Tool
ReFirm Labs.
https://www.refirmlabs.com
[email protected]
https://github.com/ReFirmLabs
Binwalk is a fast, easy to use tool for analyzing, reverse engineering, and extracting firmware images.
This thread will present two ways to go about installing this Binwalk (Automatically and Manuallly) and both are not without problems. .
If you're using Debain or Ubuntu 20.4 you can bash ./ dep.sh because its been tested on Debain and Ubuntu. I have installed binwalk on Ubuntu-Budgie 20.10, Ubuntu-Budgie 20.04 and windows 10. My theory on Windows 10 is **** windows use linux but just in case you nuts haven't dropped....
PREREQUISITES
1.Download & install Cygwin (place in path C:\cygwin)
https://www.cygwin.com/
2.Download & install latest version of Python3 ( place in path C:\python3)
https://www.python.org/downloads/
INSTALLATION (Auto)
Open your Cygwin terminal and type the following command:
$ lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg install apt-cyg /bin
$ apt-cyg install git wget unzip
$ apt-cyg install python3 python3-pip
$ wget https://github.com/ReFirmLabs/binwalk/archive$ lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg install apt-cyg /bin
$ apt-cyg install git wget unzip
$ apt-cyg install python3 python3-pip/master.zip
$ unzip master.zip
$ cd binwalk-master && python3 setup.py install
Debian users can install all optional and suggested extractors/dependencies using the included deps.sh script (recommended):
$ sudo ./binwalk-master/deps.sh
If it installed with no issues then type "binwalk" and try to extract a firmware fill to make sure that you do not get an error. If you do than uninstall and reinstall manually.
(BEFORE installing Cygwin make a note of ALL the packages you will need to manually install Binwalk. You can get them during the installation of Cygwin. CHECK MARK wget, git, lynix and your list.)
If apt-cyg is unable to locate a package TRY THE "pip install <package_name>" COMMAND. If pip is unable locate the package then it's either already installed under a different name or its obsolete.
INSTALLATION (Manual)
$ lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg install apt-cyg /bin
$ apt-cyg install git wget unzip
$ apt-cyg install python3 python3-pip
$ python3 setup.py install
$ pip3 --upgrade pip
$ pip3 install nose coverage
$ pip3 install pycryptodome
$ apt-cyg install libqt4-opengl python3-opengl python3-pyqt4 python3-pyqt4.qtopengl
$ pip3 install python3-numpy python3-scipy
$ pip3 install pyqtgraph
CAPSTONE
$ pip install capstone
$ apt-cyg install mtd-utils gzip bzip2 tar arj lhasa p7zip p7zip-full cabextract cramfsprogs cramfsswap squashfs-tools sleuthkit default-jdk lzop srecord
SASQUATCH
$ apt-cyg install zlib1g-dev liblzma-dev liblzo2-dev
$ git clone https://github.com/devttys0/sasquatch $ cd sasquatch && ./build.sh
$ pip3 install cstruct $ git clone https://github.com/sviehb/jefferson $ cd jefferson && python3 setup.py install
$ apt-cyg install liblzo2-dev python-lzo $ git clone https://github.com/jrspruitt/ubi_reader $ cd ubi_reader && python3 setup.py install
$ git clone https://github.com/devttys0/yaffshiv $ cd yaffshiv && python3 setup.py install $ wget -O - http://downloads.tuxfamily.org/sdtraces/stuffit520.611linux-i386.tar.g | tar -zxv $ cp bin/unstuff /usr/local/bin/ Note that for Debian/Ubuntu users, all of the above dependencies can be installed automatically using the included $ sudo ./deps.sh Note that I also used command it was the only way to get all the packages. It worked for me but make your own choices. Installing the IDA Plugin If IDA is installed on your system, you may optionally install the binwalk IDA plugin: $ python3 setup.py idainstall --idadir=/home/user/ida Likewise, the binwalk IDA plugin can be uninstalled: $ python3 setup.py idauninstall --idadir=/home/user/ida If all goes well... $ binwalk I believe this was my first tutorial. I gotta be honest, XDA as website is unbeatable. I have spent days upon days sifting through treads and will probably spend many more days doing research!
Thanks for sharing this.
Having made a quick look to https://www.kali.org/tools/binwalk/ it seems to be able to extract binaries from (otherwise) "closed" firmware files.
Then, of course you need to do the real thing to modify what you want to, according to your goals. At this point comes the reversing stuff.
Finally you have to repack everything (and eventually resign it as there might be some integrity check) to be able to use the given firmware.
On devices/roms I dealt with, the unpacking/repacking is done by the flashing program itself. (ie. SPD reserch tool for spreadtrum devices).
Is it able to repack correctly the rom as well ?
By the way, following the link to https : // www . refirmlabs . com we arrive to some microsoft security services.
Very strange.
FranckyGoesToHollywood said:
Thanks for sharing this.
Having made a quick look to https://www.kali.org/tools/binwalk/ it seems to be able to extract binaries from (otherwise) "closed" firmware files.
Then, of course you need to do the real thing to modify what you want to, according to your goals. At this point comes the reversing stuff.
Finally you have to repack everything (and eventually resign it as there might be some integrity check) to be able to use the given firmware.
On devices/roms I dealt with, the unpacking/repacking is done by the flashing program itself. (ie. SPD reserch tool for spreadtrum devices).
Is it able to repack correctly the rom as well ?
Click to expand...
Click to collapse
You are welcome. You know I've never been able to get SP to work or any of them to tell you the truth. Lgup, Odin are more precious than gold. I've been trying for 3 or 4 days to get Salt to flash a kdz, do, zip and images without success. The good thing about Binwalk is it will dissect anything that you feed it BUT like you were saying its definitely a lot of work brother. Do you think you could bless me with a copy of this working SP tool?
FranckyGoesToHollywood said:
By the way, following the link to https : // www . refirmlabs . com we arrive to some microsoft security services.
Very strange.
Click to expand...
Click to collapse
Huh..I will have to check that out.
FranckyGoesToHollywood said:
By the way, following the link to https : // www . refirmlabs . com we arrive to some microsoft security services.
Very strange.
Click to expand...
Click to collapse
Azure. That is strange. I found them on github by accident.
Jackspsychosis said:
You are welcome. You know I've never been able to get SP to work or any of them to tell you the truth. Lgup, Odin are more precious than gold. I've been trying for 3 or 4 days to get Salt to flash a kdz, do, zip and images without success. The good thing about Binwalk is it will dissect anything that you feed it BUT like you were saying its definitely a lot of work brother. Do you think you could bless me with a copy of this working SP tool?
Click to expand...
Click to collapse
You can get it directly from SP (free) :
Research Tool - Official SPD/Unisoc Flash Tool
The SPD Research Tool is mainly used for R&D and debugging, supports reading and writing flash partitions, NV parameters, PhaseCheck and ProdNV partitions (read back and then write to the phone), and supports functions such as packaging downloaded files. But this tool will not initialise ProdNV...
spdflashtool.com
For more convenience, I attached here both latest app and drivers. (compressed smaller)
--> however after 20' I still dont see them appear here...
This variant of the SP flasher can do really a lot of things (however I couldn't find any doc on it, you must be an SPD engineer to understand everything). Some .ini file comments can give a little help.
FranckyGoesToHollywood said:
You can get it directly from SP (free) :
Research Tool - Official SPD/Unisoc Flash Tool
The SPD Research Tool is mainly used for R&D and debugging, supports reading and writing flash partitions, NV parameters, PhaseCheck and ProdNV partitions (read back and then write to the phone), and supports functions such as packaging downloaded files. But this tool will not initialise ProdNV...
spdflashtool.com
For more convenience, I attached here both latest app and drivers. (compressed smaller)
--> however after 20' I still dont see them appear here...
This variant of the SP flasher can do really a lot of things (however I couldn't find any doc on it, you must be an SPD engineer to understand everything). Some .ini file comments can give a little help.
Click to expand...
Click to collapse
Thank you. Brother apparently I lied to ya, it wasn't SP that wouldn't flash. It was a different tool for Samsung devices. What I really need is something similar to LGUPD that will flash modified kdz firmware . I found an old school R&D tool that can make unpack and repack kdz files but can't flash since LGUP was released and LGUP won't flash a kdz file that's modified. Neither will Salt, Salt is more anal than LGUP if truth be told. It goes by LG anti-roll back rules smh. Odin won't flash a modified firmware either. You know what I'm trying do right? Sneak a patched boot image and/or custom recovery through.
Jackspsychosis said:
Thank you. Brother apparently I lied to ya, it wasn't SP that wouldn't flash. It was a different tool for Samsung devices. What I really need is something similar to LGUPD that will flash modified kdz firmware . I found an old school R&D tool that can make unpack and repack kdz files but can't flash since LGUP was released and LGUP won't flash a kdz file that's modified. Neither will Salt, Salt is more anal than LGUP if truth be told. It goes by LG anti-roll back rules smh. Odin won't flash a modified firmware either. You know what I'm trying do right? Sneak a patched boot image and/or custom recovery through.
Click to expand...
Click to collapse
I don't have much knowledge on lgup (other than it didn't even recognize my c299 - lgup+uppercut). During my SP rooting attempt I went into a vbmeta signature issue that blocks any modified boot/recovery. I wrote here a long story about that...
Finally, all this hardly worth the time spent on it (at least, as I'm not a harcore pro ;-)
Can you help with this gzip error, please? Thanks

Categories

Resources