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. r1093 - trunk/src/target/u-boot/patches ([EMAIL PROTECTED])
   2. r1094 - in trunk/src/host: . devirginator
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: werner
Date: 2007-02-24 06:42:28 +0100 (Sat, 24 Feb 2007)
New Revision: 1093

Added:
   trunk/src/target/u-boot/patches/boot-menu.patch
   trunk/src/target/u-boot/patches/console-ansi.patch
   trunk/src/target/u-boot/patches/default-env.patch
Modified:
   trunk/src/target/u-boot/patches/series
Log:
default-env.patch: provide a central "reset to default environment" function
console-ansi.patch: add basic ANSI escape sequence processing to cfb-console
boot-menu.patch: add a boot menu



Added: trunk/src/target/u-boot/patches/boot-menu.patch
===================================================================
--- trunk/src/target/u-boot/patches/boot-menu.patch     2007-02-24 02:27:50 UTC 
(rev 1092)
+++ trunk/src/target/u-boot/patches/boot-menu.patch     2007-02-24 05:42:28 UTC 
(rev 1093)
@@ -0,0 +1,276 @@
+board/neo1973/bootmenu.c: simple configurable boot menu
+board/neo1973/neo1973.c (neo1973_new_second): return 1 if a new second has
+  started since the last call
+board/neo1973/neo1973.c (neo1973_on_key_pressed): return 1 if the $POWER key is
+  pressed
+board/neo1973/neo1973.c (board_late_init): make use of neo1973_new_second and
+  neo1973_on_key_pressed, call "bootmenu" if AUX is pressed with POWER
+board/neo1973/Makefile: added bootmenu.c
+board/neo1973/neo1973.h: added function prototypes
+
+- Werner Almesberger <[EMAIL PROTECTED]>
+
+Index: u-boot/board/neo1973/bootmenu.c
+===================================================================
+--- /dev/null
++++ u-boot/board/neo1973/bootmenu.c
+@@ -0,0 +1,181 @@
++/*
++ * bootmenu.c - Convert a 480x640 PNG to a splash screen raw dump
++ *
++ * Copyright (C) 2006-2007 by OpenMoko, Inc.
++ * Written by Werner Almesberger <[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.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++ */
++
++
++#include <common.h>
++#include <environment.h>
++
++#include "neo1973.h"
++
++
++#define ANSI_CLEAR    "\e[2J"
++#define ANSI_REVERSE  "\e[7m"
++#define       ANSI_NORMAL     "\e[m"
++#define ANSI_GOTOYX   "\e[%d;%dH"
++
++#define DEBOUNCE_LOOPS                1000    /* wild guess */
++#define BOOT_MENU_TIMEOUT     60      /* 60 second */
++#define AFTER_COMMAND_WAIT    3       /* wait (2,3] after running commands */
++#define       MAX_MENU_ITEMS          10      /* cut off after that many */
++
++#define BOOT_TXT      "Boot"
++#define       FACTORY_TXT     "Factory reset"
++
++
++static int options = 0;
++static int width = sizeof(FACTORY_TXT)-1;
++
++
++static int debounce(int (*fn)(void))
++{
++      int on, i;
++
++again:
++      on = fn();
++      for (i = DEBOUNCE_LOOPS; i; i--)
++              if (on != fn())
++                      goto again;
++      return on;
++}
++
++
++static char *get_option(int n)
++{
++      char name[] = "menu_XX";
++
++      sprintf(name+5,"%d",n);
++      return getenv(name);
++}
++
++
++static void print_option_n(int n)
++{
++      char *s, *colon;
++      int len;
++
++      if (!n) {
++              printf("  %-*s  ", width, BOOT_TXT);
++              return;
++      }
++      if (n == options+1) {
++              printf("  %-*s  ", width, FACTORY_TXT);
++              return;
++      }
++      s = get_option(n);
++      if (!s)
++              return;
++      colon = strchr(s, ':');
++      if (colon)
++              *colon = 0;
++      len = strlen(s);
++      if (len > width)
++              width = len;
++      printf("  %-*s  ", width, s);
++      if (colon)
++              *colon = ':';
++}
++
++
++static void print_option(int n, int reverse)
++{
++      printf(ANSI_GOTOYX, n+4, 1);
++      if (reverse)
++              printf(ANSI_REVERSE);
++      print_option_n(n);
++      if (reverse)
++              printf(ANSI_NORMAL);
++}
++
++
++static const char *option_command(int n)
++{
++      const char *s, *colon;
++
++      s = get_option(n);
++      if (!s)
++              return NULL;
++      colon = strchr(s, ':');
++      return colon ? colon+1 : s;
++}
++
++
++static int do_bootmenu(void)
++{
++      int aux = 1, on = 1;
++      int n, seconds = 0;
++
++      printf(ANSI_CLEAR ANSI_GOTOYX "*** BOOT MENU ***\n\n", 2, 1);
++      print_option(0, 1);
++      while (options < MAX_MENU_ITEMS && option_command(options+1))
++              print_option(++options, 0);
++      print_option(options+1, 0);
++      printf("\n\nPress [AUX] to select, [POWER] to execute.\n");
++
++      n = 0;
++      while (1) {
++              int tmp;
++
++              tmp = debounce(neo1973_911_key_pressed);
++              if (tmp && !aux) {
++                      print_option(n, 0);
++                      n++;
++                      if (n == options+2)
++                              n = 0;
++                      print_option(n, 1);
++                      seconds = 0;
++              }
++              aux = tmp;
++              tmp = debounce(neo1973_on_key_pressed);
++              if (tmp && !on)
++                      return n;
++              on = tmp;
++              if (neo1973_new_second())
++                      if (++seconds > BOOT_MENU_TIMEOUT)
++                              return -1;
++      }
++}
++
++
++void bootmenu(void)
++{
++      while (1) {
++              int n, seconds;
++
++              options = 0;
++              n = do_bootmenu();
++              if (n < 0)
++                      return;
++
++              printf(ANSI_CLEAR ANSI_GOTOYX, 1, 1);
++              if (!n || n == options+1) {
++                      if (n)
++                              default_env();
++                      run_command("bootd", 0);
++              }
++              else
++                      run_command(option_command(n), 0);
++              seconds = AFTER_COMMAND_WAIT;
++              while (seconds)
++                      if (neo1973_new_second())
++                              seconds--;
++      }
++}
+Index: u-boot/board/neo1973/neo1973.c
+===================================================================
+--- u-boot.orig/board/neo1973/neo1973.c
++++ u-boot/board/neo1973/neo1973.c
+@@ -228,14 +228,10 @@ int board_late_init(void)
+                       nobootdelay = 1;
+ 
+               while (1) {
+-                      u_int8_t int1, oocs;
+-
+-                      oocs = pcf50606_reg_read(PCF50606_REG_OOCS);
+-                      if (oocs & PFC50606_OOCS_ONKEY)
++                      if (!neo1973_on_key_pressed())
+                               break;
+ 
+-                      int1 = pcf50606_reg_read(PCF50606_REG_INT1);
+-                      if (int1 & PCF50606_INT1_SECOND)
++                      if (neo1973_new_second())
+                               seconds++;
+ 
+                       if (seconds >= POWER_KEY_SECONDS)
+@@ -262,6 +258,11 @@ continue_boot:
+       /* switch on the backlight */
+       neo1973_backlight(1);
+ 
++      if (nobootdelay) {
++              bootmenu();
++              neo1973_poweroff();
++      }
++
+       return 0;
+ }
+ 
+@@ -313,6 +314,16 @@ void neo1973_vibrator(int on)
+               gpio->GPBDAT &= ~(1 << 10);
+ }
+ 
++int neo1973_new_second(void)
++{
++      return pcf50606_reg_read(PCF50606_REG_INT1) & PCF50606_INT1_SECOND;
++}
++
++int neo1973_on_key_pressed(void)
++{
++      return !(pcf50606_reg_read(PCF50606_REG_OOCS) & PFC50606_OOCS_ONKEY);
++}
++
+ int neo1973_911_key_pressed(void)
+ {
+       S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+Index: u-boot/board/neo1973/Makefile
+===================================================================
+--- u-boot.orig/board/neo1973/Makefile
++++ u-boot/board/neo1973/Makefile
+@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
+ 
+ LIB   = lib$(BOARD).a
+ 
+-OBJS  := neo1973.o pcf50606.o cmd_neo1973.o jbt6k74.o
++OBJS  := neo1973.o pcf50606.o cmd_neo1973.o jbt6k74.o bootmenu.o
+ SOBJS := lowlevel_init.o
+ 
+ .PHONY:       all
+Index: u-boot/board/neo1973/neo1973.h
+===================================================================
+--- u-boot.orig/board/neo1973/neo1973.h
++++ u-boot/board/neo1973/neo1973.h
+@@ -15,4 +15,10 @@ void neo1973_poweroff(void);
+ void neo1973_backlight(int on);
+ void neo1973_vibrator(int on);
+ 
++int neo1973_new_second(void);
++int neo1973_on_key_pressed(void);
++int neo1973_911_key_pressed(void);
++
++void bootmenu(void);
++
+ #endif

Added: trunk/src/target/u-boot/patches/console-ansi.patch
===================================================================
--- trunk/src/target/u-boot/patches/console-ansi.patch  2007-02-24 02:27:50 UTC 
(rev 1092)
+++ trunk/src/target/u-boot/patches/console-ansi.patch  2007-02-24 05:42:28 UTC 
(rev 1093)
@@ -0,0 +1,127 @@
+drivers/cfb_console.c: added processing of ANSI escape sequences \e[2J, \e[m,
+  \e[7m, and \e[row;colH
+drivers/cfb_console.c (video_putc): make \r return to the beginning of the line
+
+- Werner Almesberger <[EMAIL PROTECTED]>
+
+Index: u-boot/drivers/cfb_console.c
+===================================================================
+--- u-boot.orig/drivers/cfb_console.c
++++ u-boot/drivers/cfb_console.c
+@@ -181,6 +181,7 @@ CONFIG_VIDEO_HW_CURSOR:         - Uses the 
+ 
+ #include <version.h>
+ #include <linux/types.h>
++#include <linux/ctype.h>
+ #include <devices.h>
+ #include <video_font.h>
+ #ifdef CFG_CMD_DATE
+@@ -676,10 +677,96 @@ static void console_newline (void)
+ 
+ 
/*****************************************************************************/
+ 
++static enum {
++      CS_NORMAL = 0,
++      CS_ESC,
++      CS_NUM1,
++      CS_NUM2,
++} state = 0;
++
++static int num1, num2;
++
++
++static void swap_drawing_colors(void)
++{
++      eorx = fgx;
++      fgx = bgx;
++      bgx = eorx;
++      eorx = fgx ^ bgx;
++}
++
++
++static void process_sequence(char c)
++{
++      static int inverted = 0;
++      int i, inv;
++
++      switch (c) {
++              case 'J':
++                      /* assume num1 == 2 */
++                      for (i = 0; i != CONSOLE_ROWS; i++)
++                              console_scrollup();
++                      break;
++              case 'H':
++                      if (num1 > CONSOLE_ROWS || num2 > CONSOLE_COLS)
++                              break;
++                      console_col = num2 ? num2-1 : 0;
++                      console_row = num1 ? num1-1 : 0;
++                      break;
++              case 'm':
++                      inv = num1 == 7;
++                      if (num1 && !inv)
++                              break;
++                      if (inverted != inv)
++                              swap_drawing_colors();
++                      inverted = inv;
++                      break;
++      }
++}
++
++
++static void escape_sequence(char c)
++{
++      switch (state) {
++              case CS_ESC:
++                      state = c == '[' ? CS_NUM1 : CS_NORMAL;
++                      num1 = num2 = 0;
++                      break;
++              case CS_NUM1:
++                      if (isdigit(c))
++                              num1 = num1*10+c-'0';
++                      else if (c == ';')
++                              state = CS_NUM2;
++                      else {
++                              process_sequence(c);
++                              state = CS_NORMAL;
++                      }
++                      break;
++              case CS_NUM2:
++                      if (isdigit(c))
++                              num2 = num2*10+c-'0';
++                      else {
++                              process_sequence(c);
++                              state = CS_NORMAL;
++                      }
++              default:
++                      /* can't happen */;
++      }
++}
++
++
+ void video_putc (const char c)
+ {
++      if (state) {
++              escape_sequence(c);
++              CURSOR_SET;
++              return;
++      }
++
+       switch (c) {
+-      case 13:                /* ignore */
++      case 13:                /* return to beginning of line */
++              CURSOR_OFF;
++              console_col = 0;
+               break;
+ 
+       case '\n':              /* next line */
+@@ -698,6 +785,10 @@ void video_putc (const char c)
+               console_back ();
+               break;
+ 
++      case '\e':
++              state = CS_ESC;
++              break;
++
+       default:                /* draw the char */
+               video_putchar (console_col * VIDEO_FONT_WIDTH,
+                              console_row * VIDEO_FONT_HEIGHT,

Added: trunk/src/target/u-boot/patches/default-env.patch
===================================================================
--- trunk/src/target/u-boot/patches/default-env.patch   2007-02-24 02:27:50 UTC 
(rev 1092)
+++ trunk/src/target/u-boot/patches/default-env.patch   2007-02-24 05:42:28 UTC 
(rev 1093)
@@ -0,0 +1,101 @@
+common/env_common.c (default_env): new function that resets the environment to
+  the default value
+common/env_common.c (env_relocate): use default_env instead of own copy
+common/env_nand.c (env_relocate_spec): use default_env instead of own copy
+include/environment.h: added default_env prototype
+
+- Werner Almesberger <[EMAIL PROTECTED]>
+
+Index: u-boot/common/env_common.c
+===================================================================
+--- u-boot.orig/common/env_common.c
++++ u-boot/common/env_common.c
+@@ -202,6 +202,25 @@ uchar *env_get_addr (int index)
+       }
+ }
+ 
++void default_env(void)
++{
++      if (sizeof(default_environment) > ENV_SIZE)
++      {
++              puts ("*** Error - default environment is too large\n\n");
++              return;
++      }
++
++      memset (env_ptr, 0, sizeof(env_t));
++      memcpy (env_ptr->data,
++              default_environment,
++              sizeof(default_environment));
++#ifdef CFG_REDUNDAND_ENVIRONMENT
++      env_ptr->flags = 0xFF;
++#endif
++      env_crc_update ();
++      gd->env_valid = 1;
++}
++
+ void env_relocate (void)
+ {
+       DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__,
+@@ -245,23 +264,8 @@ void env_relocate (void)
+               gd->env_valid = 0;
+ #endif
+ 
+-      if (gd->env_valid == 0) {
+-              if (sizeof(default_environment) > ENV_SIZE)
+-              {
+-                      puts ("*** Error - default environment is too 
large\n\n");
+-                      return;
+-              }
+-
+-              memset (env_ptr, 0, sizeof(env_t));
+-              memcpy (env_ptr->data,
+-                      default_environment,
+-                      sizeof(default_environment));
+-#ifdef CFG_REDUNDAND_ENVIRONMENT
+-              env_ptr->flags = 0xFF;
+-#endif
+-              env_crc_update ();
+-              gd->env_valid = 1;
+-      }
++      if (gd->env_valid == 0)
++              default_env();
+       else {
+               env_relocate_spec ();
+       }
+Index: u-boot/common/env_nand.c
+===================================================================
+--- u-boot.orig/common/env_nand.c
++++ u-boot/common/env_nand.c
+@@ -313,19 +313,7 @@ void env_relocate_spec (void)
+ static void use_default()
+ {
+       puts ("*** Warning - bad CRC or NAND, using default environment\n\n");
+-
+-      if (default_environment_size > CFG_ENV_SIZE){
+-              puts ("*** Error - default environment is too large\n\n");
+-              return;
+-      }
+-
+-      memset (env_ptr, 0, sizeof(env_t));
+-      memcpy (env_ptr->data,
+-                      default_environment,
+-                      default_environment_size);
+-      env_ptr->crc = crc32(0, env_ptr->data, ENV_SIZE);
+-      gd->env_valid = 1;
+-
++      default_env();
+ }
+ #endif
+ 
+Index: u-boot/include/environment.h
+===================================================================
+--- u-boot.orig/include/environment.h
++++ u-boot/include/environment.h
+@@ -107,4 +107,7 @@ typedef    struct environment_s {
+       unsigned char   data[ENV_SIZE]; /* Environment data             */
+ } env_t;
+ 
++
++void default_env(void);
++
+ #endif        /* _ENVIRONMENT_H_ */

Modified: trunk/src/target/u-boot/patches/series
===================================================================
--- trunk/src/target/u-boot/patches/series      2007-02-24 02:27:50 UTC (rev 
1092)
+++ trunk/src/target/u-boot/patches/series      2007-02-24 05:42:28 UTC (rev 
1093)
@@ -54,3 +54,8 @@
 # for automated installation
 preboot-override.patch
 lowlevel_foo.patch
+
+# move these later, once the dust has settled
+default-env.patch
+console-ansi.patch
+boot-menu.patch




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2007-02-24 08:10:50 +0100 (Sat, 24 Feb 2007)
New Revision: 1094

Added:
   trunk/src/host/devirginator/
   trunk/src/host/devirginator/Makefile
   trunk/src/host/devirginator/README
   trunk/src/host/devirginator/config.example
   trunk/src/host/devirginator/scriptify.pl
   trunk/src/host/devirginator/setup.sh
   trunk/src/host/devirginator/smiley.fig
   trunk/src/host/devirginator/u-boot.in
Log:
First experimental version of the device bringup tool.



Added: trunk/src/host/devirginator/Makefile
===================================================================
--- trunk/src/host/devirginator/Makefile        2007-02-24 05:42:28 UTC (rev 
1093)
+++ trunk/src/host/devirginator/Makefile        2007-02-24 07:10:50 UTC (rev 
1094)
@@ -0,0 +1,41 @@
+#
+# Makefile - Setup and handling of prerequisites
+#
+# Copyright (C) 2006-2007 by OpenMoko, Inc.
+# Written by Werner Almesberger <[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.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+devirginate:   config setup.sh smiley.gz
+               mkdir -p tmp
+               ./setup.sh
+
+smiley.ppm:    smiley.fig
+               fig2dev -L ppm -m 2 $< >$@ || { rm -f $@; exit 1; }
+
+smiley.png:    smiley.ppm
+               pnmpad -white -width 480 -height 640 $< | \
+                 ppmchange '#ffffff' '#00ff00' | \
+                 pnmtopng >$@ || { rm -f $@; exit 1; }
+
+smiley.gz:     smiley.png
+               ../splash/splashimg.pl $< | gzip -9 >$@
+
+config:
+               @echo 'Please provide a "config" file.' 1>&2
+               @echo 'See "config.example" for details.' 1>&2
+               @exit 1

Added: trunk/src/host/devirginator/README
===================================================================
--- trunk/src/host/devirginator/README  2007-02-24 05:42:28 UTC (rev 1093)
+++ trunk/src/host/devirginator/README  2007-02-24 07:10:50 UTC (rev 1094)
@@ -0,0 +1,41 @@
+Devirginator
+============
+
+This collection of scripts initializes a "virgin" device. At the moment, this
+goes as far as allowing it to boot into u-boot, from where the rest will be
+done with DFU.
+
+First,
+% cp config.example config
+and may changes as needed. Then
+% make
+This requires Netpbm and transfig. Finally, make sure that openocd runs,
+power device up and run
+% ./devirginate
+
+The first few messages should look like this:
+Open On-Chip Debugger
+> script /home/moko/om/trunk/src/host/devirginator/tmp/script.ocd
+reset halt
+wait_halt
+waiting for target halted...
+Target 0 halted
+target halted in ARM state due to debug request, current mode: Supervisor
+cpsr: 0x400000d3 pc: 0x00000000
+[...]
+
+The "pc: 0x00000000" is important. If the number is different, e.g.,
+something like "pc: 0xffffffed", the device is probably not turned
+on. In this case, you can try to restart, or, if openocd is stuck,
+
+- kill openocd
+- pull and then replace the USB plug of the JTAGkey or debug v2 board
+- start openocd
+
+The whole procedure takes a bit longer than two minutes. Rough timeline
+(numbers are guessed and may be off by some 30 seconds):
+
+00:00  screen goes dark
+00:35  small tux logo with superimposed u-boot version string appears
+02:00  screen briefly goes dark
+02:02  smiley on green background appears

Added: trunk/src/host/devirginator/config.example
===================================================================
--- trunk/src/host/devirginator/config.example  2007-02-24 05:42:28 UTC (rev 
1093)
+++ trunk/src/host/devirginator/config.example  2007-02-24 07:10:50 UTC (rev 
1094)
@@ -0,0 +1,9 @@
+#
+# config - devirginator configuration
+#
+# This is a shell script sourced by "setup.sh".
+#
+
+OPENOCD_HOST=fs
+LOWLEVEL=$OMDIR/u-boot/board/neo1973/lowlevel_foo.bin
+UBOOT=$OMDIR/u-boot/u-boot.bin

Added: trunk/src/host/devirginator/scriptify.pl
===================================================================
--- trunk/src/host/devirginator/scriptify.pl    2007-02-24 05:42:28 UTC (rev 
1093)
+++ trunk/src/host/devirginator/scriptify.pl    2007-02-24 07:10:50 UTC (rev 
1094)
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+#
+# scriptify.pl - Convert a text file to a script image for u-boot's "autoscr"
+#
+# Copyright (C) 2006-2007 by OpenMoko, Inc.
+# Written by Werner Almesberger <[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.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+use Archive::Zip;
+
+while (<>) {
+    s/#.*//;
+    next if /^\s*$/;
+    $cmd .= $_;
+}
+
+$cmd .= pack("c",0);
+$cmd = pack("NN",length $cmd,0).$cmd;
+
+$crc = Archive::Zip::computeCRC32($cmd,0);
+
+$hdr = pack("NNNNNNNcccca32",
+  0x27051956,  # ih_magic (IH_MAGIC)
+  0,           # ih_crc
+  time,        # ih_time
+  length $cmd, # ih_size
+  0,           # ih_load
+  0,           # ih_ep 
+  $crc,                # ih_dcrc
+  17,          # ih_os (IH_OS_U_BOOT)
+  2,           # ih_arch (IH_CPU_ARM)
+  6,           # ih_type (IH_TYPE_SCRIPT)
+  0,           # ih_comp (IH_COMP_NONE)
+  "script");   # ih_name
+
+$crc = Archive::Zip::computeCRC32($hdr,0);
+
+substr($hdr,4,4) = pack("N",$crc);
+
+print $hdr.$cmd;


Property changes on: trunk/src/host/devirginator/scriptify.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/host/devirginator/setup.sh
===================================================================
--- trunk/src/host/devirginator/setup.sh        2007-02-24 05:42:28 UTC (rev 
1093)
+++ trunk/src/host/devirginator/setup.sh        2007-02-24 07:10:50 UTC (rev 
1094)
@@ -0,0 +1,85 @@
+#!/bin/sh -e
+#
+# setup.sh - Set up the devirginator
+#
+# Copyright (C) 2006-2007 by OpenMoko, Inc.
+# Written by Werner Almesberger <[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.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+OPENOCD_HOST=localhost
+OPENOCD_PORT=4444
+UBOOTDIR=${OMDIR:-/home/moko}/u-boot
+LOWLEVEL=$UBOOTDIR/board/neo1973/lowlevel_foo.bin
+UBOOT=$UBOOTDIR/u-boot.bin
+
+. config
+
+cat <<EOF >tmp/script.ocd
+reset halt
+wait_halt
+load_binary $LOWLEVEL 0
+bp 0x33f80000 4 hw
+resume
+wait_halt
+rbp 0x33f80000
+load_binary $UBOOT 0x32000000
+load_binary $PWD/tmp/preboot_override 0x32100000
+load_binary $PWD/tmp/u-boot.out 0x32200000
+load_binary $PWD/tmp/smiley.gz 0x32300000
+mww 0x32000040 0x32100000
+resume 0x32000000
+exit
+EOF
+
+sed 's/#.*//;/^ *$/d' <<EOF | tr '\n' ';' | tr '!' '\000' >tmp/preboot_override
+autoscr 0x32200000!
+EOF
+
+perl ./scriptify.pl u-boot.in >tmp/u-boot.out
+
+export OMDIR
+make smiley.gz
+mv smiley.gz tmp/
+rm -f smiley.png smiley.ppm
+
+cat <<EOF >devirginate
+#!/bin/sh
+# MACHINE-GENERATED. DO NOT EDIT !
+echo ===== STARTING ===========================================================
+{
+    echo script $PWD/tmp/script.ocd
+    sleep 120
+} | telnet $OPENOCD_HOST $OPENOCD_PORT
+echo ===== CONTINUING IN THE BACKGROUND =======================================
+EOF
+chmod +x devirginate
+
+cat <<EOF
+-------------------------------------------------------------------------------
+
+Your devirginator is now ready.
+
+To set up a device,
+
+- connect it to power and JTAG
+- switch it on
+- run ./devirginate
+- wait until the smiley appears (takes about one minute)
+
+-------------------------------------------------------------------------------
+EOF


Property changes on: trunk/src/host/devirginator/setup.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/host/devirginator/smiley.fig
===================================================================
--- trunk/src/host/devirginator/smiley.fig      2007-02-24 05:42:28 UTC (rev 
1093)
+++ trunk/src/host/devirginator/smiley.fig      2007-02-24 07:10:50 UTC (rev 
1094)
@@ -0,0 +1,13 @@
+#FIG 3.2
+Landscape
+Center
+Inches
+Letter  
+100.00
+Single
+-2
+1200 2
+5 1 0 10 0 0 50 0 -1 0.000 0 1 0 0 5100.000 3975.000 4200 3975 5100 4875 6000 
3975
+1 3 0 0 0 0 50 0 20 0.000 1 0.0000 4500 3375 225 225 4500 3375 4725 3375
+1 3 0 10 0 0 50 0 -1 0.000 1 0.0000 5100 3900 1500 1500 5100 3900 6600 3900
+1 3 0 0 0 0 50 0 20 0.000 1 0.0000 5700 3375 225 225 5700 3375 5925 3375

Added: trunk/src/host/devirginator/u-boot.in
===================================================================
--- trunk/src/host/devirginator/u-boot.in       2007-02-24 05:42:28 UTC (rev 
1093)
+++ trunk/src/host/devirginator/u-boot.in       2007-02-24 07:10:50 UTC (rev 
1094)
@@ -0,0 +1,45 @@
+#
+# Initial setup of a "virgin" device.
+#
+# Note that this yields a fairly unusual setup. The main goal is to prepare for
+# uploading the rest through DFU (JTAG would be far too slow for this), or any
+# interactive testing one may wish to do.
+#
+
+# we're non-interactive
+
+setenv dontask y
+
+# remove any pre-existing bad block table and create a new one
+
+nand scrub 0x3ff0000 0x10000
+nand createbbt
+
+# create the partition table
+
+dynpart
+
+# unset preboot command
+
+mw.l 0x32000040 0 1
+
+# write u-boot
+
+nand write.e 0x32000000 u-boot 0x40000
+
+# set up the pre-DFU environment (604800 seconds is one week)
+
+dynenv set u-boot_env
+setenv bootcmd
+setenv bootdelay 604800
+setenv splashimage nand read.e 0x32000000 splash 0x1000\; unzip 0x32000000 
0x33d00000 0x96000
+setenv usbtty cdc_acm
+saveenv
+
+# write the smiley last
+
+nand write.e 0x32300000 splash 0x1000
+
+# reset to get the smiley
+
+reset




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

Reply via email to