Project

General

Profile

Booting from Nand

Added by Jonathan Cormier about 10 years ago

Moving post for Bindu. Reference https://support.criticallink.com/redmine/boards/28/topics/1437?r=3602#message-3602

Hello,

Has there been any progress on this? I followed the instructions on this page: https://support.criticallink.com/redmine/projects/armc8-platforms/wiki/UBIFS_Nand_Boot and flashed NAND from Linux. Then I set the appropriate config pins and the boot sequence gets stuck as shown below.

U-Boot SPL 2013.01.01 (Jul 23 2013 - 09:59:03)
MityARM335x profile 1 - Model No: 3354-GX-X38-RC Serial No: 133869
Configuring for 512 MB DDR3 @ 303MHz
som.c:470 config_am335x_ddr3 RAM size = 536870912
ECC Mode = 2 lo = 56/0
nand_spl_load_image: loading 2048 bytes from 80000 to 80800000
skipping bad block 4...
skipping bad block 5...
nand_spl_load_image: loading 204800 bytes from 80000 to 80800000
skipping bad block 4...
skipping bad block 5...

I think it is related to the first post on this thread, so I am reviving this thread. Please help!


Replies (18)

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

Hi Bindu. Can you confirm that you are using a mlo and uboot that was built with the following config 'mityarm335x_4kpage'. Instructions are here: https://support.criticallink.com/redmine/projects/armc8-platforms/wiki/Das_U-Boot_Port#Building-u-Boot

Both the SD card MLO/u-boot and the one you flash should be this version. And you should be using the latest 3.2 kernel to flash it. If you did not get an sd card with the 3.2 kernel on it we have released a new version of the sd card which can be downloaded here: https://support.criticallink.com/redmine/projects/am335x-devkit/files. You'd want the MityARM-335X_dev_SD_512MB_Nand.zip version.

Note: A precompiled u-boot and mlo with 512MB nand support is available at the bottom of that wiki page.

It would also be helpful to see the logs from when you flashed the nand from linux.

RE: Booting from Nand - Added by Bindu Jagannatha about 10 years ago

Jonathan,

Thank you for moving this over. Kernel version on the board is 3.2.0+. I used the MLO and uBoot file from the SD card provided with the MityARM 335x dev kit. The sizes of these files from the SD card and the link you provided look to be slightly different, so I'll try them now. What is the difference between them?

Here is the what happened when I flashed NAND from Linux on the board:

root@mityarm-335x:/media/mmcblk0p1# flash_erase /dev/mtd1 0 0
Erasing 256 Kibyte 0 -- 100 % complete
root@mityarm-335x:/media/mmcblk0p1# nandwrite -p /dev/mtd1 MLO
Writing data to block 0 at offset 0x0
root@mityarm-335x:/media/mmcblk0p1# flash_erase /dev/mtd2 0 0
Erasing 256 Kibyte
0 -- 100 % complete
root@mityarm-335x:/media/mmcblk0p1# nandwrite p /dev/mtd2 MLO
Writing data to block 0 at offset 0x0
root@mityarm-335x:/media/mmcblk0p1# flash_erase /dev/mtd3 0 0
Erasing 256 Kibyte 0 -- 100 % complete
root@mityarm-335x:/media/mmcblk0p1# nandwrite -p /dev/mtd3 MLO
Writing data to block 0 at offset 0x0
root@mityarm-335x:/media/mmcblk0p1# flash_erase /dev/mtd4 0 0
Erasing 256 Kibyte
0 -
100 % complete
root@mityarm-335x:/media/mmcblk0p1# nandwrite p /dev/mtd4 MLO
Writing data to block 0 at offset 0x0
root@mityarm-335x:/media/mmcblk0p1# flash_erase /dev/mtd5 0 0
Erasing 256 Kibyte 1c0000 -- 100 % complete
root@mityarm-335x:/media/mmcblk0p1# nandwrite -p /dev/mtd5 u-boot.img
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x40000
root@mityarm-335x:/media/mmcblk0p1# flash_erase /dev/mtd7 0 0
Erasing 256 Kibyte
400000 -
80 % complete flash_erase: Skipping bad block at 00440000
Erasing 256 Kibyte @ 4c0000 -- 100 % complete
root@mityarm-335x:/media/mmcblk0p1# nandwrite -p /dev/mtd7 uImage
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x40000
Writing data to block 2 at offset 0x80000
Writing data to block 3 at offset 0xc0000
Writing data to block 4 at offset 0x100000
Writing data to block 5 at offset 0x140000
Writing data to block 6 at offset 0x180000
Writing data to block 7 at offset 0x1c0000
Writing data to block 8 at offset 0x200000
Writing data to block 9 at offset 0x240000
Writing data to block 10 at offset 0x280000
Writing data to block 11 at offset 0x2c0000
Writing data to block 12 at offset 0x300000
Writing data to block 13 at offset 0x340000
root@mityarm-335x:/media/mmcblk0p1#

