Use dnw for USB download in Linux ~~

Source: Internet
Author: User
Tags dmesg

 

The Development Board is a friendly arm, mini2440

PC operating system Ubuntu 10.10

Some time ago, I was familiar with the Development Board in windows, and now I started to switch to Ubuntu. Before that, I had been confused about dnw, so I tried it with win7.

The premise is that you have to install minicom. If you don't know how to configure it, you can search for it by yourself. Here we mainly talk about the configuration of dnw, because there are a lot of configurations on the Internet that cannot be used. Here I refer to the following example.

 

Let's talk about the usage of dnw for Linux.
Search for dnw for Linux on the Internet first.

I uploaded a http://download.csdn.net/source/3326087 by the way

Download and decompress the package.
The directory is as follows:

Dnw_linux/
Dnw_linux/secbulk/
Dnw_linux/secbulk/makefile
Dnw_linux/secbulk. c
Dnw_linux/dnw/
Dnw_linux/dnw. c

Secbulk. C is a PC-side USB driver, and dnw. C is a write tool.

2.2 compile and load the secbulk. c kernel module
$ CD secbulk
$ Make-C/lib/modules/'uname-R'/build M = 'pwd' modules

After compilation, You can see secbulk. KO in the current directory.

Use the insmod command to load the module. This requires the root permission.
$ Sudo insmod./secbulk. Ko

Compile the dnw Writing Tool
$ CD dnw
$ Gcc-O dnw. c
After compilation is successful, the executable file dnw is generated.

Now you can download the program.

It is a binfile I downloaded through USB.

 

 

 

Because sometimes after dnw problems, below to add some common problems and more detailed operation, refer to from: http://shundacao.blog.163.com/blog/static/1340404812010102123259108/

There are three solutions, dnw and dnw2, and usb2ram.

First, the driver needs to be loaded, and libusb-dev needs to be installed later. among them, the second kind of burning speed is very fast, and I can hear the current sound. but it is also unstable. the following are common prompts:

"Usb_bulk_write failed: Resource temporarily unavailable"

According to the prompts, the number of files to be written is greater than the capacity, but the actual situation is not found. The reason is unknown. Some people say that the USB should be re-plugged every time the file is written.

The information prompted by usb2ram is that the device cannot be found for unknown reasons.
==========================================================
The following error messages often occur when using dnw2:

Target USB device found!
Cannot claim interface: device or resource busy

========================================================== ======================
The first method I used later was to load the driver:
The method is:
1. Download the PC-side USB driver and write tool for dnw in Linux
File Name: dnw_linux.zip
After the download, change the suffix to. tgz.
# Or search for Linux dnw
2. Compile the PC-side USB driver and write Tool
2.1 decompress
$ Tar xzvf/path/to/dnw_linux.tgz
Dnw_linux/
Dnw_linux/secbulk/
Dnw_linux/secbulk/makefile
Dnw_linux/secbulk. c
Dnw_linux/dnw/
Dnw_linux/dnw. c

Secbulk. C is a PC-side USB driver, and dnw. C is a write tool.

2.2 compile and load the secbulk. c kernel module
$ CD secbulk
$ Make-C/lib/modules/'uname-R'/build M = 'pwd' modules

After compilation, You can see secbulk. KO in the current directory.
Alex @ Alex-desktop :~ /Project3/qq2440/dnw_linux/secbulk $ ls
Makefile

Module. symvers secbulk. c secbulk. Ko secbulk. Mod. c secbulk. Mod. O secbulk. o

Use the insmod command to load the module. This requires the root permission.
$ Sudo insmod./secbulk. Ko

After loading, run the dmesg command to check that the module has been successfully loaded.
[2, 238.007970] secbulk: secbulk loaded
[2, 238.009101] usbcore: registered new interface driver secbulk

2.3 compile the dnw Writing Tool
$ CD dnw
$ Gcc-O dnw. c
After compilation is successful, the executable file dnw is generated.

======================================
It is important to use dmesg to check whether the driver is successfully loaded. If this step is not completed, the system will prompt "can not open/dev/secbulk0"

3 download with dnw
3.1 start the Development Board, enter supervivi, and connect the Development Board and PC with a USB cable. Then, run the dmesg command to see the secbulk driver loading:
[2, 283.677772] USB 1-1: new full speed USB device using uhci_hcd and address 2
[2, 284.084835] USB 1-1: configuration #1 chosen from 1 choice
[284.140430] secbulk: secbulk probing...
[2, 284.140482] secbulk: bulk out endpoint found!

3.2 at this time, you can use supervivi for USB download. For more information about Vivi, see the user manual. waiting a download. ", write the file to be downloaded using the dnw tool on PC Linux
$ Sudo./dnw/path/to/what/you/want/download
# Use commands to write data here, with no interface

A success prompt is displayed after the write is complete.
100% xxxxxxx bytes OK

$ Sudo insmod./secbulk. Ko loads modules into the kernel
It will not be automatically loaded when it is started, so that it can be used only after it is loaded every time. In this case, add it to the boot script,
Make it loaded automatically. edit/etc/init. d/rc. Local and add the insmod/path/secbulk. Ko at the end.

# When calling dnw, you can only use./dnw in the current directory. In this case, add dnw to/usr/local/sbin.
Any directory, useSudo dnw filename to call.

For Original Articles, please refer to blog.csdn.net/jjzhoujun2010 for reprinting.

Author: Dream fly

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.