Flashing Om2008.8 rootfs under Windows is *LONG*

Andrew Chu andrewchu at users.projects.openmoko.org
Tue Sep 2 05:25:05 CEST 2008


Thanks for the feedback that the dfu-util for Win32 is that much slower 
on Vista.  I wasn't aware of that.  The changes I made to the dfu-util 
source code were minimal but they could use a code review (I've posted 
the diff below).  On Windows XP, I've never had to wait more than 20 
minutes to flash the rootfs so the issue might be related to Windows 
Vista, or LibUSB-Win32 on Vista, but unfortunately, I do not have 
Windows Vista so I cannot debug.  If anyone has the same issue on 
Windows XP, I would like to hear about it.

Andrew

Index: main.c
===================================================================
--- main.c	(revision 4594)
+++ main.c	(working copy)
@@ -26,8 +26,10 @@
  #include <getopt.h>
  #include <usb.h>
  #include <errno.h>
+#ifndef __MINGW32__
  #include <byteswap.h>
  #include <endian.h>
+#endif

  #include "dfu.h"
  #include "usb_dfu.h"
@@ -37,6 +39,10 @@
  #include "config.h"
  #endif

+#ifdef __MINGW32__
+#define sleep(seconds) Sleep((seconds)*1000)
+#endif
+
  #ifdef HAVE_USBPATH_H
  #include <usbpath.h>
  #endif
@@ -579,6 +585,20 @@

  		/* FIXME: check if the selected device really has only one */

+#ifdef __MINGW32__
+		int configuration = dif->configuration;
+
+		if (configuration == 0) {
+			dif->configuration = 1;
+		}
+		printf("Setting Configuration %u...\n", dif->configuration);
+		if (usb_set_configuration(dif->dev_handle, dif->configuration) < 0) {
+			fprintf(stderr, "Cannot set configuration: %s\n", usb_strerror());
+			exit(1);
+		}
+		dif->configuration = configuration;
+#endif
+
  		printf("Claiming USB DFU Runtime Interface...\n");
  		if (usb_claim_interface(_rt_dif.dev_handle, _rt_dif.interface) < 0) {
  			fprintf(stderr, "Cannot claim interface: %s\n", usb_strerror());
@@ -700,12 +720,18 @@
  		exit(1);
  	}

-#if 0
+#ifdef __MINGW32__
+	int configuration = dif->configuration;
+
+	if (configuration == 0) {
+		dif->configuration = 1;
+	}
  	printf("Setting Configuration %u...\n", dif->configuration);
  	if (usb_set_configuration(dif->dev_handle, dif->configuration) < 0) {
  		fprintf(stderr, "Cannot set configuration: %s\n", usb_strerror());
  		exit(1);
  	}
+	dif->configuration = configuration;
  #endif
  	printf("Claiming USB DFU Interface...\n");
  	if (usb_claim_interface(dif->dev_handle, dif->interface) < 0) {
Index: sam7dfu.c
===================================================================
--- sam7dfu.c	(revision 4594)
+++ sam7dfu.c	(working copy)
@@ -20,6 +20,11 @@
  #define O_BINARY 0
  #endif

+#ifdef __MINGW32__
+#define sleep(seconds) Sleep((seconds)*1000)
+#define usleep(microseconds) Sleep((microseconds)/1000)
+#endif
+
  int sam7dfu_do_upload(struct usb_dev_handle *usb_handle, int interface,
  		      int xfer_size, const char *fname)
  {
Index: usb_dfu.h
===================================================================
--- usb_dfu.h	(revision 4594)
+++ usb_dfu.h	(working copy)
@@ -12,6 +12,13 @@

  #include <sys/types.h>

+#ifdef __MINGW32__
+#include <stdint.h>
+#define u_int8_t uint8_t
+#define u_int16_t uint16_t
+#define u_int32_t uint32_t
+#endif
+
  #define USB_DT_DFU			0x21

  struct usb_dfu_func_descriptor {


Vinc Duran wrote:
> On Mon, Sep 1, 2008 at 12:57 PM, Abdelrazak Younes 
> <younes at lyx.org 
> <mailto:younes at lyx.org>> wrote:
> <snip>
> 
>      > You haven't even tried backing it up. Try and see how long *that*
>     takes.
>      > They say it is much, much better with the Linux port of DFU-util (or
>      > rather, something is very very wrong with the Windows port).
> 
>     <snip>
> 
> 
> I use Vista on my day-to-day working computer. With the FreeRunner it's 
> faster to boot to an Ubuntu live CD and work on the FreeRunner and 
> reboot in Vista for my regular work. I can flash the device a couple of 
> times and experiment with QTopia and OM 2008.8 in the time is would take 
> me to just flash the rootfs for either of those. I think the dfu for 
> windows would benefit from some work. I tried running Ubunto in a VMWare 
> virtual machine but couldn't get a good connection to the FreeRunner.
> V
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Openmoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community





More information about the community mailing list