Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r2029 - in
      trunk/src/target/OM-2007/applications/openmoko-rssreader: . src
      ([EMAIL PROTECTED])
   2. r2030 - in
      trunk/src/target/OM-2007/applications/openmoko-rssreader: . src
      ([EMAIL PROTECTED])
   3. r2031 - in
      trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup: .
      src ([EMAIL PROTECTED])
   4. r2032 - in
      trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup: .
      src ([EMAIL PROTECTED])
   5. r2033 - trunk/oe/packages/linux ([EMAIL PROTECTED])
   6. r2034 - trunk/oe/packages/linux/linux-gta01
      ([EMAIL PROTECTED])
   7. r2035 - trunk/src/target/u-boot/patches
      ([EMAIL PROTECTED])
   8. r2036 - trunk/src/target/u-boot/patches
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: zecke
Date: 2007-05-19 00:15:13 +0200 (Sat, 19 May 2007)
New Revision: 2029

Modified:
   trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog
   trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
   trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c
Log:
2007-05-19  Holger Freyther  <[EMAIL PROTECTED]>

        Load data from the cache. Currently libmrss has some issues
        parsing the data it wrote.

        * src/callbacks.c:
        (load_data_from_cache): Implement loading from cache,
        * src/main.c: Call loading.
        (main):



Modified: trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog  
2007-05-18 21:59:58 UTC (rev 2028)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog  
2007-05-18 22:15:13 UTC (rev 2029)
@@ -1,3 +1,13 @@
+2007-05-19  Holger Freyther  <[EMAIL PROTECTED]>
+
+        Load data from the cache. Currently libmrss has some issues
+        parsing the data it wrote.
+
+        * src/callbacks.c:
+        (load_data_from_cache): Implement loading from cache,
+        * src/main.c: Call loading.
+        (main):
+
 2007-05-18  Holger Freyther  <[EMAIL PROTECTED]>
 
         Start caching data

Modified: 
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c    
2007-05-18 21:59:58 UTC (rev 2028)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c    
2007-05-18 22:15:13 UTC (rev 2029)
@@ -216,9 +216,44 @@
 
 /**
  * read the feeds from disk
+ * Similiar to the Thread, but
+ *  -We do not run from a thread, so no gdk locking is necessary
+ *  -We do not load from a url but from the cache
+ *  -We do not need to cache ;)
  */
 void load_data_from_cache (struct RSSReaderData *data)
 {
+    gsize size;
+
+    for ( int i = 0; i < NUMBER_OF_FEEDS; ++i ) {
+        mrss_t *rss_data;
+        gchar *url = s_feeds[i].url;
+        g_debug ("Reading cached object '%s'\n", url);
+        gchar *content = moko_cache_read_object (data->cache, url, &size);
+        if ( !content || size == -1 ) {
+            g_debug ("Noting in the cache for '%s'\n", url);
+            continue;
+        }
+
+        int ret = mrss_parse_buffer( content, size, &rss_data );
+        if ( ret ) {
+            /* TODO use the footer to report error? */
+            g_debug( "parse_buffer of '%s' failed with '%d'", url, ret );
+            continue;
+        }
+
+        /*
+         * create the new item(s)
+         */
+        gdk_threads_leave();
+        add_mrss_item (data, rss_data, url, s_feeds[i].category);
+        gdk_threads_enter();
+
+        g_free (content);
+        mrss_free (rss_data);
+    }
+
+    g_debug ("Done loading from cache\n");
 }
 
 /*

Modified: trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c 
2007-05-18 21:59:58 UTC (rev 2028)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c 
2007-05-18 22:15:13 UTC (rev 2029)
@@ -299,8 +299,9 @@
     /*
      * load data
      */
+    data->is_all_filter = TRUE;
     refresh_categories( data );
-    data->is_all_filter = TRUE;
+    load_data_from_cache (data);
     moko_menu_box_set_active_filter( data->menubox, _("All") );
 
     gtk_widget_show_all( GTK_WIDGET(data->window) );




--- End Message ---
--- Begin Message ---
Author: zecke
Date: 2007-05-19 00:45:01 +0200 (Sat, 19 May 2007)
New Revision: 2030

Modified:
   trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog
   trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
Log:
2007-05-19  Holger Freyther  <[EMAIL PROTECTED]>

        Do not crash on non valid pubDates

        * src/callbacks.c:
        (add_mrss_item):



Modified: trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog  
2007-05-18 22:15:13 UTC (rev 2029)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog  
2007-05-18 22:45:01 UTC (rev 2030)
@@ -1,5 +1,12 @@
 2007-05-19  Holger Freyther  <[EMAIL PROTECTED]>
 
+        Do not crash on non valid pubDates
+
+        * src/callbacks.c:
+        (add_mrss_item):
+
+2007-05-19  Holger Freyther  <[EMAIL PROTECTED]>
+
         Load data from the cache. Currently libmrss has some issues
         parsing the data it wrote.
 

Modified: 
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c    
2007-05-18 22:15:13 UTC (rev 2029)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c    
2007-05-18 22:45:01 UTC (rev 2030)
@@ -140,7 +140,7 @@
          * with the order in application-data.h
          */
         RSSRFCDate *date = RSS_RFC_DATE(rss_rfc_date_new ());
