免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2497 | 回复: 0
打印 上一主题 下一主题

uboot从sd拷贝内核,根文件系统 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-27 14:19 |只看该作者 |倒序浏览

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.

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/103534/showart_2162101.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP