Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[TOOL] MTD-Utils

OP _n0p_

24th September 2012, 02:23 PM   |  #1  
_n0p_'s Avatar
OP Senior Member
Flag Kiev
Thanks Meter: 1,827
 
2,557 posts
Join Date:Joined: Apr 2009
More
Here, i've quickly compiled three MTD utils ( git://git.infradead.org/mtd-utils.git ):
nanddump, nandwrite, flash_erase
So far tested nanddump - works , i was wandering what's inside
--
mtd3: 00040000 00020000 "LogFilter"
mtd4: 00300000 00020000 "oem_log"
--
Nothing interesting, actually.
--
nandwrite should enable you to write boot, recovery, system and firstboot right from android system (i don't think that it's good idea, but anyway).
--
Readme:
MTD-Utils 1.5
Please use with extreme caution!
--
Streak 5, dump example for recovery:
./nanddump /dev/mtd/mtd1 -f /sdcard/mtd1
--
Our layout:
cat /proc/mtd
dev: size erasesize name
mtd0: 00500000 00020000 "boot"
mtd1: 00600000 00020000 "recovery"
mtd2: 00600000 00020000 "recovery_bak"
mtd3: 00040000 00020000 "LogFilter"
mtd4: 00300000 00020000 "oem_log"
mtd5: 00100000 00020000 "splash"
mtd6: 10400000 00020000 "system"
mtd7: 08c00000 00020000 "userdata"
--
Have fun,
Sergei (_n0p_)

(tools attached)

--
I was able to switch recovery on the fly, having /sdcard/CWM.img (CWM port by TheManii) and /sdcard/SM.img (Old and trusty StreakMod):

/system/xbin/flash_erase /dev/mtd/mtd1 0 0
/system/xbin/nandwrite /dev/mtd/mtd1 /sdcard/CWM.img
Reboot, checked if works - it does

Back to StreakMod:
/system/xbin/flash_erase /dev/mtd/mtd1 0 0
/system/xbin/nandwrite /dev/mtd/mtd1 /sdcard/SM.img
Attached Files
File Type: zip mtd-utils.zip - [Click for QR Code] (308.4 KB, 1632 views)
Last edited by _n0p_; 24th September 2012 at 03:44 PM. Reason: My first tests
The Following 14 Users Say Thank You to _n0p_ For This Useful Post: [ View ]
24th September 2012, 02:38 PM   |  #2  
_n0p_'s Avatar
OP Senior Member
Flag Kiev
Thanks Meter: 1,827
 
2,557 posts
Join Date:Joined: Apr 2009
More
Changelog:
Added flash_erase
The Following 2 Users Say Thank You to _n0p_ For This Useful Post: [ View ]
24th September 2012, 06:13 PM   |  #3  
Member
Thanks Meter: 6
 
60 posts
Join Date:Joined: Sep 2012
can you please guide how to flash this
should i flash this in streakmod recovery and will it wipe my current streakmod with cwm recovery ?
24th September 2012, 07:03 PM   |  #4  
_n0p_'s Avatar
OP Senior Member
Flag Kiev
Thanks Meter: 1,827
 
2,557 posts
Join Date:Joined: Apr 2009
More
This zip pack should not be flashed.
This tools can operate on (at least) Streak NAND flash partitions, i.e. read, erase, write.
It contains three android binaries - you should extract them and place, preferably, into /system/xbin
Change permissions on al this files to 755 - like:
chmod 755 nanddump
Now, you should be able to flash boot(kernel) and recovery right from working Android system.
I've given an example in first post.
hunderteins, if you reading this - would you give mtd5 from your device?
I have it empty and wander what image format it should have.
The Following User Says Thank You to _n0p_ For This Useful Post: [ View ]
24th September 2012, 08:33 PM   |  #5  
_n0p_'s Avatar
OP Senior Member
Flag Kiev
Thanks Meter: 1,827
 
2,557 posts
Join Date:Joined: Apr 2009
More
Where is AMSS, DSP and stuff?
What do we have on NAND (my comments are in italic):

