(secbulk目录下是PC端USB驱动, dnw目录是下载工具)
1.首先解压缩文件:
- # tar xvf dnw_for_linux.tar.gz
- # cd dnw_for_linux/secbulk
- # make -C /lib/modules/2.6.33.6-147.fc13.i686/build/ M=/home/lhc/Desktop/dnw_for_linux/secbulk/ modules
3.编译完成后,会生成secbulk.ko文件:
- # ls
- Makefile Module.symvers secbulk.ko secbulk.mod.o
- modules.order secbulk.c secbulk.mod.c secbulk.o
- # insmod ./secbulk.ko (注意要在root权限下)
- # dmesg (查看是否加载成功)
- secbulk:secbulk loaded
- usbcore: registered new interface driver secbulk (看到这样两行就说明成功了)
- # cd ../dnw
- # gcc -o dnw dnw.c
6.将文件copy到/usr/local/bin目录
- # cp dnw /usr/local/bin
使用方法如下:
1.在minicom下,从Nor Flash启动TQ2440,选择3功能:
- [3] Download Linux Kernel (zImage.bin) to Nand Flash
- # su
- # dnw work/linux-2.6.30.4/zImage.bin
- file name : work/linux-2.6.30.4/zImage.bin
- file size : 2305544 bytes
- Writing data…
- 100% 2305554 bytes OK (此时就将zImage镜像下载到开发板了)
- Enter your selection: 3
- USB host is connected. Waiting a download.
-
- Now, Downloading [ADDRESS:30000000h,TOTAL:2305554]
- RECEIVED FILE SIZE: 2305554 (562KB/S, 4S)
-
- NAND erase: device 0 offset 0x200000, size 0x300000
- Erasing at 0x4e0000 — 100% complete.
- OK
-
- NAND write: device 0 offset 0x200000, size 0x232e08
-
- Writing data at 0x432800 — 100% complete.
- 2305544 bytes written: OK
由于每次重启都需要加载一次secbulk.ko模块,为了实现自动加载,可作以下操作:
1.修改secbulk.ko的权限成755
2.修改etc/rc.local文件,添加下面一行
sudo sbin/insmod /usr/bin/secbulk.ko
说明:将secbulk.ko拷贝到了/usr/bin目录下边,为了防止意外删除,你要是不想动原来的文件夹的话,直接将“usr/bin/secbulk.ko”改成你的secbulk.ko的全路经即可。
重启后,用lsmod|grep secbulk来验证一下,看模块是否自动加载了 不过每次开机都要加载一次那个.ko模块,大家可以自己将它写到开机脚本里,省去了每次都要手动加载的麻烦!