一直在寻找GNU/Linux的工作、生活方式,Linux下的嵌入式开发也一样
用vivi烧写root文件系统时,如果通过mincom的xmodem串口传输方式,16M要用大约3个半钟
后来为了提高效率,找到了这个USB方式烧写软件DNW,16M文件系统的烧写只需1分多钟
下载dnw_linux.rar
解压后的编译过程如下
$ cd dnw_linux/
$ ls
dnw secbulk
$ cd dnw/
$ ls
dnw.c
编译dnw烧写程序
$ gcc dnw.c -o dnw
$ ls
dnw dnw.c
$ sudo cp dnw /usr/local/bin/
$ cd ..
$ cd secbulk/
$ ls
Makefile secbulk.c
编译dnw相应的内核模块
$ make -C /lib/modules/`uname -r`/build M=`pwd` modules
make: Entering directory `/usr/src/linux-headers-2.6.26-2-686'
CC [M] /home/c-aries/下载/dnw_linux/secbulk/secbulk.o
/home/c-aries/下载/dnw_linux/secbulk/secbulk.c: In function ‘secbulk_write’:
/home/c-aries/下载/dnw_linux/secbulk/secbulk.c:58: warning: comparison of distinct pointer types lacks a cast
Building modules, stage 2.
MODPOST 1 modules
CC /home/c-aries/下载/dnw_linux/secbulk/secbulk.mod.o
LD [M] /home/c-aries/下载/dnw_linux/secbulk/secbulk.ko
make: Leaving directory `/usr/src/linux-headers-2.6.26-2-686'
$
上一步如编译出错,可能是相应的内核头文件尚未安装
Debian系统下,可运行如下命令解决
$ uname -r
2.6.26-2-686
$ sudo apt-get install linux-headers-2.6.26-2-686
注册内核模块
$ sudo insmod secbulk.ko
$ dmesg | tail -1
[33298.895244] usbcore: registered new interface driver secbulk
$
dmesg输出说明secbulk模块已安装成功(重启系统会失效)
使用dnw
在minicom中输入烧写root文件系统的命令
vivi > load flash root u
USB host is connected. Waiting a download.
提示等待usb方式烧写
打开另一个虚拟终端,烧入当前目录中的rootfs.yaffs(dnw已被)
$ sudo dnw rootfs.yaffs
file name : rootfs.yaffs
file size : 4515456 bytes
Writing data...
100% 4515466 bytes OK
$
另一个终端显示
vivi > load flash root u
USB host is connected. Waiting a download.
Now, Downloading [ADDRESS:30000000h,TOTAL:4515466]
RECEIVED FILE SIZE: 4515466 (489KB/S, 9S)
Downloaded file at 0x30000000, size = 4515456 bytes
Found block size = 0x00450000
Erasing... ... done
Writing... ... done
Written 4515456 bytes
vivi >
root文件系统,usb方式烧写成功