Author Topic: Make a NAND Image  (Read 15346 times)

magno

  • Guest
Make a NAND Image
« on: October 10, 2013, 10:01:43 pm »
After make my changes in an Android image, I need to backup the distro from NAND.

I make an image using a bootable SDCARD (linaro) :

Code: [Select]
dd if=/dev/nand conv=sync,noerror bs=64K | gzip -c -9 > /nand.ddimg.gz

But PhoenixSuit does not recognize my image when I try to burn back to NAND.

How can I make my NAND backup PhoenixSuit compatible ?
« Last Edit: October 10, 2013, 10:32:34 pm by magno »

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: Make a NAND Image
« Reply #1 on: October 10, 2013, 11:06:16 pm »
Short answer -- you can't. Phoenixsuit takes a very specific archive format that includes compressed partitions, metadata, and initialization code.

You may be able to restore your nand image back to the nand at some later point with

zcat < nand.ddimg.gz > /dev/nand

*but* if you have a nand failure and need to do a full reformat with phoenixsuit, the new nand size may be a little smaller due to extra blocks being allocated to the bad block mapping pool. (I've seen this on one of my A10 android sticks that was having nand problems.)

magno

  • Guest
Re: Make a NAND Image
« Reply #2 on: October 12, 2013, 01:50:11 pm »
What about the reversing process using dd again?

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: Make a NAND Image
« Reply #3 on: October 12, 2013, 02:29:13 pm »
What about the reversing process using dd again?

Same answer.  zcat, dd, cat, doesn't matter what you use to write the data back.  There is nothing magical about dd: it reads data from if= and writes data to of= without any modifications.  It can be told to do things that zcat or gzip won't, like the block sizes to use and how buffering should be done, and can perform optional transformations on the data, but your usage of dd is not much different than simply:

gzip -9 < /dev/nand > /nand.ddimg.gz

other than perhaps being faster due to using 64K buffers.

(Note: -c is redundant when using gzip from standard input)

magno

  • Guest
Re: Make a NAND Image
« Reply #4 on: October 12, 2013, 03:00:37 pm »
*but* if you have a nand failure and need to do a full reformat with phoenixsuit, the new nand size may be a little smaller due to extra blocks being allocated to the bad block mapping pool. (I've seen this on one of my A10 android sticks that was having nand problems.)

There is a way to repair the nand to original size?
How can the people over there makes PhoenixSuite images?

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: Make a NAND Image
« Reply #5 on: October 12, 2013, 05:51:37 pm »
*but* if you have a nand failure and need to do a full reformat with phoenixsuit, the new nand size may be a little smaller due to extra blocks being allocated to the bad block mapping pool. (I've seen this on one of my A10 android sticks that was having nand problems.)

There is a way to repair the nand to original size?
How can the people over there makes PhoenixSuite images?

No.  Both NAND and NOR flash go bad over time.  As blocks die, other blocks that are reserved for bad block mapping replace them and the old data is copied to them.  If too many blocks go bad and you run out of free blocks for mapping, you start getting errors, and the system doesn't boot or some data files are lost.  At that point, you have to do a full reformat, which creates a smaller device with more free blocks for mapping.

As to how people make PhoenixSuit images, as I said before, these are not disk images; they contain compressed file systems (think tar or zip, not dd) along with metadata and initialization scripts.  PhoenixSuit creates a bunch of file systems and copies the data to them; so it doesn't matter if the NAND device is 3.7GB or 3.5GB -- the user data partition is simply a bit smaller.

For example, if you unzip a big directory tree, it doesn't matter how big your hard drive is, as long as you have enough free space to store the files.  This is the same reasoning behind how PhoenixSuit works.

magno

  • Guest
Re: Make a NAND Image
« Reply #6 on: October 13, 2013, 01:46:44 pm »
Understood.
Thank you for very detailed explanation.
See? You're not so lazy !!

So, the nand is doomed to be damaged ... too bad news.

I'm lookin for a tool to verify the NAND integrity.... like the windows check disk.


EDIT:
I found this, but i don't know how to use it.
http://forum.xda-developers.com/showthread.php?t=1753473


EDIT 2:
REFER: http://www.cubieforums.com/index.php?topic=51.0
After install Android in NAND (http://linux-sunxi.org/A20-Cubieboard/Nand_Images) I've noticed a "SDCARD" partition (I'm not inserted the sdcard in the cubie).
There is a fake sdcard partition and the main root partition is too small. I need to extend the main partition to gain more space.
How can I do that ?
(please consider I'm a noobie)

« Last Edit: October 13, 2013, 04:29:42 pm by magno »

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: Make a NAND Image
« Reply #7 on: October 13, 2013, 08:44:47 pm »
I'm afraid I can't answer android-specific questions like yours.  I can tell you that the livesuit format will check the nand prior to formatting, and at least on the A20, the bootloader performs a quick nand check.

For android questions, you should probably ask over on the android cubieforum board.

magno

  • Guest
Re: Make a NAND Image
« Reply #8 on: October 14, 2013, 05:34:52 pm »
Thanks.

magno

  • Guest
Re: Make a NAND Image
« Reply #9 on: October 17, 2013, 06:13:31 pm »
Patrick, I found a tool made by you here:

https://groups.google.com/forum/#!topic/linux-sunxi/5FmS2zVLvDQ

Can you help me here ?

http://www.cubieforums.com/index.php/topic,893.0.html

I am one step away to create my own custom flasheable Android image ...

gbelisario

  • Guest
Re: Make a NAND Image
« Reply #10 on: January 06, 2014, 11:44:44 am »
I am one step away to create my own custom flasheable Android image ...

Did you manage to get it working? If so, how did you do it?

Saegematz

  • Guest
Re: Make a NAND Image
« Reply #11 on: January 06, 2014, 12:15:56 pm »
hi!
Did you hear about imgRePacker.exe
It's a tool for making Image and decoding Image.
Cu