日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

u-boot 從SD卡啟動kernel (轉)

 WUCANADA 2013-03-28

u-boot 從SD卡啟動kernel 相關


轉貼1:
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 bootingStep 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# 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.http://blog./u3/103534/showart_2162101.html

從sd卡啟動之文件系統(tǒng)制作

分類: arm 654人閱讀 評論(0) 收藏 舉報

    在調試andriod的代碼時候發(fā)現(xiàn)了一個問題。在andriod調試的時候無法進入常規(guī)的文件系統(tǒng)進行簡單的操作。由于想要把alsa移植到210的開 發(fā)板中,發(fā)現(xiàn)“/”文件系統(tǒng)是無法進行讀寫的。在根文件系統(tǒng)下有一個system的目錄可以進行讀寫但是執(zhí)行命令的時候發(fā)現(xiàn)無法操作,顧想到了可讀寫的文 件系統(tǒng)的移植。因此記錄下來這篇文章以便后用,也為了遇到相同問題的開發(fā)者提供微薄的幫助。

    1,fdisk的使用。

    2,拷貝文件。

    3,修改內核的編譯選項。

    4,修改uboot啟動參數(shù)。

    5,硬件上的必要準備。

 

    1,fdisk:

    首先要介紹的是fdisk的操作。在omap的開發(fā)的時候就遇到了sd卡的制作問題。其實網(wǎng)上很多的介紹。在這里只是針對本次操作的介紹,不涉及的內容網(wǎng)上可以查閱到。

    我的環(huán)境是ubuntu10.04的OS。在插上SD卡后會發(fā)現(xiàn)dev目錄下多了sdb。(如果不確定可以使用dmesg查看kernel的log)。

    fdisk /dev/sdb

    按照提示先把所有的分區(qū)信息刪除,然后再是使用 p 打印出磁盤信息。保證沒有分區(qū)。

    再接著為磁盤分區(qū),分區(qū)的時候使用的是命令 n。按照提示輸入相應的指令 p。

    這里注意分區(qū)的大小和容量的信息。default可以選擇系統(tǒng)提示默認值,但是第二個參數(shù)是要有判斷的。我使用的SD卡1G。

    選擇如下:

root@edward-laptop:~# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sdb: 966 MB, 966787072 bytes
30 heads, 62 sectors/track, 1015 cylinders
Units = cylinders of 1860 * 512 = 952320 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x238e5adc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         200      185969   83  Linux
/dev/sdb2             201         600      372000   83  Linux

 

    以上信息因實際情況而異,可以個人調整。在得到了以上信息后執(zhí)行命令如下:

    sudo mkfs.ext4 /dev/sdb2 把第二分區(qū)的空間格式化為EXT4的文件格式。在這命令以后 mount /dev/sdb2 /mnt 把SD卡的第二分區(qū)掛到mnt的目錄下。進入mnt目錄可以發(fā)現(xiàn)多了一個lost+found的文件夾。做過文件系統(tǒng)的都會發(fā)現(xiàn)這個是制作文件系統(tǒng)的必備 信息,可以上網(wǎng)查找相關資料。有了這個文件夾也說明formate成功了。

 

    2,拷貝文件

    在這里我有疑問,ext4作為文件系統(tǒng)類型支不支持SD卡類型的設備操作?請高手回答一下這個問題。

    我們之前使用過的任何一種文件系統(tǒng)都是會有基本的目錄如:/etc /dev /bin /lib /sbin /proc /usr 等。把這些內容拷貝到掛載完畢后的目錄/mnt 或者是任何一種你指定的了文件夾。同步數(shù)據(jù)后。umount /mnt。拔出SD卡文件系統(tǒng)制作完畢。

 

    3,修改編譯選項:

    在上面的文件系統(tǒng)制作的SD時,選用了mkfs。ext4這條指令,顧把SD卡的第二個分區(qū)格式化為ext4的文件系統(tǒng)。在kernel的.config 文件中應該把相應的文件系統(tǒng)的支持列表中添加EXT4的支持。

    如下:

..............

#
# File systems
#
CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT2_FS_XIP is not set
# CONFIG_EXT3_FS is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT23=y
# CONFIG_EXT4_FS_XATTR is not set
# CONFIG_EXT4_DEBUG is not set
CONFIG_JBD2=y
# CONFIG_JBD2_DEBUG is not set
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set

...............

 

    4,修改uboot的啟動參數(shù)

    這個過程相對比較簡單,就是一條指令:set bootargs "noinitrd root=/dev/mmcblk0p2 rw console=ttySAC0"。對這條指令介紹一下:

  root指定了文件系統(tǒng)設備的載體:SD卡的第二個分區(qū)

  static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)這個函數(shù)中可以看到sprintf(md->disk->disk_name, "mmcblk%d", devidx);,SD卡的設備是以mmcblkXpX的方式命名。具體的命名規(guī)則還沒有調試過代碼。但是要指定第二分區(qū)的設備名為:mmcblk0p2 表示partition。

  

    5,uboot上的必要準備

    這個過程簡單但是必要。

    使用tftp命令下載uImage到開發(fā)板上:tftp 0x30800000 uImage

    設置好了以上參數(shù)bootargs后執(zhí)行:bootm 30800000

    最后啟動開發(fā)板??梢話燧dSD卡上的文件系統(tǒng),并且以這個文件系統(tǒng)作為根文件啟動。這時候猶豫是EXT4的文件系統(tǒng),可以讀寫保存數(shù)據(jù)。


轉貼2:
uboot從usb(fat)分區(qū)加載內核
agou 發(fā)表于 2009-12-12 16:29:00 第一步:
內核的支持。修改linux source中的.config文件。
CONFIG_CMDLINE="console=ttyS0,115200 mem=160m ip=off noinitrd root=8:1 rw rootfstype=ext2 rootdelay=10"
8為sda(即U盤)的主設備號,1為第一個分區(qū),是ext2系統(tǒng),rootdelay表示延遲10秒加載,原因為usb一般加載比較慢。注意,usb-storage支持要編進內核。

第二步:
U盤的準備。
分 成2個區(qū),第一個分區(qū)為ext2格式,用于放rootfs,一般不用vfat,因為vfat不支持特殊文件,這個區(qū)比較大。第二個分區(qū)為vfat格式,用 于放vmlinux內核文件,供bootloader加載。為什么要用vfat放這個文件,原因在于uboot只支持vfat的usb文件系統(tǒng)。

第三步:
bootloader的設置。 注意,其中 usb 0:2指的是vfat分區(qū),因為vfat在第二個分區(qū)。
# setenv bootcmd usb start\; fatload usb 0:2 0x84000000 vmlinux\; bootelf 0x84000000
# saveenv
#reset
http://blog./b/18215/archives/2009/68951.html

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多