dnw for linux 在linux下安装dnw的方法

总结一下dnw在linux下的安装方法。


DNW_for_linux 下载:

免费下载地址在 http://linux.linuxidc.com/

用户名与密码都是www.linuxidc.com

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


1.首先解压缩文件:
# tar xvf dnw_for_linux.tar.gz
另:在Ubuntu下右键解压也很方便

目录如下:
dnw_linux/
dnw_linux/secbulk/
dnw_linux/secbulk/Makefile
dnw_linux/secbulk/secbulk.c
dnw_linux/dnw/
dnw_linux/dnw/dnw.c

其中secbulk.c是PC端USB驱动, dnw.c是写入工具


2 编译并加载secbulk.c内核模块

$cd secbulk
$make -C /lib/modules/`uname -r`/build M=`pwd` modules

编译成功后在当前目录下可以看到secbulk.ko

      

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        (看到这样两行就说明成功了)

 

开机的时候不会自动加载.ko文件,这样每次都要先加载才可以使用,此时将其加入开机脚本,
使其得到自动加载,编辑/etc/init.d/rc.local 在最后加上 insmod /所在路径/secbulk.ko。


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

将原有DNW.C文件代码替换为JZ2440的代码(代码在我的博客里文章【DNW源码FORJZ2440】)

注意修改 const char* dev = "/dev/secbulk1";

有的机器为secbulk0;

查看方法为:ls /dev 

查找secbulk*

编译:

# 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功能:  

关于串口通信的设置常见 http://www.linuxidc.com/Linux/2011-12/48961.htm

####    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,是不是程序已经下载进去啊。


转载于:https://www.cnblogs.com/mrzhaoly/p/5277699.html

你可能感兴趣的:(操作系统,嵌入式,shell)