Post Reply

Dump stock rom & build flashable image

3rd June 2014, 02:13 PM   |  #1  
navneetasnavi's Avatar
OP Senior Member
Flag ludhiana
Thanks Meter: 59
 
105 posts
Join Date:Joined: Jul 2013
More
For those who wants to know and learn how:
Quote:

  1. Requirements.
  2. Preparation.
  3. Collecting Information.
  4. Dumping.
  5. Build Up Flashable Image.


CREDITS

I do not want to take any credit for this as it is not my work, I just have forked it from http://www.freaktab.com.
You can check the original post here

I just have simplified it.
Last edited by navneetasnavi; 3rd June 2014 at 03:17 PM.
The Following 2 Users Say Thank You to navneetasnavi For This Useful Post: [ View ]
3rd June 2014, 02:24 PM   |  #2  
navneetasnavi's Avatar
OP Senior Member
Flag ludhiana
Thanks Meter: 59
 
105 posts
Join Date:Joined: Jul 2013
More
Arrow Requirements
Requirements :

Quote:

  1. USB Drivers Of your device installed
  2. ADB ( Android Debugging Bridge)
  3. romdump_v82b.zip (Android ROM dumper by Sebastian404)
  4. Micro-USB-cable
  5. microSD-card OR USB-Stick
  6. Newer busybox

