HOWTO Boot from NAND Flash on the Logic PD OMAP35x Torpedo
Summary
This document describes the procedure for putting all boot images into NAND flash, and booting the board without NFS or TFTP.
Prerequisites
- Board populated with LogicLoader
- Images
- U-Boot elf file
- Kernel uImage
- JFFS2 RFS file
- If using the kernel to write the filesystem, you must have one of the following in your NFS RFS:
- mtd-utils
- Busybox, with flash_eraseall and nandwrite built in
Procedure
In LogicLoader:
- Determine where the boot partition ends. This is done by checking the extent of the boot partitions (NoLo and /lboot). In the following example, they run from block 0 to 17.
losh> info mem Configuration of /dev/nand0: Total Blocks: 2048 Bytes Per Block: 135168 Has Chunks: yes Total Chunks: 131072 Chunks Per Block: 64 Bytes Per Chunk: 2112 Bytes Per Spare: 64 NoLo Partition: Block 0 /lboot Partition: Blocks 1 -> 18
NOTE It's possible that this partition is not defined. In that case, you can assume blocks 0 to 17. - Erase the rest of NAND flash. The second parameter is the starting block. The third parameter is the size (in blocks). You may need to confirm the erase procedure.
losh> erase /dev/nand0 B18 B2030
- Initialize the configuration
losh> config CREATE
- Check the partition table.
losh> info part /dev/nand0 Partition Mounted Type ECC Method Name Start Length --------- ------- ---- ------------- ---- -------- -------- a: Y 6c hamming a 1 17 b: Y 6c hamming b 18 16 c: N 00 ----------- Empty ----------- d: N 00 ----------- Empty -----------
- If any partition exists outside of the first, remove them.
losh> unmount /dev/nand0b losh> part-rem /dev/nand0 b
- If any partition exists outside of the first, remove them.
- Create a partition for U-Boot and the kernel. We are using the kernel's /dev/mtd2 partition.
losh> part-add /dev/nand0 b 18 100
- Create yaffs filesystem
losh> mount yaffs /dev/nand0b /boot
- Load u-boot.bin into NAND
- Configure the interface. The following example uses DHCP:
losh> ifconfig sm0 dhcp
- Load the file over TFTP and load into the partition
losh> cp /tftp/10.0.0.1:u-boot /boot/u-boot
- Configure the interface. The following example uses DHCP:
- Load the Kernel into NAND
cp /tftp/10.0.0.1:/uImage-2.6.32-ts-armv7l /boot/uImage
- Set board to boot U-Boot by default. kernel_size should be the size of the kernel image, in bytes. Note that the part-add parameters should match those that you used previously.
losh> kernel_size=2532488 losh> echo "LOLOvideo-open 15 16; part-add /dev/nand0 b 18 100; mount yaffs /dev/nand0b /boot; load raw 0x81000000 $kernel_size /boot/uImage; load elf /boot/u-boot; exec -" /dev/config
- Reset the board. It should now boot into U-Boot.
In U-Boot:
- Configure the network. You can use bootp, or configure the following environment variables manually:
=> setenv serverip <server ip> => setenv ipaddr <target ip>
- Copy the image over TFTP
=> tftp $loadaddr rootfs.jffs2
- Erase the partition for the RFS. We are using the kernel's /dev/mtd3 partition
nand erase ec0000 f100000
- Write flash image to NAND flash. Note the image size from the previous load.
nand write $loadaddr ec0000 <image size>
- Set environment variables to boot from NAND
=> setenv bootcmd bootm => setenv bootargs console=ttyS0,115200 root=/dev/mtdblock3 rw rootfstype=jffs2
*NOTE: In older revisions of the hardware, the ECC scheme differs between the kernel and U-Boot. Therefore, you must write the image from the kernel. See HOWTO Boot from NAND Flash on the Logic PD OMAP35x Torpedo for more information.
Additional Resources
Linux MTD Partitions
The offsets are from the beginning of NAND flash. The values in parentheses are the same values, expressed in number of blocks.
2.6.32
Partition Name | Offset (Block) | Size (Block) | Description |
---|---|---|---|
mtd0 | 0x00000000 (0) | 0x00020000 (1) | NoLo-NAND |
mtd1 | 0x00020000 (1) | 0x00220000 (17) | Lboot-NAND |
mtd2 | 0x00240000 (18) | 0x00c80000 (100) | NAND fs #1 (Used for U-Boot and Kernel) |
mtd3 | 0x00EC0000 (118) | 0x0f100000 (1928) | NAND fs #2 |
mtd4 | 0x0FFC0000 (2046) | 0x00040000 (2) | u-boot Env-NAND |
Writing the RFS from Linux
On some revisions of the software, U-Boot and Linux disagree about the ECC format of the NAND flash. In this case, you need to use the kernel to write the JFFS2 image. The following instructions describe this process.
- Boot the board using an NFS-based file system, as described in the getting started guide.
- Place the rootfs.jffs2 image into the RFS directory on the host machine.
- On the target, on the command line, run the following commands:
- Erase the NAND partition for the RFS:
$ flash_eraseall /dev/mtd3
- Write the JFFS2 image to flash:
$ nandwrite /dev/mtd3 rootfs.jffs2
- Erase the NAND partition for the RFS:
- Reboot the board.
NAND Information
See: HOWTO Find NAND Parameters