Restoring flash image - bad blocks

Johan Ribenfors
Hi,

We want to create a flash image that we can use to setup all our mini2440s.
They seem to come with different bootloaders and images, and we want to
standardise them before we do anything with them.

However, we're stuck when the mini we are restoring the image onto has bad
blocks.

The restore (obviously, in retrospect) fails when it tries to write to the
bad block.

Is there a way around this?

Juergen Beisert
Solution: do not use plain images from a NAND. It does not work like a
harddisk. NAND memory needs bad block and checksum handling. And sometimes
the internal layout in the NAND is different from type to type.
For the root filesystem you can create an image with all the content you
need. This has to be created in accordance to the NAND flash layout and is
also bad block aware (when storing this kind of image to the NAND you can
skip bad blocks and the result will still work)

Johan Ribenfors
Hmm, I was afraid that would be the answer.

Assuming we have an 'image' - boot loader, kernel, filesystem etc we want
to install on any mini2440 we get, what's the simplest (fewest steps) way
to do this?

Ideally the process would be the same no matter what the state of the
mini2440 actually is.

Juergen Beisert
Instead of using "golden images" use a buildsystem like buildroot or
PTXdist instead. This will ensure you will get always the correct images
for your flash (even if the badblocks are different from system to system,
and even if the NAND type itself is different).

Johan Ribenfors
We're using PTXdist to build the kernel and filesystem, it was a simple
'click and run' mechanism we were after to get them onto the boards - no
matter what bootloader or setup the board already had.

We've settled on using teraterm's macro language, and writing a script for
it that will download the barebox bootloader into ram, run it, flash it to
nand, and then download and flash the kernel and filesystem.

User interaction is limited to starting the script, and then running DNW to
upload the barebox image to the board.

It works for us! (And more importantly, the people we'll have installing
the boards in the wild)