Project

General

Profile

booting 3359 from NAND only

Added by Keith Fletcher almost 11 years ago

Hi,
I have been trying to get my 3359 system up and running from NAND, using a combination of Critical Link and TI info, and I am having a few issues.
I can run u-boot and the kernel (with a few hundred "ECC: uncorrectable." errors) from NAND, but fail when the ubifs trys to mount.

With mtd-utils v 1.5.0-1_i386.deb I create the ubifs as follows, using one of the minimal fs from the CL downloads:

creating ubifs.img...
mkfs.ubifs -v -r filesystem/ -F -o ubifs.img -m 2KiB -e 124KiB -c 1580
mkfs.ubifs
root: filesystem/
min_io_size: 2048
leb_size: 126976
max_leb_cnt: 1580
output: ubifs.img
jrn_size: 8388608
reserved: 0
compr: lzo
keyhash: r5
fanout: 8
orph_lebs: 1
space_fixup: 1
super lebs: 1
master lebs: 2
log_lebs: 5
lpt_lebs: 2
orph_lebs: 1
main_lebs: 187
gc lebs: 1
index lebs: 5
leb_cnt: 198
UUID: 8C217E2C-98CA-4566-BEB5-634C5BDCAFFD
Success!
creating ubi.img...
ubinize.cfg:
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=192MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

ubinize -v -o ubi.img -m 2048 -p 128KiB -s 512 -O 512 ubinize.cfg
ubinize: LEB size: 129024
ubinize: PEB size: 131072
ubinize: min. I/O size: 2048
ubinize: sub-page size: 512
ubinize: VID offset: 512
ubinize: data offset: 2048
ubinize: UBI image sequence number: 1533214739
ubinize: loaded the ini-file "ubinize.cfg"
ubinize: count of sections: 1

ubinize: parsing section "ubifs"
ubinize: mode=ubi, keep parsing
ubinize: volume type: dynamic
ubinize: volume ID: 0
ubinize: volume size: 201326592 bytes
ubinize: volume name: rootfs
ubinize: volume alignment: 1
ubinize: autoresize flags found
ubinize: adding volume 0
ubinize: writing volume 0
ubinize: image file: ubifs.img

ubinize: writing layout volume
ubinize: done

I then load the fs into NAND as follows:

U-Boot# mw.b 0x82000000 0xff 0x8ff0000
U-Boot# tftp 0x82000000 ubi.img
failed to read bmcr on phy id 2
Vitesse VSC8601 PHY detected at addr 1
Auto negotiation took 3240 ms
link up on port 1, speed 1000, full duplex
Using cpsw device
TFTP from server 192.168.65.140; our IP address is 192.168.65.231
Filename 'ubi.img'.
Load address: 0x82000000
Loading: ################################################################# ################################################################# #################################################################
etc.. #######################################
done
Bytes transferred = 25821184 (18a0000 hex)
U-Boot# nand erase 0x780000 0x18a0000

NAND erase: device 0 offset 0x780000, size 0x8ff0000
Erasing at 0x9760000 -- 100% complete.
OK
U-Boot# nand write 0x82000000 0x780000 0x18a0000

NAND write: device 0 offset 0x780000, size 0x18a0000
25821184 bytes written: OK

My Environment variables are:

U-Boot# printenv
autoload=no
baudrate=115200
bootargs_defaults=setenv bootargs console=${console} ${optargs}
bootcmd=if mmc rescan; then echo SD/MMC found on device ${mmc_dev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run mmc_load_uimage; then run mmc_args;bootm ${kloadaddr};fi;fi;run nand_boot;
bootdelay=3
bootenv=uenv.txt
bootfile=uImage
console=ttyO0,115200n8
ethact=cpsw
ethaddr=d4:94:a1:93:58:a6
fileaddr=82000000
filesize=18A0000
importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $filesize
ip_method=none
ipaddr=192.168.65.231
kloadaddr=0x80007fc0
loadaddr=0x82000000
loadbootenv=fatload mmc ${mmc_dev} ${loadaddr} ${bootenv}
mmc_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${mmc_root} rootfstype=${mmc_root_fs_type} ip=${ip_method}
mmc_boot=run mmc_args; run mmc_load_uimage; bootm ${kloadaddr}
mmc_dev=0
mmc_load_uimage=fatload mmc ${mmc_dev} ${kloadaddr} ${bootfile}
mmc_root=/dev/mmcblk0p2 rw
mmc_root_fs_type=ext3 rootwait
nand_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${nand_root} noinitrd rootfstype=${nand_root_fs_type} ip=${ip_method}
nand_boot=echo Booting from nand ...; run nand_args; nandecc hw 2; nand read.i ${kloadaddr} ${nand_src_addr} ${nand_img_siz}; bootm ${kloadaddr}
nand_img_siz=0x500000
nand_root=ubi0:rootfs rw ubi.mtd=7,512
nand_root_fs_type=ubifs rootwait=1
nand_src_addr=0x00280000
net_args=run bootargs_defaults;setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
net_boot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${kloadaddr} ${bootfile}; run net_args; bootm ${kloadaddr}
nfsopts=nolock
rootpath=/export/rootfs
script_addr=0x81900000
serverip=192.168.65.140
static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
stderr=serial
stdin=serial
stdout=serial

The boot goes like this:

Environment size: 2016/65532 bytes
U-Boot# run nand_boot
Booting from nand ...
Booting from nand ...
HW ECC BCH8 Selected

NAND read: device 0 offset 0x280000, size 0x500000
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.

  • lots
ECC: uncorrectable.
ECC: uncorrectable.
NAND read from offset 280000 failed -74
0 bytes read: ERROR
  1. Booting kernel from Legacy Image at 80007fc0 ...
    Image Name: Linux-3.2.0
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 3635464 Bytes = 3.5 MiB
    Load Address: 80008000
    Entry Point: 80008000
    Verifying Checksum ... OK
    XIP Kernel Image ... OK
    OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[ 0.000000] Linux version 3.2.0 (mitydsp@mitydsp-dev) (gcc version 4.5.3 20110311 (prerelease) (GCC) ) #1 Mon Jun 10 00:38:51 EDT 2013
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7d

which goes pretty normally until the NAND section:

[ 1.112243] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08ABAEAWP)
[ 1.120513] Creating 8 MTD partitions on "omap2-nand.0":
[ 1.126007] 0x000000000000-0x000000020000 : "SPL"
[ 1.132263] 0x000000020000-0x000000040000 : "SPL.backup1"
[ 1.139099] 0x000000040000-0x000000060000 : "SPL.backup2"
[ 1.145935] 0x000000060000-0x000000080000 : "SPL.backup3"
[ 1.152801] 0x000000080000-0x000000260000 : "U-Boot"
[ 1.159881] 0x000000260000-0x000000280000 : "U-Boot Env"
[ 1.166717] 0x000000280000-0x000000780000 : "Kernel"
[ 1.175170] 0x000000780000-0x000010000000 : "File System"
[ 1.284118] OneNAND driver initializing
[ 1.288818] UBI: attaching mtd7 to ubi0
[ 1.292816] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 1.299285] UBI: logical eraseblock size: 129024 bytes
[ 1.304840] UBI: smallest flash I/O unit: 2048
[ 1.309692] UBI: sub-page size: 512
[ 1.314453] UBI: VID header offset: 512 (aligned 512)
[ 1.320465] UBI: data offset: 2048
[ 1.328369] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 0:0, read 64 bytes
[ 1.341308] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 0:512, read 512 bytes
[ 1.354675] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 1:0, read 64 bytes
[ 1.367614] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 1:512, read 512 bytes
[ 1.380920] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 2:0, read 64 bytes
[ 1.393890] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 2:512, read 512 bytes
[ 1.407226] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 3:0, read 64 bytes
[ 1.420166] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 3:512, read 512 bytes
[ 1.433502] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 4:0, read 64 bytes