Code:
* If you don't want to work with microSD-card OR USB-Stick you can use:
ADB push <from-PC-file> <to-android-file>
ADB pull <from-android-file> <to-PC-file>
(don't forget the pathes)
Last edited by navneetasnavi; 3rd June 2014 at 02:31 PM.
The Following 2 Users Say Thank You to navneetasnavi For This Useful Post: [ View ]
3rd June 2014, 02:41 PM   |  #3  
navneetasnavi's Avatar
OP Senior Member
Flag ludhiana
Thanks Meter: 59
 
105 posts
Join Date:Joined: Jul 2013
More
Arrow Preparations
Preparations


Setup android
Quote:

  • Settings -> [DEVICE] USB -> Enable Connect to PC
  • Settings -> [PERSONAL] Security -> Enable Unknown Sources
  • Settings -> [SYSTEM] Developer options -> Enable USB debugging


Install USB-Driver
Quote:

  • Conect Your device With computer
  • open device manager
  • right click on not recognized device
  • click update driver.

Quote:

  1. Format SD Card
  2. copy romdump form romdump_v82b.zip to the microSD-card
  3. make directory "rompump.out" and "dd.out"
  4. Remove it "secure" from PC
  5. put it into your device

The Following User Says Thank You to navneetasnavi For This Useful Post: [ View ]
3rd June 2014, 02:59 PM   |  #4  
navneetasnavi's Avatar
OP Senior Member
Flag ludhiana
Thanks Meter: 59
 
105 posts
Join Date:Joined: Jul 2013
More
Collecting Information
1. Starting shell via ADB
  • Browse to the folder where adb files are places

E.G. I have My adb files in adb folder in C: drive

Code:
cd\
cd adb
Code:
C:\adb>
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached
0123456789ABCDEF device
  • C:\adb>adb shell
Code:
root@android:/ #
=> this seems to be the ideal, because it's root (SU), if you don't have the # you have to try to type su

Confirm the correct user:
  • root@android:/ # id
Code:
uid=0(root) gid=0(root)
OR
  • root@android:/ # echo $USER
Code:
root
You can find your microSD-card under the directory "/mnt"
  • root@android:/ # cd /mnt
  • root@android:/mnt # ls
Code:
asec
external_sd
obb
sdcard
secure
shell
usb_storage
  • root@android:/mnt # cd external_sd
  • root@android:/mnt/external_sd # ls
Code:
LOST.DIR
dd.out
romdump
romdump.out

for the correct busybox release
  • root@android: # cat /proc/cpuinfo
Code:
Processor       : ARMv7 Processor rev 0 (v7l)
 :

After you have via PC download the newer busybox (I give it the name "busybox-armv7l_1.21.1") and put it to your microSD-card, then you have to copy it to your device
root@android:/ # cp /mnt/external_sd/busybox-armv7l_1.21.1 /data/busybox-armv7l_1.21.1
Destination MUST BE "/data/", otherwise it isn't executable...
  • root@android: # cat /proc/mtd
Code:
dev:    size   erasesize  name
mtd0: 00400000 00004000 "misc"
mtd1: 01000000 00004000 "kernel"
mtd2: 01000000 00004000 "boot"
mtd3: 01000000 00004000 "recovery"
mtd4: 18000000 00004000 "backup"
mtd5: 08000000 00004000 "cache"
mtd6: 80000000 00004000 "userdata"
mtd7: 00400000 00004000 "kpanic"
mtd8: 20000000 00004000 "system"
mtd9: 113400000 00004000 "user"
  • root@android: # cat /proc/partitions
Code:
major minor  #blocks  name
  31        0       4096 mtdblock0
  31        1      16384 mtdblock1
  31        2      16384 mtdblock2
  31        3      16384 mtdblock3
  31        4     393216 mtdblock4
  31        5     131072 mtdblock5
  31        6    2097152 mtdblock6
  31        7       4096 mtdblock7
  31        8     524288 mtdblock8
  31        9    4509696 mtdblock9
 179        0    3941376 mmcblk0
 179        1    3941344 mmcblk0p1
  • root@android:/ # ls -al /dev/block

Code:
brw------- root     root       7,   0 2013-10-27 15:39 loop0
brw------- root     root       7,   1 2013-10-27 15:39 loop1
brw------- root     root       7,   2 2013-10-27 15:39 loop2
brw------- root     root       7,   3 2013-10-27 15:39 loop3
brw------- root     root       7,   4 2013-10-27 15:39 loop4
brw------- root     root       7,   5 2013-10-27 15:39 loop5
brw------- root     root       7,   6 2013-10-27 15:39 loop6
brw------- root     root       7,   7 2013-10-27 15:39 loop7
brw------- root     root     179,   0 2013-10-27 16:29 mmcblk0
brw------- root     root     179,   1 2013-10-27 16:29 mmcblk0p1
drwxr-xr-x root     root              2013-10-27 15:39 mtd
brw------- root     root      31,   0 2013-10-27 15:39 mtdblock0
brw------- root     root      31,   1 2013-10-27 15:39 mtdblock1
brw------- root     root      31,   2 2013-10-27 15:39 mtdblock2
brw------- root     root      31,   3 2013-10-27 15:39 mtdblock3
brw------- root     root      31,   4 2013-10-27 15:39 mtdblock4
brw------- root     root      31,   5 2013-10-27 15:39 mtdblock5
brw------- root     root      31,   6 2013-10-27 15:39 mtdblock6
brw------- root     root      31,   7 2013-10-27 15:39 mtdblock7
brw------- root     root      31,   8 2013-10-27 15:39 mtdblock8
brw------- root     root      31,   9 2013-10-27 15:39 mtdblock9
drwxr-xr-x root     root              2013-10-27 15:39 platform
drwx------ root     root              2013-10-27 15:39 vold
  • root@android:/ # ls -al /dev/block/mtd/by-name

Code:
lrwxrwxrwx root     root              2013-10-27 15:39 backup -> /dev/block/mtdblock4
lrwxrwxrwx root     root              2013-10-27 15:39 boot -> /dev/block/mtdblock2
lrwxrwxrwx root     root              2013-10-27 15:39 cache -> /dev/block/mtdblock5
lrwxrwxrwx root     root              2013-10-27 15:39 kernel -> /dev/block/mtdblock1
lrwxrwxrwx root     root              2013-10-27 15:39 kpanic -> /dev/block/mtdblock7
lrwxrwxrwx root     root              2013-10-27 15:39 misc -> /dev/block/mtdblock0
lrwxrwxrwx root     root              2013-10-27 15:39 recovery -> /dev/block/mtdblock3
lrwxrwxrwx root     root              2013-10-27 15:39 system -> /dev/block/mtdblock8
lrwxrwxrwx root     root              2013-10-27 15:39 user -> /dev/block/mtdblock9
lrwxrwxrwx root     root              2013-10-27 15:39 userdata -> /dev/block/mtdblock6
  • root@android:/dev # /data/busybox-armv7l_1.21.1 blkid

Code:
/dev/block/mmcblk0p1: UUID="04A7-463C"
/dev/block/vold/31:9: UUID="8269-1ED1"
/dev/block/vold/179:1: UUID="04A7-463C"
/dev/block/mtdblock9: UUID="8269-1ED1"
/dev/block/mtdblock8: LABEL="system" UUID="06bc9880-9e07-4dec-ae8d-1e59a1b88921"
/dev/block/mtdblock6: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b"
/dev/block/mtdblock5: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b"
The Following User Says Thank You to navneetasnavi For This Useful Post: [ View ]
3rd June 2014, 03:08 PM   |  #5  
navneetasnavi's Avatar
OP Senior Member
Flag ludhiana
Thanks Meter: 59
 
105 posts
Join Date:Joined: Jul 2013
More
DUMPING
Dumping ROM

Dumping (at adb shell)

1.) via dd:
  • dd if=/dev/block/mtdblock0 of=/mnt/external_sd/dd.out/misc.img
