Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101508
  • 博文数量: 11
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 182
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-22 21:35
文章存档

2010年(6)

2009年(5)

我的朋友

分类: LINUX

2010-01-27 14:19:58


Loading your Kernel Image from the SD Reader:
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.binThis 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 kernelThis writes using ecc blocks ( the .e part) the kernel that's located in 0x32000000 to the kernel partition.
 

Loading your Root Filesystem Image from the SD Reader:
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.
Setting the Environment Variables for booting
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# saveenvThis 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
MINI2440# saveenvThis 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.
阅读(4425) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-11-05 22:51:38

版主,你好!!看了你的文章,学习了。能否给份uboot从sd里拷贝内核详细一点的Demo代码做参考? 最近在整那个s3c6410用uboot从sd里读取内核并自动下载到nandflash中,最后自动启动到桌面。请指教,感谢!! 我邮箱; suzhalex@163.com