[U-Boot-Users] JFFS2 images on NAND flash

Matthias Fuchs matthias.fuchs at esd-electronics.com
Tue Apr 17 15:10:20 CEST 2007


Hi,

is anybody using U-Boot's NAND subsystem to write jffs2 images to NAND flash?
It seems that images written by U-Boot are not compatible to what Linux 
expects.

This is what I did:

1) I created the jffs2 image using mkfs.jffs2 from ELDK 4.1:
mkfs.jffs2 -n -b -p -s 2048 -e 0x20000 -d test -o /tftpboot/du440/test.img

2a) Flashing and mounting under Linux is fine:
du440:~# flash_eraseall /dev/mtd4
du440:~# nandwrite /dev/mtd4 test_jffs2.img
du440:~# mount /nand0


2b) Flashing with U-Boot:

U-Boot 1.2.0-gfdd1d6dc-dirty (Apr 17 2007 - 14:39:52)

CPU:   AMCC PowerPC 440EPx Rev. A at 533.333 MHz (PLB=133, OPB=66, EBC=66 MHz)
       Security/Kasumi support
       I2C boot EEPROM disabled
       Bootstrap Option C - Boot ROM Location EBC (16 bits)
       Internal PCI arbiter enabled, PCI async ext clock used
       32 kB I-Cache 32 kB D-Cache
Board: DU440, serial# AA0004, HW-Rev. 1.0, CPLD-Rev. 1.1
I2C:   ready
DTT:   1 is 36 C
DTT:   2 is 49 C
DRAM:  Slot 0 populated with DDR2 DIMM Ref. Buffalo D2N533B - Component: 
unknown
       1024 MB
FLASH:  4 MB
NAND:  512 MiB
PCI:   Bus Dev VenId DevId Class Int
        00  0c  126f  0720  0300  00
In:    serial
Out:   serial
Err:   serial
USB:   Host(int phy)
Net:   ppc_4xx_eth0
USBhub: ERROR: writing to register 0x00 failed
Hit any key to stop autoboot:  0
=> nand info

Device 0: NAND 256MiB 3,3V 8-bit, sector size 128 KiB
Device 1: NAND 256MiB 3,3V 8-bit, sector size 128 KiB
=> nand erase clean

NAND erase: device 0 whole chip
Skipping bad block at  0x00000000
Skipping bad block at  0x00040000
Skipping bad block at  0x00120000
Skipping bad block at  0x08160000
Skipping bad block at  0x0f740000
Erasing at 0xffe0000 -- 100% complete. Cleanmarker written at 0xffe0000.
OK
=> tftp 200000 /tftpboot/du440/target_root_du440/test_jffs2.img
...
Bytes transferred = 2490368 (260000 hex)
=> nand write.jffs2 200000 0 $(filesize)

NAND write: device 0 offset 0x0, size 0x260000

Bad block at 0x0 in erase block from 0x0 will be skipped
Bad block at 0x40000 in erase block from 0x40000 will be skipped
Bad block at 0x120000 in erase block from 0x120000 will be skipped
Writing data at 0x2bf800 -- 100% complete.
 2490368 bytes written: OK
=> boot                                 
...
du440:~# mount -t jffs2 /dev/mtdblock4 /nand0
mtd->read(0x400 bytes from 0x20000) returned ECC error
mtd->read(0x1fc3c bytes from 0x203c4) returned ECC error
mtd->read(0x400 bytes from 0x60000) returned ECC error
mtd->read(0x1f8cc bytes from 0x60734) returned ECC error
mtd->read(0x400 bytes from 0x80000) returned ECC error
mtd->read(0x1f954 bytes from 0x806ac) returned ECC error
...

some more information:
-mkfs.jffs2 comes from the ELDK 4.1 distribution
-U-Boot is updated to current git repository
-Linux kernel is synced to Denx Linux kernel git repository
-U-Boot port for this board will be commited when current issues are solved.

I also noticed that the NAND+JFFS2 code has never been tested on large block 
NANDs. jffs2_1pass.c definetly looks like small block NAND only:

#define NAND_PAGE_SIZE 512
#define NAND_PAGE_SHIFT 9


Any ideas?

Matthias




More information about the U-Boot mailing list