storing barebox to flash /dev/nand0

Juergen Beisert jbe at pengutronix.de
Fri Sep 10 06:30:45 EDT 2010


Marek,

Belisko Marek wrote:
> On Fri, Sep 10, 2010 at 11:27 AM, Juergen Beisert <jbe at pengutronix.de> 
wrote:
> > Belisko Marek wrote:
> >> Hi,
> >>
> >> I'm porting barebox to mini2440 board. I can boot barebox from SDRAM
> >> by loading to TEXT_BASE address.
> >> I would like to test also booting from NAND flash but I can't find a
> >> way how to store barebox loaded in RAM
> >> to flash.
> >>
> >> I try tftp barebox.bin /dev/nand0 but if failed with:
> >>
> >> TFTP from server 10.146.1.21 ('barebox.bin' -> '/dev/nand0')
> >>         offset 0x00000200 not page aligned
> >> write: Invalid argument
> >>
> >> tftp failed: error -22
> >>
> >> How can I properly store to flash?
> >
> > Consider the bad blocks in your NAND. So, you will need a bad block aware
> > device to write to.
> >
> > This code in your board specific init routine should add the thing:
> >
> > [...]
> > /* ----------- add some vital partitions -------- */
> > devfs_add_partition("nand0", 0x00000, 0x40000, PARTITION_FIXED,
> > "self_raw"); dev_add_bb_dev("self_raw", "self0");
> >
> > devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED,
> > "env_raw"); dev_add_bb_dev("env_raw", "env0");
> > [...]
>
> OK add vital partitions but after that ls -la /dev shows:
> [...]

Not sure if this is all right (all show the barebox partition):

> crw-------     262144 self_raw

Okay, 256 kiB

> crw-------          0 self0

Hmm, 0?

> crw-------     262144 nand0.barebox

Okay, 256 kiB

> crw-------          0 nand0.barebox.bb

Again, 0?

For the environment it looks different:

> crw-------     131072 env_raw
> crw-------     131072 env0
> crw-------     131072 nand0.bareboxenv
> crw-------     131072 nand0.bareboxenv.bb

All are 128 kiB.

jbe

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |



More information about the barebox mailing list