r1977 - in trunk/src/host/qemu-neo1973: . openmoko

andrew at sita.openmoko.org andrew at sita.openmoko.org
Wed May 16 21:47:43 CEST 2007


Author: andrew
Date: 2007-05-16 21:47:42 +0200 (Wed, 16 May 2007)
New Revision: 1977

Modified:
   trunk/src/host/qemu-neo1973/openmoko/flash.sh
   trunk/src/host/qemu-neo1973/vl.c
Log:
Make flash.sh less timing dependent by using correct qemu shutdown.  Fix usb-gadget initialisation with no '-usb'.


Modified: trunk/src/host/qemu-neo1973/openmoko/flash.sh
===================================================================
--- trunk/src/host/qemu-neo1973/openmoko/flash.sh	2007-05-16 19:45:37 UTC (rev 1976)
+++ trunk/src/host/qemu-neo1973/openmoko/flash.sh	2007-05-16 19:47:42 UTC (rev 1977)
@@ -71,24 +71,33 @@
 # Launch the emulator assuming that u-boot is now functional enough
 # for us to be able to issue u-boot commands.
 # This is also an example of how you *shouldn't* write scripts.
+# We should parse the u-boot output for command prompt lines and only
+# issue commands when u-boot is awaiting them.
 emu () {
 	$qemu -mtdblock "$script_dir/$flash_image" -kernel "$script_dir/$1" \
 		-serial stdio -nographic -usb -monitor null <&0 & pid=$!
 }
 uboot () {
 	cd $src_dir
-	emu $1 <<< "$3"
+	emu $1 <<< "                               
+$3
+neo1973 power-off
+"
 	echo Please wait, programming the NAND flash...
-	sleep $2
-	kill $pid # Ugly, use the qemu monitor instead
-	sleep 1
-	kill -9 $pid
-	sleep 1
+	(sleep $2; kill $pid; sleep 1; kill -KILL $pid)& timer=$!
+	if ! wait $pid; then
+		kill $timer
+		echo
+		echo U-boot failed to finish writing in $2 seconds, giving up.
+		echo
+		exit -1
+	fi
+	kill $timer
 	cd $script_dir
 }
 
 # Set up BBT, u-boot environment, boot menu and program u-boot binary.
-uboot $uboot_image 40 "               
+uboot $uboot_image 300 "
 setenv dontask y
 nand createbbt
 setenv bootcmd 'setenv bootargs \${bootargs_base} \${mtdparts}; bootm $kernel_addr'
@@ -103,15 +112,15 @@
 saveenv"
 
 # Program bootsplash.
-uboot splash.gz 10 "               
+uboot splash.gz 60 "
 nand write.e $kernel_addr splash $splash_size"
 
 # Program the kernel binary.
-uboot $kernel_image 10 "               
+uboot $kernel_image 60 "
 nand write.e $kernel_addr kernel $kernel_size"
 
 # Program the root filesystem.
-uboot $rootfs_image 20 "               
+uboot $rootfs_image 120 "
 nand write.jffs2 $kernel_addr rootfs $rootfs_size"
 
 # Make the kernel image accessible under a fixed name

Modified: trunk/src/host/qemu-neo1973/vl.c
===================================================================
--- trunk/src/host/qemu-neo1973/vl.c	2007-05-16 19:45:37 UTC (rev 1976)
+++ trunk/src/host/qemu-neo1973/vl.c	2007-05-16 19:47:42 UTC (rev 1977)
@@ -4309,6 +4309,18 @@
     USBDevice *dev;
     USBPort *port;
 
+    if (strstart(devname, "gadget", &p)) {
+        dev = usb_gadget;
+        port = host_usb_ports;
+        if (!dev || !port)
+            return -1;
+        if (p[0] == ':')
+            usb_gadget_config_set(port, strtoul(&p[1], NULL, 0));
+        else if (p[0] != 0)
+            return -1;
+        goto attach;
+    }
+
     if (!free_usb_ports)
         return -1;
 
@@ -4325,16 +4337,6 @@
         if (nr >= (unsigned int) nb_nics || strcmp(nd_table[nr].model, "usb"))
             return -1;
         dev = usb_net_init(&nd_table[nr]);
-    } else if (strstart(devname, "gadget", &p)) {
-        dev = usb_gadget;
-        port = host_usb_ports;
-        if (!dev || !port)
-            return -1;
-        if (p[0] == ':')
-            usb_gadget_config_set(port, strtoul(&p[1], NULL, 0));
-        else if (p[0] != 0)
-            return -1;
-        goto attach;
     } else {
         return -1;
     }





More information about the commitlog mailing list