1、 在WINDOWS下FAT32格式化整个SD卡;
2、 切换到虚拟机下,在Ubuntu 9.04的环境下,系统能识别出SD卡,其中/dev/sdc即为SD卡存储设备; @linuxidc:/media$ cat /proc/partitions
major minor #blocks name
8 0 20971520 sda
8 1 20049088 sda1
8 2 1 sda2
8 5 915673 sda5
8 32 1997312 sdb
使用df -h,可以看出其挂载点为/media/disk;
/dev/sdb 2.0G 4.0K 2.0G 1% /media/disk
3、copy bootloader镜像
@linuxidc:/tftpboot$ ls
u-boot-bbg.bin u-boot-bbg-no-padding.bin uImage
@linuxidc:/tftpboot$ sudo dd if=./u-boot-bbg.bin of=/dev/sdb bs=512 && sync && sync
记录了 274+1 的读入
记录了 274+1 的写出
140660字节(141 kB)已复制,0.000910636 秒,154 MB/秒
4、copy内核镜像
@linuxidc:/tftpboot$ sudo dd if=./uImage of=/dev/sdb bs=512 seek=2048 && sync && sync
记录了 4429+1 的读入
记录了 4429+1 的写出
2267676字节(2.3 MB)已复制,0.0549108 秒,41.3 MB/秒
5、copy根文件系统
@linuxidc:/tftpboot$ sudo fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x390ef65e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): p
Disk /dev/sdb: 2045 MB, 2045247488 bytes
63 heads, 62 sectors/track, 1022 cylinders, total 3994624 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x390ef65e
Device Boot Start End Blocks Id System
Command (m for help): d
No partition is defined yet!
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (62-3994623, default 62): 8192
Last sector, +sectors or +size{K,M,G} (8192-3994623, default 3994623):
Using default value 3994623
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
@linuxidc:/tftpboot$
注意重新启动系统。sudo reboot
@linuxidc:~$ sudo mkfs.ext3 /dev/sdb1
[sudo] password for glose:
mke2fs 1.41.4 (27-Jan-2009)
/dev/sdb1 is mounted; will not make a filesystem here!
得先把其umonut
@linuxidc:~$ sudo umount /media/disk/
@linuxidc:~$ sudo mkfs.ext3 /dev/sdb1
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
124672 inodes, 498304 blocks
24915 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=511705088
16 block groups
32768 blocks per group, 32768 fragments per group
7792 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
接着是把根文件系统复制到刚才的分区
首先建立一个文件挂载点目录,然后把设备挂载上去
@linuxidc:~$ mkdir /home/glose/mountpoint
@linuxidc:~$ sudo mount /dev/sdb1 /home/glose/mountpoint
在这里我的要文件系统在/tools/rootfs里面
@linuxidc:~$ cd /tools/rootfs/
@linuxidc:/tools/rootfs$ sudo cp -rpa [A-z]* /home/glose/mountpoint
@linuxidc:/tools/rootfs$ sudo umount /home/glose/mountpoint
把SD卡插入到板子上,启动开发板
U-Boot 2009.08 (Dec 22 2009 - 07:31:32)
CPU: Freescale i.MX51 family 3.0V at 800 MHz
mx51 pll1: 800MHz
mx51 pll2: 665MHz
mx51 pll3: 216MHz
ipg clock : 66500000Hz
ipg per clock : 665000000Hz
uart clock : 66500000Hz
cspi clock : 54000000Hz
Board: MX51 BABBAGE 3.0 [POR]
Boot Device: MMC
DRAM: 512 MB
MMC: FSL_ESDHC: 0
JEDEC ID: 0x1f:0x27:0x01
Reading SPI NOR flash 0xc0000 [0x20000 bytes] -> ram 0x975e0800
.SUCCESS
In: serial
Out: serial
Err: serial
Net: FEC0 [PRIME]
Hit any key to stop autoboot: 0
*** ERROR: `ipaddr' not set
Wrong Image Format for bootm command
ERROR: can't get kernel image!
出现如上错误,得设置相应的环境
BBG U-Boot > setenv bootargs_mmc 'setenv bootargs ${bootargs} console=tty0 root=/dev/mmcblk0p1 rootwait rw'
BBG U-Boot > setenv bootcmd_mmc 'run bootargs_base bootargs_mmc;mmc read 0 ${loadaddr} 0x800 0x1800;bootm'
BBG U-Boot > setenv bootcmd 'run bootcmd_mmc'
保存环境
BBG U-Boot > saveenv
Saving Environment to SPI Flash...
Erasing SPI flash...Erase is built in program.
Writing to SPI flash...Writing SPI NOR flash 0xc0000 [0x20000 bytes] <- ram 0x975e0800
.....SUCCESS
Done
重启