- 论坛徽章:
- 0
|
(转载请保留作者信息和文章出处) 本文差不多算是翻译,英文原版请看
http://wiki.openmoko.org/wiki/Dfu-util
dfu-util是pc host端 usb dfu (usb device firmware upgrade)协议的实现,用这个程序可以和openmoko的uboot通信,这个uboot似乎被添加了一些东西,实现了手机端的usb dfu协议。
用这个dfu-util可以:
1、可以在手机上的nand flash划分分区
2、传输任何东西到neo1973的ram中,尤其在底层代码的开发阶段,这个功能特别好用
3、读取当前nand flash的分区,这样可以很方便的备份整个系统
dfu-util的源代码树在
http://svn.openmoko.org/trunk/src/host/dfu-util
编译之:./autogen.sh
chmod +x configure.ac
./configure.ac
make
make install 搞定
在编译他之前,需要安装libusb-dev autogen pkg-config,预编译好的二进制文件在
http://downloads.openmoko.org/snapshots/2007.11/images/neo1973/
macos用户编译请参照
http://wiki.openmoko.org/wiki/Dfu-util
要使用dfu-util,需要挂载/proc/bus/usb目录,如果此目录无效(即/proc/bus/usb目录为空),请
添加 usbfs /proc/bus/usb usbfs defaults到/etc/fstab中
dfu-util - (C) 2007 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY
Usage: dfu-util [options] ...
-h --help Print this help message
-V --version Print the version number
-l --list List the currently attached DFU capable USB devices
-d --device vendor:product Specify Vendor/Product ID of DFU device
-c --cfg config_nr Specify the Configuration of DFU device
-i --intf intf_nr Specify the DFU Interface number
-a --alt alt_nr Specify the Altseting of the DFU Interface
-t --transfer-size Specify the number of bytes per USB Transfer
-U --upload file Read firmware from device into
-D --download file Write firmware from into dfu-util - (C) 2007 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY
Usage: dfu-util [options] ...
-h --help Print this help message
-V --version Print the version number
-l --list List the currently attached DFU capable USB devices
-d --device vendor:product Specify Vendor/Product ID of DFU device
-c --cfg config_nr Specify the Configuration of DFU device
-i --intf intf_nr Specify the DFU Interface number
-a --alt alt_nr Specify the Altseting of the DFU Interface
-t --transfer-size Specify the number of bytes per USB Transfer
-U --upload file Read firmware from device into
-D --download file Write firmware from into device
-R --reset Issue USB Reset signalling once we're finished
device
-R --reset Issue USB Reset signalling once we're finished
使用dfu-util --list可以列出目前连接的dfu设备,和其相关信息,以下是一个例子# ./dfu-util --list
dfu-util - (C) 2007 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY
Found DFU Runtime: [0x1457:0x5119] devnum=0, cfg=0, intf=2, alt=0, name="USB Device Firmware Upgrade"
dfu-util --device 0x1457:0x5119
指定设备的usb制造商和产品id,如果有多于一个的dfu设备连接到你的pc host,那么用这个参数来指定使用哪一个设备就很有必要了
dfu-util --transfer-size
这个参数的意义我也没有理解,哪位好心人知道的,请给我留言
dfu-util --download 将指定的文件下载到设备上
dfu-util --upload 将设备上指定的文件上传到pc (此参数可能目前无法使用,大家可以自行尝试一下看看,好使了没有)
===================几个例子
刷rootfs: dfu-util -a rootfs -R -D /path/to/openmoko-devel-image.jffs2
刷内核: dfu-util -a kernel -R -D /path/to/uImage
刷bootloader: dfu-util -a u-boot -R -D /path/to/u-boot.bin
将一个内核复制到neo的ram中:
dfu-util -a 0 -R -D /path/to/uImage ,完成之后,内核就会处于neo的ram的启动地址0x32000000
处。但是注意的是,通过此方法,无法将大于2m的文件传输到ram中。
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/12679/showart_685721.html |
|