By Bill » Sunday, January 17 2010, 17:35
These instructions assume that you've got a working U-Boot and that you've managed to compile a kernel for U-Boot (uImage), and that you've created a jffs2 filesystem image for your device.
Step 1: Initialize the SD reader on your device by issuing the mmc command.
MINI2440 # mmc trying to detect SD Card... Manufacturer: 0x03, OEM "SD" Product name: "SD08G", revision 8.0 Serial number: 4392543921 Manufacturing date: 7/2008 CRC: 0x6, b0 = 1 READ_BL_LEN=15, C_SIZE_MULT=0, C_SIZE=365 size = 0 SD Card detected RCA: 0xd555 type: SDHC MINI2440 #
Step 2: Load in to ram, the kernel image from the SD card using the fatload command.
MINI2440 # fatload mmc 0:1 0x32000000 uImage.bin reading uImage.bin
This loads the file uImage from the mmc (SD) Device 0, on parition 1 in to the ram at memory location 0x32000000 (6 zeros)
Step 3: Erase the kernel partition and write the kernel in memory to the kernel partition.
MINI2440# nand erase kernel Erasing....... MINI2440# nand write.e 0x32000000 kernel
This writes using ecc blocks ( the .e part) the kernel that's located in 0x32000000 to the kernel partition.
Step 1: Initialize the SD reader as we did in step 1 above.
Step 2: Use the fatload command as we did above to load your root filesystem image in to ram.
Step 3: Erase the rootfs partition and write the image you loaded in ram, to NAND.
MINI2440# nand erase rootfs MINI2440# nand write.jffs2 0x32000000 rootfs $(filesize)
This writes a jffs2 filesystem to the rootfs partition. For this command you need to pass the file size of the image in hex, but fortunately u-boot is some what smart here, and has provided us a variable that contains the file size of the last file transferred to ram. So you just use $(filesize) as the size at the end and it knows what to do.
Before you can boot this, you need to set some environment variables in U-Boot.
Step 1: Set the bootcmd variable to tell U-Boot what type of kernel image you have and what partition its on.
MINI2440# setenv bootcmd nboot.e kernel \; bootm MINI2440# saveenv
This tells u-boot to read the kernel using ecc blocks from the kernel partition and to use bootm as the type of image (uImage) and saves the environment variables.
Step 2: Set the bootargs variable to tell u-boot what to pass to the kernel command line.
MINI2440# setenv bootargs root=/dev/mtdblock3 rootfstype=jffs2 console=ttySAC0,115200 mini2440=1tb rootwait MINI2440# saveenv
This tells u-boot to tell the kernel that you're booting from mtdblock3 (rootfs partition), your filesystem is jffs2, your console is ttySA0 at 115200 baud, and the last argument tells the kernel what size display you have. 1tb is for the 7" display, and 0tb is for the 3.5" display.
Now assuming everything worked as it should, you can reset your board and it should begin booting linux.
Questions? Comments? Please visit my forum and ask!