主题 : 不需要加载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 从 mini2440资料下载中心 移动到本区(2009-08-13)
这个不需要加载内核模块,省去了编译内核模块的麻烦,不过需要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) 下载次数:482

使用方法:
下载附件后,解压得到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) 下载次数:280

使用方法:
下载附件后,解压得到下面三个文件
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: 5391
精华: 0
发帖: 24
金钱: 240 两
威望: 240 点
贡献值: 0 点
综合积分: 48 分
注册时间: 2009-04-21
最后登录: 2009-06-04
5楼  发表于: 2009-05-29 16:41
不知道为什么,我在fedora 10下面总是用不了,libusb都已经安装了
包 libusb-static-0.1.12-20.fc10.i386 已安装并且是最新版本
包 libusb1-static-0.9.3-0.1.fc10.i386 已安装并且是最新版本
包 libusb1-0.9.3-0.1.fc10.i386 已安装并且是最新版本
包 libusb1-devel-0.9.3-0.1.fc10.i386 已安装并且是最新版本
包 libusb-0.1.12-20.fc10.i386 已安装并且是最新版本
包 libusb-devel-0.1.12-20.fc10.i386 已安装并且是最新版本

在QQ2440上输入下列命令,显示usb未连接
Supervivi> load flash kernel u                                                  
USB host is not connected yet.

在PC上也显示未能找到usb设备
[root@localhost dnw2]# ./dnw2 dnw2.c
Target usb device not found!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2009-05-29 20:44

 回 5楼(sky_ysk) 的帖子

这个看起来应该是Fedora没有检测到QQ2440. 你可以换个USB口或者换台PC试试,确保至少可以发现新的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: 5391
精华: 0
发帖: 24
金钱: 240 两
威望: 240 点
贡献值: 0 点
综合积分: 48 分
注册时间: 2009-04-21
最后登录: 2009-06-04
7楼  发表于: 2009-05-30 12:00

 回 6楼(kasim) 的帖子

USB口换过了,还是不行。我这里暂时没有别的机器有linux可以用
我想请问下是否装上secbulk就可以识别呢?
[ 此帖被sky_ysk在2009-05-30 13:04重新编辑 ]
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
8楼  发表于: 2009-05-30 14:03
就算不加载secbulk模块,在Linux下用lsusb命令应该也可以看得到开发板的USB VID和PID
"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: 3371
精华: 0
发帖: 2
金钱: 20 两
威望: 20 点
贡献值: 0 点
综合积分: 4 分
注册时间: 2009-01-07
最后登录: 2009-06-10
9楼  发表于: 2009-06-01 10:58
一直直接用    usb2ram,速度在500KB/S左右
附件: usb2ram.tar.gz (9 K) 下载次数:379