Booting the kernel from NAND
This example shows how to set up the Embedded Artists 3250 board for booting Linux from NAND FLASH. To help in setting up kernel boot, some pre-setup macro commands are already available on the board.
Note that although this example is performed on the EA3250 board, the procedure is the same for all boards.
Prerequisites ↑
Before continuing with this example, make sure the board has the latest version of the kickstart and
S1L? boot loaders installed. Go to the
LPC32x0BoardEA3250bootloadersrestore page for information on how to update your boot loaders.
The procedure also assumes you are using the latest u-boot and kernel patches used to build the u-boot boot loader and kernel image. Get the latest patches form the downloads page via the Download tab.
This procedure also assume the images to be programmed into NAND FLASH will be downloaded to the board via TFTP so you'll need a TFTP server to serve the images to the board.
Boot into u-boot ↑
If needed, install the u-boot binary (u-boot.bin) to the Embedded Artists board using the procedure on the
LPC32x0BoardEA3250ubootinstall page. Once u-boot is installed, boot the board to get to the u-boot prompt. See below.
5
Embedded Artist 3250 Board
Build date: Sep 28 2010 11:47:15
Autoboot in progress, press any key to stop
U-Boot 2009.03-rc1 (Dec 14 2010 - 15:59:13)
DRAM: 64 MB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
uboot>
Download the kernel image to the board ↑
First, start by using TFTP to get the kernel image from a TFTP server to the boards memory. Use the
or commands to get the image with static IP or a DHCP obtained IP address.
uboot> run tftpstatickernel
HW MAC address: 00:1A:F1:00:00:00
ENET:auto-negotiation complete#$
ENET:FULL DUPLEX
ENET:100MBase
TFTP from server 192.168.1.41; our IP address is 192.168.1.101
Filename 'uImage'.
Load address: 0x80100000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
###############################################
done
Bytes transferred = 1901188 (1d0284 hex)
uboot>
Burning the kernel image in NAND FLASH ↑
Now that the image is in memory, you can use the command to place the image into NAND FLASH. This will erase the area of NAND used for kernel storage and place the downloaded kernel image there.
uboot> run mtdkernelburn
NAND erase: device 0 offset 0x140000, size 0x400000
Erasing at 0x520000 -- 100% complete.
OK
NAND write: device 0 offset 0x140000, size 0x400000
4194304 bytes written: OK
uboot>
u-boot environment setup for kernel boot from NAND ↑
Now that the kernel is in FLASH, the boot command needs to be setup to tell u-boot how to load and start the kernel image. This is done with the u-boot environment variable bootcmd. Note bootcmd also sets up the root file system boot method and the bootargs environment variable in the example below. The kernel is setup for NAND boot and a JFFS2 root file system. The saveenv command is used to save the changes for u-boot so they will happen next time on reset.
uboot> setenv bootcmd 'run mtdboot; run mtdkernel; bootm $(loadaddr)'
uboot> saveenv
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x120000 -- 100% complete.
Writing to Nand... done
uboot>
That's all that is needed. The next time the system is booted, the kernel will boot from NAND.
5
Embedded Artist 3250 Board
Build date: Sep 28 2010 11:47:15
Autoboot in progress, press any key to stop
U-Boot 2009.03-rc1 (Dec 20 2010 - 09:48:36)
DRAM: 64 MB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
Loading from NAND 128MiB 3,3V 8-bit, offset 0x140000
Image Name: Linux-2.6.34
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1901124 Bytes = 1.8 MB
Load Address: 80008000
Entry Point: 80008000
## Booting kernel from Legacy Image at 80100000 ...
Image Name: Linux-2.6.34
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1901124 Bytes = 1.8 MB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.34 (usb10132@usb10132-desktop) (gcc version 4.1.2) #7 PREEMPT Mon Dec 20 09:25:14 PST 2010
CPU: ARM926EJ-S [41069264] revision 4 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Embedded Artists LPC3250 OEM board with the LPC3250 Microcontroller
Memory policy: ECC disabled, Data cache writeback
...
...
...