主题 : 不需要加载kernel模块的linux dnw 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 944
精华: 3
发帖: 71
金钱: 22760 两
威望: 4838 点
贡献值: 20 点
综合积分: 202 分
注册时间: 2008-06-27
最后登录: 2017-07-16
楼主  发表于: 2009-04-11 21:54

 不需要加载kernel模块的linux dnw

管理提醒: 本帖被 qq2440 执行取消置顶操作(2009-09-10)
这个不需要加载内核模块,省去了编译内核模块的麻烦,不过需要libusb的支持,安装libusb和libusb-dev这两个包就可以了,详见包里面的README
我在qq2440上测了下,烧写kernel时下载速度有250 KB/s,应该比较快了。
http://c8051f320dev.googlecode.com/files/dnw2_linux_latest.tgz
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2009-04-11 23:05
呵呵,你是我们的USB专家了啊,谢谢!
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2009-04-12 11:42
这是在Ubuntu 8.10上编译的过程和生成的ELF执行档信息 (编译之前通过sudo apt-get install libusb-dev安装libusb和编译所需头文件)

alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$ gcc dnw2.c -o dnw2 -lusb      
dnw2.c: In function ‘prepare_write_buf’:
dnw2.c:98: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘__off_t’
dnw2.c: In function ‘main’:
dnw2.c:144: warning: unknown conversion type character 0x9 in format

alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$ ls
dnw2  dnw2.c  README
alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$ ls -l
total 20
-rwxr-xr-x 1 alex alex 9846 2009-04-12 11:40 dnw2
-rw-r--r-- 1 alex alex 2748 2009-04-11 19:35 dnw2.c
-rw-r--r-- 1 alex alex  401 2009-04-11 21:48 README
alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$
alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$
alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$
alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$ readelf -h dnw2
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x8048800
  Start of program headers:          52 (bytes into file)
  Start of section headers:          5996 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         36
  Section header string table index: 33
alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$
alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$ readelf -d dnw2

Dynamic section at offset 0xf18 contains 22 entries:
  Tag        Type                         Name/Value
0x00000001 (NEEDED)                     Shared library: [libusb-0.1.so.4]
0x00000001 (NEEDED)                     Shared library: [libc.so.6]
0x0000000c (INIT)                       0x8048674
0x0000000d (FINI)                       0x8048d6c
0x00000004 (HASH)                       0x8048168
0x6ffffef5 (GNU_HASH)                   0x8048228
0x00000005 (STRTAB)                     0x8048438
0x00000006 (SYMTAB)                     0x8048268
0x0000000a (STRSZ)                      305 (bytes)
0x0000000b (SYMENT)                     16 (bytes)
0x00000015 (DEBUG)                      0x0
0x00000003 (PLTGOT)                     0x8049ff4
0x00000002 (PLTRELSZ)                   160 (bytes)
0x00000014 (PLTREL)                     REL
0x00000017 (JMPREL)                     0x80485d4
0x00000011 (REL)                        0x80485c4
0x00000012 (RELSZ)                      16 (bytes)
0x00000013 (RELENT)                     8 (bytes)
0x6ffffffe (VERNEED)                    0x80485a4
0x6fffffff (VERNEEDNUM)                 1
0x6ffffff0 (VERSYM)                     0x804856a
0x00000000 (NULL)                       0x0
alex@alex-desktop:~/project3/qq2440/dnw_linux/dnw2/dnw2$ ldd dnw2
        linux-gate.so.1 =>  (0xb7f2a000)
        libusb-0.1.so.4 => /lib/libusb-0.1.so.4 (0xb7ef2000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7d94000)
        /lib/ld-linux.so.2 (0xb7f10000)
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
fqh
级别: 新手上路
UID: 630
精华: 0
发帖: 11
金钱: 90 两
威望: 73 点
贡献值: 0 点
综合积分: 22 分
注册时间: 2008-05-05
最后登录: 2010-02-23
3楼  发表于: 2009-04-15 00:14
真的非常好用,非常快。我用linux好几年了,每次下载内核都要换回windows非常地不方便。这个东西很爽
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
4楼  发表于: 2009-04-28 16:23
我把编译好的执行档和源代码打包成debian package(.deb, .dsc)格式,方便用Debian或者Ubuntu的兄弟:)

1.安装编译好的执行档
执行档文件   dnw2_0.0.20090411-1_i386.deb.bz2 (6 K) 下载次数:38

使用方法:
下载附件后,解压得到dnw2_0.0.20090411-1_i386.deb, 用命令 (需要root权限)
$dpkg -i /path/to/dnw2_0.0.20090411-1_i386.deb
安装。安装后,在/usr/sbin下有dnw2执行文件。使用说明在/usr/share/doc/dnw2/README

2. 编译源代码
源代码文件   dnw2_source.zip (15 K) 下载次数:35

使用方法:
下载附件后,解压得到下面三个文件
dnw2_0.0.20090411-1.dsc
dnw2_0.0.20090411-1.diff.gz
dnw2_0.0.20090411.orig.tar.gz
将这三个文件放在同一目录下,在另一目录下执行命令
$dpkg-source -x /path/to/dnw2_0.0.20090411-1.dsc
该命令将在当前目录下生成dnw2-0.0.20090411目录,并将源代码解压到其中。

用下面的命令编译:
$cd dnw2-0.0.20090411 && dpkg-buildpackage -b -rfakeroot

编译成功的话将在上层目录生成下列文件:
dnw2_0.0.20090411-1_i386.changes
dnw2_0.0.20090411-1_i386.deb

可以用上面的方法安装编译生成的dnw2_0.0.20090411-1_i386.deb

以上是标准的"Debian 方式"开发,习惯用RedHat或者Fedora的兄弟也可以了解一下:)
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 9299
精华: 0
发帖: 5
金钱: 40 两
威望: 17 点
贡献值: 0 点
综合积分: 10 分
注册时间: 2009-09-24
最后登录: 2014-06-09
5楼  发表于: 2009-09-25 09:03
请问各位,在哪里有libusb-dev下载啊?我现在只有libusb,找不到libusb-dev,所以DNW没法装啊
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2009-09-25 09:37

 回 5楼(无限不循环) 的帖子

如果你用Debian或者Ubuntu,可以通过apt-get或者图形界面的软件管理器安装,软件包名字是libusb-dev;
如果用Fedora, 查Fedora的使用手册,如何通过rpm或者系统的软件管理器安装一个新的软件包
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 43717
精华: 0
发帖: 3
金钱: 25 两
威望: 5 点
贡献值: 0 点
综合积分: 6 分
注册时间: 2011-04-19
最后登录: 2016-09-05
7楼  发表于: 2015-01-24 21:44
非常非常好用