I ignored flashing the filesystem, since I intend to use NFS (which has been successful with the SD card boot mode).

Thanks,
Bindu

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

Can you edit your post and put the output inside pre tags. You can highlight text and hit the pre button above text box.

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

Your flashing steps look fine. Let me know if anything changes with the new files.

The new sd card image has the latest kernel and u-boot. There were several bug fixes for nand. If you look at the boot/versions.txt file it contains the git hashes for the kernel and u-boot images included. And you can look on the git site to see the commits that were made. http://support.criticallink.com/gitweb/

RE: Booting from Nand - Added by Bindu Jagannatha about 10 years ago

Sorry about the formatting on that last post! Yeah turns out using the new files works! The files that come on the SD card are probably not meant for NAND boot.

However, NFS filesystem mount is not working with NAND boot. Is there a special way to do this? Below are my u-boot environment variables:

arch=arm
baudrate=115200
board=mityarm335x
board_name=mityarm335x
bootargs=console=ttyO0,115200n8 video=da8xx:bpp=16 noinitrd root=/dev/nfs rootwait nfsroot=${serverip}:${rootpath},nolock rw ip=dhcp
bootcmd=run config_dvi; run nand_boot
bootdelay=3
bootfile=uImage
config_dvi=i2c dev 1;i2c mw 38 8 3d; i2c mw 38 33 0
console=ttyO0,115200n8
cpu=armv7
ethact=cpsw
ethaddr=78:c5:e5:bc:50:3f
ipaddr=192.17.52.100
kloadaddr=0x80007fc0
loadaddr=0x82000000
nand_boot=echo Booting from nand ...; 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,2048
nand_root_fs_type=ubifs rootwait=1
nand_src_addr=0x340000
nfsopts=nolock
rootpath=/home/mitydsp/nfs/targetNFS/
script_addr=0x81900000
serverip=192.17.52.249
soc=am33xx
stderr=serial
stdin=serial
stdout=serial
vendor=cl
ver=U-Boot 2013.10-g6c6a700 (Nov 20 2013 - 17:01:23)

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

Bindu,

I can't see anything wrong with your environment. Are you able to boot nfs while loading off the sd card with the new files?

RE: Booting from Nand - Added by Bindu Jagannatha about 10 years ago

Jonathan,

Yes, we were able to mount the NFS root filesystem while booting from the SD card using the new MLO and u-boot files. In fact, we were also able to boot from NAND while mounting the filesystem from the SD card; its just the NFS mount that we are unable to do while booting from NAND. This was where booting stopped when NAND booting using NFS filesystem:

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
[    7.433563] Backtrace: 
[    7.436035] [<c0017ab8>] (dump_backtrace+0x0/0x110) from [<c04be194>] (dump_stack+0x18/0x1c)
[    7.444488]  r6:df928000 r5:c075e584 r4:c0803320 r3:c078e810
[    7.450195] [<c04be17c>] (dump_stack+0x0/0x1c) from [<c04be204>] (panic+0x6c/0x1a0)
[    7.457885] [<c04be198>] (panic+0x0/0x1a0) from [<c072dcb4>] (mount_block_root+0x184/0x228)
[    7.466247]  r3:c078e810 r2:00000000 r1:df82bf58 r0:c0675b80
[    7.471923]  r7:00008000
[    7.474487] [<c072db30>] (mount_block_root+0x0/0x228) from [<c072df1c>] (mount_root+0xd8/0xe0)
[    7.483093] [<c072de44>] (mount_root+0x0/0xe0) from [<c072e0bc>] (prepare_namespace+0x198/0x1d4)
[    7.491912]  r4:c08023a0
[    7.494445] [<c072df24>] (prepare_namespace+0x0/0x1d4) from [<c072d90c>] (kernel_init+0x124/0x130)
[    7.503417]  r5:c076b6f8 r4:c076b6f8
[    7.507049] [<c072d7e8>] (kernel_init+0x0/0x130) from [<c0043b08>] (do_exit+0x0/0x67c)
[    7.514953]  r5:c072d7e8 r4:00000000

