内核与文件系统烧写
程序下载方法
烧写裸板程序
1. 使用oflash烧写
Windows:
- 直接运行oflash.exe,按照提示选择JTAG,CPU,NAND或NOR, 读或写。
- oflash <要烧写的文件>
- 使用配置文件,建立一个名为cfg.txt的文件,下面是一给例子
图1.1
- oflash -f <其他名字的配置文件>
- 仿照配置文件的方式,把配置项直接放在oflash命令后,如:
oflash 0 1 1 0 0 led_nor.bin //通过OpenJTAG把leds_nor.bin烧到 S3C2440的NorFlash
oflash 1 1 0 0 0 led_nand.bin //通过OpenJTAG把leds_nor.bin烧到 S3C2440的NandFlash
注:bootlaoder也是通过这个方法下载(实验在Norfalsh上)。韦东山的硬件裸板程序都下载到Nandflash。
Linux:
烧写内核&文件系统
注:linux服务器要开启TFTP和NFS服务
1. TFTP
注:使用windows上的tftp工具
- tftp 30000000 文件名
例如 tftp 30000000 leds.bin
- 擦除文件所要存放的局域
nand erase bootloader(uboot现在放在nor里面的)
- 向nand写驱动文件
nand write 30000000 bootloader(打开tftp,选择好要下载的驱动文件)
-
开关拨向nand,重新启动,程序就可以运行了
-
启动tffp服务
烧写uboot:
tftp 30000000 uboot.bin
nand erase bootloader
nand write 30000000 bootloader
1.1 烧写内核:
-
tftp 30000000 uImage
-
nand erase kernel
-
nand write.jffs2 30000000 kernel
1.2 烧写文件系统:
-
tftp 30000000 fs_qtopia.yaffs2
-
nand erase root
-
nand write.yaffs 30000000 0x00260000 $(filesize)
2. NFS
2.1 烧写内核:
1.nfs 30000000 192.168.3.108:/work/nfs_root/uImage
-
nand erase kernel
-
nand write.jffs2 30000000 kernel
2.2 烧写文件系统:
-
nfs 30000000
/work/nfs_root/fs_qtopia.yaffs2 -
nand erase root
-
nand write.yaffs 30000000 0x00260000 $(filesize)
linux下的dnw
- 把linux下的dnw放在/bin目录
加上权限
sudo chmod +x /bin/dnw sudo chmod +s /bin/dnw
-
在UBOOT界面输入K -> 然后在linux下执行 dnw uImage
-
在UBOOT界面输入Y -> 然后在linux下执行 dnw fs_qtopia.yaffs2
挂载虚拟文件系统
note:
serverip:192.168.3.108
开发板ip:192.168.3.17
1. 启动flash上NFS后手工mount
mount -t nfs -o nolock,vers=2 192.168.3.108:/work/nfs_root/first_fs /mnt
这时候可以在 /mnt 目录下看到虚拟机上的文件
2. 使用nfs作为根文件系统来启动
更改开发板的启动项
set bootargs noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0 (flash启动)
nfs启动
linux内核文件->Documentation->nfsroot.txt
nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
set bootargs noinitrd root=/dev/nfs nfsroot=192.168.3.108:/work/nfs_root/first_fs ip=192.168.3.17:192.68.3.108:192.168.3.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0