Backing Up Nand


Pleng

Well-Known Member
Joined
Dec 28, 2006
Messages
3,030
I've unfortunately become something of a serial reflasher and I'm loathe to constantly reinstall hotfixes, and community codec packs, set up my desktop and menus etc every time I reflash. Is there any way I can back up the current status of my NAND into a new rootfs.img file that I can put on my reflash SD card so that I'll always have a ready-to go system after reflashing?
 
I'm using Stuckie's extension system to save on NAND space. It uses mounted loopback files, so you can just back them up as you wish!

http://www.gp32x.de/board/index.php?/topic/54508-simple-dev-pnd/

For you, just reflash and mount the extension file again: Back where you were, like magic.
 
Last edited by a moderator:
um thanks. but that's not really what I'm after.
 
This looks possible by doing crazy stuff with the ubifs tools... by literally taking a running system and squishing it back into a rootfs.img for flashing purposes.

Looks scary as sin to do, though!
Though I haven't figured out a way of even opening the existing rootfs.img on my PC yet ( haven't really spent much time looking at it ) so there may be a safer way of doing it that way.. would be less fun though ;)
 
I guess the best would be if the current Firmware reflasher could be extended into a general-purpose nand-flashing and dumping tool.
Basically your boot from SD Card, and it offers you a Menu along the lines of:
Code:
-----------------------
Pandora NAND Utils
-----------------------

 ->dump NAND to file
   flash file to NAND
   
   reboot
   shutdown
 
Yea that would be cool.

In the meantime, does anybody know how I can backup my NAND to a rootfs.img file??
 
** WARNING ** I COULD BE TALKING OUT MY ARSE HERE SO DON'T ATTEMPT THE FOLLOWING UNLESS YOU'RE FEELING BRAVE! ** WARNING **
By the looks of things, you'll need mkfs-ubifs from the Angstrom repository.
You'll then need to do something like: sudo mkfs.ubifs -r / -m 4096 -e 516096 -c 4095 -o /root.ubifs
You might want to not have anything mounted when you do that, however.. and I'm not sure if it'll be smart enough to ignore it's own file. If not, you'll have to do some sneaky binds to a separate folder, and ignore/blank out the stuff you don't want to copy over.
You'll then want to run: ubinize -o rootfs.img -m 4096 -p 512KiB ubinize.cfg
Where ubinize.cfg is something like:
[rootfs]
# Volume mode (other option is static)
mode=ubi
# Source image
image=root.ubifs
# Volume ID in UBI image
vol_id=0
# Allow for dynamic resize
vol_type=dynamic
# Volume name
vol_name=rootfs
# Autoresize volume at first mount
vol_flags=autoresize

Then you should have a rootfs.img that _might_ work.
I have NOT tested this, but from what I've read from the ubifs docs, this seems to be about right.
The Pandora may expect different block sizes and things, I'm not sure as I haven't looked further into it yet. This might start you off though, that and looking over the information on building the rootfs from scratch to ensure the ubifs format is correct.
You'll want to look over here anyway: http://www.linux-mtd.infradead.org/doc/ubifs.html and here wouldn't hurt either: http://blogs.distant-earth.com/wp/?p=90

I've still got MilkyTracker to fix before I look at anything else ( I now at least have ddd running to track down the bugger! ) but if there's been no progress made by the time I have that done, I'll have a further poke around. I seem to be doing the more ludicrous hacks at the moment ;)
 
Pleng said:
Yea that would be cool.

In the meantime, does anybody know how I can backup my NAND to a rootfs.img file??

nanddump /dev/mtd4 <filename>


/dev/mtd0-3 = boot images/etc, you don't need.. they come with the flash utility
/dev/mtd4 = your rootfs files, and the flash utility will use this file to reflash mtd4, granted you replace the old rootfs.img file with the one created by nanddump.
 
Last edited by a moderator:
awesome

Can I do this from within the Pandora's OS or do I need to boot from the reflash SD?
 
Pleng said:
awesome

Can I do this from within the Pandora's OS or do I need to boot from the reflash SD?

I never tried it while in Pandora's OS booted from the NAND, but I did from an OS booted off of SD card.

You CAN mount the /dev/mtd4 while its booted off the NAND, so I'm assuming the command will work using the NAND OS.
 
Last edited by a moderator:
Noisome said:
nanddump /dev/mtd4 <filename>


/dev/mtd0-3 = boot images/etc, you don't need.. they come with the flash utility
/dev/mtd4 = your rootfs files, and the flash utility will use this file to reflash mtd4, granted you replace the old rootfs.img file with the one created by nanddump.

Wow, that doesn't sound anywhere near as painful as I thought it was going to be ( didn't realise there was a nanddump program actually ON the Pandora.. I was going round the hard way, knowing that the filesystem is UbiFS so figuring out how to create one of them! )

Glad someone who actually knew what they were up to stepped in ;) I could've ended up going all over the place instead!
 
Last edited by a moderator:
Stuckie said:
...I could've ended up going all over the place instead!

I did! And then I found nanddump! lol
 
Last edited by a moderator:
Back
Top