Code:
8192+0 records in
8192+0 records out
4194304 bytes transferred in 0.677 secs (6195426 bytes/sec)
  • dd if=/dev/block/mtdblock1 of=/mnt/external_sd/dd.out/kernel.img
Code:
32768+0 records in
32768+0 records out
16777216 bytes transferred in 1.734 secs (9675441 bytes/sec)
  • dd if=/dev/block/mtdblock2 of=/mnt/external_sd/dd.out/boot.img

Code:
32768+0 records in
32768+0 records out
16777216 bytes transferred in 2.665 secs (6295390 bytes/sec)
  • dd if=/dev/block/mtdblock3 of=/mnt/external_sd/dd.out/recovery.img

Code:
32768+0 records in
32768+0 records out
16777216 bytes transferred in 1.340 secs (12520310 bytes/sec)
  • dd if=/dev/block/mtdblock4 of=/mnt/external_sd/dd.out/backup.img

Code:
786432+0 records in
786432+0 records out
402653184 bytes transferred in 69.198 secs (5818855 bytes/sec)
  • dd if=/dev/block/mtdblock8 of=/mnt/external_sd/dd.out/system.img

Code:
1048576+0 records in
1048576+0 records out
536870912 bytes transferred in 57.050 secs (9410533 bytes/sec)
  • /data/busybox-armv7l_1.21.1 ls -ltr /mnt/external_sd/dd.out/

Code:
-rwxrwxr-x    1 1000     1015       4194304 Oct 27 21:09 misc.img
-rwxrwxr-x    1 1000     1015      16777216 Oct 27 21:12 kernel.img
-rwxrwxr-x    1 1000     1015      16777216 Oct 27 21:14 boot.img
-rwxrwxr-x    1 1000     1015      16777216 Oct 27 21:15 recovery.img
-rwxrwxr-x    1 1000     1015     402653184 Oct 27 21:17 backup.img
-rwxrwxr-x    1 1000     1015     536870912 Oct 27 21:27 system.img

?not really need?
Code:
dd if=/dev/block/mtdblock5 of=/mnt/external_sd/dd.out/cache.img
dd if=/dev/block/mtdblock6 of=/mnt/external_sd/dd.out/userdata.img
dd if=/dev/block/mtdblock7 of=/mnt/external_sd/dd.out/kpanic.img
dd if=/dev/block/mtdblock9 of=/mnt/external_sd/dd.out/user.img