-        rss_rfc_date_set (date, item->pubDate);
+        rss_rfc_date_set (date, item->pubDate ? item->pubDate : "");
         gdk_threads_enter();
         gtk_list_store_append( data->feed_data, &iter );
         gtk_list_store_set   ( data->feed_data, &iter,




--- End Message ---
--- Begin Message ---
Author: stefan
Date: 2007-05-19 01:48:04 +0200 (Sat, 19 May 2007)
New Revision: 2031

Modified:
   trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/ChangeLog
   
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/src/openmoko-panel-startup.c
Log:
2007-05-18  Stefan Schmidt <[EMAIL PROTECTED]>

        * ChangeLog:
        * src/openmoko-panel-startup.c:
        (startup_applet_free):
        (monitor_event_func):
        (applet_main):
        (filter_func):
                Make it less noisy by disableing debug for sn_process return 
value.
                Correct the timer add and remove handling.



Modified: 
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/ChangeLog     
2007-05-18 22:45:01 UTC (rev 2030)
+++ trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/ChangeLog     
2007-05-18 23:48:04 UTC (rev 2031)
@@ -1,11 +1,22 @@
-2007-05-18  Stefan Schmidt,,,  <[EMAIL PROTECTED]>
+2007-05-18  Stefan Schmidt <[EMAIL PROTECTED]>
 
-        Reviewed by NOBODY (OOPS!).
+        * ChangeLog:
+        * src/openmoko-panel-startup.c:
+        (startup_applet_free):
+        (monitor_event_func):
+        (applet_main):
+        (filter_func):
+               Make it less noisy by disableing debug for sn_process return 
value.
+               Correct the timer add and remove handling.
 
+2007-05-18  Stefan Schmidt <[EMAIL PROTECTED]>
+
         * src/openmoko-panel-startup.c:
         (show_hourglass):
         (hide_hourglass):
         (mb_panel_applet_create):
+               A special eventbox around the image is not needed.
+               Cleanup some unneeded code
 
 2007-05-18 Stefan Schmidt <[EMAIL PROTECTED]>
 

Modified: 
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/src/openmoko-panel-startup.c
===================================================================
--- 
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/src/openmoko-panel-startup.c
  2007-05-18 22:45:01 UTC (rev 2030)
+++ 
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/src/openmoko-panel-startup.c
  2007-05-18 23:48:04 UTC (rev 2031)
@@ -53,7 +53,6 @@
        GtkImage *image;
        GdkPixbuf *hglass[HOURGLASS_PIXMAPS];
        const char *last_icon;
-       guint timeout_id;
        GdkWindow *root_window;
        SnDisplay *sn_display;
 } StartupApplet;
@@ -63,6 +62,7 @@
 struct LaunchList {
        char *id;
        time_t when;
+       guint timeout_id;
        LaunchList *next;
 };
 
@@ -76,7 +76,6 @@
 {
        gdk_window_remove_filter (applet->root_window,
                                        (GdkFilterFunc) filter_func, applet);
-       g_source_remove(applet->timeout_id);
        g_slice_free(StartupApplet, applet);
 }
 
@@ -120,10 +119,6 @@
                {
                        g_message("Entered SN_MONITOR_EVENT_INITIATED");
 
-                       /* Set up a timeout that will be called every 0.5 
seconds */
-                       applet->timeout_id = g_timeout_add(500,
-                                          (GSourceFunc) applet_main, applet);
-
                        LaunchList *item = launch_list;
 
                        /* Reset counter */
@@ -144,6 +139,10 @@
                        t = time(NULL);
                        item->when = t + TIMEOUT;
 
+                       /* Set up a timeout that will be called every 0.5 
seconds */
+                       item->timeout_id = g_timeout_add(500,
+                                          (GSourceFunc) applet_main, applet);
+
                        if (!hourglass_shown)
                                show_hourglass(applet);
                }
@@ -163,6 +162,7 @@
                                        else
                                                last_item->next = item->next;
 
+                                       g_source_remove(item->timeout_id);
                                        free(item->id);
                                        free(item);
 
@@ -174,8 +174,6 @@
 
                        if (launch_list == NULL && hourglass_shown)
                                hide_hourglass(applet);
-
-                       g_source_remove(applet->timeout_id);
                }
                break;
        default:
@@ -204,6 +202,7 @@
                        else
                                last_item->next = item->next;
 
+                       g_source_remove(item->timeout_id);
                        free(item->id);
                        free(item);
 
@@ -237,7 +236,7 @@
 
        ret = sn_display_process_event(applet->sn_display, xevent);
 
-       g_message("%s: sn_display_process return value: %i", G_STRFUNC, ret);
+       //g_message("%s: sn_display_process return value: %i", G_STRFUNC, ret);
 
        return GDK_FILTER_CONTINUE;
 }




--- End Message ---
--- Begin Message ---
Author: stefan
Date: 2007-05-19 02:36:06 +0200 (Sat, 19 May 2007)
New Revision: 2032

