Linux下使用DNW下载镜像-TQ2440

效果图:

Linux下使用DNW下载镜像-TQ2440

1.首先解压缩文件:
# tar xvf dnw_for_linux.tar.gz
另:在ubuntu下右键解压也很方便
2.然后切换到下面的目录,编译usb驱动模块:
# cd dnw_for_linux/secbulk
# make -C /lib/modules/2.6.33.6-147.fc13.i686/build/ M=/home/libing/dnw_for_linux/secbulk/ modules


注意:相应路径要替换成你机器的路径。/lib/modules/2.6.32-33-generic/build/目录中“2.6.32-33-generic”是当前启动内核版本,如果你是多内核要注意了(不确定可以终端uname -r命令查看内核版本)。


当然了也可以在文件夹下新建一文档,copy指令,然后保存,以可执行程序的方式运行之。
       
3.编译完成后,会生成secbulk.ko文件:
# ls
Makefile       Module.symvers  secbulk.ko     secbulk.mod.o
modules.order  secbulk.c       secbulk.mod.c  secbulk.o


4.加载模块到Linux内核:
# sudo 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目录
# sudo cp dnw /usr/local/bin


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


使用方法如下:

1.在minicom下,从Nor Flash启动TQ2440,选择a功能:  

####    Boot for Nor Flash Main Menu   #####                                  
#####     EmbedSky USB download mode     #####                                 
                                                                               
[1] Download u-boot or STEPLDR.nb1 or other bootloader to Nand Flash           
[2] Download Eboot (eboot.nb0) to Nand Flash                                   
[3] Download Linux Kernel (zImage.bin) to Nand Flash                           
[5] Download CRAMFS image to Nand Flash                                        
[6] Download YAFFS image (root.bin) to Nand Flash                              
[7] Download Program (uCOS-II or TQ2440_Test) to SDRAM and Run it              
[8] Boot the system                                                            
[9] Format the Nand Flash                                                      
[0] Set the boot parameters                                                    
[a] Download User Program (eg: uCOS-II or TQ2440_Test)                         
[b] Download LOGO Picture (.bin) to Nand  Flash                                
[l] Set LCD Parameters                                                         
[n] Enter TFTP download mode menu                                              
[o] Download u-boot to Nor Flash                                               
[r] Reboot u-boot                                                              
[t] Test Linux Image (zImage)                                                  
[q] quit from menu                                                             
Enter your selection: a                                                        
USB host is connected. Waiting a download. 

minicom的输出信息
Enter your selection: a                                                        
USB host is connected. Waiting a download. 
2.此时,打开另一个终端:
# sudo dnw 1.bin
libing@ubuntu:~$ sudo dnw 1.bin
file name : 1.bin
file size : 1214004 bytes
Writing data...
100%     1214014 bytes     OK
重启ARM,是不是程序已经下载进去啊,真是令人高兴啊。

DNW_for_linux 下载:

具体下载目录在 /pub/2011/12/08/Linux下使用DNW下载镜像-TQ2440/

不过每次开机都要加载一次那个.ko模块,大家可以自己将它写到开机脚本里,省去了每次都要手动加载的麻烦!

相关推荐