Bindu

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

Can you attach the full bootlog in a text file? That error is standard for kernel couldn't find root filesystem.

RE: Booting from Nand - Added by Bindu Jagannatha about 10 years ago

Hi Jonathan,

So the NFS mount on NAND boot magically started working. I don't think I changed anything. Either way, I am still having a problem: NAND boot mount NFS filesystem ONLY when SD card is still inserted in its slot, else it fails after loading the kernel. Attached are the files with both boot logs.

Also it says bad block in NAND early on, what does that mean? How can I correct it? Do I need to correct it?

Thanks,
Bindu

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

Thanks for the logs. I don't have time to look at them today so I'll try to check them out on Monday.

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

I removed the timestamps and did a diff between the two logs and they don't show much difference.

log.diff (4.35 KB) log.diff

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

I would try to look to see if your nfs filesystem is trying to mount the sd card and thus causing it to hang.

Your bad boot log doesn't show the same "Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)" line as before which indicates to me that the kernel is able to mount it and that the problem may be with the filesystem itself.

I would put some debug statements at the top of some of the /etc/init.d scripts to see if one of them is being run but never completing.

RE: Booting from Nand - Added by Bindu Jagannatha about 10 years ago

Hey Jonathan,

I tried putting a few echo statement in some of the /etc/init.d scripts, but no luck. The boot is stuck at the following line, which I don't see when I am booting from NAND, mounting NFS but with the SD card in its slot:

[   12.185302] alignment: ignoring faults is unsafe on this CPU.  Defaulting to fixup mode.

I don't know what could be wrong with the NFS filesystem -- its the exact copy of the one in the SD card that came with the dev kit.