Modified:
   trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/ChangeLog
   
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/src/openmoko-panel-startup.c
Log:
2007-05-19  Stefan Schmidt <[EMAIL PROTECTED]>

        * src/openmoko-panel-startup.c:
        (show_hourglass):
        (hide_hourglass):
        (monitor_event_func):
        (applet_main):
        (filter_func):
                Define a debug macro and disbale debug by default.



Modified: 
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/ChangeLog     
2007-05-18 23:48:04 UTC (rev 2031)
+++ trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/ChangeLog     
2007-05-19 00:36:06 UTC (rev 2032)
@@ -1,3 +1,13 @@
+2007-05-19  Stefan Schmidt <[EMAIL PROTECTED]>
+
+        * src/openmoko-panel-startup.c:
+        (show_hourglass):
+        (hide_hourglass):
+        (monitor_event_func):
+        (applet_main):
+        (filter_func):
+               Define a debug macro and disbale debug by default.
+
 2007-05-18  Stefan Schmidt <[EMAIL PROTECTED]>
 
         * ChangeLog:

Modified: 
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/src/openmoko-panel-startup.c
===================================================================
--- 
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/src/openmoko-panel-startup.c
  2007-05-18 23:48:04 UTC (rev 2031)
+++ 
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-startup/src/openmoko-panel-startup.c
  2007-05-19 00:36:06 UTC (rev 2032)
@@ -46,6 +46,14 @@
 
 #include <string.h>
 
+#undef DEBUG_THIS_FILE
+
+#ifdef DEBUG_THIS_FILE
+#define DEBUG(_format_, ...) g_debug(_format_, ## __VA_ARGS__)
+#else
+#define DEBUG(...)
+#endif
+
 #define TIMEOUT                   20
 #define HOURGLASS_PIXMAPS 8
 
@@ -89,14 +97,14 @@
 
 static void show_hourglass(StartupApplet *applet)
 {
-       g_message("Entered %s", G_STRFUNC);
+       DEBUG("Entered %s", G_STRFUNC);
        gtk_widget_show_all(GTK_WIDGET (applet->image));
        hourglass_shown = TRUE;
 }
 
 static void hide_hourglass(StartupApplet *applet)
 {
-       g_message("Entered %s", G_STRFUNC);
+       DEBUG("Entered %s", G_STRFUNC);
        gtk_widget_hide_all(GTK_WIDGET (applet->image));
        hourglass_shown = FALSE;
 }
@@ -109,7 +117,7 @@
        time_t t;
        StartupApplet *applet = (StartupApplet *) user_data;
 
-       g_message("Entered %s", G_STRFUNC);
+       DEBUG("Entered %s", G_STRFUNC);
        context = sn_monitor_event_get_context(event);
        sequence = sn_monitor_event_get_startup_sequence(event);
        id = sn_startup_sequence_get_id(sequence);