2.) via "romdump":
  • cp /mnt/external_sd/romdump /data/romdump
  • /data/romdump

Code:
Android ROM dumper v0.82b
(c)2011 Sebastian404
Device : rk31sdk-eng 4.2.2 JDQ39 eng.linking.20130709.184313 test-keys
 
Creating required files... done.
Opening mtd table... done.
Dumping kernel config... sh: cat: /proc/config.gz: No such file or directory
done.
Dumping boot partition... done.
Dumping recovery partition... done.
Dumping system partition... done.
Creating Checksums... done.
Cleaning up... done.
All done.
  • ls -al /sdcard/romdump

Code:
-rwxrwxr-x system   sdcard_rw   16777216 2013-10-27 22:46 boot.img
-rwxrwxr-x system   sdcard_rw        275 2013-10-27 22:48 checksum.md5
-rwxrwxr-x system   sdcard_rw          0 2013-10-27 22:46 config.gz
-rwxrwxr-x system   sdcard_rw   16777216 2013-10-27 22:46 recovery.img
-rwxrwxr-x system   sdcard_rw       1507 2013-10-27 22:46 system.info.gz
-rwxrwxr-x system   sdcard_rw  373034496 2013-10-27 22:48 system.tar

cp /sdcard/romdump/boot.img /mnt/external_sd/romdump.out/boot.img
cp /sdcard/romdump/checksum.md5 /mnt/external_sd/romdump.out/checksum.md5
cp /sdcard/romdump/config.gz /mnt/external_sd/romdump.out/config.gz
cp /sdcard/romdump/recovery.img /mnt/external_sd/romdump.out/recovery.img
cp /sdcard/romdump/system.info.gz /mnt/external_sd/romdump.out/system.info.gz
cp /sdcard/romdump/system.tar /mnt/external_sd/romdump.out/system.tar

  • ls -al /mnt/external_sd/romdump.out

Code:
-rwxrwxr-x system   sdcard_rw   16777216 2013-10-27 23:15 boot.img
-rwxrwxr-x system   sdcard_rw        275 2013-10-27 23:15 checksum.md5
-rwxrwxr-x system   sdcard_rw          0 2013-10-27 23:15 config.gz
-rwxrwxr-x system   sdcard_rw   16777216 2013-10-27 23:15 recovery.img
-rwxrwxr-x system   sdcard_rw       1507 2013-10-27 23:15 system.info.gz
-rwxrwxr-x system   sdcard_rw  373034496 2013-10-27 23:16 system.tar
The Following User Says Thank You to navneetasnavi For This Useful Post: [ View ]
3rd June 2014, 03:14 PM   |  #6  
navneetasnavi's Avatar
OP Senior Member
Flag ludhiana
Thanks Meter: 59
 
105 posts
Join Date:Joined: Jul 2013
More
Arrow Build Up Flashable Image
Build Up Flashable Image