Also, the rootfs is too big for our applications (I can't put it on the NAND). Do you know how I can get a smaller rootfs?

Thank you,
Bindu

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

Looking at the diff I posted the alignment prints out in both cases. This is a normal boot printout.

From your bad log I can see the line that starts with "pvrsrvkm". I'm fairly sure this gets printed by the /etc/init.d/rc.pvr script.

If you look in the /etc/inittab file, you should see that the /etc/init.d/rcS file gets run first followed by "/etc/init.d/rc 5" for runlevel 5. Also after looking at the /etc/init.d/rc file looks like you can enable verbose output in /etc/default/rcS by changing VERBOSE to very.

Did you make sure to copy the filesystem as root to make sure the /dev/ files got created correctly?

As stated in the root filesystem wiki page Timesys is our recommended approach for creating custom filesystems. You will be able to pick which tools you want and it will build you the filesystem.

RE: Booting from Nand - Added by Bindu Jagannatha about 10 years ago

Hello again,

Thank you for your help so far; I have been making progress, but still stuck on the NAND boot. After booting the kernel and mounting the NFS filesystem, here is where is gets stuck:

INIT: version 2.86 booting
Please wait: booting...
Starting udev
[    7.118896] udevd (814): /proc/814/oom_adj is deprecated, please use /proc/814/oom_score_adj instead.
[   11.771240] alignment: ignoring faults is unsafe on this CPU.  Defaulting to fixup mode.
Root filesystem already rw, not remounting
Caching udev devnodes
ALSA: Restoring mixer settings...
NOT configuring network interfaces: / is an NFS mount
Starting portmap daemon: portmap.
Sat Dec 24 12:43:00 UTC 2011
INIT: Entering runlevel: 5
Starting system message bus: dbus.
Starting Hardware abstraction layer hald
Starting Dropbear SSH server: dropbear.
Starting telnet daemon.
Starting network benchmark server: netserver.
creating NFS state directory: done
starting 8 nfsd kernel threads: done
starting mountd: done
starting statd: done
Starting syslogd/klogd: done
Starting thttpd.
Starting PVR
[   14.540527] pvrsrvkm: disagrees about version of symbol module_layout
insmod: error inserting '/lib/modules/3.1.0/kernel/drivers/gpu/pvr/pvrsrvkm.ko': -1 Invalid module format
FATAL: Module omaplfb not found.
FATAL: Module bufferclass_ti not found.
BusyBox v1.13.2 (2011-12-15 15:46:39 CST) multi-call binary

Usage: mknod [OPTIONS] NAME TYPE MAJOR MINOR

Create a special file (block, character, or pipe)

Options:
        -m      Create the special file using the specified mode (default a=rw)
TYPEs include:
        b:      Make a block device
        c or u: Make a character device
        p:      Make a named pipe (MAJOR and MINOR are ignored)

chmod: /dev/pvrsrvkm: No such file or directory
[   14.658325] Unhandled fault: external abort on non-linefetch (0x1018) at 0x4011e014
Bus error
Starting Lighttpd Web Server: lighttpd.
2011-12-24 12:43:02: (log.c.166) server started 
Calibrating touchscreen (first time only)xres = 1024, yres = 768

What can I do to fix this?

Bindu

RE: Booting from Nand - Added by Jonathan Cormier about 10 years ago

Excellent this is a known issue. On boot the filesystem will try to calibrate the touch screen if its calibration file is missing. This is impossible to do if you don't actually have a touchscreen. Its looking for a pointercal in the boot partition of the sd card which isn't there.

If you don't need the matrix gui demo, and you probably don't the easiest solution would be to remove it from startup. On the filesystem do the following:

rm -v etc/rc*.d/*matrix-gui*

The -v option will print out the files its deleting so we can be sure the command is working. This will delete the symlink to the matrix-gui from each of the startup levels.

You can also remove the rc.pvr startup script if you aren't using the 3d accelerator as your kernel modules aren't even loading:

Starting PVR
[   14.540527] pvrsrvkm: disagrees about version of symbol module_layout
insmod: error inserting '/lib/modules/3.1.0/kernel/drivers/gpu/pvr/pvrsrvkm.ko': -1 Invalid module format
FATAL: Module omaplfb not found.
FATAL: Module bufferclass_ti not found.
BusyBox v1.13.2 (2011-12-15 15:46:39 CST) multi-call binary

Usage: mknod [OPTIONS] NAME TYPE MAJOR MINOR

Create a special file (block, character, or pipe)

Options:
        -m      Create the special file using the specified mode (default a=rw)
TYPEs include:
        b:      Make a block device
        c or u: Make a character device
        p:      Make a named pipe (MAJOR and MINOR are ignored)

chmod: /dev/pvrsrvkm: No such file or directory

RE: Booting from Nand - Added by Bindu Jagannatha almost 10 years ago

Jonathan, thank you for all the information. We put his task on the back burner for a while -- but it works perfectly fine now. But I am curious about something:

The NAND flash chip on the module we have is the MT29F4G08ABAEA WP, which the Micron website claims is 4GB. But the MitySOM 335x datasheet says that the NAND flash is only upto 1GB. Our boot log says its 512 MB, but the datasheet for the part says something different. Why is this?

Using fdsik / df also lists only 512MB. What happened to the rest of the space? We would really like to have upto 4GB ideally for our applications.

Bindu

RE: Booting from Nand - Added by Jonathan Cormier almost 10 years ago

Bindu,

The datasheet says the part is 4Gb which divided by 8 is 512MB. We don't have any parts that carry a nand over 1GB, if a customer needs more storage in the past they have used mmc (upto 32GB) or a network filesystem like nfs. You could also look into emmc which is essentially a surface mounted mmc but we haven't had any projects use this so support would be minimal.

Let me know if you have any more questions.

Jonathan

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