热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

CentOS6.4下利用dnw烧写文件,dnw安装与配置(基于TQ2440)

首先下载dnw:http:download.csdn.netdetailplaza021011140这个是在网上找的,当然也可以去别的地方下载

首先下载dnw:http://download.csdn.net/detail/plaza02/1011140

这个是在网上找的,当然也可以去别的地方下载,很多的。

1.解压缩文件: # tar xvf dnw_for_linux.tar.gz

  2.然后切换到下面的目录,编译usb驱动模块: # 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

 (注 意:相应路径要替换成你机器的路径。/lib/modules/2.6.33.6-147.fc13.i686/build/目录中 “2.6.33.6-147.fc13.i686”是当前启动内核版本,如果你是多内核要注意了(不确定可以终端uname -r命令查看内核版本)。或者利用命令:make -C /lib/modules/`uname -r`/build M=`pwd` modules)

出现错误:make: *** /lib/modules/2.6.25-14.fc9.i686/build: 沒有此一档案和目录
sudo yum install kernel-devel 再make -C /lib/modules/`uname -r`/build M=`pwd` modules

  3.编译完成后,会生成secbulk.ko文件: # ls

  Makefile Module.symvers secbulk.ko secbulk.mod.o

  modules.order secbulk.c secbulk.mod.c secbulk.o

  4.加载模块到Linux内核: # insmod ./secbulk.ko (注意要在root权限下)

  # dmesg (查看是否加载成功)

  secbulk:secbulk loaded

  usbcore: registered new interface driver secbulk (看到这样两行就说明成功了)

  5.下面开始编译dnw工具 # cd ../dnw

  # gcc -o dnw dnw.c

  (编译完成,会看到dnw可执行文件)

  6.将文件copy到/usr/local/bin目录 # cp dnw /usr/local/bin

  (这样就可以在shell下面直接使用dnw命令了)

DNW的使用

  1.在minicom下,从Nor Flash启动TQ2440,选择1功能: [1] Download uboot or STEPLDR.nb1 or other bootloader to Nand Flash

  2.此时,打开另一个终端: # su

  # sudo dnw /mnt/h/embedded/天嵌4.3寸屏的镜像/

  file name : work/linux-2.6.30.4/zImage.bin/U-boot/u-boot-1.1.6_Q43_20120323.bin

ile size : 231424 bytes
Writing data...
100% 231434 bytes OK(此时就将u-boot镜像下载到开发板了)

  3.再看下minicom的输出信息 ter your selection: 1

USB host is connected. Waiting a download.



Now, Downloading [ADDRESS:30000000h,TOTAL:231434]

RECEIVED FILE SIZE: 231434 (226KB/S, 1S)



NAND erase: device 0 offset 0x0, size 0x40000


Erasing at 0x0 -- 50% complete.
Erasing at 0x20000 -- 100% complete.

OK



NAND write: device 0 offset 0x0, size 0x38800