I/PrintK ( 1): <5>Creating 8 MTD partitions on "msm_nand":
54MB hole
I/PrintK ( 1): <5>0x000003600000-0x000003b00000 : "boot"
I/PrintK ( 1): <5>0x000003b00000-0x000004100000 : "recovery"
I/PrintK ( 1): <5>0x000004100000-0x000004700000 : "recovery_bak"
I/PrintK ( 1): <5>0x000004700000-0x000004740000 : "LogFilter"
I/PrintK ( 1): <5>0x000004740000-0x000004a40000 : "oem_log"
1MB hole
I/PrintK ( 1): <5>0x000004b40000-0x000004c40000 : "splash"
35MB hole
I/PrintK ( 1): <5>0x000007000000-0x000017400000 : "system"
I/PrintK ( 1): <5>0x000017400000-0x000030000000 : "userdata" (should be 0x000020000000)
W/PrintK ( 1): <4>mtd: partition "userdata" extends beyond the end of device "msm_nand" -- size truncated to 0x8c00000

According to this article:
http://forum.xda-developers.com/showthread.php?t=542688
this areas can be regained and hmmm, altered?
AMSS, DSP, service tag, provider lock and some other interesting stuff could be there!
The Following User Says Thank You to _n0p_ For This Useful Post: [ View ]
24th September 2012, 08:57 PM   |  #6  
Senior Member
Thanks Meter: 335
 
181 posts
Join Date:Joined: Sep 2009
Thumbs up
Quote:
Originally Posted by _n0p_

hunderteins, if you reading this - would you give mtd5 from your device?
I have it empty and wander what image format it should have.

nice one. Thanks. But my mtd5 is 1048576 times 0xff.

What is the difference between

$ cat /dev/mtd/mtd5 > /sdcard/mtd5

and

$ nanddump /dev/mtd/mtd5 -f /sdcard/mtd5

?
The Following User Says Thank You to hunderteins For This Useful Post: [ View ]
24th September 2012, 09:01 PM   |  #7  
_n0p_'s Avatar
OP Senior Member
Flag Kiev
Thanks Meter: 1,827
 
2,557 posts
Join Date:Joined: Apr 2009
More
Quote:
Originally Posted by hunderteins

nice one. Thanks. But my mtd5 is 1048576 times 0xff.

What is the difference between

$ cat /dev/mtd/mtd5 > /sdcard/mtd5

and

$ nanddump /dev/mtd/mtd5 -f /sdcard/mtd5

?

Well, it seems that nothing, but this makes me feel dumber than usual
I didn't try cat
24th September 2012, 09:17 PM   |  #8  
Wiki Admin / Recognized Contributor
Thanks Meter: 1,595
 
3,547 posts
Join Date:Joined: Dec 2010
flash_image should be the built in way of writing to mtd and raw emmc partitions, though we rarely ever discuss flash_image

try reading the raw nand at the beginning of it, thats where its stored on emmc devices, and there is unmapped space in the beginning
54mb should be approx enough shouldnt it? (not at pc to verify file sizes of the firmwares)

you could compare to the spro's map i guess, its an emmc device, but not a qisda one.
if i had the mapping for the "streak2 5" that would be the best to compare to, but i dont

is there any way to verify the mem locations are correct? i have the exact emmc layout for the s7/s10 because nvflash provides it if asked.
but there is no standardized tool for qualcomm chips, ill assume they're correct

also: at least on filesystems you should use dd and not cat for the fact that cat drops the final byte or something to that degree.
i dont recall if it applies to yaffs2 but it should for ext, it shouldnt matter for raw mtd partitions
24th September 2012, 09:39 PM   |  #9  
Member
Thanks Meter: 6
 
60 posts
Join Date:Joined: Sep 2012
hmmm iam still confused need to wait more to know this all
24th September 2012, 09:53 PM   |  #10  
_n0p_'s Avatar
OP Senior Member
Flag Kiev
Thanks Meter: 1,827
 
2,557 posts
Join Date:Joined: Apr 2009
More
Quote:
Originally Posted by TheManii

flash_image should be the built in way of writing to mtd and raw emmc partitions, though we rarely ever discuss flash_image
try reading the raw nand at the beginning of it, thats where its stored on emmc devices, and there is unmapped space in the beginning
54mb should be approx enough shouldnt it? (not at pc to verify file sizes of the firmwares)

You see, tools operate on logical partition level (i think flash_image is a userspace tool that uses mtd partitions, same as mtd-utils).
And kernel doesn't provide a raw device for NAND (i'd love to be wrong though).
I'll try tomorrow to supply kernel an MTD table via mtdparts parameter and check ow it goes.

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

Advanced Search
Display Modes