How to boot from NAND Flash on the Logic i.MX31 Lite

The Logic i.MX31 Lite boot loader, LogicLoader, does not support JFFS2 and its YAFFS implementation has a different ECC algorithm than the one used in mainline YAFFS. Hence, we use LogicLoader to burn the kernel to a YAFFS partition and we use Linux to burn the JFFS2 RFS.

Requirements

These instructions have only been tested against:

  • 2.6.24 Kernel
  • Logic Loader Version 2.4.0p1-IMX31_10 0001

You must also setup your host with tftp, nfs, and dhcp as per the Getting Started Guide. '$kernel_byte_size' should be replaced with the size of your kernel image in bytes.

Linux MTD partitions

NOR flash partitions

0x00000000-0x00080000 : "Bootloader"
0x00080000-0x00200000 : "Kernel"

NAND flash partitions

0x00000000-0x00200000 : "nand.kernel"
0x00200000-0x04000000 : "nand.rootfs"
0x00000000-0x04000000 : "<NULL>"
0x00000000-0x04000000 : "<NULL>"

Burning the Kernel to NAND Flash

Erase the NAND partitions

losh> erase /dev/nand0 B0 B4096

Create Kernel partition

losh> part-add /dev/nand0 a 0 124      

Copy kernel to boot partition

losh> mount yaffs /dev/nand0a /boot
losh> ifconfig sm0 dhcp
losh> cp /tftp/10.0.0.2:zImage-2.6.24-ts-armv6l /boot/zImage

Load the kernel and boot to NFS RFS

losh> load raw 0x81000000 $kernel_byte_size /boot/zImage
losh> exec -t -i 1236

Burning the RFS to NAND Flash

Copy your jffs2 image to the rfs directory on your host and burn it to flash on the target.

# flash_eraseall /dev/mtd3
# flashcp $jffs_image /dev/mtd3

Reboot the board and configure LogicLoader to load and boot the kernel.

Configure LogicLoader to autoboot the kernel

Create the LogicLoader config block.

losh> config CREATE                                                             
creating new config: offset: 0x0 pos: 0                                         
total size: 0x10000, address 0x40000                                            
Nor flash erase: The area (or parts of it) 0x40000 - 0x10000 is locked.         

************** WARNING!! ********************                                   

You are about to erase the config block.                                        
Do you wish to continue? (y/n)                                                  
erasing flash:  100%                                                            
burning flash:  100%                                                            
 dev_config burn good (65536 bytes)                                             

Write the boot script to the config block.

losh> echo "LOLOifconfig sm0 dhcp; part-add /dev/nand0 a 0 124; mount yaffs /dev/nand0a /boot; load raw 0x81000000 $kernel_byte_size /boot/zImage; exec -t -i 1236 \"noinitrd console=tty0 console=ttymxc0,115200 root=/dev/mtdblock3 rootfstype=jffs2 rw ip=dhcp\"" /dev/config

Reset the board and it should automatically boot into Linux