|
楼主 |
发表于 2015-4-28 20:33:23
|
显示全部楼层
五.启动TF卡的制作,该环境需要在linux操作系统下把TF卡分区,至于启动过程后面再讲。如果有命令不能执行则加上sudo
1.现在我们有的文件:
1)u-boot-sunxi-with-spl.bin
2)script.bin
3)uImage
4)modules(这个在rootfs中再使用
后面还会需要制作 uEnv.txt或者Boot.src作为启动参数存放文件
2.分区TF卡
先查看当前机器的disk
fdisk -l
把TF卡插到读卡器上插入机器
再次查看
fdisk -l
多出来的就是TF卡,我机器上是/dev/sdb,也有可能是/dev/sdc
开始分区
fdisk /dev/sdb
创建第一分区(除了+20M,其他都使用默认值,注意是defualt需要为1,如果以前分区过的话可以在windows使用sd formatter全部格式化,或者使用fdisk,再d来删除分区)
Command (m for help): n # Type n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): # Press Enter Key
Using default response p
Partition number (1-4, default 1): # Press Enter Key
Using default value 1
First sector (2048-15523839, default 2048): # Press Enter Key
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-15523839, default 15523839): +20M # Type +20M
接下来创建第二分区(全部使用默认默认值)
Command (m for help): n
Partition type: # Press Enter Key
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 2): # Press Enter Key
Using default value 2
First sector (43008-15523839, default 43008):
Using default value 43008
Last sector, +sectors or +size{K,M,G} (43008-15523839, default 15523839): # Press Enter Key
Using default value 15523839
把分区写入SD
Command (m for help): w # Type w
接下来格式化2个区分
sudo mkfs.vfat /dev/sdb1
sudo mkfs.ext4 /dev/sdb2
以上就把TF卡分成2个区了,一个是20M的分区1,一个是剩余空间的分区2
这2个分区对应的dev变成了
/dev/sdb1
/dev/sdb2
接下来需要把
1)u-boot-sunxi-with-spl.bin
2)script.bin
3)uImage
写入分区,同时创建uEvn.txt
3.写入u-boot
sudo dd if=/dev/zero of=/dev/sdb1 bs=1k count=1023 seek=1
sudo dd if=${u-boot-dir}/u-boot-sunxi-with-spl.bin of=${card} bs=1024 seek=8
${u-boot-dir}用u-boot-sunxi-with-spl.bin 实际路径替换
4.写入script.bin.uImage
挂载sdb1分区
sudo mount /dev/sdb1 /mnt
sudo cp script.bin /mnt
sudo cp uImage /mnt
注意需要加上对应文件的相应路径
5.创建uEnv.txt
cd /mnt
sudo gedit uEnv.txt
把以下内容写入:
bootargs=console=ttyS0,115200 disp.screen0_output_mode=EDID:1024x768p50 hdmi.audio=EDID:0 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
aload_script=fatload mmc 0 0x43000000 script.bin;
aload_kernel=fatload mmc 0 0x48000000 uImage;bootm 0x48000000;
uenvcmd=run aload_script aload_kernel
6.卸载/mnt
cd ..
sudo umount /mnt
7.制作完成,这时候可以把TF卡插入板上运行了,不过因为没有文件系统,所以跑到最后会死机。
|
|