WinHex or any other Hex-Editor who can work with large files
Rk29xx ImageTools V2.1 by wendal (I download it here at 4. (it's without "su" and "Superuser.apk"))
(Alternatively you can use RK3xxx Firmware Tools by SergioPoverony)

First check the "dd.out/backup.img" with a HexEditor to determine whether there is information in it (first 4 characters "RKAF") or only zeros (HEX "FF") what means it is empty...

If there is this information in it, you will perhaps* have the complete ROM in it, which will include the loader and parameter files and you can use "wendal tools" to extract it...
1. Put the "backup.img" into the wendal tools directory and rename it to "wendal.img"
2. Start the "Runme.bat",
2a. Select 1 + return
2b. then any key
2c. and then you have to wait.

Code:
D:\RK3066_IMG_Mod_Tool>lua rk29xx_rom_tools_tnt.lua
RK29xx Image Pack/Unpack Tools
Blog http://wendal.net
Project: https://github.com/wendal/teclast_tools
feedback: pad@wendal.net
Pls input: 1-Unpack 2-Pack 3-Exit
1
Pls copy Image file into this folder,and rename to wendal.img
Notify any errors!
Drücken Sie eine beliebige Taste . . .
Reading file header...
File header: RKFWf
Read loader's offset
Read loader's len
Read update.img's offset
Read update.img's len
Output Loader
offset(0x66) len(0x2F8AE)
Output updata.img
offset(0x2F914) len(0x1973A804)
Unpack updata.img to Temp folder
Check file... OK
------- UNPACK ------
package-file    0x00000800      0x00000241
RK3188Loader(L)_V1.20.bin       0x00001000      0x0002F96E
parameter       0x00031000      0x00000266
Image/misc.img  0x00031800      0x0000C000
Image/kernel.img        0x0003D800      0x00846034
Image/boot.img  0x00884000      0x000FE6F1
Image/recovery.img      0x00982800      0x00B18000
Image/system.img        0x0149A800      0x16E09800
backupimage/backup.img  0x182A4000      0x01495004
update-script   0x19739800      0x000003A5
recover-script  0x1973A000      0x0000010A
Unpack firmware OK!
------ OK ------
Unpack -- All Done
Pls input: 1-Unpack 2-Pack 3-Exit
The Following User Says Thank You to navneetasnavi For This Useful Post: [ View ]
6th June 2014, 09:23 AM   |  #7  
nightwalker's Avatar
Senior Member
Flag Uttar Pradesh>Meerut
Thanks Meter: 309
 
669 posts
Join Date:Joined: Mar 2013
More
Amazing work,you should add your name at TWRP which you compiled.
Well,hats off bro.
The Following User Says Thank You to nightwalker For This Useful Post: [ View ]
24th July 2014, 07:36 PM   |  #8  
Junior Member
Thanks Meter: 0
 
1 posts
Join Date:Joined: Mar 2012
Steps for MMC based devices
Thanks for the info. Don't know why it hadn't occur to me to use dd for taking the image.

This works great for MTD based devices but does nothing for MMC based devices.

Never fear, I found the answer in an old post from lavero.burgos on repartitioning a Nook tablet.

Turns out if you use the parted from the CM team you can acquire the partition information you need.

Here is a shorthand of the previous instructions as they apply to MMC devices:

Req:
  • USB Drivers for your device
  • ADB installed and in your path
  • Appropriately sized USB cable for your device
  • microSD card
  • GNU parted
  • a rooted device

Prep:
  • make directory "firmware-img" on SD Card
  • make directory "tools" on SD Card
  • copy parted to tools directory on SD Card
  • Remove SD Card safely from PC
  • put SD Card into rooted device

Collect Info:
Run the commands below (one per line)
  • adb shell
  • su (if not already root user)
  • cp /mnt/<sd card mount point>/tools/parted /system/bin
  • cat /proc/partitions
  • parted /dev/block/mmcblk0
  • print
    make note of the partition number and name for the partitions you wish to dump
  • quit

Dumping ROM:
Run dd as defined below each partition you wan to dump, the <partition path> will be /dev/block/mmcblk0p<partition number>.
dd if=<partition path> of=/mnt/<sd card mount point>/firmware-img/<partition name>.img

---------- Post added at 02:36 PM ---------- Previous post was at 02:21 PM ----------

I hope this helps. I'm by no means an expert on this type of thing, so if you have additions or corrections, plz feel free. I've been watching learning and gathering, now I have a chance to give back.

I've gotten this to work on Nook tablet, Atrix HD and gonna test it on my Xoom in the next few days.
Last edited by big-g; 24th July 2014 at 07:30 PM. Reason: Missed a step
25th July 2014, 10:41 PM   |  #9  
navneetasnavi's Avatar
OP Senior Member
Flag ludhiana
Thanks Meter: 59
 
105 posts
Join Date:Joined: Jul 2013
More
I dont know much about the MMC based devices .. As I onLy Have used Mediatek devices so far, btw thanx for the information

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android by ThreadRank