@@ -117,7 +125,7 @@
        switch (sn_monitor_event_get_type(event)) {
        case SN_MONITOR_EVENT_INITIATED:
                {
-                       g_message("Entered SN_MONITOR_EVENT_INITIATED");
+                       DEBUG("Entered SN_MONITOR_EVENT_INITIATED");
 
                        LaunchList *item = launch_list;
 
@@ -151,7 +159,7 @@
        case SN_MONITOR_EVENT_COMPLETED:
        case SN_MONITOR_EVENT_CANCELED:
                {
-                       g_message("Entered 
SN_MONITOR_EVENT_CANCELED/COMPLETED");
+                       DEBUG("Entered SN_MONITOR_EVENT_CANCELED/COMPLETED");
                        LaunchList *item = launch_list, *last_item = NULL;
 
                        /* Find actual list item and free it*/
@@ -187,7 +195,7 @@
        LaunchList *last_item = NULL;
        time_t t;
 
-       g_message("Entered %s", G_STRFUNC);
+       DEBUG("Entered %s", G_STRFUNC);
 
        if (!hourglass_shown)
                return TRUE;
@@ -222,7 +230,7 @@
        if (hourglass_cur_frame_n == 8)
                hourglass_cur_frame_n = 0;
 
-       g_message("hourglass_cur_frame_n =%i", hourglass_cur_frame_n);
+       DEBUG("hourglass_cur_frame_n =%i", hourglass_cur_frame_n);
 
     gtk_image_set_from_pixbuf( applet->image, 
applet->hglass[hourglass_cur_frame_n] );
 
@@ -236,8 +244,6 @@
 
        ret = sn_display_process_event(applet->sn_display, xevent);
 
-       //g_message("%s: sn_display_process return value: %i", G_STRFUNC, ret);
-
        return GDK_FILTER_CONTINUE;
 }
 




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-05-19 04:41:36 +0200 (Sat, 19 May 2007)
New Revision: 2033

Modified:
   trunk/oe/packages/linux/gta01-kernel_2.6.bb
Log:
update default kernel to 2.6.21.1


Modified: trunk/oe/packages/linux/gta01-kernel_2.6.bb
===================================================================
--- trunk/oe/packages/linux/gta01-kernel_2.6.bb 2007-05-19 00:36:06 UTC (rev 
2032)
+++ trunk/oe/packages/linux/gta01-kernel_2.6.bb 2007-05-19 02:41:36 UTC (rev 
2033)
@@ -1 +1 @@
-require linux-gta01_2.6.20.10.bb
+require linux-gta01_2.6.21.1.bb




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-05-19 04:43:57 +0200 (Sat, 19 May 2007)
New Revision: 2034

Modified:
   trunk/oe/packages/linux/linux-gta01/defconfig-2.6.21.1-fic-gta01
Log:
enable GTA01 backlight and HXD8 light sensor driver


Modified: trunk/oe/packages/linux/linux-gta01/defconfig-2.6.21.1-fic-gta01
===================================================================
--- trunk/oe/packages/linux/linux-gta01/defconfig-2.6.21.1-fic-gta01    
2007-05-19 02:41:36 UTC (rev 2033)
+++ trunk/oe/packages/linux/linux-gta01/defconfig-2.6.21.1-fic-gta01    
2007-05-19 02:43:57 UTC (rev 2034)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.21
-# Tue May  1 10:13:25 2007
+# Wed May 16 23:39:09 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1032,6 +1032,7 @@
 # CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_PCF8591 is not set
 # CONFIG_SENSORS_MAX6875 is not set
+CONFIG_SENSORS_TSL256X=m
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
@@ -1155,6 +1156,7 @@
 CONFIG_BACKLIGHT_LCD_SUPPORT=y
 CONFIG_BACKLIGHT_CLASS_DEVICE=y
 CONFIG_LCD_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_GTA01=y
 CONFIG_FB=y
 # CONFIG_FIRMWARE_EDID is not set
 # CONFIG_FB_DDC is not set




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-05-19 07:11:22 +0200 (Sat, 19 May 2007)
New Revision: 2035

Modified:
   trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch
Log:
put config.tmp into the correct directory (board/neo1973/gta01 rather 
board/neo1973)


Modified: trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch        
2007-05-19 02:43:57 UTC (rev 2034)
+++ trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch        
2007-05-19 05:11:22 UTC (rev 2035)
@@ -8,7 +8,7 @@
 ===================================================================
 --- u-boot.orig/Makefile
 +++ u-boot/Makefile
-@@ -1988,6 +1988,14 @@
+@@ -2009,6 +2009,14 @@
  sbc2410x_config: unconfig
        @$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
  
@@ -35,7 +35,7 @@
  
  #ifndef CONFIG_CMDLINE_EDITING
  static char * delete_char (char *buffer, char *p, int *colp, int *np, int 
plen);
-@@ -404,7 +405,7 @@
+@@ -376,7 +377,7 @@
  
        debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
  
@@ -1805,7 +1805,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/board/neo1973/gta01/split_by_variant.sh
-@@ -0,0 +1,54 @@
+@@ -0,0 +1,57 @@
 +#!/bin/sh
 +# ---------------------------------------------------------
 +#  Set the core module defines according to Core Module
@@ -1814,43 +1814,46 @@
 +# Set up the GTA01 type define
 +# ---------------------------------------------------------
 +
++CFGINC=${obj}include/config.h
++CFGTMP=${obj}board/neo1973/gta01/config.tmp
++
 +mkdir -p ${obj}include
 +if [ "$1" == "" ]
 +then
 +      echo "$0:: No parameters - using GTA01Bv3 config"
-+      echo "#define CONFIG_ARCH_GTA01B_v3" > ${obj}include/config.h
-+      echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
++      echo "#define CONFIG_ARCH_GTA01B_v3" > $CFGINC
++      echo "GTA01_BIG_RAM=y" > $CFGTMP
 +else
 +      case "$1" in
 +      gta01v4_config)
-+      echo "#define CONFIG_ARCH_GTA01_v4" > ${obj}include/config.h
-+      echo "GTA01_BIG_RAM=n" > ${obj}board/neo1973/config.tmp
++      echo "#define CONFIG_ARCH_GTA01_v4" > $CFGINC
++      echo "GTA01_BIG_RAM=n" > $CFGTMP
 +      ;;
 +
 +      gta01v3_config)
-+      echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
-+      echo "GTA01_BIG_RAM=n" > ${obj}board/neo1973/config.tmp
++      echo "#define CONFIG_ARCH_GTA01_v3" > $CFGINC
++      echo "GTA01_BIG_RAM=n" > $CFGTMP
 +      ;;
 +
 +      gta01bv2_config)
-+      echo "#define CONFIG_ARCH_GTA01B_v2" > ${obj}include/config.h
-+      echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
++      echo "#define CONFIG_ARCH_GTA01B_v2" > $CFGINC
++      echo "GTA01_BIG_RAM=y" > $CFGTMP
 +      ;;
 +
 +      gta01bv3_config)
-+      echo "#define CONFIG_ARCH_GTA01B_v3" > ${obj}include/config.h
-+      echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
++      echo "#define CONFIG_ARCH_GTA01B_v3" > $CFGINC
++      echo "GTA01_BIG_RAM=y" > $CFGTMP
 +      ;;
 +
 +      gta01bv4_config)
