storing barebox to flash /dev/nand0

Belisko Marek marek.belisko at gmail.com
Fri Sep 10 05:53:00 EDT 2010


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:
cr-------- 4294967295 zero
crw-------       2977 defaultenv
crw------- 4294967295 mem
crw-------  268435456 nand0
cr--------    8388608 nand_oob0
crw-------          0 ram0
crw-------         32 phy0
crw-------     262144 self_raw
crw-------          0 self0
crw-------     131072 env_raw
crw-------     131072 env0
crw-------     262144 nand0.barebox
crw-------     131072 nand0.bareboxenv
crw-------    1572864 nand0.kernel
crw-------  266469376 nand0.root
crw-------  266076160 nand0.root.bb
crw-------    1572864 nand0.kernel.bb
crw-------     131072 nand0.bareboxenv.bb
crw-------          0 nand0.barebox.bb

and storing barebox to nand0.barebox.bb report no space left.
Include startup log:
barebox 2010.09.0-00077-gf899e3f-dirty (Sep 10 2010 - 10:02:48)

Board: Mini 2440
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB
3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 0 at 0x00000000
Bad eraseblock 1 at 0x00020000
Bad eraseblock 376 at 0x02f00000
Bad eraseblock 531 at 0x04260000
Bad eraseblock 1097 at 0x08920000
dm9000 i/o: 0x20000300, id: 0x90000a46
got MAC address from EEPROM: 00:00:00:00:00:00
refclk:    12000 kHz
mpll:     405000 kHz
upll:      48000 kHz
fclk:     405000 kHz
hclk:     101250 kHz
pclk:      50625 kHz
SDRAM1:   CL4 at 101MHz
SDRAM2:   CL4 at 101MHz
Malloc space: 0x31bc0000 -> 0x31fc0000 (size  4 MB)
Stack space : 0x31bb8000 -> 0x31bc0000 (size 32 kB)
envfs: wrong magic on /dev/env0
no valid environment found on /dev/env0. Using default environment
running /env/bin/init...

Hit any key to stop autoboot:  3

type update_kernel [<imagename>] to update kernel into flash
type update_root [<imagename>] to update rootfs into flash
>
> (Sizes depending on the size of your boot loader binary).
>
> And at runtime:
>
> barebox> addpart /dev/nand0 256k(barebox)ro,128k(bareboxenv)
> barebox> erase /dev/nand0.barebox.bb
> barebox> tftp barebox.bin /dev/nand0.barebox.bb
>
> 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/  |
>

Thanks,

Marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com



More information about the barebox mailing list