[DEV] MAC OS Tools ... (and may be Linux) - Defy Android Development

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

Related

Testing ROM Images in the SDK Emulator!

I started looking at Android Development and got the whole Dev kit and the Eclipse enrionment setup and working fine.
The question I have is that I would try different apps I develop on the different ROMs available.
How do I get any of the new ROMs, like the HERO ROM ZIP files I can download to run in the emulator or is it even possible?
Im assuming that the system.img file in the SDK id the file I need to replace or re-create, but how is this done?
I am a noob to the develop stuff so step by step instructions would be much appreciated.
I also think this would be great for other developers and ROM makers to be able to test in this way.
Thanks
Simon
Hopefully THIS one dont get closed, it IS asking a development question...anyway,
I would like to know this as well. I would like to test things myself (getting better at manipulating them), and would like to know what he is asking as well.
Thanks.
I don't think this would work, as the ROMs are hardware depending, me thinks. Or at the least the kernel and drivers are.
maybe this will help, maybe not, just an emulator primer, so maybe people can jump on board with this
under <sdk path>/tools
to list out your AVD(android virtual device)
android list targets
will return:
Available Android targets:
id:1
Name: Android 1.1
Type: platform
API level: 2
Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P
id:2
Name: Android 1.5
Type: platform
API level: 3
Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P
id:3
Name: Google APIs
Type: add-on
Vendor: Google Inc.
Description: Android + Google APIs
Based on Android 1.5 (API level 3)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA (default), HVGA-L, QVGA-P, HVGA-P, QVGA-L
from here we choose our integer target, lets say 2
creating an AVD:
android create avd -n your_chosen_name_here -t 2
When you create an AVD, the android tool creates a dedicated directory for it on your development computer. The directory contains the AVD configuration file, the user data image and SD card image (if available), and any other files associated with the device. Note that the directory does not contain a system image — instead, the AVD configuration file contains a mapping to the system image, which it loads when the AVD is launched.
By default, the android tool creates the AVD directory inside ~/.android/avd/ (on Linux/Mac), C:\Documents and Settings\<user>\.android\ on Windows XP, and C:\Users\<user>\.android\ on Windows Vista
Click to expand...
Click to collapse
to run your newly created AVD:
emulator -avd your_chosen_name_here
maybe this will help, but I'm guessing everyone here already knows all of this.
references:
http://developer.android.com/guide/developing/tools/emulator.html#starting
Yeah, I understand that you can specify the AVD.
The only thing now is to edit the AVD to point to a different image. This is easy!
The system image file is a *.img file.
So how do we get our ROM images compiled into the IMG file format?
There must be a tool, but I cant find anything.
And what hardware does the emulator, emulate? Maybe it ignores the hardware specific calls throu an API so the ROM image target hardware shouldn't matter.
I just started messing around with rom's and after I build one I put system.img userdata.img and ramdisk.img from my /mydroid/out folder into the sdk's image folder and start the and it uses the new rom when I start the emulator
thats the easy part
do a nandroid backup
copy the sdk/platforms/android-1.5
to something like sdk/platforms/MINE
go to your AVD directory AVD/whateveryoucalledit
open up the config.ini
edit:
skin.name=HVGA
skin.path=platforms\MINE\skins\HVGA
image.sysdir.1=platforms\MINE\images\
go to your nandroid backup on your sdcard
copy system.img
go to sdk/platforms/MINE/images/
and paste the nandroid system.img
now run your AVD and it will boot that system.img
im running CyanogenMod rom right now in the emulator
hint* number pad 7 with numlock off in the emulator is how to open up the hardware keyboard
Awesome. I'll be giving this a try later.
One question: The apps are in the system.img file on the SDK images as far as I can tell. What do you do with all the apps in the new ROMs?
whatever you want to do with them, they're all there, even android market works perfectly
And where are you guys getting the system.img file from?
The ROM zip files dont have them.
Sorry....Im noob to this. LOL
ggolemg said:
whatever you want to do with them, they're all there, even android market works perfectly
Click to expand...
Click to collapse
OK, Im confused. Can you just unzip the ROM files and place in the folder that you point using the same folder structure?
OR
Do you have to have a system.img ?
Another thought:
I dont want to have to install all the ROMs just to create a Nandroid backup to get the images. There must be a way to create the images from the raw files in the ZIP files.
Any ideas?
UPDATE: The same technology used by Nandroid itself!
The google android emulator included in the google android sdk is limited. Although you can use 'adb push' to upload more tools, but one has to do it again next time. Follow the steps to create a enhanced system.img:
1. system.img is yaffs2 flash file system, so firstly you need the mkfs.yaffs2 tool, download it in the following link: Release Android Yaffs2 Tool (Both X86 And ARM). One has to be a registered user to download the tools.
2. use the 'adb push' to upload tools to android emulator, executables in /system/bin/, libraries in /system/lib, one can also create folder. One need change the file mode necessary.
3. upload the ARM mkfs.yaffs2 tool, use the following command to create system.img: # mkfs.yaffs2 /system /system.img
4. download the system.img to local with command 'adb pull', replace the system.img in your emulator folder/tools/lib/images/
Click to expand...
Click to collapse
so it seems like it would be just as much fun doing a nandroid backup
*edit*
so now the real question is, how do we go about ripping out the nandroid functionality to be able to do this locally?
*edit 2*
it is the mkfs.yaffs2 tool
Usage:
mkfs.yaffs2 yourdir yourimage
Ohsaka said:
NANDROID - CYGWIN DIRECTIONS (not not not, I repeat, not fully tested and verified yet)
Changes so far if you are using cygwin:
1) Make sure you have the 'netcat' and 'gcc' packages, else just run cygwin.exe again and get them.
You can test if you have them by running 'which nc' and 'which gcc', both commands should return /usr/bin/<command>
2) Compile the mkyaffs2image executable.
Inside the extracted nandroid archive directory, goto the tartools\yaffs2\utils\ directory (inside a cygwin prompt) and type 'make'.
This should generate a file named "mkyaffs2image.exe" which you need to place somewhere on your path.
(Hint: If you haven't downloaded the Android SDK, abort now. Wait for more explicit directions... Else, place the .exe where adb is, since it should be on your path already)
3) Edit the nandroid.sh script. (else you get a permission denied error when the script tries to run the dump_image-arm file)
Find the line:
adb push ./$tool /cache/$tool
Add the following line after it:
adb shell chmod 777 /cache/$tool
4) Make a managed mount named /tmp (else windows will puke on the long unix filenames with colons, etc)
mkdir /tmp
mount -o managed c:/cygwin/tmp /tmp (Note: change c:/cygwin to be the directory cygwin was installed to, you can find it by typing 'cd /' and then 'explorer .')
5) Follow the standard "tar + mkyaffs2image" directions to generate the last three .img files. They refer to the /tmp directory which you created in the previous step.
Viola! Looks like I have a complete backup image now...
$ ls -l
total 117504
-rw-r--r-- 1 Osaka None 2621440 Jun 12 21:31 boot.img
-rw------- 1 Osaka None 737088 Jun 12 22:07 cache.img
-rw------- 1 Osaka None 53570880 Jun 12 22:06 data.img
-rw-r--r-- 1 Osaka None 262144 Jun 12 21:31 misc.img
-rw-r--r-- 1 Osaka None 5242880 Jun 12 21:31 recovery.img
-rw------- 1 Osaka None 57885696 Jun 12 22:06 system.img
Now I just need to drink up the courage to test it on my phone!
Click to expand...
Click to collapse
ggolemg said:
so it seems like it would be just as much fun doing a nandroid backup
*edit*
so now the real question is, how do we go about ripping out the nandroid functionality to be able to do this locally?
*edit 2*
it is the mkfs.yaffs2 tool
Usage:
mkfs.yaffs2 yourdir yourimage
Click to expand...
Click to collapse
Is this for Linux (which I don't have) and if so, is there a Windows version?
short answer: yes its only for linux
long answer is a plea for help i posted in the nandroid thread about it:
I was wondering if there was a method to use the yaffs3 command to make a system.img from an unzipped rom placed on the sdcard through ADB, from what I've seen nandroid is almost exactly what I'm after.
The issue of why I can not just do this through linux, i can. I just want to be able to do it through windows some way without loading the entire rom on the phone and nandroiding the system.img out.
Either the aforementioned method, or the ability to mount a portion of my computers hard drive as a recognizable mountable partition within android running on the usb connected phone, loading the rom on that partition, unzipping it there, running ADB and making the system.img. But this way seems to bring up more problems than it's worth.
Or.. running the make yaffs3 command through ADB running the emulator with the rom unzipped on the virtual sdcard. This would actually be the best option as it would not require an actual phone.
I hope someone can help. Thank you very much.
Click to expand...
Click to collapse
hopefully someone knows the answer, I'm still trying though.
so on windows we would adb push the update.zip to the sdcard on the emulator
unzip it on the sdcard, there are apps for that
adb shell mkfs.yaffs2 sdcard/<extractedzipfilename>/system/ sdcard/system.img
adb pull the newly created system.img and proceed to load it in the emulator
i know im missing a ton here, please someone correct me
I'd love to be able to run these images in the emulator on windows!
ggolemg said:
thats the easy part
do a nandroid backup
copy the sdk/platforms/android-1.5
to something like sdk/platforms/MINE
go to your AVD directory AVD/whateveryoucalledit
open up the config.ini
edit:
skin.name=HVGA
skin.path=platforms\MINE\skins\HVGA
image.sysdir.1=platforms\MINE\images\
go to your nandroid backup on your sdcard
copy system.img
go to sdk/platforms/MINE/images/
and paste the nandroid system.img
now run your AVD and it will boot that system.img
im running CyanogenMod rom right now in the emulator
hint* number pad 7 with numlock off in the emulator is how to open up the hardware keyboard
Click to expand...
Click to collapse
Hm, the emulator just hangs on the ANDROID.. message, similar to when the standard system.img was in.
anyone figure out how to do this on a mac?
thanks if anyone can.
johnnylicious said:
anyone figure out how to do this on a mac?
thanks if anyone can.
Click to expand...
Click to collapse
I found this somewhere else and take no credit for it. I did shorten the steps.
Of course this is once you have the sdk installed on your mac
1. Run Terminal, and change to the 'tools' directory of the SDK (or add the tools directory to the path settings in ~/.profile).
2. Type './android list target'
3. Note the 'id' number of the '1.5' target (in my case it's '2')
4. Type './android create avd -n enhanced -t 2' (substitute 2 with the target number determined above if required)
5. You will be prompted to create a hardware profile. {You can leave as default no}
6. Use nandroid to create a backup then copy system.img
7. Copy file to ~/.android/avd/enhanced.avd/system.img
8. You're ready! Type './emulator -avd enhanced' to run! Note: inital boot may take a few minutes!
Can anyone post up the
Android Yaffs2 Tool (Both X86 And ARM)
for download? The above link doesn't work. I did a google search and all the D/L links are referring to the same location.
thanks!

[GUIDE] Howto create an insecure boot image for asus tf101

NOTE: I started few days ago working with the boot image.
I'm not an Android expert. If you find an error in this post, let me know.
Use this information at your own risk. If you brick your tablet, don't blame on me.
Nothing of the tools used here are written by me. I'm not taking credit for another's work.
I have rooted my tf101 with the instructions from the mashi's thread. (http://forum.xda-developers.com/showthread.php?t=1125714)
I was curious about the root process of our beloved tablet.
For add root at the stock firmware you need the su packages and a proper boot image.
I've worked for years on linux machines, so I know that you need the "su" command to become root.
But what about the boot image? What does it need for?
I've googled and found some information that I'd like to share with you:
For using adb as superuser, and push the su package, you need to flash a so called "insecure boot" on your tablet/phone.
The process is easy:
NOTE: Even if I'm on a Windows machine, I prefer to do this work in linux. The entire process has been done in an Ubuntu 11.04 virtual machine.
What you need:
- a PC running linux
- BootTools and BlobTools from Rayman84 (http://androidroot.mobi/)
- mkbootimg (mkbootfs is optional) from the android repository
I assume that you have all the above tools in your $PATH variable.
First of all you need a stock boot image; you can extract one from your tablet (with nvflash) or from the latest stock firmware (US-VERSION - WW-VERSION)
We're going for the official packages from the ASUS website. Download it on your home directory (or wherever you want).
Let's start:
Code:
mkdir stock_firmware
cd stock_firmware
unzip ../UpdateLauncher_WW_epaduser_84411.zip
unzip ASUS/Update/WW_epad-user-8.4.4.11.zip
blobunpack blob
bootunpack blob.LNX
Now we have a lot of "strange" files:
Code:
ASUS
blob
blob.APP
blob.EBT
blob.HEADER
blob.LNX
blob.LNX-config
blob.LNX-kernel.gz
blob.LNX-ramdisk.cpio.gz
blob.PT
blob.SOS
META-INF
For our work, we just need blob.LNX-ramdisk.cpio.gz
Code:
mkdir boot_img
cd boot_img
gunzip -dc ../blob.LNX-ramdisk.cpio.gz | cpio -i
vi default.prop (or "gedit default.prop" if you want a GUI)
Here you have to change the line "ro.secure=1" in "ro.secure=0"
The final file should appears as this:
Code:
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=0
ro.allow.mock.location=0
ro.debuggable=0
persist.service.adb.enable=0
Almost done. Let's repack:
Code:
find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz
or alternatively:
Code:
mkbootfs ./ | gzip > ../newramdisk.cpio.gz
Finally make the boot.img:
Code:
cd ..
mkbootimg --kernel blob.LNX-kernel.gz --ramdisk newramdisk.cpio.gz -o boot.img
Now you have your boot.img, ready to be flashed with nvflash.
For information on what to do with this file, please refer to the mashi or brk threads.
Again, I've taken this information from google.
All the credits and many thanks to:
Rayman for the BlobTools and the BootTools - http://androidroot.mobi/
Mashi for his thread on rooting the stock kernel - http://forum.xda-developers.com/showthread.php?t=1125714
Brk for his batch script - http://forum.xda-developers.com/showthread.php?t=1185104
If you found this guide useful, hit the "Thanks" button.
For your convenience, you can find the tools used attached in this post (compiled on Ubuntu 11.04).
UPDATE: I have written a script (thanks gnufabio for the idea) that automatically modify a stock boot.img into an insecure one.
ex:
Code:
./insecure.sh boot.img
when the script finishes you will find a file called my_boot.img ready to be flashed with nvflash.
Bootunpack and mkbootimg should be in your $PATH.
This script doesn't do much error checking, so keep your eyes open.
HF
hey thanks very nice guide
Excellent. I've been looking around trying to work out how to package up a kernel build, this helps a great deal.
I'm assuming that I just replace the blob.LNX-kernel.gz with my built zImage?
SammyC said:
Excellent. I've been looking around trying to work out how to package up a kernel build, this helps a great deal.
I'm assuming that I just replace the blob.LNX-kernel.gz with my built zImage?
Click to expand...
Click to collapse
I haven't try but i guess yes.
If you really want to recompile/repackage the kernel, you can refer to this http://www.droidforums.net/forum/rescue-squad-guides/31452-how-compile-your-own-kernel.html ; it's about the Motorola Droid, but some concepts are universal for all the android devices.
HF
Good work, btw give a look to this script i made: mcpio
Unpacking and repacking the ramdisk will be easier:
Code:
mcpio -c ramdisk-folder/
mcpio -e ramdis-archive.cpio.gz
Thanks - Very useful to have this in this section. I tried the example, and it all worked fine on an old Ubuntu dist.
gnufabio said:
Good work, btw give a look to this script i made: mcpio
Unpacking and repacking the ramdisk will be easier:
Code:
mcpio -c ramdisk-folder/
mcpio -e ramdis-archive.cpio.gz
Click to expand...
Click to collapse
Well, that's a lot easier...
I didn't know your script, thanks for sharing.
Updated the first post with a bash script to automate the entire process.
Yesterday I've succesfully recompiled the stock kernel and I'm thinking on write another guide like this one on the subject.
The process is a little complicate, i'm looking for an easy way to explain but it's hard.
Anyway I'm working on it in my spare time.
That would be great if you could.
ASUS haven't (yet) released the source for the kernel in their latest 3.2 build. If you've updated to 3.2, you can still root and repackage using this method. Just use nvflash to save off the kernel from your running device as per the backup/restore thread, then use bootunpack on that and follow the rest of the instructions
raypou said:
ASUS haven't (yet) released the source for the kernel in their latest 3.2 build. If you've updated to 3.2, you can still root and repackage using this method. Just use nvflash to save off the kernel from your running device as per the backup/restore thread, then use bootunpack on that and follow the rest of the instructions
Click to expand...
Click to collapse
it's exactly the method used here: http://forum.xda-developers.com/showthread.php?t=1198303
If anyone interested, here're win32 binaries of BlobTools and BootTools
Just compiled from git repo.
I unpacked a rom with a kernelblob in the root directory, and edited init.rc. Which command should I use to repackage it? If I follow the guide (instead of boot.img I used kernelblob, no extension) I get the EEE Pad logo then scrambled, colored lines all over.
If I, however, install the base rom, then the one where I changed something in the kernelblob, it boots up.
theMIROn said:
If anyone interested, here're win32 binaries of BlobTools and BootTools
Just compiled from git repo.
Click to expand...
Click to collapse
Hi, makebootimg.exe doesn't work. It gives error saying: error: could not load kernel 'blob.LNX-kernel.gz'
Tried same files in linux and worked fine.
Can you try to fix this?
EDIT: tried to compile myself but got the same issue. I think is related with the need to change source code to make this run on windows.
Working boottools for windows available here: http://forum.xda-developers.com/showpost.php?p=17237701&postcount=443
brk said:
Hi, makebootimg.exe doesn't work. It gives error saying: error: could not load kernel 'blob.LNX-kernel.gz'
Tried same files in linux and worked fine.
Can you try to fix this?
Click to expand...
Click to collapse
yep, it's code issue
attached BootTools-Win32.zip with fixed mkbootimg.exe
is there this guide for tf201?
BR
Maframan
maframan said:
is there this guide for tf201?
BR
Maframan
Click to expand...
Click to collapse
You should probably check the TF201 forum.
Could this method be used to pack a new Splash Screen? (I want to change that annoying ASUS logo to something better) Would I go about the Flash_Image method to flash the image after compiled? (I do Not have NvFlash, but I am rooted with Cwm)
Which blobs would I modify as well, just the EBT?
rebound821 said:
NOTE: I started few days ago working with the boot image.
I'm not an Android expert. If you find an error in this post, let me know.
Use this information at your own risk. If you brick your tablet, don't blame on me.
Nothing of the tools used here are written by me. I'm not taking credit for another's work.
I have rooted my tf101 with the instructions from the mashi's thread. (http://forum.xda-developers.com/showthread.php?t=1125714)
I was curious about the root process of our beloved tablet.
For add root at the stock firmware you need the su packages and a proper boot image.
I've worked for years on linux machines, so I know that you need the "su" command to become root.
But what about the boot image? What does it need for?
I've googled and found some information that I'd like to share with you:
For using adb as superuser, and push the su package, you need to flash a so called "insecure boot" on your tablet/phone.
The process is easy:
NOTE: Even if I'm on a Windows machine, I prefer to do this work in linux. The entire process has been done in an Ubuntu 11.04 virtual machine.
What you need:
- a PC running linux
- BootTools and BlobTools from Rayman84 (http://androidroot.mobi/)
- mkbootimg (mkbootfs is optional) from the android repository
I assume that you have all the above tools in your $PATH variable.
First of all you need a stock boot image; you can extract one from your tablet (with nvflash) or from the latest stock firmware (US-VERSION - WW-VERSION)
We're going for the official packages from the ASUS website. Download it on your home directory (or wherever you want).
Let's start:
Code:
mkdir stock_firmware
cd stock_firmware
unzip ../UpdateLauncher_WW_epaduser_84411.zip
unzip ASUS/Update/WW_epad-user-8.4.4.11.zip
blobunpack blob
bootunpack blob.LNX
Now we have a lot of "strange" files:
Code:
ASUS
blob
blob.APP
blob.EBT
blob.HEADER
blob.LNX
blob.LNX-config
blob.LNX-kernel.gz
blob.LNX-ramdisk.cpio.gz
blob.PT
blob.SOS
META-INF
For our work, we just need blob.LNX-ramdisk.cpio.gz
Code:
mkdir boot_img
cd boot_img
gunzip -dc ../blob.LNX-ramdisk.cpio.gz | cpio -i
vi default.prop (or "gedit default.prop" if you want a GUI)
Here you have to change the line "ro.secure=1" in "ro.secure=0"
The final file should appears as this:
Code:
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=0
ro.allow.mock.location=0
ro.debuggable=0
persist.service.adb.enable=0
Almost done. Let's repack:
Code:
find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz
or alternatively:
Code:
mkbootfs ./ | gzip > ../newramdisk.cpio.gz
Finally make the boot.img:
Code:
cd ..
mkbootimg --kernel blob.LNX-kernel.gz --ramdisk newramdisk.cpio.gz -o boot.img
Now you have your boot.img, ready to be flashed with nvflash.
For information on what to do with this file, please refer to the mashi or brk threads.
Again, I've taken this information from google.
All the credits and many thanks to:
Rayman for the BlobTools and the BootTools - http://androidroot.mobi/
Mashi for his thread on rooting the stock kernel - http://forum.xda-developers.com/showthread.php?t=1125714
Brk for his batch script - http://forum.xda-developers.com/showthread.php?t=1185104
If you found this guide useful, hit the "Thanks" button.
For your convenience, you can find the tools used attached in this post (compiled on Ubuntu 11.04).
UPDATE: I have written a script (thanks gnufabio for the idea) that automatically modify a stock boot.img into an insecure one.
ex:
Code:
./insecure.sh boot.img
when the script finishes you will find a file called my_boot.img ready to be flashed with nvflash.
Bootunpack and mkbootimg should be in your $PATH.
This script doesn't do much error checking, so keep your eyes open.
HF
Click to expand...
Click to collapse
Hi Sir,
First of all thankyou for you guide because I did follow you guide and created the insecure boot.image succesfully. I still have one problem, after flashing the boot.image, I still could not root the android device. Why is that? Do I need to change something else in the boot.img?

[Tutorial] How to port cf-root to other i9003 Firmwares [23/02/2012]

Tutorial for Porting Cf-root To Newer Firmware's
There were quite a few requests for a tutorial to create ginger bread cf-root. So here it is folks.
Big Thanks to skin1980 for helping me out.
Credits:
Chainfire for the cf-root.
Skin1980 for porting it to Samsung Galaxy SLCD.
Prerequisites:
Any Linux. Basic knowledge of linux is mandatory.
Tools for Unpacking and Packing images.
Base Samsung Galaxy SLCD Gingerbread Cf-root.
Samsung Galaxy SLCD Gingerbread Firmware ROM for cf-root creation.
Downloads & Setup
Any Linux: For this tutorial I am using Linux Mint KDE. You are free to use the Linux of your choice. Ideal starting point for downloading and installing Linux would be Distrowatch.com.
Tools for unpacking and packing images: These are sets of tools that allow you to unpack and pack boot images. Basically one requires just a few tools to achieve.
Link to Download: cfroot-tools.zip - 19 KB.
Download and exatract it into your home folder. It will create a cfroot-tools folder under home folder. Go to the folder and execute the following comand:
Code:
chmod +x *
Base Cf-root: Download any latest cf-root from this Link. Extract the normalboot.img from the cf-root tar file.
normalboot.img: Require normalboot.img extracted from downloaded Gb ROM.
Hex editor: You will require and Hex Editor. I am using bless hex editor. You can use any one which you are comfortable or the one available under your linux distribution.
Open terminal window and enter the following commands:
Code:
[FONT=Microsoft Sans Serif][SIZE=2]cd
[/SIZE][/FONT][FONT=Microsoft Sans Serif][SIZE=2]gedit ~/.bashrc[/SIZE][/FONT]
You can use any editor of your choice. The main purpose is to set the tools path. At the bottom of this file, add the following lines:
Code:
PATH=$HOME/cfroot-tools:$PATH
export PATH
Save and close the file.
Logoff from linux and login again for the new path to take effect.
The Actual Process
For the purpose of tutorial, I am going to use XXKPQ cf-root as the base and DDKP3 for creating new one.
Create a folder called “cfroot” with out the quotes under home.
Go to the created folder and create two more folders: DDKP3 and XXKPQ.
Now copy the normalboot.img extracted from XXKPQ cf-root and copy it into the XXKPQ folder. Next copy the normalboot.img fromDDKP3 firmware and copy it into DDKP3 folder.
Now go to the cfroot-tools folder under HOME and copy the decom.sh and recom.sh into XXKPQ and DDKP3 folders.
The above steps can be accomplished by the below code. Open command window and type the following:
Code:
cd
mkdir ~/cfroot
mkdir ~/cfroot/XXKPQ
mkdir ~/cfroot/DDKP3
cd ~/cfroot/XXKPQ
cp ~/cfroot-tools/*.sh .
chmod +x *.sh
cd ~/cfroot/DDKP3
cp ~/cfroot-tools/*.sh .
chmod +x *.sh
You need to press enter after each command.
From terminal window, first to change directory to XXKPQ, type the following commands:
Code:
cd ~/cfroot/XXKPQ
./decom.sh
After the execution of the above command, the following files and folders will be created:
normalboot.img-base
normalboot.img-cmdline
normalboot.img-pagesize
normalboot.img-ramdisk.gz => Ramdisk
normalboot.img-zImage => Kernel
Click to expand...
Click to collapse
Apart from these files, a folder called ramdisk will be created, into which the contents of normalboot.img-ramdisk.gz would have been extracted.
Now once more from the terminal window execute the following command:
Code:
cd ~/cfroot/DDKP3
./decom.sh
Also make note of the following values, which are shown, when the decom.sh script is executed.
Code:
BOARD_KERNEL_BASE 81800000
BOARD_PAGE_SIZE 00001000
Now under DDKP3 folder, edit the recom.sh file. Replace the value after --base with the value after BOARD_KERNEL_BASE. Replace the value after --pagesize with value after BOARD_PAGE_SIZE. Save the file.
Now we can switch to file manager. It will be easier to work using a file manager from here on. Open the XXKPQ/ramdisk and DDKP3/ramdisk folders separately in file manager.
Copy the folders res & sbin from base cf-root (XXKPQ in our case) and paste into DDKP3/ramdisk folder. Overwrite all when prompted.
Copy all the files under XXKPQ/ramdisk (in the root) to DDKP3/ramdisk.
From XXKPQ/ramdisk/lib/modules/2.6.35.7/kernel/ copy the fs folder into DDKP3/ramdisk/lib/modules/2.6.35.7/kernel/.
At this point of time, we no longer require the XXKPQ folder. So we can close the file manager window browsing XXKPQ folder.
Now comes the tricky and critical part. This must be done very carefully. We need to edit the .ko files using a hex editor.
Under the kernel/crypto/ folder, there is a pcbc.ko file, edit it using an hex editor. Search for 2.6.35.7 using find option in the editor. Now note down the six digit numbers starting immediately after 2.6.35.7-CL. In our case the magic number is 882023. Close the file and the editor.
Now we open the kernel/fs/ folder in the file manager.
Now open the mbcache.ko file in the hex editor. Search for 2.6.35.7 again. As we can see that the six digits after 2.6.35.7-CL is not 882023. In our case it is 709629. We need to change 709629 to 882023 and save the file. Different editors provide for different methods of editing. In my case I can just simply click on starting number that is 7 and start typing 882023 and save the file.
Now you need to do the same for two more files under kernel/fs/jbd2/ and kernel/fs/ext4/.
Now go back to ramdisk folder. Under ramdisk/sbin/boot/ there is a file called install.sh. We are now going to edit this file. This not important that you edit this file.
Edit the first line and replace XXKPQ with DDKP3.
Similarly under the “# Once be enough”, there is another XXKPQ which is to be replace with DDKP3.
Now save this file.
Now back to command prompt and execute the following commands:
Code:
cd ~/cfroot/DDKP3
./recom.sh
Executing the above script recreates the normalboot.img-ramdisk.gz, the normalboot.img and create DDKP3-CFROOT-16-02-2012.tar.
The DDKP3-CFROOT-16-02-2012.tar is the cf-root for DDKP3 and can be flashed using ODIN as Pda file.
*
Thats it folks. Hope my effort is worthwhile and benefits some of you.
*
Additional Links:
A text file Create Custom Rom (though not for our phone but is quite useful all the same) - Found it while searching google. Don't know who created it. But here is the link. Create_Custom_Rom.txt - 5 KB
The link to tools zip mentioned in the above text file. tools.tar.gz - 49 MB
Script to uncompress and compress UC Kernel
uc_decom.sh - 258 b
uc_recom.sh - 382 b
10 Chars ......
For Future Use
Whoa! This is huge! Awesomr work man! Thanks.
Edit - No offence meant, but it would be appropriate if the title is How to "port" or similar. Since it ws "created" by ChainFire and we just porting it.
ganeshbiyer is good, very patient, did not think that my trouble!
Has been helping me! Am very grateful!
great job! & i already translate it into chinese^^
and a problem:
after i run the script "decom.sh",it display following words:
[[email protected] xxkpq]# ./decom.sh
./decom.sh: line 5: unpackbootimg: command not found
gunzip: ../normalboot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
[[email protected] xxkpq]#
help me please~what's going on?
cRainin said:
great job! & i already translate it into chinese^^
and a problem:
after i run the script "decom.sh",it display following words:
[[email protected] xxkpq]# ./decom.sh
./decom.sh: line 5: unpackbootimg: command not found
gunzip: ../normalboot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
[[email protected] xxkpq]#
help me please~what's going on?
Click to expand...
Click to collapse
unpackbootimg must be in the path.
also it must be executable.
ganeshbiyer said:
unpackbootimg must be in the path.
also it must be executable.
Click to expand...
Click to collapse
sorry,i paste the wrong code. my problem is this:
[[email protected] XXKPQ]$ ./decom.sh./decom.sh: /home/chenyu/cfroot-tools/unpackbootimg: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
gzip: ../normalboot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
[[email protected] XXKPQ]$
cRainin said:
sorry,i paste the wrong code. my problem is this:
[[email protected] XXKPQ]$ ./decom.sh./decom.sh: /home/chenyu/cfroot-tools/unpackbootimg: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
gzip: ../normalboot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
[[email protected] XXKPQ]$
Click to expand...
Click to collapse
Need to install the missing file ld-linux.so.2
Sent from my GT-I9003 using xda premium
Thank you Ganeshbiyer! this is the tutorial for which send multiple private messages and never answered .. Thanks again, nowI can make a version for Gingerbread UBKPD.
goodbye
Yeah ganesh! A superb work..well done bro
thanks bhaiya....
Thanks for the tutorial buddy
Hope it has been useful.
_
Release all PERFECT! I had no problem in making the entire guide .. BUT ... when flashing in ODIN, and says that when it failed to finish.
I knew that I would be so easy, so I started to analyze both folders (my UBKPD and XXKPQ) and did not get that at the root of KPD I have 12 files and only 11 KPQ. The 12th file executable type KPD called RECOVERY. This file should remove it before using recom.sh?
Thanks again for the guide. goodbye
Edit2:
Well, my little patience led me to delete that file and then went back to RECOVERY recom.sh run and throw me error that could not erase normalboot.img and did not understand, but looking at the files in the root, not the size you normalboot.img was higher than the stock then replace the stock normalboot (+5 mb), run again and finally he created recom.sh cf.root, I flash with ODIN successfully without any problem in these +30 minutes.
Thanks (again).
Now I have as including UV & OC (freqmax 1100MHz is very good speed and would think you do not need more with this phone)
maybe a stupid question:
would it work with other phones as well? natually with the files of the other phone and not with the 9003 files
fabsau said:
maybe a stupid question:
would it work with other phones as well? natually with the files of the other phone and not with the 9003 files
Click to expand...
Click to collapse
Well you can always try
thanks for your reply
I will try it soon^^
wait for my next reply
greetings fabsau
i do it all at this tutorial and it create .tar fine without trouble.. i flash with odin also no problem happen.. but while device open.. at boot logo get stuck or freeze at long time.. why it happen???
i confuse with this line:-
-Copy the folders res & sbin from base cf-root (XXKPQ in our case) and paste into DDKP3/ramdisk folder. Overwrite all when prompted.
-Copy all the files under XXKPQ/ramdisk (in the root) to DDKP3/ramdisk.
-From XXKPQ/ramdisk/lib/modules/2.6.35.7/kernel/ copy the fs folder into DDKP3/ramdisk/lib/modules/2.6.35.7/kernel/
Click to expand...
Click to collapse
why do not copy all the file in ramdisk n skip copy file inside the ramdisk folder.. it is difference?? please tell me if i do a mistake.

[DEV-GUIDE] Flytouch 3 Superpad 2 - Custom ROM building tutorial

Dear All,
I have been building some custom Android ROMS for the past few years, and my latest toy is a Flytouch 3 I wanted to share some of my findings and methods here, perhaps other newbies like me will find it useful.
1. FT3 ROM contents:
FT3 ROMs will be in RAR or ZIP format and have 2 or 3 files in them as explained below. Just unzip or unrar the package to use them:
firmware2 - flash tool which burns the firmware ( I guess...lol)
bootloader-discovery - 7zip file which contains the bootloader
IMPORTANT! Do not flash a wrong bootloader to your device or it will be bricked! Actually this is the only way you can brick the thing, it's pretty sturdy in that sense. If you are not sure, do not copy bootloader-recovery to your sdcard when flashing, it will boot with your existing bootloader anyway.
firmware-discovery - 7zip file which contains the firmware and it's the main file you want to edit.
2. firmware-discovery contents:
This is the easy part! Modifying this file will let you modify system and data partitions. You can also use different ramdisks and kernels compatible with your device. It's a 7zip file and you can unpack and repack easily with the 7-zip file manager (http://www.7-zip.org/).
I use 7-zip on Windows although I use Ubuntu Linux as my main OS. There is something wrong with my 7-zip installation most probably, but I was too lazy to check it If you are on Windows anyway, you are good, just download and use 7-zip from the URL above. I advise that you do all your firmware-discovery editing within 7-zip file manager. That way, you won't have to worry about re-packing with the correct 7-zip settings. At least, that's how I do it and had no problems.
firmware-discovery will have these files in the 7zip package:
uImage - kernel
Very important Your kernel will make the difference between having and not having certain functionality, even if your hardware supports it.
uImage_recovery - recovery file - I beleive this is what runs when you push menu+power.
ramdisk.img - ramdisk
This is one of the interesting files you might want to play with. Ramdisk is a simple file system with some crucial files, mainly init.rc that lets you control the boot process. You can also stick a initlogo.rle image here to display a splash image in initial boot. More details below at title 4.
data.tar - /data partition - tar archive
All user data is stored here, including apps and user definable settings. This is what gets wiped when you do a recovery by pushing menu+power.
system.tar - /system partition - tar archive
System data, drivers and apps, including Android OS itself (except kernel). Certainly the most interesting part for the average modder
3. Editing system.tar and data.tar:
This might be the bulk of your modding, and most probably what will be most visible to the end user.
I very strongly suggest that you use a Linux system to edit these files. If you use Windows, file permissions will not be saved! If Windows is your main OS, simply install a VM host such as VirtualBox and install your fav Linux distro inside it. Most of them will have an Archive Manager with a GUI and will certainly support TAR. Even without a GUI, you can use "tar" and "untar" commands from a terminal to unpack and repack these files. When you are on Linux, TAR files will preserve file ownership and file permissions. This can be very crucial in your modding.
For modders who are new to Linux, I can recommend Ubuntu. It's very user friendly and easy to use in my opinion.
When you are done editing system.tar and data.tar copy them to your Windows box and drop and them to firmware-recovery file within 7-zip file manager.
4. Unpack, Edit and Repack ramdisk.img:
Now we are on to more serious stuff ramdisk.img consists of a 64 byte U-Boot header, followed by a gzip compressed ramdisk cpio image. So we need to strip the first 64 bytes, and use gunzip to extract it to a folder. After making the changes in the folder, we need apply cpio+gzip compression to the folder and add the 64 byte u-boot header again. You will need to use Linux and install the mkimage tool for these operations.
Here's the command to install mkimage tool in Ubuntu:
Code:
sudo apt-get install uboot-mkimage
It sounds complicated, but no worries, I have some shell scripts that can do all that for you! Thanks to leeh33 from Techknow for the scripts below:
unpack_ramdisk.sh
Code:
mkdir ramdisk
cd ramdisk
dd if=../ramdisk.img bs=64 skip=1 of=ramdisk.gz
gzip -dc ramdisk.gz | cpio -idmv
rm ramdisk.gz
repack_ramdisk.sh
Code:
cd ramdisk
find . | cpio -o -H newc -C 512 | gzip -n > ../ramdisk.cpio.gz
cd ..
mkimage -A ARM -O Linux -T ramdisk -C none -a 0x41000000 -e 0x41000000 -n hRamdisk -d ramdisk.cpio.gz ramdisk.img
rm ramdisk.cpio.gz
Create the scripts above using a text editor or download the attachment to this post and put the scripts together with your ramdisk.img file in a new folder. Executing unpack_ramdisk.sh will create a folder named ramdisk and extract the ramdisk contents here. You can edit e.g. init.rc in this folder, or add a static bootlogo. To add a custom bootlogo create a initlogo.rle image file by following this guide: http://www.androidtablets.net/forum/android-tablet-hacking/438-how-setup-static-bootlogo-before-animated-boot-animation.html Then place the resulting initlogo.rle file directly in the ramdisk directory.
After you are done editing the ramdisk folder, simply run repack_ramdisk.sh and your new ramdisk.img will be created, replacing the old one. Copy the ramdisk.img file to your Windows box again and drop it to firmware-recovery file within 7-zip file manager.
That's it, you have a custom ROM now! Please feel free to ask questions or correct me if you think I have any errors in the info above.
Happy Modding!!!
Tolga
Big problem about my device...
Thank you for this useful post!
I have seen a good knowledge about these devices(flytouch 3) and decided to post my question here:
I have a big problem! I used IUW Burning tool to flash my device. my device is:
SuperPad III (As box says)
Model: ANDR P1001
I decided to try tim's custom rom. It doesn't work. After restarting the device, screen become black (There was no connection
with screen, it was not turned on). The device had vibration when I pressed power button. It continued vibrating periodically(like it was restarting).
After that I flashed my device using IUW with most likely firmware, but during the process I FORGOT TO CHOOSE userdata.img FILE!
Now the device can't even communicate with pc.
OTG method is not working. The device no more vibrates at start up! At motherboard led is lighting when pressing power button.So IS MY DEVICE DEAD? Or is there any solution in this situation(Alternative communication, or whatever...)

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.

Categories

Resources