-+      echo "#define CONFIG_ARCH_GTA01B_v4" > ${obj}include/config.h
-+      echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
++      echo "#define CONFIG_ARCH_GTA01B_v4" > $CFGINC
++      echo "GTA01_BIG_RAM=y" > $CFGTMP
 +      ;;
 +
 +      *)
 +      echo "$0:: Unrecognised config - using GTA01Bv4 config"
-+      echo "#define CONFIG_ARCH_GTA01B_v4" > ${obj}include/config.h
-+      echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
++      echo "#define CONFIG_ARCH_GTA01B_v4" > $CFGINC
++      echo "GTA01_BIG_RAM=y" > $CFGTMP
 +      ;;
 +
 +      esac




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-05-19 07:13:53 +0200 (Sat, 19 May 2007)
New Revision: 2036

Modified:
   trunk/src/target/u-boot/patches/uboot-dfu.patch
Log:
u-boot DFU trailer support for bootloader partition.  This prevents the
flashing of data into the bootloader partition, that is either not a u-boot
image, or not for the matching device and/or hardware revision.

To achieve this, we add a 16byte trailer at the end of u-boot.bin. The trailer
can be added using 'tools/mkudfu'.  A new makefile target for u-boot.udfu can
do this for you.


Modified: trunk/src/target/u-boot/patches/uboot-dfu.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-dfu.patch     2007-05-19 05:11:22 UTC 
(rev 2035)
+++ trunk/src/target/u-boot/patches/uboot-dfu.patch     2007-05-19 05:13:53 UTC 
(rev 2036)
@@ -99,7 +99,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/drivers/usbdfu.c
-@@ -0,0 +1,1042 @@
+@@ -0,0 +1,1066 @@
 +/*
 + * (C) 2007 by OpenMoko, Inc.
 + * Author: Harald Welte <[EMAIL PROTECTED]>
@@ -155,6 +155,7 @@
 +#include <usbdcore.h>
 +#include <usb_dfu.h>
 +#include <usb_dfu_descriptors.h>
++#include <usb_dfu_trailer.h>
 +
 +#include <nand.h>
 +#include <jffs2/load_kernel.h>
@@ -193,6 +194,19 @@
 +
 +static struct dnload_state _dnstate;
 +
++static int dfu_trailer_matching(const struct uboot_dfu_trailer *trailer)
++{
++      if (trailer->magic == UBOOT_DFU_TRAILER_MAGIC &&
++          trailer->version == UBOOT_DFU_TRAILER_V1 &&
++          trailer->vendor == CONFIG_USBD_VENDORID &&
++          (trailer->product == CONFIG_USBD_PRODUCTID_CDCACM ||
++           trailer->product == CONFIG_USBD_PRODUCTID_GSERIAL) &&
++          trailer->revision == get_board_rev())
++              return 1;
++
++      return 0;
++}
++
 +static struct part_info *get_partition_nand(int idx)
 +{
 +      struct mtd_device *dev;
@@ -407,7 +421,17 @@
 +                      ds->ptr = ds->buf;
 +                      break;
 +              case 1:
-+                      if (ds->ptr > ds->buf) {
++                      if (ds->ptr >
++                          ds->buf + sizeof(struct uboot_dfu_trailer)) {
++                              struct uboot_dfu_trailer trailer;
++                              dfu_trailer_mirror(&trailer, ds->ptr);
++                              if (!dfu_trailer_matching(&trailer)) {
++                                      printf("DFU TRAILER NOT OK\n");
++                                      dev->dfu_state = DFU_STATE_dfuERROR;
++                                      dev->dfu_status = DFU_STATUS_errTARGET;
++                                      return RET_STALL;
++                              }
++
 +                              rc = erase_flash_verify_nand(urb, ds,
 +                                                      ds->part->size,
 +                                                      ds->part_net_size);
@@ -1589,3 +1613,466 @@
  
  /*-----------------------------------------------------------------------
   * Physical Memory Map
+Index: u-boot/tools/Makefile
+===================================================================
+--- u-boot.orig/tools/Makefile
++++ u-boot/tools/Makefile
+@@ -21,10 +21,10 @@
+ # MA 02111-1307 USA
+ #
+ 
+-BIN_FILES     = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) 
bmp_logo$(SFX)
++BIN_FILES     = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) 
bmp_logo$(SFX) mkudfu$(SFX)
+ 
+ OBJ_LINKS     = environment.o crc32.o
+-OBJ_FILES     = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o
++OBJ_FILES     = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o 
mkudfu.o
+ 
+ ifeq ($(ARCH),mips)
+ BIN_FILES     += inca-swap-bytes$(SFX)
+@@ -137,6 +137,10 @@
+               $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+               $(STRIP) $@
+ 
++$(obj)mkudfu$(SFX):   $(obj)mkudfu.o
++              $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
++              $(STRIP) $@
++
+ $(obj)ncb$(SFX):      $(obj)ncb.o
+               $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+               $(STRIP) $@
+Index: u-boot/tools/mkudfu.c
+===================================================================
+--- /dev/null
++++ u-boot/tools/mkudfu.c
+@@ -0,0 +1,314 @@
++/*
++ * USB DFU file trailer tool
++ * (C) Copyright by OpenMoko, Inc.
++ * Author: Harald Welte <[EMAIL PROTECTED]>
++ *
++ * based on mkimage.c, copyright information as follows:
++ *
++ * (C) Copyright 2000-2004
++ * DENX Software Engineering
++ * Wolfgang Denk, [EMAIL PROTECTED]
++ * All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of
++ * the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ * MA 02111-1307 USA
++ */
++
++#include <errno.h>
++#include <fcntl.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#ifndef __WIN32__
++#include <netinet/in.h>               /* for host / network byte order 
conversions    */
++#endif
++#include <sys/mman.h>
++#include <sys/stat.h>
++#include <time.h>
++#include <unistd.h>
++
++#if defined(__BEOS__) || defined(__NetBSD__) || defined(__APPLE__)
++#include <inttypes.h>
++#endif
++
++#ifdef __WIN32__
++typedef unsigned int __u32;
++
++#define SWAP_LONG(x) \
++      ((__u32)( \
++              (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
++              (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) | \
++              (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) | \
++              (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
++typedef               unsigned char   uint8_t;
++typedef               unsigned short  uint16_t;
++typedef               unsigned int    uint32_t;
++
++#define     ntohl(a)  SWAP_LONG(a)
++#define     htonl(a)  SWAP_LONG(a)
++#endif        /* __WIN32__ */
++
++#ifndef       O_BINARY                /* should be define'd on __WIN32__ */
++#define O_BINARY      0
++#endif
++
++#include <usb_dfu_trailer.h>
++
++extern int errno;
++
++#ifndef MAP_FAILED
++#define MAP_FAILED (-1)
++#endif
++
++static char *cmdname;
++
++static char *datafile;
++static char *imagefile;
++
++
++static void usage()
++{
++      fprintf (stderr, "%s - create / display u-boot DFU trailer\n", cmdname);
++      fprintf (stderr, "Usage: %s -l image\n"
++                       "          -l ==> list image header information\n"
++                       "       %s -v VID -p PID -r REV -d data_file image\n",
++              cmdname, cmdname);
++      fprintf (stderr, "          -v ==> set vendor ID to 'VID'\n"
++                       "          -p ==> set product ID system to 'PID'\n"
++                       "          -r ==> set hardware revision to 'REV'\n"
++                       "          -d ==> use 'data_file' as input file\n"
++              );
++      exit (EXIT_FAILURE);
++}
++
++static void print_trailer(struct uboot_dfu_trailer *trailer)
++{
++      printf("===> DFU Trailer information:\n");
++      printf("Trailer Vers.:  %d\n", trailer->version);
++      printf("Trailer Length: %d\n", trailer->length);
++      printf("VendorID:       0x%04x\n", trailer->vendor);
++      printf("ProductID:      0x%04x\n", trailer->product);
++      printf("HW Revision:    0x%04x\n", trailer->revision);
++}
++
++static void copy_file (int ifd, const char *datafile, int pad)
++{
++      int dfd;
++      struct stat sbuf;
++      unsigned char *ptr;
++      int tail;
++      int zero = 0;
++      int offset = 0;
++      int size;
++
++      if ((dfd = open(datafile, O_RDONLY|O_BINARY)) < 0) {
++              fprintf (stderr, "%s: Can't open %s: %s\n",
++                      cmdname, datafile, strerror(errno));
++              exit (EXIT_FAILURE);
++      }
++
++      if (fstat(dfd, &sbuf) < 0) {
++              fprintf (stderr, "%s: Can't stat %s: %s\n",
++                      cmdname, datafile, strerror(errno));
++              exit (EXIT_FAILURE);
++      }
++
++      ptr = (unsigned char *)mmap(0, sbuf.st_size,
++                                  PROT_READ, MAP_SHARED, dfd, 0);
++      if (ptr == (unsigned char *)MAP_FAILED) {
++              fprintf (stderr, "%s: Can't read %s: %s\n",
++                      cmdname, datafile, strerror(errno));
++              exit (EXIT_FAILURE);
++      }
++
++      size = sbuf.st_size - offset;
++      if (write(ifd, ptr + offset, size) != size) {
++              fprintf (stderr, "%s: Write error on %s: %s\n",
++                      cmdname, imagefile, strerror(errno));
++              exit (EXIT_FAILURE);
++      }
++
++      if (pad && ((tail = size % 4) != 0)) {
++
++              if (write(ifd, (char *)&zero, 4-tail) != 4-tail) {
++                      fprintf (stderr, "%s: Write error on %s: %s\n",
++                              cmdname, imagefile, strerror(errno));
++                      exit (EXIT_FAILURE);
++              }
++      }
++
++      (void) munmap((void *)ptr, sbuf.st_size);
++      (void) close (dfd);
++}
++
++
++int main(int argc, char **argv)
++{
++      int ifd;
++      int lflag = 0;
++      struct stat sbuf;
++      u_int16_t opt_vendor, opt_product, opt_revision;
++      struct uboot_dfu_trailer _hdr, _mirror, *hdr = &_hdr;
++
++      opt_vendor = opt_product = opt_revision = 0;
++
++      cmdname = *argv;
++
++      while (--argc > 0 && **++argv == '-') {
++              while (*++*argv) {
++                      switch (**argv) {
++                      case 'l':
++                              lflag = 1;
++                              break;
++                      case 'v':
++                              if (--argc <= 0)
++                                      usage ();
++                              opt_vendor = strtoul(*++argv, NULL, 16);
++                              goto NXTARG;
++                      case 'p':
++                              if (--argc <= 0)
++                                      usage ();
++                              opt_product = strtoul(*++argv, NULL, 16);
++                              goto NXTARG;
++                      case 'r':
++                              if (--argc <= 0)
++                                      usage ();
++                              opt_revision = strtoul(*++argv, NULL, 16);
++                              goto NXTARG;
++                      case 'd':
++                              if (--argc <= 0)
++                                      usage ();
++                              datafile = *++argv;
++                              goto NXTARG;
++                      case 'h':
++                              usage();
++                              break;
++                      default:
++                              usage();
++                      }
++              }
++NXTARG:               ;
++      }
++
++      if (argc != 1)
++              usage();
++
++      imagefile = *argv;
++
++      if (lflag)
++              ifd = open(imagefile, O_RDONLY|O_BINARY);
++      else
++              ifd = open(imagefile, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0666);
++
++      if (ifd < 0) {
++              fprintf (stderr, "%s: Can't open %s: %s\n",
++                      cmdname, imagefile, strerror(errno));
++              exit (EXIT_FAILURE);
++      }
++
++      if (lflag) {
++              unsigned char *ptr;
++              /* list header information of existing image */
++              if (fstat(ifd, &sbuf) < 0) {
++                      fprintf (stderr, "%s: Can't stat %s: %s\n",
++                              cmdname, imagefile, strerror(errno));
++                      exit (EXIT_FAILURE);
++              }
++
++              if ((unsigned)sbuf.st_size < sizeof(struct uboot_dfu_trailer)) {
++                      fprintf (stderr,
++                              "%s: Bad size: \"%s\" is no valid image\n",
++                              cmdname, imagefile);
++                      exit (EXIT_FAILURE);
++              }
++
++              ptr = (unsigned char *)mmap(0, sbuf.st_size,
++                                          PROT_READ, MAP_SHARED, ifd, 0);
++              if ((caddr_t)ptr == (caddr_t)-1) {
++                      fprintf (stderr, "%s: Can't read %s: %s\n",
++                              cmdname, imagefile, strerror(errno));
++                      exit (EXIT_FAILURE);
++              }
++
++              dfu_trailer_mirror(hdr, ptr+sbuf.st_size);
++
++              if (hdr->magic != UBOOT_DFU_TRAILER_MAGIC) {
++                      fprintf (stderr,
++                              "%s: Bad Magic Number: \"%s\" is no valid 
image\n",
++                              cmdname, imagefile);
++                      exit (EXIT_FAILURE);
++              }
++
++              /* for multi-file images we need the data part, too */
++              print_trailer(hdr);
++
++              (void) munmap((void *)ptr, sbuf.st_size);
++              (void) close (ifd);
++
++              exit (EXIT_SUCCESS);
++      }
++
++      /* if we're not listing: */
++
++      copy_file (ifd, datafile, 0);
++
++      memset (hdr, 0, sizeof(struct uboot_dfu_trailer));
++
++      /* Build new header */
++      hdr->version    = UBOOT_DFU_TRAILER_V1;
++      hdr->magic      = UBOOT_DFU_TRAILER_MAGIC;
++      hdr->length     = sizeof(struct uboot_dfu_trailer);
++      hdr->vendor     = opt_vendor;
++      hdr->product    = opt_product;
++      hdr->revision   = opt_revision;
++
++      print_trailer(hdr);
++      dfu_trailer_mirror(&_mirror, (unsigned char *)hdr+sizeof(*hdr));
++
++      if (write(ifd, &_mirror, sizeof(struct uboot_dfu_trailer))
++                                      != sizeof(struct uboot_dfu_trailer)) {
++              fprintf (stderr, "%s: Write error on %s: %s\n",
++                      cmdname, imagefile, strerror(errno));
++              exit (EXIT_FAILURE);
++      }
++
++      /* We're a bit of paranoid */
++#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && 
!defined(__FreeBSD__)
++      (void) fdatasync (ifd);
++#else
++      (void) fsync (ifd);
++#endif
++
++      if (fstat(ifd, &sbuf) < 0) {
++              fprintf (stderr, "%s: Can't stat %s: %s\n",
++                      cmdname, imagefile, strerror(errno));
++              exit (EXIT_FAILURE);
++      }
++
++      /* We're a bit of paranoid */
++#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && 
!defined(__FreeBSD__)
++      (void) fdatasync (ifd);
++#else
++      (void) fsync (ifd);
++#endif
++
++      if (close(ifd)) {
++              fprintf (stderr, "%s: Write error on %s: %s\n",
++                      cmdname, imagefile, strerror(errno));
++              exit (EXIT_FAILURE);
++      }
++
++      exit (EXIT_SUCCESS);
++}
+Index: u-boot/include/usb_dfu_trailer.h
+===================================================================
+--- /dev/null
++++ u-boot/include/usb_dfu_trailer.h
+@@ -0,0 +1,31 @@
++#ifndef _USB_DFU_TRAILER_H
++#define _USB_DFU_TRAILER_H
++
++/* trailer handling for DFU files */
++
++#define UBOOT_DFU_TRAILER_V1  1
++#define UBOOT_DFU_TRAILER_MAGIC       0x19731978
++struct uboot_dfu_trailer {
++      u_int32_t       magic;
++      u_int16_t       version;
++      u_int16_t       length;
++      u_int16_t       vendor;
++      u_int16_t       product;
++      u_int32_t       revision;
++} __attribute__((packed));
++
++/* we mirror the trailer because we want it to be longer in later versions
++ * while keeping backwards compatibility */
++static inline void dfu_trailer_mirror(struct uboot_dfu_trailer *trailer,
++                                    unsigned char *eof)
++{
++      int i;
++      int len = sizeof(struct uboot_dfu_trailer);
++      unsigned char *src = eof - len;
++      unsigned char *dst = (unsigned char *) trailer;
++
++      for (i = 0; i < len; i++)
++              dst[len-1-i] = src[i];
++}
++
++#endif /* _USB_DFU_TRAILER_H */
+Index: u-boot/Makefile
+===================================================================
+--- u-boot.orig/Makefile
++++ u-boot/Makefile
+@@ -261,6 +261,12 @@
+ $(obj)u-boot.bin:     $(obj)u-boot
+               $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+ 
++$(obj)u-boot.udfu:    $(obj)u-boot.bin
++              ./tools/mkudfu -v $(CONFIG_USB_DFU_VENDOR) \
++                             -p $(CONFIG_USB_DFU_PRODUCT) \
++                             -r $(CONFIG_USB_DFU_REVISION) \
++                             -d $< $@
++
+ $(obj)u-boot.img:     $(obj)u-boot.bin
+               ./tools/mkimage -A $(ARCH) -T firmware -C none \
+               -a $(TEXT_BASE) -e 0 \
+Index: u-boot/board/neo1973/gta01/split_by_variant.sh
+===================================================================
+--- u-boot.orig/board/neo1973/gta01/split_by_variant.sh
++++ u-boot/board/neo1973/gta01/split_by_variant.sh
+@@ -15,37 +15,44 @@
+       echo "$0:: No parameters - using GTA01Bv3 config"
+       echo "#define CONFIG_ARCH_GTA01B_v3" > $CFGINC
+       echo "GTA01_BIG_RAM=y" > $CFGTMP
++      echo "CONFIG_USB_DFU_REVISION=0x0230" > $CFGTMP
+ else
+       case "$1" in
+       gta01v4_config)
+       echo "#define CONFIG_ARCH_GTA01_v4" > $CFGINC
+       echo "GTA01_BIG_RAM=n" > $CFGTMP
++      echo "CONFIG_USB_DFU_REVISION=0x0140" > $CFGTMP
+       ;;
+ 
+       gta01v3_config)
+       echo "#define CONFIG_ARCH_GTA01_v3" > $CFGINC
+       echo "GTA01_BIG_RAM=n" > $CFGTMP
++      echo "CONFIG_USB_DFU_REVISION=0x0130" > $CFGTMP
+       ;;
+ 
+       gta01bv2_config)
+       echo "#define CONFIG_ARCH_GTA01B_v2" > $CFGINC
+       echo "GTA01_BIG_RAM=y" > $CFGTMP
++      echo "CONFIG_USB_DFU_REVISION=0x0220" > $CFGTMP
+       ;;
+ 
+       gta01bv3_config)
+       echo "#define CONFIG_ARCH_GTA01B_v3" > $CFGINC
+       echo "GTA01_BIG_RAM=y" > $CFGTMP
++      echo "CONFIG_USB_DFU_REVISION=0x0230" > $CFGTMP
+       ;;
+ 
+       gta01bv4_config)
+       echo "#define CONFIG_ARCH_GTA01B_v4" > $CFGINC
+       echo "GTA01_BIG_RAM=y" > $CFGTMP
++      echo "CONFIG_USB_DFU_REVISION=0x0240" > $CFGTMP
+       ;;
+ 
+       *)
+       echo "$0:: Unrecognised config - using GTA01Bv4 config"
+       echo "#define CONFIG_ARCH_GTA01B_v4" > $CFGINC
+       echo "GTA01_BIG_RAM=y" > $CFGTMP
++      echo "CONFIG_USB_DFU_REVISION=0x0240" > $CFGTMP
+       ;;
+ 
+       esac
+Index: u-boot/board/neo1973/gta01/config.mk
+===================================================================
+--- u-boot.orig/board/neo1973/gta01/config.mk
++++ u-boot/board/neo1973/gta01/config.mk
+@@ -24,6 +24,9 @@
+ #
+ # download area is 3200'0000 or 3300'0000
+ 
++CONFIG_USB_DFU_VENDOR=0x1457
++CONFIG_USB_DFU_PRODUCT=0x5119
++
+ sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+ 
+ ifeq ($(GTA01_BIG_RAM),y)




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to