Writing data at 0x0 -- 0% complete.
Writing data at 0x800 -- 1% complete.
Writing data at 0x1000 -- 2% complete.
Writing data at 0x1800 -- 3% complete.
Writing data at 0x2000 -- 4% complete.
Writing data at 0x2800 -- 5% complete.
Writing data at 0x3000 -- 6% complete.
Writing data at 0x3800 -- 7% complete.
Writing data at 0x4800 -- 8% complete.
Writing data at 0x5000 -- 9% complete.
Writing data at 0x5800 -- 10% complete.
Writing data at 0x6000 -- 11% complete.
Writing data at 0x6800 -- 12% complete.
Writing data at 0x7000 -- 13% complete.
Writing data at 0x7800 -- 14% complete.
Writing data at 0x8000 -- 15% complete.
Writing data at 0x9000 -- 16% complete.
Writing data at 0x9800 -- 17% complete.
Writing data at 0xa000 -- 18% complete.
Writing data at 0xa800 -- 19% complete.
Writing data at 0xb000 -- 20% complete.
Writing data at 0xb800 -- 21% complete.
Writing data at 0xc000 -- 22% complete.
Writing data at 0xc800 -- 23% complete.
Writing data at 0xd800 -- 24% complete.
Writing data at 0xe000 -- 25% complete.
Writing data at 0xe800 -- 26% complete.
Writing data at 0xf000 -- 27% complete.
Writing data at 0xf800 -- 28% complete.
Writing data at 0x10000 -- 29% complete.
Writing data at 0x10800 -- 30% complete.
Writing data at 0x11800 -- 31% complete.
Writing data at 0x12000 -- 32% complete.
Writing data at 0x12800 -- 33% complete.
Writing data at 0x13000 -- 34% complete.
Writing data at 0x13800 -- 35% complete.
Writing data at 0x14000 -- 36% complete.
Writing data at 0x14800 -- 37% complete.
Writing data at 0x15000 -- 38% complete.
Writing data at 0x16000 -- 39% complete.
Writing data at 0x16800 -- 40% complete.
Writing data at 0x17000 -- 41% complete.
Writing data at 0x17800 -- 42% complete.
Writing data at 0x18000 -- 43% complete.
Writing data at 0x18800 -- 44% complete.
Writing data at 0x19000 -- 45% complete.
Writing data at 0x19800 -- 46% complete.
Writing data at 0x1a800 -- 47% complete.
Writing data at 0x1b000 -- 48% complete.
Writing data at 0x1b800 -- 49% complete.
Writing data at 0x1c000 -- 50% complete.
Writing data at 0x1c800 -- 51% complete.
Writing data at 0x1d000 -- 52% complete.
Writing data at 0x1d800 -- 53% complete.
Writing data at 0x1e800 -- 54% complete.
Writing data at 0x1f000 -- 55% complete.
Writing data at 0x1f800 -- 56% complete.
Writing data at 0x20000 -- 57% complete.
Writing data at 0x20800 -- 58% complete.
Writing data at 0x21000 -- 59% complete.
Writing data at 0x21800 -- 60% complete.
Writing data at 0x22000 -- 61% complete.
Writing data at 0x23000 -- 62% complete.
Writing data at 0x23800 -- 63% complete.
Writing data at 0x24000 -- 64% complete.
Writing data at 0x24800 -- 65% complete.
Writing data at 0x25000 -- 66% complete.
Writing data at 0x25800 -- 67% complete.
Writing data at 0x26000 -- 68% complete.
Writing data at 0x26800 -- 69% complete.
Writing data at 0x27800 -- 70% complete.
Writing data at 0x28000 -- 71% complete.
Writing data at 0x28800 -- 72% complete.
Writing data at 0x29000 -- 73% complete.
Writing data at 0x29800 -- 74% complete.
Writing data at 0x2a000 -- 75% complete.
Writing data at 0x2a800 -- 76% complete.
Writing data at 0x2b800 -- 77% complete.
Writing data at 0x2c000 -- 78% complete.
Writing data at 0x2c800 -- 79% complete.
Writing data at 0x2d000 -- 80% complete.
Writing data at 0x2d800 -- 81% complete.
Writing data at 0x2e000 -- 82% complete.
Writing data at 0x2e800 -- 83% complete.
Writing data at 0x2f000 -- 84% complete.
Writing data at 0x30000 -- 85% complete.
Writing data at 0x30800 -- 86% complete.
Writing data at 0x31000 -- 87% complete.
Writing data at 0x31800 -- 88% complete.
Writing data at 0x32000 -- 89% complete.
Writing data at 0x32800 -- 90% complete.
Writing data at 0x33000 -- 91% complete.
Writing data at 0x33800 -- 92% complete.
Writing data at 0x34800 -- 93% complete.
Writing data at 0x35000 -- 94% complete.
Writing data at 0x35800 -- 95% complete.
Writing data at 0x36000 -- 96% complete.
Writing data at 0x36800 -- 97% complete.
Writing data at 0x37000 -- 98% complete.
Writing data at 0x37800 -- 99% complete.
Writing data at 0x38000 -- 100% complete.

231424 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模块


最后,提高下载速度
将secbulk.c中的
#define BULKOUT_BUFFER_SIZE 32
改为
#define BULKOUT_BUFFER_SIZE 512

重复上面第步骤重新编译,下载
可发现速度快了很多。


推荐阅读
author-avatar
a403441305
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有