You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(79) |
Aug
(27) |
Sep
(64) |
Oct
(202) |
Nov
(31) |
Dec
(59) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(125) |
Feb
(173) |
Mar
(13) |
Apr
(140) |
May
(75) |
Jun
(1) |
Jul
(37) |
Aug
(14) |
Sep
|
Oct
(20) |
Nov
(9) |
Dec
(2) |
2003 |
Jan
(51) |
Feb
(12) |
Mar
(18) |
Apr
(24) |
May
(1) |
Jun
|
Jul
|
Aug
(72) |
Sep
(12) |
Oct
(18) |
Nov
(60) |
Dec
(26) |
2004 |
Jan
(1) |
Feb
(40) |
Mar
(3) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(5) |
2006 |
Jan
(13) |
Feb
(5) |
Mar
(8) |
Apr
(13) |
May
(7) |
Jun
(6) |
Jul
(10) |
Aug
(6) |
Sep
(6) |
Oct
(35) |
Nov
(20) |
Dec
(10) |
2007 |
Jan
(13) |
Feb
(9) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(54) |
Jun
(78) |
Jul
(35) |
Aug
(21) |
Sep
(21) |
Oct
(29) |
Nov
(10) |
Dec
(5) |
2010 |
Jan
|
Feb
|
Mar
(26) |
Apr
(55) |
May
(73) |
Jun
(63) |
Jul
(38) |
Aug
(39) |
Sep
(19) |
Oct
(2) |
Nov
(1) |
Dec
(1) |
2011 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Stefan E. <se...@us...> - 2002-05-02 15:24:23
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv16462 Modified Files: tar.c Log Message: - use generic io framework to provide a tar reader w/o actually knowing where the data comes from. Index: tar.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/tar.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tar.c 26 Apr 2002 18:24:54 -0000 1.1 +++ tar.c 2 May 2002 15:24:21 -0000 1.2 @@ -20,6 +20,10 @@ * $Id$ * * $Log$ + * Revision 1.2 2002/05/02 15:24:21 seletz + * - use generic io framework to provide a tar reader w/o actually knowing + * where the data comes from. + * * Revision 1.1 2002/04/26 18:24:54 seletz * - first revision of minimal tar archive support. * - this module will be used to get a blob/ramdisk/kernel @@ -59,6 +63,8 @@ #include <blob/util.h> #include <blob/command.h> +#include <blob/init.h> +#include <blob/generic_io.h> #include <blob/tar.h> /********************************************************************** @@ -83,6 +89,7 @@ static char module_version[] = "$Id$"; + /********************************************************************** * static functions */ @@ -95,61 +102,137 @@ static int tar_hdr_fsize_get( tar_hdr_posix_t *hdr, unsigned long *size ); static int tar_from_oct( unsigned char *start, size_t digits, unsigned long *value ); +/* io driver stuff */ +int tar_io_conf( io_driver_t * io, void *conf ); +int tar_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); +int tar_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); + /**********************************************************************/ /**********************************************************************/ /**********************************************************************/ -/* simple memory block getter */ -int mem_block_get( unsigned char *buffer, void *priv ) +/* set debug level */ +void tar_dbg_set( int lvl ) { - struct mem *mp= (struct mem *)priv; + tar_dbg = lvl; +} - DBG( 15, "%s: priv=%p\n", __FUNCTION__, priv ); +/********************************************************************** + * io driver for tar archives + */ +void init_tar_default_io( void ) +{ + int ret; + static io_driver_t def_tar_io_driver; + static tar_arch_t def_tar_arch; - if ( !mp ) + tar_dbg_set(0); + + /* init default tar drv */ + ret = tar_io_init( &def_tar_io_driver, &def_tar_arch ); + if ( ret ) return; + + ret = io_register( &def_tar_io_driver, "TAR" ); + if ( ret ) return; +} +__initlist(init_tar_default_io, INIT_LEVEL_OTHER_STUFF + 2); + +int tar_io_init( io_driver_t *io, tar_arch_t *arch ) +{ + if ( !io || !arch ) return -EINVAL; - if ( !mp->curr ) - mp->curr=mp->start; + DBG( 5, "%s: driver=%p, arch=%p\n", __FUNCTION__, + driver, arch ); - DBG( 15, "%s: start=%p, curr=%p\n", __FUNCTION__, - mp->start, mp->curr ); + io->conf = tar_io_conf; + io->read = tar_io_read; + io->write = tar_io_write; + io->private_data = (void *)arch; - memcpy( buffer, mp->curr, 512 ); - mp->curr += 512; + /* filled by configure */ + io->io_size = 0; + + /* filled for us by io_chain() */ + io->child_io = NULL; return 0; } -/* memory block reset */ -int mem_block_reset( void *priv ) +/* the user gives us a filename in conf */ +int tar_io_conf( io_driver_t * io, void *conf ) { - struct mem *mp= (struct mem *)priv; + int ret; + char *name; + io_driver_t *child; + tar_arch_t *arch; - DBG( 15, "%s: priv=%p\n", __FUNCTION__, priv ); + DBG( 5, "%s: io=%p, conf=%p\n", __FUNCTION__, + io, conf ); - if ( !mp ) + if ( !io || !conf ) return -EINVAL; - DBG( 15, "%s: start=%p, curr=%p\n", __FUNCTION__, - mp->start, mp->curr ); + arch = (tar_arch_t*)io->private_data; + if ( !arch ) + return -EINVAL; - mp->curr=mp->start; + child = io_get_child( io ); + if ( !child ) + return -EINVAL; + + name = (char *)conf; + + /* init new archive struct */ + ret = tar_init( arch, child ); + if ( ret ) + return -EINVAL; + + /* try to find file */ + ret = tar_file_search( arch, name ); + if ( ret ) + return -EINVAL; + + /* set io_size to filesize */ + io->io_size = arch->f_size; return 0; } -/* set debug level */ -void tar_dbg_set( int lvl ) +int tar_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) { - tar_dbg = lvl; + io_driver_t *child; + tar_arch_t *arch; + u32 offset; + + arch = (tar_arch_t*)io->private_data; + if ( !arch ) + return -EINVAL; + + child = io_get_child( io ); + if ( !child ) + return -EINVAL; + + offset = arch->f_start_block*512; + + DBG( 3, "%s: dest=%p, src=%p(=%p), amount=%d, child=%p\n", __FUNCTION__, + dest, src, (char *)((u32)src + offset), amount, child ); + + return io_read(dest, (unsigned char *)(offset + (u32)src), amount, child ); } +int tar_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) +{ + return -EINVAL; +} + +/********************************************************************** + * TAR functions + */ /* init archive struct */ -int tar_init( tar_arch_t *arch, block_get_fn get, block_reset_fn reset, void *priv ) +int tar_init( tar_arch_t *arch, io_driver_t *io ) { - DBG( 1, "%s: arch=%p, get=%p, reset=%p, priv=%p\n", __FUNCTION__, - arch, get, reset, priv ); + DBG( 1, "%s: arch=%p, io=%p\n", __FUNCTION__, arch, io ); DBG( 1, "tar: version %s\n", module_version ); @@ -157,11 +240,10 @@ return -EINVAL; } - arch->block_get = get; - arch->block_reset=reset; - arch->block_get_priv = priv; - arch->size=0l; - arch->blocks=0l; + arch->io_driver=io; + arch->block = 0; + arch->f_size=0l; + arch->f_blocks=0l; arch->filename[0]=0; return 0; @@ -180,11 +262,7 @@ return -EINVAL; /* reset to block 0 */ - ret = arch->block_reset( arch->block_get_priv ); - if ( ret ) { - printf( "tar: cant reset to block 0: %d\n", ret ); - return ret; - } + arch->block = 0; while ( !fini ) { ret = tar_fileinfo_get( arch ); @@ -197,8 +275,8 @@ printf( "%s %ld bytes, %d blocks\n", arch->filename, - arch->size, - arch->blocks ); + arch->f_size, + arch->f_blocks ); /* skip file */ ret = tar_skip_file( arch ); @@ -225,11 +303,7 @@ return -EINVAL; /* reset to block 0 */ - ret = arch->block_reset( arch->block_get_priv ); - if ( ret ) { - printf( "tar: cant reset to block 0: %d\n", ret ); - return ret; - } + arch->block = 0; ret = tar_file_search( arch, filename ); if ( ret ) { @@ -246,7 +320,7 @@ } printf( "tar: extracted file '%s', %ld bytes (%d blocks).\n", - arch->filename, arch->size, arch->blocks ); + arch->filename, arch->f_size, arch->f_blocks ); return 0; } @@ -275,8 +349,8 @@ DBG( 5, "%s %ld bytes, %d blocks\n", arch->filename, - arch->size, - arch->blocks ); + arch->f_size, + arch->f_blocks ); if ( strncmp( arch->filename, file, 255 ) == 0 ) { found = 1; @@ -297,23 +371,13 @@ /* skip to next file, if any */ static int tar_skip_file( tar_arch_t *arch ) { - int ret = 0; - int block; - DBG( 1, "%s: arch=%p\n", __FUNCTION__, arch ); if ( !arch ) return -EINVAL; /* skip data */ - for ( block=0; block<arch->blocks; block++ ) { - ret = arch->block_get( arch->buffer, arch->block_get_priv ); - if ( ret ) { - printf( "tar: cant get block %d: %d\n", block, ret ); - return ret; - } - } - + arch->block += arch->f_blocks; return 0; } @@ -321,7 +385,6 @@ static int tar_xtract_blocks( tar_arch_t *arch, char *dest ) { int ret = 0; - int block; unsigned long size; DBG( 1, "%s: arch=%p, dest=%p\n", __FUNCTION__, arch, dest ); @@ -329,30 +392,13 @@ if ( !arch || !dest ) return -EINVAL; - size = arch->size; + size = arch->f_size; if ( !size ) return -EINVAL; - /* extract data */ - for ( block=0; block<arch->blocks; block++ ) { - ret = arch->block_get( arch->buffer, arch->block_get_priv ); - if ( ret ) { - printf( "tar: cant get block %d: %d\n", block, ret ); - return ret; - } - - DBG( 5, "%s: %ld bytes to go\n", __FUNCTION__, size ); - - if ( size>512 ) { - memcpy( dest, arch->buffer, 512 ); - size -= 512; - dest += 512; - } else { - memcpy( dest, arch->buffer, size ); - dest += size; - } - - } + ret = io_read( dest, (unsigned char*)(arch->f_start_block*512), arch->f_size, arch->io_driver ); + if ( ret ) + return ret; return 0; } @@ -367,11 +413,12 @@ return -EINVAL; /* get header */ - ret = arch->block_get( arch->buffer, arch->block_get_priv ); + ret = io_read( arch->buffer, (unsigned char *)(arch->block*512), 512, arch->io_driver ); if ( ret ) { printf( "tar: cant get block: %d\n", ret ); goto DONE; } + arch->block++; /* and decode infos */ phdr = (tar_hdr_posix_t*)arch->buffer; @@ -382,16 +429,17 @@ goto DONE; } - ret = tar_hdr_fsize_get( phdr, &arch->size ); + ret = tar_hdr_fsize_get( phdr, &arch->f_size ); if ( ret ) { printf( "tar: cant decode file size: %d\n", ret ); ret = ret; goto DONE; } - arch->blocks = (arch->size/512) + (arch->size%512?1:0); + arch->f_start_block = arch->block; + arch->f_blocks = (arch->f_size/512) + (arch->f_size%512?1:0); printf( "tar: %s %ld bytes, %d blocks\n", phdr->name, - arch->size, arch->blocks ); + arch->f_size, arch->f_blocks ); strncpy( arch->filename, phdr->name, 100 ); arch->filename[100] = 0; @@ -400,8 +448,9 @@ DONE: /* reset fileinfos on error */ if ( ret ) { - arch->size=0; - arch->blocks=0; + arch->f_size=0; + arch->f_start_block = 0; + arch->f_blocks=0; arch->filename[0]=0; } return ret; |
From: Stefan E. <se...@us...> - 2002-05-02 15:23:03
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv16161 Modified Files: tar.h Log Message: - use generic io framework Index: tar.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/tar.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tar.h 26 Apr 2002 18:25:19 -0000 1.1 +++ tar.h 2 May 2002 15:23:01 -0000 1.2 @@ -233,35 +233,31 @@ /* End of Format description. */ -/* a function which knows how to get blocks for our archive */ -typedef int (*block_get_fn)( unsigned char buffer[512], void *priv_data ); -/* a function which "rewinds" to block 0 */ -typedef int (*block_reset_fn)( void *priv_data ); - typedef struct { - /* block getter functions & data */ - block_get_fn block_get; - block_reset_fn block_reset; - void *block_get_priv; + /* io driver to get data from */ + io_driver_t *io_driver; + /* current block */ + int block; + /* block buffer */ unsigned char buffer[512]; + /* file infos */ + int f_start_block; char filename[255]; - unsigned long size; - int blocks; + unsigned long f_size; + int f_blocks; } tar_arch_t; -struct mem { - unsigned char *start; - unsigned char *curr; -}; - -int mem_block_get( unsigned char *buffer, void *priv ); -int mem_block_reset( void *priv ); - void tar_dbg_set( int lvl ); -int tar_init( tar_arch_t *arch, block_get_fn get, block_reset_fn reset, void *priv ); +int tar_init( tar_arch_t *arch, io_driver_t *io ); int tar_tell( tar_arch_t *arch ); int tar_xtract( tar_arch_t *arch, char *filename, char *dest ); + +/********************************************************************** + * io driver for tar archives + */ +int tar_io_init( io_driver_t *io, tar_arch_t *arch ); +int tar_io_conf( io_driver_t *io, void *conf ); #endif |
From: Stefan E. <se...@us...> - 2002-05-02 15:22:39
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv15918 Added Files: generic_io.h Log Message: - header file for generic io framework --- NEW FILE: generic_io.h --- /* generic_io.h - generic io interface * * Copyright (C) 2002, Stefan Eletzhofer <ste...@el...> * * 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 * * $Id: generic_io.h,v 1.1 2002/05/02 15:22:36 seletz Exp $ */ #ifndef BLOB_GENERIC_IO_H #define BLOB_GENERIC_IO_H 1 /* BLOB io abstraction module ~~~~~~~~~~~~~~~~~~~~~~~~~~ Why do I think that this is necessary? --------------------------------------- Please consider the following scenario: A ARM-Linux powered device gets developed, produced and delivered to many customers. As usual, system updates are necessary at some point in the future. System updates should be fool-proof and easy to perform, w/o JTAG cables, computers and so on. One possible solution: A CF card contains a filesystem on a partition. There are several files on this partition/filesystem: - blob - zImage - initrd.gz - cramfs.img This (special) CF card contains thus all necessary files for a complete system update (or recovery). The end-user of our new arm-powered linux device now only has to plug in the CF card, reset the device and blob does the rest: 1) detect a system update CF card (i.e. searches for a special file or a special magic number) 2) perhaps verifies somehow the contents (md5 sums etc.) 3) reflashes all images stored on the CF card to the internal flash 4) marks the CF card as "already used" somehow (by writing some file, deleting the images, etc. ) 5) reboots the system So, all in all what I want is: - have the internal flash memory partitionized. Each partition has a "sane" name, i.e. "blob", "kernel", "initrd" and so on. - I want to be able to reflash each partition using blob - I want to have several FS options to access my CF card, i.e. FAT fs (easy to use for customers), CRAMFS (code already there), raw TAR file access (uncompressed, code here. useful for updates per tftp and xmodem downloads). - I want to have access to CF cards, network devices (tftp) - I want to have the code modules nicely separated How do I want o archieve this? ------------------------------ For the above scenario to become reality one needs to: - supply several FS access modules (some people want to have a FAT filesystem on the update device, some like cramfs, and some raw TAR archives containing the update images). - provide several different "update devices" i.e. CF cards, memory (i.e. downloaded files), network interfaces (tftp). - provide access to the internal flash memory The code below tries to supply a abstraction layer such that for example the filesystem code does not need to know how to access the update device, the partition code does not need how to access the CF card or the internal flash memory. With this library it should be possible to implement the update scenario in a clean way. [CF Card]--ide cf access-->[Partition code]--partition access--+ | +------------------------------------------------------------+ | +->[FS code]--file access-->[Partition code]-->[flash code] [] are io "drivers". They know how to read/write on their abstraction levels, i.e. the partition "io driver" knows how to read partition data The io drivers are chained, from highest abstraction (file access) down to the lowest abstraction (raw flash read/write, CF IDE reads). */ #define IO_NAME_LEN 32 #define IO_MAX_DRIVER 16 struct _io_def; /* io_init_func - initialize private data * * This function configures the io driver * * driver: the driver struct * init_data: data the driver needs to init * */ typedef int (*io_configure_func)( struct _io_def *driver, void *init_data ); /* read_func - generic io function type * * This function reads data "out" of the driver * * dest: where to write the data to * src: where to read from * amount: how much to read * driver: the driver struct * */ typedef int (*io_read_func)( unsigned char *dest, unsigned char *src, size_t amount, struct _io_def *driver ); /* write_func - generic io function type * * This function writes data "into" the driver * * dest: where to write the data to * src: where to read from * amount: how much to read * driver: the driver struct * */ typedef int (*io_write_func)( unsigned char *dest, unsigned char *src, size_t amount, struct _io_def *driver ); typedef struct _io_def { /* driver subfunctions, see below */ io_configure_func conf; io_read_func read; io_write_func write; /* driver's private data */ void *private_data; /* io size in bytes */ size_t io_size; /* child io driver, if any */ struct _io_def *child_io; /* driver's name */ char name[IO_NAME_LEN]; } io_driver_t; void io_dbg_set( int lvl ); /* io_init - initialize generic io module */ void io_init( void ); /* io_register - register a new io. * * io: the io to register * name: the io's name */ int io_register( io_driver_t *io, char *name ); /* io_configure - configures io driver * * io: the io "driver" * conf_data: the configuration data */ int io_configure( io_driver_t *io, void *conf_data ); /* io_get_byname - get a io by its name * * name: the searched io's name */ io_driver_t *io_get_byname( char *name ); /* io_chain_driver - chain io drivers * * parent: parent driver * new_child: new child driver */ int io_chain_driver( char *parent, char *new_child ); /* io_read - read data using io rd * * dest: destination address * src: source address * amount: amount to read */ int io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *rd ); /* io_write - write data using io rd * * dest: destination address * src: source address * amount: amount to read */ int io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *rd ); /* io_copy - copy data * * Copy data from io driver "src" to io driver "dest". Copy * "amount" bytes of data. * * dest: destination io driver * src: source io driver * amount: amount to copy */ int io_copy( io_driver_t *dest, io_driver_t *src, size_t amount ); /* FIXME: static inline functions instead of macros */ #define io_get_name( io ) ((io)->name) #define io_get_size( io ) ((io)->io_size) #define io_get_child( io) ((io)->child_io) /********************************************************************** * RAM io driver */ typedef struct ram_io { u32 start; u32 len; u32 pos; } ram_io_t; int ram_io_init( io_driver_t *io, ram_io_t *ram ); int ram_io_conf( io_driver_t *io, void *conf ); #define BLOB_GENERIC_IO_H 1 #endif |
From: Stefan E. <se...@us...> - 2002-05-02 15:22:10
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv13320a Added Files: generic_io.c Log Message: - generic io framework - this tries to add a generic io framework. io "drivers" for a memory pool included. Why do i need this? Well, i want to have CF, Flash, Memory, filesystem and tar file access separated from each other. Please have a look at generic_io.h, system3.c::iotest(), and tar.c (now also using the generic io framework) --- NEW FILE: generic_io.c --- /********************************************************************** * generic_io.c * * generic io abstraction * * Copyright (C) 2002, Stefan Eletzhofer <ste...@el...> * * 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 * * $Id: generic_io.c,v 1.1 2002/05/02 15:22:07 seletz Exp $ * * $Log: generic_io.c,v $ * Revision 1.1 2002/05/02 15:22:07 seletz * - generic io framework * - this tries to add a generic io framework. io "drivers" for * a memory pool included. * Why do i need this? Well, i want to have CF, Flash, Memory, filesystem * and tar file access separated from each other. Please have a look at * generic_io.h, * system3.c::iotest(), * and tar.c (now also using the generic io framework) * * Revision 1.4 2002/04/27 04:59:59 timriker * turn on ide and pcmcia again, fix pcmcia compiles (but not features) for non sa1111 systems * * Revision 1.3 2002/04/26 09:22:05 seletz * - added original copyright from Brad Parker * - corrected EMAIL addr * * Revision 1.2 2002/04/24 14:27:08 seletz * - first round of bugfixing. Now at last one can read 512 byte sectors * of a CF in true-ide mode. See system3.c::pcmciatest(). * * Still WIP. YMMV, and so on.... * * Revision 1.1 2002/04/18 19:52:49 seletz * - Added PCMCIA and IDE framework. Based on Brad Parker's code. * NOTE NOTE NOTE: * This is all Work-In-Progress (you have been warned) * */ /********************************************************************** * Includes */ #ifdef HAVE_CONFIG_H # include <blob/config.h> #endif #include <blob/types.h> #include <blob/errno.h> #include <blob/util.h> #include <blob/command.h> #include <blob/time.h> #include <blob/serial.h> #include <blob/arch.h> #include <blob/init.h> #include <blob/generic_io.h> /********************************************************************** * Defines / Makros */ #define IO_MODULE_TEST 1 #define IO_DEBUG 1 #ifdef IO_DEBUG # define DBG( x, args... ) if ( io_dbg>x ) printf( args ) #else # define DBG( x, args... ) #endif /********************************************************************** * Typen */ /********************************************************************** * Programmglobale Variable */ /********************************************************************** * Modulglobale Variable */ static char *module_version = "$Id: generic_io.c,v 1.1 2002/05/02 15:22:07 seletz Exp $"; #ifdef IO_DEBUG static int io_dbg = 1; #else static int io_dbg = 0; #endif static io_driver_t *drivers[IO_MAX_DRIVER]; /********************************************************************** * Prototypen */ static int ram_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); static int ram_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); /********************************************************************** * Exported functions */ void io_dbg_set( int lvl ) { io_dbg = lvl; } void io_init( void ) { int i; for ( i=0; i<IO_MAX_DRIVER;i++) drivers[i] = NULL; return; } __initlist(io_init, INIT_LEVEL_OTHER_STUFF + 1); int io_register( io_driver_t *io, char *name ) { int i; if ( !io || !name ) return -EINVAL; for ( i=0; i<IO_MAX_DRIVER;i++) { if (!drivers[i]) break; } if ( i==IO_MAX_DRIVER) return -EINVAL; drivers[i]=io; strncpy( io->name, name, IO_NAME_LEN ); DBG( 1, "%s: driver '%s' registered #%d.\n", __FUNCTION__, name, i ); return 0; } int io_configure( io_driver_t *io, void *conf_data ) { if ( !io ) return -EINVAL; if (io->conf ) return io->conf( io, conf_data ); return 0; } io_driver_t *io_get_byname( char *name ) { int i; if ( !name ) return NULL; for ( i=0; i<IO_MAX_DRIVER;i++) { if (drivers[i]) { DBG( 1, "%s: #%d '%s'\n", __FUNCTION__, i, io_get_name( drivers[i] ) ); if ( strncmp( io_get_name( drivers[i] ), name, IO_NAME_LEN ) == 0 ) return drivers[i]; } } return NULL; } int io_chain_driver( char *parent, char *new_child ) { io_driver_t *p, *c; if ( !parent || !new_child ) return -EINVAL; p = io_get_byname( parent ); if ( !p ) return -EINVAL; c = io_get_byname( new_child ); if ( !c ) return -EINVAL; DBG( 1, "%s: chained Parent '%s' -> child '%s'.\n", __FUNCTION__, io_get_name( p ), io_get_name( c ) ); p->child_io = c; return 0; } int io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *rd ) { if ( !rd || !rd->read ) return -EINVAL; /* FIXME: check bounds */ return rd->read( dest, src, amount, rd ); } int io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *rd ) { if ( !rd|| !rd->write ) return -EINVAL; /* FIXME: check bounds */ return rd->write( dest, src, amount, rd ); } int io_copy( io_driver_t *dest, io_driver_t *src, size_t amount ) { static unsigned char buffer[512]; int ret = 0; int blocks, block, to_copy; unsigned char *adr = NULL; if ( !dest || !src ) return -EINVAL; blocks = amount / 512 + (amount%512?1:0); DBG( 1, "%s: %d blocks (%d bytes) to copy.\n", __FUNCTION__, blocks, amount ); for ( block=0; block<blocks; block++ ) { if ( amount > 512 ) { to_copy = 512; } else { to_copy = amount; } DBG( 1, "%s: block %d/%d (%d bytes)\n", __FUNCTION__, block, blocks, to_copy ); /* read from source */ ret = io_read( buffer, adr, to_copy, src ); if ( ret ) { DBG( 1, "%s: read failed at block %d (adr %p).\n", __FUNCTION__, block, adr ); return -EINVAL; } /* write to dest */ ret = io_write( adr, buffer, to_copy, dest ); if ( ret ) { DBG( 1, "%s: write failed at block %d (adr %p).\n", __FUNCTION__, block, adr ); return -EINVAL; } amount -= to_copy; adr += to_copy; } return 0; } /********************************************************************** * A simple RAM driver */ void init_ram_default_io( void ) { int ret; static ram_io_t ram0, ram1; static io_driver_t io_ram0, io_ram1; ram0.start=0xd0000000; ram0.len=8*1024*1024; ram0.pos=0; ram1.start=0xd0800000; ram1.len=8*1024*1024; ram1.pos=0; ret = ram_io_init( &io_ram0, &ram0 ); if ( ret ) return; ret = ram_io_init( &io_ram1, &ram1 ); if ( ret ) return; ret = io_register( &io_ram0, "RAM0" ); if ( ret ) return; ret = io_register( &io_ram1, "RAM1" ); if ( ret ) return; } __initlist(init_ram_default_io, INIT_LEVEL_OTHER_STUFF + 2); int ram_io_init( io_driver_t *io, ram_io_t *ram ) { if ( !io || !ram ) return -EINVAL; io->private_data = (void *)ram; io->io_size = ram->len - ram->pos; io->conf = ram_io_conf; io->read = ram_io_read; io->write = ram_io_write; io->child_io = NULL; return 0; } int ram_io_conf( io_driver_t * io, void *conf ) { ram_io_t *ram; if ( !io || !conf ) return -EINVAL; ram = (ram_io_t*)io->private_data; if ( !ram ) return -EINVAL; if ( (u32)conf >= ram->len ) return -EINVAL; ram->pos = (u32)conf; io->io_size = ram->len - (u32)ram->pos; return 0; } static int ram_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) { u32 offset; ram_io_t *ram; DBG( 1, "%s: dest=%p, src=%p, amount=%d, io=%p\n", __FUNCTION__, dest, src, amount, io ); if ( !io || !dest ) return -EINVAL; ram = (ram_io_t*)io->private_data; if ( !ram ) return -EINVAL; offset = ram->start + (u32)ram->pos; DBG( 1, "%s: dest=%p, src=%p(=%p), amount=%d, io=%p\n", __FUNCTION__, dest, src, (void*)(src +offset), amount, io ); memcpy( dest, (void *)(offset + (u32)src), amount); return 0; } static int ram_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) { u32 offset; ram_io_t *ram; if ( !io || !src ) return -EINVAL; ram = (ram_io_t*)io->private_data; if ( !ram ) return -EINVAL; offset = ram->start + (u32)ram->pos; DBG( 1, "%s: dest=%p(=%p), src=%p, amount=%d, io=%p\n", __FUNCTION__, dest, (void*)(dest +offset), src, amount, io ); memcpy((void *)(offset + (u32)dest), src, amount); return 0; } #if defined(IO_MODULE_TEST) /********************************************************************** * module test function */ int io_test( void ) { int ret = 0; io_driver_t *io0, *io1; DBG( 1, "%s: version %s\n", __FUNCTION__, module_version ); io0 = io_get_byname( "RAM0" ); if ( ret ) return -EINVAL; io1 = io_get_byname( "RAM1" ); if ( ret ) return -EINVAL; ret = io_copy( io1, io0, 768 ); if ( ret ) return -EINVAL; return 0; } #endif |
From: Tim R. <Ti...@Ri...> - 2002-05-02 04:21:05
|
ugh. my bad. I needed that second set of eyes. I was thinking the my "load kernel" was the same as "reload kernel" not a truncated version of my test "loadkernel" command. Very sorry, but thanx for the info! I fixed it up. Tell me if you still ahve issues. Christopher Hoover wrote: > > > are you sure you do not have jffs2, cramfs or zimage turned on? > > I'm sure. > > > "load kernel" should still load a kernel from your flash partition no? > > Nope. > > blob> load kernel > *** invalid command > blob> > > -ch > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > blob-cvs-commit mailing list > blo...@li... > https://lists.sourceforge.net/lists/listinfo/blob-cvs-commit -- Tim Riker - http://rikers.org/ - short SIGs! <g> All I need to know I could have learned in Kindergarten ... if I'd just been paying attention. |
From: Tim R. <tim...@us...> - 2002-05-02 04:17:01
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv1097/utils/test Modified Files: Makefile.am Log Message: fix "reload kernel" for non-jffs2 systems Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/utils/test/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.am 30 Apr 2002 23:31:31 -0000 1.5 +++ Makefile.am 2 May 2002 04:16:58 -0000 1.6 @@ -10,6 +10,7 @@ md5support.o \ mini_inflate.o \ error.o \ +flash.o \ util.o \ jffs2.o \ compr_rtime.o \ @@ -24,6 +25,7 @@ md5support.c \ mini_inflate.c \ error.c \ +flash.c \ util.c \ jffs2.c \ compr_rtime.c \ |
From: Tim R. <tim...@us...> - 2002-05-02 04:17:01
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv1097/src/blob Modified Files: flash.c load_kernel.c main.c Log Message: fix "reload kernel" for non-jffs2 systems Index: flash.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/flash.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- flash.c 30 Apr 2002 23:28:47 -0000 1.16 +++ flash.c 2 May 2002 04:16:58 -0000 1.17 @@ -336,6 +336,14 @@ } +/* given an address, return the size of that flash block */ +int flash_get_block_size(u32 address) +{ + int block = find_block(address); + if (block == -ERANGE) + return 0; + return flash_blocks[block].size; +} /* convert address range to range of flash blocks. returns 0 on Index: load_kernel.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/load_kernel.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- load_kernel.c 1 May 2002 00:02:10 -0000 1.7 +++ load_kernel.c 2 May 2002 04:16:58 -0000 1.8 @@ -38,6 +38,7 @@ #include <blob/error.h> #include <blob/load_kernel.h> #include <blob/util.h> +#include <blob/flash.h> #ifdef CONFIG_CRAMFS_SUPPORT extern struct kernel_loader cramfs_load; @@ -73,13 +74,22 @@ printf("."); } -int load_kernel_part(blob_status_t *blob_status, struct part_info *part) +int load_kernel(blob_status_t *blob_status) { int i; u32 size; - u32 digest[4]; + struct part_info part; - for (i = 0; loader[i] && !loader[i]->check_magic(part); i++) +#if defined(CONFIG_CRAMFS_SUPPORT) || defined(CONFIG_ZIMAGE_SUPPORT) || defined(CONFIG_JFFS2_SUPPORT) + part.offset = (char *) RAMDISK_FLASH_BASE; + part.size = RAMDISK_FLASH_LEN; +#else + part.offset = (char *) KERNEL_FLASH_BASE; + part.size = KERNEL_FLASH_LEN; +#endif + part.erasesize = flash_get_block_size(part.offset); + + for (i = 0; loader[i] && !loader[i]->check_magic(&part); i++) ; if (!loader[i]) { @@ -90,7 +100,7 @@ } else { printf("loading kernel from %s ...", loader[i]->name); if ((size = loader[i]->load_kernel((u32 *)KERNEL_RAM_BASE, - part, "/boot/linux")) == 0) { + &part, "/boot/linux")) == 0) { eprintf("error loading kernel!\n"); return(EINVAL); } @@ -102,47 +112,3 @@ printf("loaded 0x%08x (%d) bytes\n", size, size); return(ENOERROR); } - -int load_kernel(blob_status_t *blob_status) -{ - struct part_info part; - -/* FIXME this is hardcoded, should use flash[].size */ -#define MAIN_BLOCK_SIZE 2 * 64 * 1024 - part.erasesize = MAIN_BLOCK_SIZE; - part.size = KERNEL_FLASH_LEN; - part.offset = (char *) KERNEL_FLASH_BASE; - - return load_kernel_part(blob_status, &part); -} - -#if defined(CONFIG_CRAMFS_SUPPORT) || defined(CONFIG_ZIMAGE_SUPPORT) || defined(CONFIG_JFFS2_SUPPORT) -static int loadkernel_cmd(int argc, char *argv[]) -{ - struct part_info part; - static blob_status_t blob_status; - -/* FIXME this is hardcoded, should use flash[].size */ -#define RAMDISK_BLOCK_SIZE 2 * 64 * 1024 - part.erasesize = RAMDISK_BLOCK_SIZE; - part.size = RAMDISK_FLASH_LEN; - part.offset = (char *) RAMDISK_FLASH_BASE; - blob_status.kernelSize = 0; - return load_kernel_part(&blob_status, &part); -} - -static char loadkernel_help[] = "loadkernel\n" -"Use dynamic methods: " -#ifdef CONFIG_CRAMFS_SUPPORT -"cramfs " -#endif -#ifdef CONFIG_ZIMAGE_SUPPORT -"zImage " -#endif -#ifdef CONFIG_JFFS2_SUPPORT -"jffs2 " -#endif -"to load the kernel from ramdisk\n"; - -__commandlist(loadkernel_cmd, "loadkernel", loadkernel_help); -#endif Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/main.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- main.c 1 May 2002 08:58:04 -0000 1.48 +++ main.c 2 May 2002 04:16:58 -0000 1.49 @@ -129,8 +129,7 @@ /* Load kernel and ramdisk from flash to RAM */ do_reload("blob"); - /* do_reload("kernel"); does not work for jffs2 but the next line does?!? TimRiker */ - parse_command("load kernel"); + do_reload("kernel"); if(blob_status.load_ramdisk) do_reload("ramdisk"); |
From: Tim R. <tim...@us...> - 2002-05-02 04:17:01
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv1097/include/blob Modified Files: flash.h Log Message: fix "reload kernel" for non-jffs2 systems Index: flash.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/flash.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- flash.h 13 Feb 2002 00:06:11 -0000 1.10 +++ flash.h 2 May 2002 04:16:58 -0000 1.11 @@ -96,5 +96,6 @@ int flash_get_first_block_address(u32 *addr); int flash_get_next_block_address(u32* addr, u32 current); +int flash_get_block_size(u32 address); #endif |
From: Christopher H. <ch...@us...> - 2002-05-02 01:45:42
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv1968/src/blob Modified Files: badge4.c Log Message: working version that does the sdram/cpld/spd dance properly Index: badge4.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/badge4.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- badge4.c 27 Apr 2002 00:55:04 -0000 1.7 +++ badge4.c 2 May 2002 01:45:39 -0000 1.8 @@ -36,10 +36,12 @@ #include <blob/i2c-gpio.h> #include <blob/spd.h> +#define DEBUG + static struct i2c_bus_gpio_private badge4_i2c_bus_gpio_private = { sda_gpio: BADGE4_GPIO_SDSDA, scl_gpio: BADGE4_GPIO_SDSCL, - delay: 1000 + delay: 100 }; static struct i2c_bus badge4_i2c_bus = { @@ -120,38 +122,42 @@ */ } -static inline int spd_byte(int addr) -{ - return i2c_read_device_byte_at(&badge4_i2c_bus, SPD_I2C_ADDR(0), addr); -} - static void badge4_setup_sdram(void) { int i, size; int typ0, typ1; int memory_type, row_bits, col_bits, row_density; + u8 spd[128]; + + printf("\n\n\n" BOARD_NAME "\n" + "Blob port by Christopher Hoover <ch...@hp...>\n\n"); /* Intialize the I2C bus and driver. */ i2c_init(&badge4_i2c_bus); /* Probe for the SPD EEPROM */ if (i2c_probe(&badge4_i2c_bus, SPD_I2C_ADDR(0)) != 0) { - printf("SDRAM: SDRAM SO-DIMM absent\n"); + printf("SDRAM: SDRAM SO-DIMM absent.\n"); return; } /* Read the SPD to determine the SO-DIMM SDRAM parameters. */ + if (i2c_read_device_bytes(&badge4_i2c_bus, SPD_I2C_ADDR(0), + 0, spd, sizeof(spd)) != 0) { + printf("SDRAM: failed to read SPD EEPROM.\n"); + goto fail; + } /* quick sanity check */ - memory_type = spd_byte(SPD_MEMORY_TYPE); + memory_type = spd[SPD_MEMORY_TYPE]; if (memory_type != SPD_MEMORY_TYPE_SDRAM) { printf("SDRAM: SDRAM SO-DIMM wrong type (%d)\n", memory_type); goto fail; } - row_bits = spd_byte(SPD_ROW_BITS); - col_bits = spd_byte(SPD_COL_BITS); - row_density = spd_byte(SPD_ROW_DENSITY); + row_bits = spd[SPD_ROW_BITS]; + col_bits = spd[SPD_COL_BITS]; + row_density = spd[SPD_ROW_DENSITY]; /* calculate the size: bit 0 is 4M, bit 1 is 8M, etc. */ size = 0; |
From: Christopher H. <ch...@us...> - 2002-05-02 01:45:42
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv1968/src/lib Modified Files: i2c.c i2c-gpio.c Log Message: working version that does the sdram/cpld/spd dance properly Index: i2c.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/i2c.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- i2c.c 27 Apr 2002 00:55:04 -0000 1.3 +++ i2c.c 2 May 2002 01:45:39 -0000 1.4 @@ -85,7 +85,7 @@ return rc; DPRINTF("resetting i2c bus"); - for (i = 0; i < 9; i++) + for (i = 0; i < 15; i++) (void) i2c_stop(bus); DPRINTF("testing i2c bus"); Index: i2c-gpio.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/i2c-gpio.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- i2c-gpio.c 25 Apr 2002 22:46:11 -0000 1.1 +++ i2c-gpio.c 2 May 2002 01:45:39 -0000 1.2 @@ -71,6 +71,7 @@ struct i2c_bus_gpio_private *private = (struct i2c_bus_gpio_private *) bus->private; + GAFR &= ~(private->sda_gpio | private->scl_gpio); GPDR &= ~(private->sda_gpio | private->scl_gpio); GPCR = (private->sda_gpio | private->scl_gpio); |
From: Christopher H. <ch...@mu...> - 2002-05-02 01:25:26
|
It seems to me we need a concept above and beyond a partition (= a chunk of flash). I'll call this an "image" for lack of a better word. -- We have a list of "images" to be loaded on boot. -- No reason for "kernel" or "ramdisk" image to be special. -- Any image can: -- either "execute" in place or copied/loaded into ram from somewhere -- somewhere == raw partition, download, file on a filesystem in a partition -- Certain commands should require certain images to be present (i.e. exist for xip else loaded from somewhere) -- Image loading would have a post-success hook so that loading certain flavor images could update the param table(ugh) -- we would need this for initrd's, maybe root fs images. I'd like something along these lines so that I can stuff two kernels and two jffs roots into flash and chose which one to boot. -ch > -----Original Message----- > From: Russ Dill [mailto:Rus...@as...] > Sent: Wednesday, May 01, 2002 4:52 PM > To: Tim Riker > Cc: Christopher Hoover; blo...@li... > Subject: Re: blob/src/blob main.c,1.46,1.47 > > > On Wed, 2002-05-01 at 16:39, Tim Riker wrote: > > are you sure you do not have jffs2, cramfs or zimage turned on? > > > > "load kernel" should still load a kernel from your flash > partition no? > > This is exactly what the boot is doing. > > > > if you define --enable-{jffs2|cramfs|zImage} then "load > kernel" will try > > to find a kernel in your ramdisk. > > > > random semirelated ramblings...instead of all this hardcoded > stuff, why > not have a pointer for blob, kernel, paramater block, and > root (pointer > to partitions). if two pointers point to the same partition, > its assumed > that there is an fs involved, otherwise, its (likely) raw flash. > Somehow, CF, ide, netboot, and paramater block needs to get thrown in > here too. > |
From: Christopher H. <ch...@mu...> - 2002-05-02 01:20:40
|
> are you sure you do not have jffs2, cramfs or zimage turned on? I'm sure. > "load kernel" should still load a kernel from your flash partition no? Nope. blob> load kernel *** invalid command blob> -ch |
From: Russ D. <Rus...@as...> - 2002-05-01 23:50:37
|
On Wed, 2002-05-01 at 16:39, Tim Riker wrote: > are you sure you do not have jffs2, cramfs or zimage turned on? > > "load kernel" should still load a kernel from your flash partition no? > This is exactly what the boot is doing. > > if you define --enable-{jffs2|cramfs|zImage} then "load kernel" will try > to find a kernel in your ramdisk. > random semirelated ramblings...instead of all this hardcoded stuff, why not have a pointer for blob, kernel, paramater block, and root (pointer to partitions). if two pointers point to the same partition, its assumed that there is an fs involved, otherwise, its (likely) raw flash. Somehow, CF, ide, netboot, and paramater block needs to get thrown in here too. |
From: Tim R. <Ti...@Ri...> - 2002-05-01 23:45:38
|
are you sure you do not have jffs2, cramfs or zimage turned on? "load kernel" should still load a kernel from your flash partition no? This is exactly what the boot is doing. if you define --enable-{jffs2|cramfs|zImage} then "load kernel" will try to find a kernel in your ramdisk. If you are not using those, then turn them off. Christopher Hoover wrote: > > This change breaks booting from a flash partition containg the kernel. > It is an ugly regression because it causes autoboot to jump into junk > (because no kernel has been loaded into dram). The "boot" command does > the same, unless preceeded by an explicit "reload kernel". > > -ch > > > -----Original Message----- > > From: blo...@li... > > [mailto:blo...@li...] On > > Behalf Of Tim Riker > > Sent: Tuesday, April 30, 2002 4:53 PM > > To: blo...@li... > > Subject: CVS: blob/src/blob main.c,1.46,1.47 > > > > > > Update of /cvsroot/blob/blob/src/blob > > In directory usw-pr-cvs1:/tmp/cvs-serv23964/src/blob > > > > Modified Files: > > main.c > > Log Message: > > wierd work around, comments welcome > > > > Index: main.c > > =================================================================== > > RCS file: /cvsroot/blob/blob/src/blob/main.c,v > > retrieving revision 1.46 > > retrieving revision 1.47 > > diff -u -d -r1.46 -r1.47 > > --- main.c 30 Apr 2002 23:30:54 -0000 1.46 > > +++ main.c 30 Apr 2002 23:53:24 -0000 1.47 > > @@ -129,7 +129,8 @@ > > > > /* Load kernel and ramdisk from flash to RAM */ > > do_reload("blob"); > > - do_reload("kernel"); > > + /* do_reload("kernel"); does not work for jffs2 but the > > next line does?!? TimRiker */ > > + parse_command("load kernel"); > > if(blob_status.load_ramdisk) > > do_reload("ramdisk"); > > > > @@ -435,7 +436,7 @@ > > } else if(strncmp(argv[1], "kernel", 7) == 0) { > > #if KERNEL_FLASH_BASE == RAMDISK_FLASH_BASE > > printerrprefix(); > > - printf("configured for kernel in ramdisk\n", argv[1]); > > + printf("configured for kernel in ramdisk\n"); > > return -EINVAL; > > #else > > src = (u32 *)KERNEL_RAM_BASE; > > > > -- Tim Riker - http://rikers.org/ - short SIGs! <g> All I need to know I could have learned in Kindergarten ... if I'd just been paying attention. |
From: Christopher H. <ch...@mu...> - 2002-05-01 22:54:23
|
This change breaks booting from a flash partition containg the kernel. It is an ugly regression because it causes autoboot to jump into junk (because no kernel has been loaded into dram). The "boot" command does the same, unless preceeded by an explicit "reload kernel". -ch > -----Original Message----- > From: blo...@li... > [mailto:blo...@li...] On > Behalf Of Tim Riker > Sent: Tuesday, April 30, 2002 4:53 PM > To: blo...@li... > Subject: CVS: blob/src/blob main.c,1.46,1.47 > > > Update of /cvsroot/blob/blob/src/blob > In directory usw-pr-cvs1:/tmp/cvs-serv23964/src/blob > > Modified Files: > main.c > Log Message: > wierd work around, comments welcome > > Index: main.c > =================================================================== > RCS file: /cvsroot/blob/blob/src/blob/main.c,v > retrieving revision 1.46 > retrieving revision 1.47 > diff -u -d -r1.46 -r1.47 > --- main.c 30 Apr 2002 23:30:54 -0000 1.46 > +++ main.c 30 Apr 2002 23:53:24 -0000 1.47 > @@ -129,7 +129,8 @@ > > /* Load kernel and ramdisk from flash to RAM */ > do_reload("blob"); > - do_reload("kernel"); > + /* do_reload("kernel"); does not work for jffs2 but the > next line does?!? TimRiker */ > + parse_command("load kernel"); > if(blob_status.load_ramdisk) > do_reload("ramdisk"); > > @@ -435,7 +436,7 @@ > } else if(strncmp(argv[1], "kernel", 7) == 0) { > #if KERNEL_FLASH_BASE == RAMDISK_FLASH_BASE > printerrprefix(); > - printf("configured for kernel in ramdisk\n", argv[1]); > + printf("configured for kernel in ramdisk\n"); > return -EINVAL; > #else > src = (u32 *)KERNEL_RAM_BASE; > > |
From: Tim R. <tim...@us...> - 2002-05-01 08:58:07
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv5308/src/blob Modified Files: main.c Log Message: TomW claims a race Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/main.c,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- main.c 30 Apr 2002 23:53:24 -0000 1.47 +++ main.c 1 May 2002 08:58:04 -0000 1.48 @@ -355,7 +355,11 @@ *numRead = XModemReceive((char *) startAddress, bufLen); - printf("\n\n\n"); + /* There is a race condition somewhere... We need this delay */ + /* else the report is not printed out. TomW 4/30/2002 */ + msleep(100); + + printf("\n\n"); serial_flush_output(); if (blob_status.terminalSpeed != blob_status.downloadSpeed) { |
From: Tim R. <Ti...@Ri...> - 2002-05-01 00:07:15
|
Well, --enable-jffs2 is now fully working for me. Open issues: parse_command("load kernel") works on boot do_reload("kernel") does not. Note that parse_command("load kernel") calls do_reload("kernel") Something is fishy. Loading the kernel from my 15.8M jffs2 takes 20 seconds! I suspect that this is not the expected time, and that it can be drastically improved. -- Tim Riker - http://rikers.org/ - short SIGs! <g> All I need to know I could have learned in Kindergarten ... if I'd just been paying attention. |
From: Tim R. <tim...@us...> - 2002-05-01 00:02:15
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv25823/src/blob Modified Files: load_kernel.c Log Message: please erikm by removing debug md5 Index: load_kernel.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/load_kernel.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- load_kernel.c 27 Apr 2002 11:19:20 -0000 1.6 +++ load_kernel.c 1 May 2002 00:02:10 -0000 1.7 @@ -38,8 +38,6 @@ #include <blob/error.h> #include <blob/load_kernel.h> #include <blob/util.h> -#include <blob/md5.h> -#include <blob/md5support.h> #ifdef CONFIG_CRAMFS_SUPPORT extern struct kernel_loader cramfs_load; @@ -102,9 +100,6 @@ blob_status->kernelType = fromFlash; printf("loaded 0x%08x (%d) bytes\n", size, size); - md5_buffer( (const char *)KERNEL_RAM_BASE, size, &digest[0] ); - print_md5_digest(&digest[0]); - printf("\n"); return(ENOERROR); } |
From: Tim R. <tim...@us...> - 2002-04-30 23:53:26
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv23964/src/blob Modified Files: main.c Log Message: wierd work around, comments welcome Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/main.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- main.c 30 Apr 2002 23:30:54 -0000 1.46 +++ main.c 30 Apr 2002 23:53:24 -0000 1.47 @@ -129,7 +129,8 @@ /* Load kernel and ramdisk from flash to RAM */ do_reload("blob"); - do_reload("kernel"); + /* do_reload("kernel"); does not work for jffs2 but the next line does?!? TimRiker */ + parse_command("load kernel"); if(blob_status.load_ramdisk) do_reload("ramdisk"); @@ -435,7 +436,7 @@ } else if(strncmp(argv[1], "kernel", 7) == 0) { #if KERNEL_FLASH_BASE == RAMDISK_FLASH_BASE printerrprefix(); - printf("configured for kernel in ramdisk\n", argv[1]); + printf("configured for kernel in ramdisk\n"); return -EINVAL; #else src = (u32 *)KERNEL_RAM_BASE; |
From: Tim R. <tim...@us...> - 2002-04-30 23:31:34
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv19427/utils/test Modified Files: Makefile.am Log Message: USER_SPACE_TEST Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/utils/test/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 27 Apr 2002 11:18:44 -0000 1.4 +++ Makefile.am 30 Apr 2002 23:31:31 -0000 1.5 @@ -35,7 +35,7 @@ bin_PROGRAMS = \ load_kernel_test -CFLAGS = -g -Wall -DHAVE_CONFIG_H -I${top_builddir}/include \ +CFLAGS = -g -Wall -DHAVE_CONFIG_H -DUSER_SPACE_TEST -I${top_builddir}/include \ -I${top_srcdir}/include -I@LINUX_INCLUDE@ CC = gcc |
From: Tim R. <tim...@us...> - 2002-04-30 23:30:56
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv19275/src/blob Modified Files: main.c Log Message: spelling Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/main.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- main.c 27 Apr 2002 10:26:50 -0000 1.45 +++ main.c 30 Apr 2002 23:30:54 -0000 1.46 @@ -122,7 +122,7 @@ } #endif - /* Parse all the tags in the paramater block */ + /* Parse all the tags in the parameter block */ #ifdef PARAM_START parse_ptags((void *) PARAM_START, &conf); #endif |
From: Tim R. <tim...@us...> - 2002-04-30 23:30:16
|
Update of /cvsroot/blob/blob/include/blob/arch In directory usw-pr-cvs1:/tmp/cvs-serv19156/include/blob/arch Modified Files: shannon.h Log Message: remove dupe Index: shannon.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/arch/shannon.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- shannon.h 27 Apr 2002 10:26:49 -0000 1.12 +++ shannon.h 30 Apr 2002 23:30:13 -0000 1.13 @@ -91,15 +91,14 @@ #define BLOB_FLASH_LEN (64 * 1024) #define PARAM_FLASH_BASE (BLOB_FLASH_BASE + BLOB_FLASH_LEN) #define PARAM_FLASH_LEN (64 * 1024) +#define KERNEL_FLASH_BASE (PARAM_FLASH_BASE + PARAM_FLASH_LEN) #define KERNEL_FLASH_LEN ((1024 - 128) * 1024) /* RAM_LEN if load_kernel */ #define LOAD_RAMDISK 0 /* leave ramdisk in flash */ #if defined(CONFIG_CRAMFS_SUPPORT) || defined(CONFIG_JFFS2_SUPPORT) -#define KERNEL_FLASH_BASE (PARAM_FLASH_BASE + PARAM_FLASH_LEN) #define RAMDISK_FLASH_BASE KERNEL_FLASH_BASE #define RAMDISK_FLASH_LEN (4 * 1024 * 1024 - BLOB_FLASH_LEN - PARAM_FLASH_LEN) #else -#define KERNEL_FLASH_BASE (PARAM_FLASH_BASE + PARAM_FLASH_LEN) #define RAMDISK_FLASH_BASE (KERNEL_FLASH_BASE + KERNEL_FLASH_LEN) #define RAMDISK_FLASH_LEN (4 * 1024 * 1024 - BLOB_FLASH_LEN - PARAM_FLASH_LEN - KERNEL_FLASH_LEN) #endif |
From: Tim R. <tim...@us...> - 2002-04-30 23:29:48
|
Update of /cvsroot/blob/blob/include/blob/arch In directory usw-pr-cvs1:/tmp/cvs-serv19007/include/blob/arch Modified Files: idr.h Log Message: 14 row, 2 mtd parts on enable-jffs2 Index: idr.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/arch/idr.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- idr.h 19 Apr 2002 20:00:23 -0000 1.10 +++ idr.h 30 Apr 2002 23:29:45 -0000 1.11 @@ -54,9 +54,16 @@ #define PARAM_FLASH_LEN (0 * 1024) /* not used yet */ #define KERNEL_FLASH_BASE (PARAM_FLASH_BASE + PARAM_FLASH_LEN) #define KERNEL_FLASH_LEN ((1024 - 128) * 1024) -#define RAMDISK_FLASH_BASE (KERNEL_FLASH_BASE + KERNEL_FLASH_LEN) #define LOAD_RAMDISK 0 /* leave ramdisk in flash */ + +#if defined(CONFIG_CRAMFS_SUPPORT) || defined(CONFIG_JFFS2_SUPPORT) +/* kernel will be read directly from the ramdisk, so locations are the same */ +#define RAMDISK_FLASH_BASE KERNEL_FLASH_BASE +#define RAMDISK_FLASH_LEN (16 * 1024 * 1024 - BLOB_FLASH_LEN - PARAM_FLASH_LEN) +#else +#define RAMDISK_FLASH_BASE (KERNEL_FLASH_BASE + KERNEL_FLASH_LEN) #define RAMDISK_FLASH_LEN (16 * 1024 * 1024 - BLOB_FLASH_LEN - PARAM_FLASH_LEN - KERNEL_FLASH_LEN) +#endif /* the position of the kernel boot parameters */ #define BOOT_PARAMS (0xc0000100) @@ -67,7 +74,8 @@ /* Memory configuration */ #ifdef BLOB_NEED_MEMCONFIG #warning "use defines from memsetup.h for better readability" -# define MDCNFG_VALUE 0x72347234 /* 0x0 MDCNFG */ +/* # define MDCNFG_VALUE 0x72347234 */ /* 0x0 MDCNFG 12 rows*/ +# define MDCNFG_VALUE 0x72547254 /* 0x0 MDCNFG 14 rows */ # define MDCAS00_VALUE 0x55555557 /* 0x04 MDCAS00 */ # define MDCAS01_VALUE 0x55555555 /* 0x08 MDCAS01 */ # define MDCAS02_VALUE 0x55555555 /* 0x0c MDCAS02 */ |
From: Tim R. <tim...@us...> - 2002-04-30 23:28:49
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv18762/src/blob Modified Files: flash.c Log Message: add spinner Index: flash.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/flash.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- flash.c 13 Feb 2002 00:06:11 -0000 1.15 +++ flash.c 30 Apr 2002 23:28:47 -0000 1.16 @@ -244,6 +244,13 @@ flash_driver->enable_vpp(); while(i < nwords) { + /* spinner */ + { + char spinner[4] = { '/','-','\\','|' }; + if ((i & 0x3ff) == 0) { + printf("%c\r", spinner[(i >> 10) & 0x3]); + } + } /* nothing to write */ if(dst[i] == src[i]) { i++; |
From: Tim R. <tim...@us...> - 2002-04-30 23:28:29
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv18662/src/blob Modified Files: flash-commands.c Log Message: help text Index: flash-commands.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/flash-commands.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- flash-commands.c 16 Jan 2002 20:51:02 -0000 1.2 +++ flash-commands.c 30 Apr 2002 23:28:25 -0000 1.3 @@ -99,7 +99,7 @@ return 0; } -static char lockhelp[] = "fllock {blob|param|kernel|ramdisk}\n" +static char lockhelp[] = "lock {blob|param|kernel|ramdisk}\n" "Lock <argument> region of flash\n"; __commandlist(Lock, "lock", lockhelp); |