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: Tim R. <tim...@us...> - 2002-04-27 08:33:52
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv16942/include/blob Modified Files: main.h Log Message: allow 0 boot_delay Index: main.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/main.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- main.h 6 Jan 2002 18:59:40 -0000 1.6 +++ main.h 27 Apr 2002 08:11:58 -0000 1.7 @@ -66,7 +66,7 @@ serial_baud_t terminalSpeed; int load_ramdisk; - int boot_delay; + int boot_delay; /* -1 == no-autoboot */ char cmdline[COMMAND_LINE_SIZE]; |
From: Tim R. <tim...@us...> - 2002-04-27 07:32:46
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv8998/utils/test Modified Files: load_kernel_test.c Log Message: add filename to load_kernel methods Index: load_kernel_test.c =================================================================== RCS file: /cvsroot/blob/blob/utils/test/load_kernel_test.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- load_kernel_test.c 26 Apr 2002 06:13:14 -0000 1.3 +++ load_kernel_test.c 27 Apr 2002 07:32:40 -0000 1.4 @@ -21,9 +21,9 @@ fodder_ram_base = malloc(0x10000); out = malloc(0xe00000); - if (argc < 2) { + if (argc < 3) { printf("not enough arguments usage:\n"); - printf("%s: <fs_image> <outfile>\n", basename(argv[0])); + printf("%s: <fs_image> <kernel_filename> <outfile>\n", basename(argv[0])); return 0; } @@ -43,7 +43,7 @@ memset(part.offset + st.st_size, 0xff, part.size - st.st_size); fclose(fp); - printf("flash emulation region is 0x%lx bytes\n", part.size); + printf("flash emulation region is 0x%x bytes\n", part.size); for (i = 0; loader[i]; i++) if (loader[i]->check_magic(&part)) @@ -53,14 +53,14 @@ } else { printf("loading kernel from "); printf(loader[i]->name); - if ((size = loader[i]->load_kernel((u32 *) out, &part)) == 0) { - printf(" error loading kernel!\n"); + if ((size = loader[i]->load_kernel((u32 *) out, &part, argv[2])) == 0) { + printf(" error loading kernel \"%s\"!\n", argv[2]); return 0; } } printf("loaded 0x%08lx bytes\n", size); - if (!(fp = fopen(argv[2], "w"))) { + if (!(fp = fopen(argv[3], "w"))) { perror("could not open outfile"); return 0; } |
From: Tim R. <tim...@us...> - 2002-04-27 07:32:46
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv8998/src/blob Modified Files: cramfs.c jffs2.c load_kernel.c zImage.c Log Message: add filename to load_kernel methods Index: cramfs.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/cramfs.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cramfs.c 16 Feb 2002 00:43:59 -0000 1.3 +++ cramfs.c 27 Apr 2002 07:32:40 -0000 1.4 @@ -112,7 +112,7 @@ return total_size; } -static u32 cramfs_load_kernel(u32 *dest, struct part_info *part) +static u32 cramfs_load_kernel(u32 *dest, struct part_info *part, char *filename) { struct cramfs_super *super; struct cramfs_inode *inode; @@ -134,6 +134,8 @@ /* does it have 5 to 8 characters? */ if (!inode->namelen == 2) continue; name = (char *) (inode + 1); + + /* FIXME - should use "filename" */ if (!strncmp("linux\0\0", name, 8)) { size = cramfs_load_file(dest, part, inode); break; Index: jffs2.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/jffs2.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- jffs2.c 16 Feb 2002 00:43:59 -0000 1.3 +++ jffs2.c 27 Apr 2002 07:32:40 -0000 1.4 @@ -299,6 +299,10 @@ unsigned long version, off; i = 0; + if (name[i] == '/') { + pino = 1; + i++; + } do { /* parse the next dir/file/symlink */ @@ -359,16 +363,15 @@ return node; } -static u32 jffs2_load_kernel(u32 *dest, struct part_info *part) +static u32 jffs2_load_kernel(u32 *dest, struct part_info *part, char *filename) { struct jffs2_raw_dirent *node; - - if (!(node = find_inode(part, "linux", 1))) { - UDEBUG("could not find /linux\n"); + if (!(node = find_inode(part, filename, 1))) { + UDEBUG("could not find \"%s\"\n", filename); return 0; } if (node->type != DT_REG) { - UDEBUG("/linux is not a regular file\n"); + UDEBUG("\"%s\" is not a regular file\n", filename); return 0; } return read_inode(part, dest, node->ino, DT_REG); Index: load_kernel.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/load_kernel.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- load_kernel.c 16 Feb 2002 00:43:59 -0000 1.3 +++ load_kernel.c 27 Apr 2002 07:32:40 -0000 1.4 @@ -96,7 +96,7 @@ } else { printf("loading kernel from %s ...", loader[i]->name); if ((size = loader[i]->load_kernel((u32 *)KERNEL_RAM_BASE, - &part)) == 0) { + &part, "/boot/linux")) == 0) { eprintf("error loading kernel!\n"); return; } Index: zImage.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/zImage.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- zImage.c 16 Feb 2002 00:43:59 -0000 1.3 +++ zImage.c 27 Apr 2002 07:32:40 -0000 1.4 @@ -44,7 +44,7 @@ return ((u32 *) part->offset)[9] == ZIMAGE_MAGIC; } -static u32 zImage_load_kernel(u32 *dest, struct part_info *part) +static u32 zImage_load_kernel(u32 *dest, struct part_info *part, char *filename) { unsigned long size; int i; |
From: Tim R. <tim...@us...> - 2002-04-27 07:32:45
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv8998/include/blob Modified Files: load_kernel.h Log Message: add filename to load_kernel methods Index: load_kernel.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/load_kernel.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- load_kernel.h 26 Apr 2002 04:44:41 -0000 1.4 +++ load_kernel.h 27 Apr 2002 07:32:40 -0000 1.5 @@ -50,9 +50,10 @@ /* Return true if there is a kernel contained at src */ int (* check_magic)(struct part_info *part); - /* load the kernel from the partition part to dst, return the number - * of bytes copied if successful, zero if not */ - u32 (* load_kernel)(u32 *dst, struct part_info *part); + /* load the kernel from filename in partition part to dst, + * return the number of bytes copied if successful, zero if not + * some methods will ignore filename */ + u32 (* load_kernel)(u32 *dst, struct part_info *part, char *filename); /* A brief description of the module (ie, "cramfs") */ char *name; |
From: Tim R. <tim...@us...> - 2002-04-27 06:55:14
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv2650/src/blob Modified Files: Makefile.am Log Message: add zImage load_kernel support Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/blob/Makefile.am,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- Makefile.am 27 Apr 2002 00:55:04 -0000 1.29 +++ Makefile.am 27 Apr 2002 06:55:09 -0000 1.30 @@ -157,6 +157,7 @@ @BLOB_CHKMEM_OBJS@ \ @BLOB_CLOCK_OBJS@ \ @BLOB_CRAMFS_OBJS@ \ + @BLOB_ZIMAGE_OBJS@ \ @BLOB_FLASH_OBJS@ \ @BLOB_JFFS2_OBJS@ \ @BLOB_PLATFORM_OBJS@ \ |
From: Tim R. <tim...@us...> - 2002-04-27 06:55:14
|
Update of /cvsroot/blob/blob In directory usw-pr-cvs1:/tmp/cvs-serv2650 Modified Files: acconfig.h configure.in Log Message: add zImage load_kernel support Index: acconfig.h =================================================================== RCS file: /cvsroot/blob/blob/acconfig.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- acconfig.h 23 Apr 2002 12:36:19 -0000 1.18 +++ acconfig.h 27 Apr 2002 06:55:09 -0000 1.19 @@ -125,6 +125,9 @@ /* Define if cramfs support is wanted */ #undef CONFIG_CRAMFS_SUPPORT +/* Define if zImage support is wanted */ +#undef CONFIG_ZIMAGE_SUPPORT + @BOTTOM@ #endif Index: configure.in =================================================================== RCS file: /cvsroot/blob/blob/configure.in,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- configure.in 26 Apr 2002 07:12:38 -0000 1.51 +++ configure.in 27 Apr 2002 06:55:09 -0000 1.52 @@ -388,6 +388,11 @@ [cramfs_flag=$enable_cramfs], [cramfs_flag=no]) +AC_ARG_ENABLE(zimage, +[ --enable-zimage Enable support for loading zImage directly from flash], +[zimage_flag=$enable_zimage], +[zimage_flag=no]) + @@ -406,6 +411,7 @@ uucodec_flag=yes jffs2_flag=yes cramfs_flag=yes + zimage_flag=yes fi @@ -504,6 +510,14 @@ AC_SUBST(BLOB_CRAMFS_OBJS) +dnl Check wether or not zImage support is wanted +if test "x$zimage_flag" = "xyes" ; then + BLOB_ZIMAGE_OBJS="zImage.o" + AC_DEFINE(CONFIG_ZIMAGE_SUPPORT) +fi + +AC_SUBST(BLOB_ZIMAGE_OBJS) + dnl Check for extra debug info @@ -610,6 +624,7 @@ echo "UU Codec support ${uucodec_flag}" echo "JFFS2 support ${jffs2_flag}" echo "cramfs support ${cramfs_flag}" +echo "zImage support ${zimage_flag}" echo "Blob commands: ${BLOB_COMMANDS}" echo "Run-time debug information ${blob_debug_flag}" echo "" |
From: Tim R. <tim...@us...> - 2002-04-27 06:53:32
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv2382/utils/test Modified Files: Makefile.am Log Message: force objs Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/utils/test/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 27 Apr 2002 00:55:05 -0000 1.2 +++ Makefile.am 27 Apr 2002 06:53:26 -0000 1.3 @@ -45,7 +45,7 @@ $(load_kernel_test_extra_SOURCES) load_kernel_test: $(load_kernel_test_OBJECTS) - gcc $(CFLAGS) -o $@ $< + gcc $(CFLAGS) -o $@ $(load_kernel_test_OBJECTS) $(load_kernel_test_extra_SOURCES): ln -s ../../src/*/$@ |
From: Tim R. <tim...@us...> - 2002-04-27 05:00:02
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv18882/include/blob Modified Files: pcmcia.h Log Message: turn on ide and pcmcia again, fix pcmcia compiles (but not features) for non sa1111 systems Index: pcmcia.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/pcmcia.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pcmcia.h 26 Apr 2002 09:23:03 -0000 1.4 +++ pcmcia.h 27 Apr 2002 04:59:59 -0000 1.5 @@ -76,7 +76,7 @@ */ #define PCMCIA_MAX_SLOTS 2 -#if defined(PT_SYSTEM3) || defined(IDR) +#if defined(PT_SYSTEM3) || defined(IDR) || defined(SHANNON) # define PCMCIA_S0_BASE 0x20000000 # define PCMCIA_S0_ATTR_BASE 0x28000000 # define PCMCIA_S1_BASE 0x30000000 |
From: Tim R. <tim...@us...> - 2002-04-27 05:00:02
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv18882/src/lib Modified Files: Makefile.am ide.c pcmcia.c Log Message: turn on ide and pcmcia again, fix pcmcia compiles (but not features) for non sa1111 systems Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/lib/Makefile.am,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Makefile.am 27 Apr 2002 04:16:34 -0000 1.19 +++ Makefile.am 27 Apr 2002 04:59:59 -0000 1.20 @@ -33,6 +33,7 @@ i2c.c \ i2c-gpio.c \ icache.c \ + ide.c \ init.c \ led.c \ md5.c \ @@ -40,6 +41,7 @@ memcpy.c \ memset.c \ mini_inflate.c \ + pcmcia.c \ printf.c \ reboot.c \ serial.c \ Index: ide.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/ide.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ide.c 26 Apr 2002 09:22:05 -0000 1.3 +++ ide.c 27 Apr 2002 04:59:59 -0000 1.4 @@ -23,6 +23,9 @@ * $Id$ * * $Log$ + * 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 @@ -53,8 +56,7 @@ #include <blob/command.h> #include <blob/time.h> #include <blob/serial.h> -#include <blob/sa1100.h> -#include <blob/sa1111.h> +#include <blob/arch.h> #include <blob/ide.h> /********************************************************************** @@ -332,7 +334,7 @@ if (dbg > 2) printf("hd_read_mapped(sector_num=%d, buffer=%x)\n", - sector_num, buffer); + sector_num, (u32)buffer); #if 0 sector = (sector_num % disk_sectors_per_track) + 1; @@ -463,7 +465,7 @@ } _DBG( "ide: %s: port=%x, count=%d, status=%x\n", __FUNCTION__, - port, count, status ); + *port, count, status ); if (status & 0x01) { err = port[1]; Index: pcmcia.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/pcmcia.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pcmcia.c 26 Apr 2002 09:22:05 -0000 1.3 +++ pcmcia.c 27 Apr 2002 04:59:59 -0000 1.4 @@ -24,6 +24,9 @@ * $Id$ * * $Log$ + * 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 @@ -54,10 +57,13 @@ #include <blob/command.h> #include <blob/time.h> #include <blob/serial.h> -#include <blob/sa1100.h> -#include <blob/sa1111.h> +#include <blob/arch.h> #include <blob/pcmcia.h> +#ifdef SA1111_BASE +#include <blob/sa1111.h> +#endif + /********************************************************************** * Defines / Makros */ @@ -155,6 +161,7 @@ int WEAK_SYM pcmcia_slot_detect( int slot ) { int detect = 0; +#ifdef SA1111_BASE unsigned int flags = PCSR; switch ( slot ) { @@ -177,8 +184,10 @@ } _DBG( "%s: slot %d status: %x\n", __FUNCTION__, slot, pcmcia_slots[slot].status ); - DONE: +#else +#warning "FIXME: non sa1111 systems not yet supported" +#endif return detect; } @@ -187,6 +196,7 @@ { int ret = 0; +#ifdef SA1111_BASE switch ( slot ) { case 0: PCCR = (PCCR & ~PCCR_S0_PSE) | PCCR_S0_FLT | PCCR_S0_PWAITEN; @@ -204,6 +214,9 @@ _DBG( "%s: slot %d status: %x\n", __FUNCTION__, slot, pcmcia_slots[slot].status ); DONE: +#else +#warning "FIXME: non sa1111 systems not yet supported" +#endif return ret; } @@ -212,6 +225,7 @@ { int ret = 0; +#ifdef SA1111_BASE switch ( slot ) { case 0: PCCR = PCCR | PCCR_S0_PSE; @@ -229,6 +243,9 @@ _DBG( "%s: slot %d status: %x\n", __FUNCTION__, slot, pcmcia_slots[slot].status ); DONE: +#else +#warning "FIXME: non sa1111 systems not yet supported" +#endif return ret; } @@ -237,6 +254,7 @@ { int ret = 0; +#ifdef SA1111_BASE switch ( slot ) { case 0: PCCR |= PCCR_S0_RST; @@ -256,13 +274,16 @@ } _DBG( "%s: slot %d reset\n", __FUNCTION__, slot ); - +#else +#warning "FIXME: non sa1111 systems not yet supported" +#endif return ret; } /* dump slot HW line stati */ int pcmcia_dump_stati( void ) { +#ifdef SA1111_BASE int status = PCSR; printf("s0: "); @@ -284,6 +305,9 @@ if (status & PCSR_S1_BVD1) printf("bvd1 "); else printf(" "); if (status & PCSR_S1_BVD2) printf("bvd2 "); else printf(" "); printf("\n"); +#else +#warning "FIXME: non sa1111 systems not yet supported" +#endif return 0; } @@ -402,7 +426,7 @@ break; case CISTPL_FUNCID: func_id = *p; - _DBG( "%s: func_id=%p\n", __FUNCTION__, func_id ); + _DBG( "%s: func_id=%d\n", __FUNCTION__, func_id ); break; case CISTPL_FUNCE: if (n_features < PCMCIA_MAX_FEATURES) @@ -516,7 +540,6 @@ int pcmcia_slot_attr_read( int slot, u16 offset, u8 *value ) { int ret = 0; - u32 attr_base = 0; /* sanity check */ if ( slot < 0 ) { @@ -559,7 +582,6 @@ int pcmcia_slot_attr_write( int slot, u16 offset, u8 value ) { int ret = 0; - u32 attr_base = 0; /* sanity check */ if ( slot < 0 ) { |
From: Tim R. <tim...@us...> - 2002-04-27 04:16:39
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv10733/src/lib Modified Files: Makefile.am Added Files: ext2fs.c Removed Files: disk.c Log Message: rename, some coversion to types.h --- NEW FILE: ext2fs.c --- /* * disk.c * * read extfs file system root dir, locate image and load it into memory * * this is a very large hack which assumes: * - ms-dos partion table * - linux partition is #1 partition * - bootable image is at /zImage or /boot/zImage * - ramdisk image is at /ramdisk.gz or /boot/ramdisk.gz * * Copyright (C) 2001, Brad Parker (br...@he...) * * 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 */ #ifdef HAVE_CONFIG_H # include <blob/config.h> #endif #include <blob/types.h> #include <blob/serial.h> #include <blob/util.h> #include <blob/serial.h> #define _SIZE_T /* don't use the one in the kernel's types.h */ #include <linux/ext2_fs.h> char buf1[512], buf2[512]; char sb_block_buf[EXT2_MAX_BLOCK_SIZE]; char inode_block_buf[EXT2_MAX_BLOCK_SIZE]; char dir_block_buf[EXT2_MAX_BLOCK_SIZE]; char ind_block_buf[EXT2_MAX_BLOCK_SIZE]; char ind2_block_buf[EXT2_MAX_BLOCK_SIZE]; char block1[EXT2_MAX_BLOCK_SIZE]; char block2[EXT2_MAX_BLOCK_SIZE]; extern int verbose; extern int hd_read_mapped(int sector_num, char *buffer); char tohex(char b) { b = b & 0xf; if (b < 10) return '0' + b; return 'a' + (b - 10); } void dumpmem(char *ptr, int len) { char line[80], chars[80], *p, b, *c, *end; int j; end = ptr + len; while (ptr < end) { SerialOutputHex((int)ptr); p = line; c = chars; *p++ = ' '; for (j = 0; j < 16; j++) { b = *ptr++; *p++ = tohex(b >> 4); *p++ = tohex(b); *p++ = ' '; *c++ = ' ' <= b && b <= '~' ? b : '.'; } *p = 0; SerialOutputString(line); *c = 0; SerialOutputString(chars); serial_write('\n'); } } #ifdef TEST char disk[1024*1024*8]; int read_buffer(int sectornum, char *buf) { char *ptr = disk + sectornum * 512; if (ptr > disk+sizeof(disk)) { printf("read past eod!\n"); while (1); return -1; } memcpy(buf, ptr, 512); return 0; } #else int read_buffer(int sectornum, char *buf) { return hd_read_mapped(sectornum, buf); } #endif void debug(char *msg) { printf("%s\n", msg); } int le32_p(u8 *p) { int n; n = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; return n; } /* ms-dos disk partition structure */ struct part_ent { u8 p_boot; u8 p_start[3]; u8 p_type; u8 p_end[3]; u8 p_start_sector[4]; u8 p_size_sectors[4]; }; static unsigned int start, size; static unsigned int base; struct ext2_group_desc group_desc[32]; unsigned int boot_inode_num=0; unsigned int our_inode_num=0; unsigned int e2fs_block_size; unsigned int e2fs_sectors_per_block; void set_ext2fs_block_size(int bytes) { e2fs_block_size = bytes; e2fs_sectors_per_block = bytes / 512; if (verbose > 1) { printf("set_ext2fs_block_size(bytes=%d) sectors_per_block %d\n", bytes, e2fs_sectors_per_block); } } /* read ext2fs 4k block */ int read_block(int blocknum, char *buf) { unsigned int abs_blocknum = base + blocknum*e2fs_sectors_per_block; int i; if (verbose > 2) printf("read_block(%d) base %d, abs %d\n", blocknum, base, abs_blocknum); for (i = 0; i < e2fs_sectors_per_block; i++) { if (read_buffer(abs_blocknum, buf) != 0) { return -1; } abs_blocknum++; buf += 512; } return 0; } /* check master boot record; locate parition info */ int check_mbr() { struct part_ent *p; int h, s, c; if( verbose > 0) printf("check MBR...\n"); if (read_buffer(0, buf1)) { debug("mbr read error"); return -1; } if ((u8)buf1[510] != 0x55 || (u8)buf1[511] != 0xaa) { debug("bad mbr signature"); if (verbose > 1) dumpmem(buf1, sizeof(buf1)); return -1; } /* XXX 1st partition must be linux */ p = (struct part_ent *)&buf1[0x1be]; if (p->p_type != 0x83) { debug("part #1 not linux"); return -1; } h = p->p_start[0]; s = p->p_start[1] & 0x3f; c = ((p->p_start[1] & 0xc0) << 2) + p->p_start[2]; if( verbose > 0) printf("found linux partition\n"); start = le32_p(p->p_start_sector); size = le32_p(p->p_size_sectors); if (verbose > 1) { printf("partition @ h=%d,s=%d,c=%d\n", h, s, c); printf("start %d, size %d\n", start, size); } return 0; } /* * read ext2fs inode * require group descriptors to be in memory */ int read_inode(struct ext2_super_block *sb, int ino, struct ext2_inode *ibuf) { u32 group, offset, block, block_nr; group = (ino - 1) / EXT2_INODES_PER_GROUP(sb); offset = ((ino - 1) % EXT2_INODES_PER_GROUP(sb)) * EXT2_INODE_SIZE(sb); block = offset >> EXT2_BLOCK_SIZE_BITS(sb); if (!group_desc[(unsigned)group].bg_inode_table) { if( verbose > 0) { printf("inode %d; group %d, offset %d, block %d; no group descriptor\n", ino, group, offset, block); } return -1; } block_nr = group_desc[(unsigned)group].bg_inode_table + block; offset &= (EXT2_BLOCK_SIZE(sb) - 1); if (verbose > 1) { printf("inode %d; group %d, offset %d, block %d, block_nr %d\n", ino, group, offset, block, block_nr); printf("inodes/group %d, inode size %d\n", EXT2_INODES_PER_GROUP(sb), EXT2_INODE_SIZE(sb)); } /* read entire block and copy inode out */ if (read_block(block_nr, inode_block_buf)) return -1; memcpy((char *)ibuf, inode_block_buf + offset, 128); return 0; } int load_indirect_block(int iblock_num, char **pptr, u32 *poffset) { int i; u8 *p; u32 bn; char *ptr; u32 offset; ptr = *pptr; offset = *poffset; if (verbose > 1) printf("indirect block %d\n", iblock_num); if (read_block(iblock_num, ind_block_buf)) { debug("read indirect block error"); return -1; } p = ind_block_buf; for (i = 0; i < e2fs_block_size/4; i++) { bn = le32_p(p); p += 4; if (bn == 0) break; #if 0 // FIXME if (verbose > 2) printf("file block # %d (0x%x)\n", bn, bn); else if( verbose > 0) printf("%d \r", offset); #endif // 0 FIXME switch( verbose) { case 0: if( bn % 100 == 0) serial_write( '.'); break; case 1: printf("%d \r", offset); break; default: printf("file block # %d (0x%x)\n", bn, bn); break; } if (read_block(bn, ptr)) { debug("read file block error"); return -1; } ptr += e2fs_sectors_per_block*512; offset += e2fs_sectors_per_block*512; } *pptr = ptr; *poffset = offset; return 0; } int load_file_inode(struct ext2_super_block *sb, unsigned int inode_num, char *ptr) { struct ext2_inode file_inode, *inode; u32 offset; int i; if (read_inode(sb, inode_num, &file_inode)) { debug("read file inode error"); return -1; } inode = &file_inode; offset = 0; if (verbose > 1) { printf("file inode:\n"); printf("mode %o\n", inode->i_mode); printf("flags %x\n", inode->i_flags); printf("size %x\n", inode->i_size); printf("blocks %x (max %d)\n", inode->i_blocks, EXT2_N_BLOCKS); } for (i = 0; i < EXT2_NDIR_BLOCKS; i++) { if (verbose > 1) printf("block[%d] %d (0%x)\n", i, inode->i_block[i], inode->i_block[i]); else if( verbose > 0) printf("%d \r", offset); else if( inode->i_block[i] % 100 == 0) serial_write( '.'); if (inode->i_block[i] == 0) break; if (read_block(inode->i_block[i], ptr)) { debug("read file block error"); return -1; } ptr += e2fs_sectors_per_block*512; offset += e2fs_sectors_per_block*512; } if (inode->i_block[EXT2_NDIR_BLOCKS]) { if (verbose > 2) printf("1 indirect block %d\n", inode->i_block[EXT2_NDIR_BLOCKS]); if (load_indirect_block(inode->i_block[EXT2_NDIR_BLOCKS], &ptr, &offset)) return -1; } if (inode->i_block[EXT2_NDIR_BLOCKS+1]) { int i; u8 *p; u32 bn; if (verbose > 2) printf("2 indirect block %d\n", inode->i_block[EXT2_NDIR_BLOCKS+1]); if (read_block(inode->i_block[EXT2_NDIR_BLOCKS+1], ind2_block_buf)) { debug("read 2nd indirect block error"); return -1; } p = ind2_block_buf; for (i = 0; i < e2fs_block_size/4; i++) { bn = le32_p(p); p += 4; if (bn == 0) break; if (verbose > 2) printf("ind block # %d (0x%x)\n", bn, bn); if (load_indirect_block(bn, &ptr, &offset)) return -1; } } #if 0 if (inode->i_block[EXT2_NDIR_BLOCKS+2]) { printf("3 indirect inode %d\n", inode->i_block[EXT2_NDIR_BLOCKS+2]); if(read_block(inode->i_block[EXT2_NDIR_BLOCKS+2], &ind_block_buf)) { debug("read 3rd indirect block error"); return -1; } } #endif if( verbose > 0) printf("done! offset %d (0x%x)\n", offset, offset); else serial_write( '\n'); return inode->i_size; // success: return file size } /* * read file "fileName" into RAM location ramBase */ int load_root_image(char *fileName, void *ramBase) { struct ext2_super_block *sb; struct ext2_inode root_inode, boot_inode, *inode; struct ext2_group_desc *bg; struct ext2_dir_entry_2 *de; int sb_block, group_block, group_desc_count, desc_blocks; int i; u32 offset; int retval=0; /* read super block */ base = start; sb_block = 1; group_block = sb_block + 1; if( verbose > 0) printf("reading super block...\n"); set_ext2fs_block_size(1024); #if 0 { int abn; abn = base; for (i = 0; i < 8; i++) { printf("abn %d\n", abn); if (read_buffer(abn, sb_block_buf) != 0) break; dumpmem(sb_block_buf, 64); abn++; } } #endif if (read_block(sb_block, sb_block_buf)) { debug("find_root read error"); return -1; } sb = (struct ext2_super_block *)sb_block_buf; if (verbose > 1) printf("sb magic %x\n", sb->s_magic); if (sb->s_magic != EXT2_SUPER_MAGIC) { debug("sb magic number wrong"); return -1; } if (verbose > 1) { printf("block size %d\n", EXT2_BLOCK_SIZE(sb)); printf("blocks per group %d\n", sb->s_blocks_per_group); printf("block # of sb %d\n", sb->s_block_group_nr); printf("first data block %d\n", sb->s_first_data_block); printf("inodes / group %d\n", EXT2_INODES_PER_GROUP(sb)); } group_desc_count = (sb->s_blocks_count - sb->s_first_data_block + EXT2_BLOCKS_PER_GROUP(sb) - 1) / EXT2_BLOCKS_PER_GROUP(sb); desc_blocks = (group_desc_count + EXT2_DESC_PER_BLOCK(sb) - 1) / EXT2_DESC_PER_BLOCK(sb); if (verbose > 1) printf("group_block %d, group_desc_count %d, desc_blocks %d\n", group_block, group_desc_count, desc_blocks); /* set block size */ set_ext2fs_block_size(EXT2_BLOCK_SIZE(sb)); //this is wrong and a hack; why? if (EXT2_BLOCK_SIZE(sb) == 4096) group_block = 1; /* read group descriptors */ if (read_block(group_block, block2)) { debug("read group desc error"); return -1; } if (verbose > 4) { dumpmem(block2, sizeof(block2)); } bg = (struct ext2_group_desc *)block2; for (i = 0; i < group_desc_count; i++) { group_desc[i] = bg[i]; if (verbose > 1) { printf("block group %d\n", i); printf("dirs %d\n", bg[i].bg_used_dirs_count); } } // set_ext2fs_block_size(EXT2_BLOCK_SIZE(sb)); /* read root inode */ if (read_inode(sb, EXT2_ROOT_INO, &root_inode)) { debug("read initial inode error"); return -1; } inode = &root_inode; if (verbose > 1) { printf("mode %o\n", inode->i_mode); printf("flags %x\n", inode->i_flags); printf("size %x\n", inode->i_size); printf("blocks %x (max %d)\n", inode->i_blocks, EXT2_N_BLOCKS); printf("block[0] %x\n", inode->i_block[0]); printf("block[1] %x\n", inode->i_block[1]); printf("\n"); } if (read_block(inode->i_block[0], dir_block_buf)) { debug("read root inode dir block error"); return -1; } if (verbose > 1) printf("scanning root dir\n"); offset = 0; while (offset < 4096) { char name[256]; de = (struct ext2_dir_entry_2 *)(dir_block_buf + offset); if (verbose > 1) printf("offset 0x%x, len 0x%x\n", offset, de->rec_len); strncpy(name, de->name, de->name_len); name[de->name_len] = 0; offset += de->rec_len; if (verbose > 1) { printf("inode %d, type %d, name '%s'\n", de->inode, de->file_type, name); printf("rec_len %d (%x), b %d\n", de->rec_len, de->rec_len, offset); } if (/* FIXME de->file_type == 2 && */ strncmp(name, "boot", 5) == 0) { if( verbose > 0) printf("found /boot dir\n"); if (verbose > 1) printf("/boot dir inode %d\n", de->inode); boot_inode_num = de->inode; break; } // FIXME de->file_type == 0 for me 8-( if (/* FIXME de->file_type == 1 && */ strncmp(name, fileName, sizeof(name)) == 0) { if( verbose > 0) printf("found /%s\n", fileName); if (verbose > 1) printf("/%s inode %d\n", fileName, de->inode); our_inode_num = de->inode; break; } } if (boot_inode_num) { if (verbose > 1) printf("scanning /boot dir\n"); if (read_inode(sb, boot_inode_num, &boot_inode)) { debug("read boot inode error"); return -1; } inode = &boot_inode; if (verbose > 1) { printf("mode %o\n", inode->i_mode); printf("flags %x\n", inode->i_flags); printf("size %x\n", inode->i_size); printf("blocks %x\n", inode->i_blocks); printf("block[0] %x\n", inode->i_block[0]); printf("block[1] %x\n", inode->i_block[1]); } if (read_block(inode->i_block[0], dir_block_buf)) { debug("read boot inode dir block error"); return -1; } our_inode_num = 0; offset = 0; while (offset < 4096) { char name[256]; de = (struct ext2_dir_entry_2 *)(dir_block_buf + offset); strncpy(name, de->name, de->name_len); name[de->name_len] = 0; offset += de->rec_len; if (verbose > 1) { printf("inode %d, type %d, name '%s'\n", de->inode, de->file_type, name); printf("rec_len %d (%x), b %d\n", de->rec_len, de->rec_len, offset); } if (/* FIXME de->file_type == 1 && */ strncmp(name, fileName, sizeof(name)) == 0) { printf("found /boot/%s\n", fileName); our_inode_num = de->inode; } if (our_inode_num) break; } } if (our_inode_num) { if( verbose > 0) printf("reading %s:\n", fileName); if( (retval=load_file_inode(sb, our_inode_num, ramBase)) < 0) return -1; } return retval; // success: return file size } #ifdef TEST main() { int fd; fd = open("/tmp/disk", 0); read(fd, disk, sizeof(disk)); close(fd); check_mbr(); find_root(); } #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/lib/Makefile.am,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Makefile.am 27 Apr 2002 00:55:04 -0000 1.18 +++ Makefile.am 27 Apr 2002 04:16:34 -0000 1.19 @@ -28,8 +28,8 @@ libblob_a_SOURCES = \ command.c \ crc32.c \ - disk.c \ error.c \ + ext2fs.c \ i2c.c \ i2c-gpio.c \ icache.c \ --- disk.c DELETED --- |
From: Christopher H. <ch...@us...> - 2002-04-27 01:23:31
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv14789/include/blob Added Files: spd.h Log Message: defines for spd eeproms --- NEW FILE: spd.h --- /* * spd.h: defines for PC SDRAM serial presence detect * * Copyright (C) 2001 Hewlett-Packard Company * Written by Christopher Hoover <ch...@hp...> * * 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 * */ /* * PC SDRAM Serial Presence Detect (SPD) Specification, Revision 1.2B * * http://developer.intel.com/technology/memory/pc133sdram/spec/Spdsd12b.pdf */ #ifndef _SPD_H_ #define _SPD_H_ #define SPD_I2C_ADDR(a) (0x50 | (a)) #define SPD_SPD_MANUF_BYTES 0 #define SPD_SPD_TOTAL_BYTES 1 #define SPD_MEMORY_TYPE 2 # define SPD_MEMORY_TYPE_EDO 2 # define SPD_MEMORY_TYPE_SDRAM 4 #define SPD_ROW_BITS 3 #define SPD_COL_BITS 4 #define SPD_MODULE_ROWS 5 #define SPD_DATA_WIDTH 6 #define SPD_DATA_WIDTH_L 6 #define SPD_DATA_WIDTH_H 7 #define SPD_VOLTAGE_INTERFACE 8 #define SPD_CYCLE_TIME 9 #define SPD_ACCESS_TIME 10 #define SPD_MODULE_TYPE 11 #define SPD_REFRESH_RATE_TYPE 12 #define SPD_PRIMARY_SDRAM_WIDTH 13 #define SPD_MIN_CLOCK_B2B_RAND_COL 15 #define SPD_BURST_LENGTHS 16 #define SPD_NUMBER_OF_BANKS_SDRAM 17 #define SPD_CAS_LATENCY 18 #define SPD_CS_LATENCY 19 #define SPD_WE_LATENCY 20 #define SPD_MODULE_ATTRIBS 21 #define SPD_DEVICE_ATTRIBS 22 #define SPD_CYCLE_TIME_CL_X_1 23 #define SPD_ACCESS_TIME_CL_X_1 24 #define SPD_CYCLE_TIME_CL_X_2 25 #define SPD_ACCESS_TIME_CL_X_2 26 #define SPD_TRP 27 #define SPD_TRRD 28 #define SPD_TRCD 29 #define SPD_TRAS 30 #define SPD_ROW_DENSITY 31 #define SPD_CMD_ADDR_SETUP_TIME 32 #define SPD_CMD_ADDR_HOLD_TIME 33 #define SPD_DATA_SETUP_TIME 34 #define SPD_DATA_HOLD_TIME 35 #define SPD_DATA_REVISION 62 #define SPD_CHECKSUM 63 #define SPD_MANUF_JDEC_ID 64 #define SPD_MANUF_LOCATION 72 #define SPD_MANUF_PART_NUMBER 73 #define SPD_REVISION_CODE 91 #define SPD_MANUF_DATE 93 #define SPD_SERIAL_NUMBER 95 #define SPD_MANUF_SPECIFIC_DATA 99 #define SPD_INTEL_SPEC_FREQ 126 #define SPD_INTEL_SPEC_CAS_LATENCY 127 #endif |
From: Christopher H. <ch...@us...> - 2002-04-27 00:56:18
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv9158/utils/test Modified Files: .cvsignore Log Message: fixing regression Index: .cvsignore =================================================================== RCS file: /cvsroot/blob/blob/utils/test/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- .cvsignore 27 Apr 2002 00:55:04 -0000 1.2 +++ .cvsignore 27 Apr 2002 00:56:13 -0000 1.3 @@ -6,3 +6,4 @@ Makefile.in Makefile junk +load_kernel_test |
From: Christopher H. <ch...@us...> - 2002-04-27 00:55:13
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv8216/include/blob Modified Files: i2c.h Log Message: add i2c_probe fix badge4 initialization to fetch the SDRAM info out of the SPD add i2c.c and i2c-gpio.c to lib build remove ide.c and pcmcia.c from lib build (currently broken) switch initial terminal baud to whatever is in arch header Index: i2c.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/i2c.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- i2c.h 25 Apr 2002 22:46:11 -0000 1.1 +++ i2c.h 27 Apr 2002 00:55:04 -0000 1.2 @@ -22,6 +22,7 @@ extern int i2c_read_device_bytes(struct i2c_bus *, u8, u8, u8 *, unsigned long); extern int i2c_write_device_byte_at(struct i2c_bus *, u8, u8, u8); extern int i2c_write_device_bytes_at(struct i2c_bus *, u8, u8, const u8 *, unsigned long); +extern int i2c_probe(struct i2c_bus *bus, u8); extern int i2c_scan(struct i2c_bus *bus, u8 map[256]); /* low-level operators */ |
From: Christopher H. <ch...@us...> - 2002-04-27 00:55:12
|
Update of /cvsroot/blob/blob/utils In directory usw-pr-cvs1:/tmp/cvs-serv8216/utils Modified Files: Makefile.am Log Message: add i2c_probe fix badge4 initialization to fetch the SDRAM info out of the SPD add i2c.c and i2c-gpio.c to lib build remove ide.c and pcmcia.c from lib build (currently broken) switch initial terminal baud to whatever is in arch header Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/utils/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.am 26 Apr 2002 07:12:38 -0000 1.5 +++ Makefile.am 27 Apr 2002 00:55:04 -0000 1.6 @@ -5,7 +5,6 @@ SUBDIRS = \ build \ - test \ mkparamblock CLEANFILES = *~ |
From: Christopher H. <ch...@us...> - 2002-04-27 00:55:12
|
Update of /cvsroot/blob/blob/include/blob/arch In directory usw-pr-cvs1:/tmp/cvs-serv8216/include/blob/arch Modified Files: badge4.h Log Message: add i2c_probe fix badge4 initialization to fetch the SDRAM info out of the SPD add i2c.c and i2c-gpio.c to lib build remove ide.c and pcmcia.c from lib build (currently broken) switch initial terminal baud to whatever is in arch header Index: badge4.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/arch/badge4.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- badge4.h 27 Feb 2002 18:41:48 -0000 1.6 +++ badge4.h 27 Apr 2002 00:55:04 -0000 1.7 @@ -1,7 +1,7 @@ /* * badge4.h: Badge4 specific defines * - * Copyright (C) 2001 Hewlett-Packard Company + * Copyright (C) 2001-2002 Hewlett-Packard Company * Written by Christopher Hoover <ch...@hp...> * * $Id$ @@ -27,27 +27,37 @@ #ifndef BLOB_ARCH_BADGE4_H #define BLOB_ARCH_BADGE4_H +#define BADGE4_SA1111_BASE (0x48000000) +/* GPIOs on the BadgePAD 4 */ +#define BADGE4_GPIO_INT_1111 GPIO_GPIO0 /* SA-1111 IRQ */ +#define BADGE4_GPIO_SDSDA GPIO_GPIO17 /* SDRAM SPD Data */ +#define BADGE4_GPIO_SDSCL GPIO_GPIO18 /* SDRAM SPD Clock */ +#define BADGE4_GPIO_SDTYP0 GPIO_GPIO19 /* SDRAM Type Control */ +#define BADGE4_GPIO_SDTYP1 GPIO_GPIO20 /* SDRAM Type Control */ +#define BADGE4_GPIO_PCMEN5V GPIO_GPIO24 /* 5V power */ +#define BADGE4_GPIO_SA1111_NRST GPIO_GPIO25 /* SA-1111 nRESET */ +#define BADGE4_GPIO_CLK_1111 GPIO_GPIO27 /* GPIO_32_768kHz */ +/* Interrupts on the BadgePAD 4 */ +#define BADGE4_IRQ_GPIO_SA1111 IRQ_GPIO0 /* SA-1111 interrupt */ -/* boot CPU speed */ -#define CPU_SPEED (0x0a) +/* boot CPU speed */ +#define CPU_SPEED CPU_CORE_SPEED_206mhz /* serial port */ #define USE_SERIAL3 #define TERMINAL_SPEED baud_115200 - /* GPIO for the LED */ #define LED_GPIO (0x00000000) /* No LED */ - +#define SA1111_BASE BADGE4_SA1111_BASE /* the base address were BLOB is loaded by the first stage loader */ #define BLOB_ABS_BASE_ADDR (0x08000400) /* sram */ - /* where do various parts live in RAM */ #define BLOB_RAM_BASE (0XC0100000) #define KERNEL_RAM_BASE (0xC0008000) @@ -61,16 +71,15 @@ #define PARAM_FLASH_LEN (0x00002000 * 2) #define KERNEL_FLASH_BASE (PARAM_FLASH_BASE + PARAM_FLASH_LEN) #define KERNEL_FLASH_LEN (0x00010000 * 16) -#define LOAD_RAMDISK 1 /* load ramdisk into ram */ +#define LOAD_RAMDISK 0 /* load ramdisk into ram */ #define RAMDISK_FLASH_BASE (KERNEL_FLASH_BASE + KERNEL_FLASH_LEN) #define RAMDISK_FLASH_LEN (0x00010000 * 47) -#define PARAM_START PARAM_FLASH_BASE -#define PARAM_LEN PARAM_FLASH_LEN +#define PARAM_START PARAM_FLASH_BASE +#define PARAM_LEN PARAM_FLASH_LEN /* the position of the kernel boot parameters */ #define BOOT_PARAMS (0xc0000100) - /* the size (in kbytes) to which the compressed ramdisk expands */ #define RAMDISK_SIZE (8 * 1024) |
From: Christopher H. <ch...@us...> - 2002-04-27 00:55:12
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv8216/src/lib Modified Files: Makefile.am i2c.c Log Message: add i2c_probe fix badge4 initialization to fetch the SDRAM info out of the SPD add i2c.c and i2c-gpio.c to lib build remove ide.c and pcmcia.c from lib build (currently broken) switch initial terminal baud to whatever is in arch header Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/lib/Makefile.am,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Makefile.am 26 Apr 2002 04:46:59 -0000 1.17 +++ Makefile.am 27 Apr 2002 00:55:04 -0000 1.18 @@ -30,8 +30,9 @@ crc32.c \ disk.c \ error.c \ + i2c.c \ + i2c-gpio.c \ icache.c \ - ide.c \ init.c \ led.c \ md5.c \ @@ -39,7 +40,6 @@ memcpy.c \ memset.c \ mini_inflate.c \ - pcmcia.c \ printf.c \ reboot.c \ serial.c \ Index: i2c.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/i2c.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- i2c.c 25 Apr 2002 23:29:42 -0000 1.2 +++ i2c.c 27 Apr 2002 00:55:04 -0000 1.3 @@ -324,6 +324,19 @@ return 0; } +int i2c_probe(struct i2c_bus *bus, u8 devAddr) +{ + int ack; + + i2c_start(bus); + i2c_write_byte(bus, READ_ADDR(devAddr)); + ack = i2c_get_ack_quietly(bus); + i2c_stop(bus); + + /* 0 == device present */ + return ack; +} + int i2c_scan(struct i2c_bus *bus, u8 map[256]) { int i; |
From: Christopher H. <ch...@us...> - 2002-04-27 00:55:12
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv8216/src/blob Modified Files: Makefile.am badge4.c initcalls.c Log Message: add i2c_probe fix badge4 initialization to fetch the SDRAM info out of the SPD add i2c.c and i2c-gpio.c to lib build remove ide.c and pcmcia.c from lib build (currently broken) switch initial terminal baud to whatever is in arch header Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/blob/Makefile.am,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- Makefile.am 23 Apr 2002 12:36:19 -0000 1.28 +++ Makefile.am 27 Apr 2002 00:55:04 -0000 1.29 @@ -21,7 +21,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # - bin_PROGRAMS = \ blob-start-elf32 \ blob-start \ Index: badge4.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/badge4.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- badge4.c 13 Feb 2002 00:08:54 -0000 1.6 +++ badge4.c 27 Apr 2002 00:55:04 -0000 1.7 @@ -1,7 +1,7 @@ /* * badge4.c: Badge 4 specific stuff * - * Copyright (C) 2001 Hewlett-Packard Company + * Copyright (C) 2001-2002 Hewlett-Packard Company * Written by Christopher Hoover <ch...@hp...> * * This program is free software; you can redistribute it and/or modify @@ -26,10 +26,30 @@ # include <blob/config.h> #endif +#include <blob/arch/badge4.h> #include <blob/flash.h> #include <blob/init.h> #include <blob/sa1100.h> #include <blob/serial.h> +#include <blob/util.h> +#include <blob/i2c.h> +#include <blob/i2c-gpio.h> +#include <blob/spd.h> + +static struct i2c_bus_gpio_private badge4_i2c_bus_gpio_private = { + sda_gpio: BADGE4_GPIO_SDSDA, + scl_gpio: BADGE4_GPIO_SDSCL, + delay: 1000 +}; + +static struct i2c_bus badge4_i2c_bus = { + init_bus: init_bus_gpio, + set_sda: set_sda_gpio, + get_sda: get_sda_gpio, + set_scl: set_scl_gpio, + get_scl: get_scl_gpio, + private: &badge4_i2c_bus_gpio_private +}; /* flash descriptor for Badge4 flash */ /* 1 x Intel 28F320C3BA100 Advanced+ Boot Block Flash (32 Mbit) */ @@ -53,40 +73,35 @@ }, }; - - - -static void init_flash_driver(void) +static void badge4_select_drivers(void) { + /* select serial driver */ + serial_driver = &sa11x0_serial_driver; + flash_descriptors = badge4_flash_descriptors; flash_driver = &intel16_flash_driver; } -__initlist(init_flash_driver, INIT_LEVEL_DRIVER_SELECTION); +__initlist(badge4_select_drivers, INIT_LEVEL_DRIVER_SELECTION); -static void init_hardware(void) +static void badge4_init_sa1111(void) { /* - * Grab a paper bag. This is ugly. - * * We have to do part of the SA-1111 initialization here. * Whenever we pull down GPIO_SA1111_NRST (GPIO 25, 1111_RST~ - * on the schematic), the DRAM goes to hell as that GPIO is - * also wired into the CPLD that controls the DRAM interface. - * Argh. + * on the schematic), the SDRAM goes away as that gpio is also + * wired into the CPLD that controls the SO-DIMM SDRAM + * interface. (Argh.) * - * The only reason the following works is that we're running - * blob out of sram. (The same kind of thing would also work - * when running out of flash, but there's no good place to - * hook int platform-specific initialization in the blob - * loader in the short window when it is running out of - * flash. + * The only reason this code runs at all is that we have set + * up blob to run out of SRAM. Fortunately all BadgePAD 4's + * have SRAM. */ /* Asert nRESET. */ - GPCR = GPIO_GPIO25; - GPDR |= GPIO_GPIO25; + GPCR = BADGE4_GPIO_SA1111_NRST; + GPDR |= BADGE4_GPIO_SA1111_NRST; /* * Set up the 3.6864MHz clock on GPIO 27 for the SA-1111: @@ -97,25 +112,100 @@ TUCR = TUCR_3_6864MHz; /* De-assert nRESET */ - GPSR = GPIO_GPIO25; + GPSR = BADGE4_GPIO_SA1111_NRST; /* * The SA-1111 initialization is not yet done, but Linux * can do the rest. */ +} + +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; + + /* 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"); + return; + } + + /* Read the SPD to determine the SO-DIMM SDRAM parameters. */ + + /* quick sanity check */ + memory_type = spd_byte(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); + + /* calculate the size: bit 0 is 4M, bit 1 is 8M, etc. */ + size = 0; + for (i = 0; i < 8; i++) + if (row_density & (1<<i)) + size += (4<<i); + + printf("SDRAM: %d Mbytes (row bits=%d, col bits=%d)\n", + size, row_bits, col_bits); /* - * GPIO 19 and 20 specify SDRAM "type". - * These settings are for 12 row bits, 9 col bits. - * ### Incorporate SPD code here. + * Here's what the CPLD expects + * + * typ1 typ0 flavor typical geometry + * 0 0 SO-DIMM with 64 Mbit parts xx/8 + * 0 1 SO-DIMM with 128 Mbit parts 12/9 + * 1 0 SO-DIMM with 256 Mbit parts 13/9 */ - GPSR = GPIO_GPIO19; - GPCR = GPIO_GPIO20; - GPDR |= (GPIO_GPIO19 | GPIO_GPIO20); - /* select serial driver */ - serial_driver = &sa11x0_serial_driver; -} + /* ### should we use the other SPD info or is col/row bits enough? */ + if (col_bits == 8) { + typ1 = 0; typ0 = 0; + } else if (row_bits == 12 && col_bits == 9) { + typ1 = 0; typ0 = 1; + } else if (row_bits == 13 && col_bits == 9) { + typ1 = 1; typ0 = 0; + } else { + printf("SDRAM: unexpected SDRAM geometry\n"); + goto fail; + } + + set: + printf("SDRAM: setting type typ1=%d, typ0=%d\n", typ1, typ0); + GPDR |= (BADGE4_GPIO_SDTYP0 | BADGE4_GPIO_SDTYP1); + if (typ0) + GPSR = BADGE4_GPIO_SDTYP0; + else + GPCR = BADGE4_GPIO_SDTYP0; + if (typ1) + GPSR = BADGE4_GPIO_SDTYP1; + else + GPCR = BADGE4_GPIO_SDTYP1; + return; -__initlist(init_hardware, INIT_LEVEL_DRIVER_SELECTION); + fail: + printf("SDRAM: making unwarranted assumption that SDRAM is 12x9\n"); + typ1 = 0; typ0 = 1; + goto set; +} + +static void badge4_init_hardware(void) +{ + badge4_init_sa1111(); + badge4_setup_sdram(); +} +__initlist(badge4_init_hardware, INIT_LEVEL_INITIAL_HARDWARE + 1); Index: initcalls.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/initcalls.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- initcalls.c 3 Jan 2002 16:07:17 -0000 1.3 +++ initcalls.c 27 Apr 2002 00:55:04 -0000 1.4 @@ -27,6 +27,7 @@ # include <blob/config.h> #endif +#include <blob/arch.h> #include <blob/init.h> #include <blob/icache.h> #include <blob/led.h> @@ -39,7 +40,7 @@ /* default serial initialisation */ static void serial_default_init(void) { - serial_init(baud_9600); + serial_init(TERMINAL_SPEED); } |
From: Christopher H. <ch...@us...> - 2002-04-27 00:55:11
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv8216/utils/test Modified Files: .cvsignore Makefile.am Log Message: add i2c_probe fix badge4 initialization to fetch the SDRAM info out of the SPD add i2c.c and i2c-gpio.c to lib build remove ide.c and pcmcia.c from lib build (currently broken) switch initial terminal baud to whatever is in arch header Index: .cvsignore =================================================================== RCS file: /cvsroot/blob/blob/utils/test/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .cvsignore 14 Feb 2002 09:59:34 -0000 1.1 +++ .cvsignore 27 Apr 2002 00:55:04 -0000 1.2 @@ -1 +1,8 @@ -load_kernel_test +aclocal.m4 +configure +config.cache +config.log +config.status +Makefile.in +Makefile +junk Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/utils/test/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 26 Apr 2002 07:12:38 -0000 1.1 +++ Makefile.am 27 Apr 2002 00:55:05 -0000 1.2 @@ -45,7 +45,6 @@ $(load_kernel_test_extra_SOURCES) load_kernel_test: $(load_kernel_test_OBJECTS) - #gcc $(CFLAGS) -o $@ $(load_kernel_test_OBJECTS) gcc $(CFLAGS) -o $@ $< $(load_kernel_test_extra_SOURCES): |
From: Christopher H. <ch...@us...> - 2002-04-27 00:55:11
|
Update of /cvsroot/blob/blob In directory usw-pr-cvs1:/tmp/cvs-serv8216 Modified Files: .cvsignore Log Message: add i2c_probe fix badge4 initialization to fetch the SDRAM info out of the SPD add i2c.c and i2c-gpio.c to lib build remove ide.c and pcmcia.c from lib build (currently broken) switch initial terminal baud to whatever is in arch header Index: .cvsignore =================================================================== RCS file: /cvsroot/blob/blob/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- .cvsignore 16 Sep 2001 15:41:25 -0000 1.2 +++ .cvsignore 27 Apr 2002 00:55:04 -0000 1.3 @@ -5,3 +5,4 @@ config.status Makefile.in Makefile +junk |
From: Russ D. <Rus...@as...> - 2002-04-26 20:23:08
|
On Fri, 2002-04-26 at 13:04, Christopher Hoover wrote: > > cvs is broken: > > - automake complains about load_kernel_test stuff > - test directory fails in compilation of load_kernel_test > - no target for load_kernel.o personally, I would recommend that load_kernel_test be not built by default, but only if the user implicitly goes to util/test and types make |
From: Christopher H. <ch...@mu...> - 2002-04-26 20:09:02
|
ide.c compilation fails ... with complaints about SA1111_BASE =20 i also get a warning about switching to asm/hardware/sa1111.h -- = because i'm using a 2.5.x kernel -ch |
From: Christopher H. <ch...@mu...> - 2002-04-26 20:04:20
|
cvs is broken: - automake complains about load_kernel_test stuff - test directory fails in compilation of load_kernel_test - no target for load_kernel.o |
From: Russ D. <Rus...@as...> - 2002-04-26 19:24:27
|
On Fri, 2002-04-26 at 11:24, Stefan Eletzhofer wrote: > Update of /cvsroot/blob/blob/src/lib > In directory usw-pr-cvs1:/tmp/cvs-serv26183 > > Added Files: > tar.c > Log Message: > - first revision of minimal tar archive support. > - this module will be used to get a blob/ramdisk/kernel > update mechanism from e.g. CF cards using raw tar archives. > For ex. do a "tar -c --posix -f /def/hda zImage blob initrd.gz cramfs.img" > with /dev/hda a mounted CF card, ship the CF card to your customer > and off you go. > - Missing so far: > * only posix tar format > * no zlib support (do we need this?) > * only "t" and "x" are supported, i.e. no creation of tar > archives so far. > - This is WIP .... > why not do this with a single cramfs? The current cramfs implementation is not complete, but it would be a complete one would be a lot shorter than this tar implementation. Also, if you ale looking for zlib, there is a deflate implementation in mini_inflate.c. |
From: Stefan E. <se...@us...> - 2002-04-26 18:26:41
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv3418 Modified Files: system3.c Log Message: - test command for tar archive library. Will eventually go into libcommands.a Index: system3.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/system3.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- system3.c 24 Apr 2002 14:34:26 -0000 1.12 +++ system3.c 26 Apr 2002 18:26:38 -0000 1.13 @@ -48,6 +48,7 @@ #include <blob/sa1111.h> #include <blob/pcmcia.h> #include <blob/ide.h> +#include <blob/tar.h> /********************************************************************** * defines @@ -435,6 +436,62 @@ serial_write('\n'); } } + +int tar_cmd( int argc, char *argv[] ) +{ + int ret = 0; + u32 start = 0; + u32 dest = 0; + tar_arch_t my_arch; + struct mem arch_adr; + + tar_dbg_set( 100 ); + + if ( argc<3 ) ERR( -EINVAL ); + + ret = strtou32(argv[2], &start); + if ( ret < 0 ) ERR( -EINVAL ); + + arch_adr.start = (unsigned char *)start; + ret = tar_init( &my_arch, mem_block_get, mem_block_reset, &arch_adr ); + if ( ret ) { + printf( "tar_init: %d\n", ret ); + goto DONE; + } + + switch (argv[1][0]) { + case 't': + case 'T': + ret = tar_tell( &my_arch ); + if ( ret ) { + printf( "tar_tell: %d\n", ret ); + goto DONE; + } + break; + case 'x': + case 'X': + if ( argc<4 ) ERR( -EINVAL ); + + ret = strtou32(argv[4], &dest); + if ( ret < 0 ) ERR( -EINVAL ); + + _DBG( "dest=%p\n", (unsigned char *)dest ); + _DBG( "filename=%s\n", argv[3] ); + + ret = tar_xtract( &my_arch, argv[3], (unsigned char *)dest ); + if ( ret ) { + printf( "tar_xtract: %d\n", ret ); + goto DONE; + } + dumpmem( dest, 0x200 ); + break; + } + +DONE: + return ret; +} +static char tar_help[] = "tar [t|x] src [filename dest]\n"; +__commandlist(tar_cmd, "tar", tar_help); /***************************************************************** * manually reference flash and download commands until they |
From: Stefan E. <se...@us...> - 2002-04-26 18:25:22
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv2394 Added Files: tar.h Log Message: - header file for tar.c --- NEW FILE: tar.h --- /* * tar.h * Copyright (C) 1988, 92, 93, 94, 96, 97 Free Software Foundation, Inc. * 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 */ #ifndef BLOB_TAR_H #define BLOB_TAR_H 1 /*---------------------------------------------. | `tar' Header Block, from POSIX 1003.1-1990. | `---------------------------------------------*/ /* POSIX header. */ typedef struct posix_header { /* byte offset */ char name[100]; /* 0 */ char mode[8]; /* 100 */ char uid[8]; /* 108 */ char gid[8]; /* 116 */ char size[12]; /* 124 */ char mtime[12]; /* 136 */ char chksum[8]; /* 148 */ char typeflag; /* 156 */ char linkname[100]; /* 157 */ char magic[6]; /* 257 */ char version[2]; /* 263 */ char uname[32]; /* 265 */ char gname[32]; /* 297 */ char devmajor[8]; /* 329 */ char devminor[8]; /* 337 */ char prefix[155]; /* 345 */ /* 500 */ } tar_hdr_posix_t __attribute__ (( packed )); #define TMAGIC "ustar" /* ustar and a null */ #define TMAGLEN 6 #define TVERSION "00" /* 00 and no null */ #define TVERSLEN 2 /* Values used in typeflag field. */ #define REGTYPE '0' /* regular file */ #define AREGTYPE '\0' /* regular file */ #define LNKTYPE '1' /* link */ #define SYMTYPE '2' /* reserved */ #define CHRTYPE '3' /* character special */ #define BLKTYPE '4' /* block special */ #define DIRTYPE '5' /* directory */ #define FIFOTYPE '6' /* FIFO special */ #define CONTTYPE '7' /* reserved */ /* Bits used in the mode field, values in octal. */ #define TSUID 04000 /* set UID on execution */ #define TSGID 02000 /* set GID on execution */ #define TSVTX 01000 /* reserved */ /* file permissions */ #define TUREAD 00400 /* read by owner */ #define TUWRITE 00200 /* write by owner */ #define TUEXEC 00100 /* execute/search by owner */ #define TGREAD 00040 /* read by group */ #define TGWRITE 00020 /* write by group */ #define TGEXEC 00010 /* execute/search by group */ #define TOREAD 00004 /* read by other */ #define TOWRITE 00002 /* write by other */ #define TOEXEC 00001 /* execute/search by other */ /*-------------------------------------. | `tar' Header Block, GNU extensions. | `-------------------------------------*/ /* In GNU tar, SYMTYPE is for to symbolic links, and CONTTYPE is for contiguous files, so maybe disobeying the `reserved' comment in POSIX header description. I suspect these were meant to be used this way, and should not have really been `reserved' in the published standards. */ /* *BEWARE* *BEWARE* *BEWARE* that the following information is still boiling, and may change. Even if the OLDGNU format description should be accurate, the so-called GNU format is not yet fully decided. It is surely meant to use only extensions allowed by POSIX, but the sketch below repeats some ugliness from the OLDGNU format, which should rather go away. Sparse files should be saved in such a way that they do *not* require two passes at archive creation time. Huge files get some POSIX fields to overflow, alternate solutions have to be sought for this. */ /* Descriptor for a single file hole. */ struct sparse { /* byte offset */ char offset[12]; /* 0 */ char numbytes[12]; /* 12 */ /* 24 */ }; /* Sparse files are not supported in POSIX ustar format. For sparse files with a POSIX header, a GNU extra header is provided which holds overall sparse information and a few sparse descriptors. When an old GNU header replaces both the POSIX header and the GNU extra header, it holds some sparse descriptors too. Whether POSIX or not, if more sparse descriptors are still needed, they are put into as many successive sparse headers as necessary. The following constants tell how many sparse descriptors fit in each kind of header able to hold them. */ #define SPARSES_IN_EXTRA_HEADER 16 #define SPARSES_IN_OLDGNU_HEADER 4 #define SPARSES_IN_SPARSE_HEADER 21 /* The GNU extra header contains some information GNU tar needs, but not foreseen in POSIX header format. It is only used after a POSIX header (and never with old GNU headers), and immediately follows this POSIX header, when typeflag is a letter rather than a digit, so signaling a GNU extension. */ typedef struct extra_header { /* byte offset */ char atime[12]; /* 0 */ char ctime[12]; /* 12 */ char offset[12]; /* 24 */ char realsize[12]; /* 36 */ char longnames[4]; /* 48 */ char unused_pad1[68]; /* 52 */ struct sparse sp[SPARSES_IN_EXTRA_HEADER]; /* 120 */ char isextended; /* 504 */ /* 505 */ } tar_hdr_extra_t; /* Extension header for sparse files, used immediately after the GNU extra header, and used only if all sparse information cannot fit into that extra header. There might even be many such extension headers, one after the other, until all sparse information has been recorded. */ typedef struct sparse_header { /* byte offset */ struct sparse sp[SPARSES_IN_SPARSE_HEADER]; /* 0 */ char isextended; /* 504 */ /* 505 */ } tar_hdr_sparse_t; /* The old GNU format header conflicts with POSIX format in such a way that POSIX archives may fool old GNU tar's, and POSIX tar's might well be fooled by old GNU tar archives. An old GNU format header uses the space used by the prefix field in a POSIX header, and cumulates information normally found in a GNU extra header. With an old GNU tar header, we never see any POSIX header nor GNU extra header. Supplementary sparse headers are allowed, however. */ typedef struct oldgnu_header { /* byte offset */ char unused_pad1[345]; /* 0 */ char atime[12]; /* 345 */ char ctime[12]; /* 357 */ char offset[12]; /* 369 */ char longnames[4]; /* 381 */ char unused_pad2; /* 385 */ struct sparse sp[SPARSES_IN_OLDGNU_HEADER]; /* 386 */ char isextended; /* 482 */ char realsize[12]; /* 483 */ /* 495 */ } tar_hdr_oldgnu_t; /* OLDGNU_MAGIC uses both magic and version fields, which are contiguous. Found in an archive, it indicates an old GNU header format, which will be hopefully become obsolescent. With OLDGNU_MAGIC, uname and gname are valid, though the header is not truly POSIX conforming. */ #define OLDGNU_MAGIC "ustar " /* 7 chars and a null */ /* The standards committee allows only capital A through capital Z for user-defined expansion. */ /* This is a dir entry that contains the names of files that were in the dir at the time the dump was made. */ #define GNUTYPE_DUMPDIR 'D' /* Identifies the *next* file on the tape as having a long linkname. */ #define GNUTYPE_LONGLINK 'K' /* Identifies the *next* file on the tape as having a long name. */ #define GNUTYPE_LONGNAME 'L' /* This is the continuation of a file that began on another volume. */ #define GNUTYPE_MULTIVOL 'M' /* For storing filenames that do not fit into the main header. */ #define GNUTYPE_NAMES 'N' /* This is for sparse files. */ #define GNUTYPE_SPARSE 'S' /* This file is a tape/volume header. Ignore it on extraction. */ #define GNUTYPE_VOLHDR 'V' /*--------------------------------------. | tar Header Block, overall structure. | `--------------------------------------*/ /* tar files are made in basic blocks of this size. */ #define TAR_BLOCKSIZE 512 enum archive_format { DEFAULT_FORMAT, /* format to be decided later */ V7_FORMAT, /* old V7 tar format */ OLDGNU_FORMAT, /* GNU format as per before tar 1.12 */ POSIX_FORMAT, /* restricted, pure POSIX format */ GNU_FORMAT /* POSIX format with GNU extensions */ }; typedef union block { char buffer[TAR_BLOCKSIZE]; tar_hdr_posix_t header; tar_hdr_extra_t extra_header; tar_hdr_oldgnu_t oldgnu_header; tar_hdr_sparse_t sparse_header; } tar_block_t; /* 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; /* block buffer */ unsigned char buffer[512]; /* file infos */ char filename[255]; unsigned long size; int 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_tell( tar_arch_t *arch ); int tar_xtract( tar_arch_t *arch, char *filename, char *dest ); #endif |