[ 2.053985] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 27:512, read 512 bytes
[ 2.071166] UBI error: check_what_we_have: MTD device is not UBI-formatted and possibly contains non-UBI data - refusing it
[ 2.082641] slab error in kmem_cache_destroy(): cache `ubi_scan_leb_slab': Can't free all objects
[ 2.091796] Backtrace:
[ 2.094360] [<c0017ab8>] (dump_backtrace+0x0/0x110) from [<c04bdde0>] (dump_stack+0x18/0x1c)

Any insight as to where my problem could be would be greatly appreciated,

Keith Fletcher.


Replies (6)

RE: booting 3359 from NAND only - Added by Keith Fletcher almost 11 years ago

The hundreds of "ECC: uncorrectable." messages were due to "nandecc hw 2" line in my environment variables. I discoverd that "nandecc hw 2" disables the nandecc, but replacing with nandecc hw2 seems to help.

Still no progress with the filesystem though.

RE: booting 3359 from NAND only - Added by Tim Iskander almost 11 years ago

Keith
Make sure that the ECC mode is consistent between u-boot (where you are flashing the ubifs) and the kernel. Alternatively, you could flash the ubifs image from linux (boot from mmc and then flash).
You might also want to change your subpagesize to 2048 (page size) with -s 2048 -O 2048.
See http://processors.wiki.ti.com/index.php/UBIFS_Support and http://e2e.ti.com/support/embedded/linux/f/354/t/242691.aspx

cheers
/Tim

RE: booting 3359 from NAND only - Added by Keith Fletcher almost 11 years ago

Hi Tim,
Thanks for the quick reply. When you say keep the EEC mode consistent between the u-boot and the kernel is this just the EEC mode used when they were written to NAND, or something more sinister such as something in the way they were compiled?

Also if I use the -s 2048 -O 2046 options with ubinize how do I tell the kernel to expect the same: when the kernel attempts to initialise the NAND driver it still using a sub-page size of 512

Cheers.
Keith.

RE: booting 3359 from NAND only - Added by Keith Fletcher almost 11 years ago

Hi Tim,
I have just been looking at flashing from the mmc, however, I have managed to confuse myself even more!
From the linux running on the SD card if I use "mtdinfo -au" it tells me that the file system is in mtd8, not mtd7 (there is an extra partition mtd0, for NOR).
It may be that I have a really old SD card, so I will download the latest and try again.

Who determines the NAND partitions and where are they stored. I have been using the memory map in the AM335x U-Boot User's Guide. does each of the seperate systems (MLO, u-boot.img, kernel and filesystem) all keep their own version of how it expects the NAND to be partitioned?
Is the NAND actually partitioned, or is there just this table of addresses and where things should go?

Cheers for any help

Keith.

RE: booting 3359 from NAND only - Added by Michael Williamson almost 11 years ago

Hi Keith,

I don't think the NAND is actually physically partitioned. It's more of a "table" as you say.

The Kernel will use a default partitioning as coded in the arch/arm/mach-davinci/board-mityarm335x.c file. However, you can compile the kernel with the mtdparts option, which will allow you to pass an alternate partitioning of the MTD devices via the command line arguments to the kernel.

-Mike

RE: booting 3359 from NAND only - Added by Tim Iskander almost 11 years ago

I'll add to what Mike said a wee bit.
You can use the mtdparts u-boot command to display (and set) mtdparts in u-boot [ see http://www.denx.de/wiki/view/DULG/UBootCmdGroupFlash#Section_5.9.3.5. ]
These should line up with the linux verison of the mtdparts by default.

cheers
/Tim

    (1-6/6)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)