Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/macppc/stand/bootxx convert to using shared_bbinfo ...



details:   https://anonhg.NetBSD.org/src/rev/3a0ee3940e1c
branches:  trunk
changeset: 526993:3a0ee3940e1c
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed May 15 13:55:38 2002 +0000

description:
convert to using shared_bbinfo from <sys/bootblock.h>, and install as an
"${OBJCOPY} -O binary ..." program (rather than as ELF)

diffstat:

 sys/arch/macppc/stand/bootxx/Makefile |  23 +++++++++++++----------
 sys/arch/macppc/stand/bootxx/bootxx.c |  33 ++++++++++++++++++++-------------
 2 files changed, 33 insertions(+), 23 deletions(-)

diffs (99 lines):

diff -r 98c1ecd37548 -r 3a0ee3940e1c sys/arch/macppc/stand/bootxx/Makefile
--- a/sys/arch/macppc/stand/bootxx/Makefile     Wed May 15 13:39:22 2002 +0000
+++ b/sys/arch/macppc/stand/bootxx/Makefile     Wed May 15 13:55:38 2002 +0000
@@ -1,15 +1,18 @@
-#      $NetBSD: Makefile,v 1.6 2002/04/13 13:44:48 tsutsui Exp $
+#      $NetBSD: Makefile,v 1.7 2002/05/15 13:55:38 lukem Exp $
 
-PROG= bootxx
-NOMAN= # defined
-STRIPFLAG=
-BINMODE=444
+PROG=          bootxx
+NOMAN=         # defined
+BINMODE=       444
 
-CFLAGS= -Os -mmultiple -Wall -msoft-float
-CPPFLAGS+= -D_STANDALONE
+CFLAGS=                -Os -mmultiple -Wall -msoft-float
+CPPFLAGS+=     -D_STANDALONE
+STRIPFLAG=
+LINKFLAGS=     -x -N -Ttext 4000 -e _start
+CLEANFILES+=   ${PROG}.sym
 
-${PROG}: ${PROG}.o
-       ${LD} -o bootxx -x -N -Ttext 4000 -e _start ${PROG}.o
-       @${SIZE} ${PROG}
+${PROG}: ${OBJS}
+       ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
+       @${SIZE} ${.TARGET}.sym
+       ${OBJCOPY} -O binary ${.TARGET}.sym ${.TARGET}
 
 .include <bsd.prog.mk>
diff -r 98c1ecd37548 -r 3a0ee3940e1c sys/arch/macppc/stand/bootxx/bootxx.c
--- a/sys/arch/macppc/stand/bootxx/bootxx.c     Wed May 15 13:39:22 2002 +0000
+++ b/sys/arch/macppc/stand/bootxx/bootxx.c     Wed May 15 13:55:38 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootxx.c,v 1.5 1999/12/22 18:57:47 thorpej Exp $       */
+/*     $NetBSD: bootxx.c,v 1.6 2002/05/15 13:55:38 lukem Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -34,15 +34,23 @@
 #include <sys/types.h>
 #include <machine/bat.h>
 
+#include <sys/bootblock.h>
+
 int (*openfirmware)(void *);
 int stack[1024];
 
-#define MAXBLOCKNUM 30
+struct shared_bbinfo bbinfo = {
+       { MACPPC_BBINFO_MAGIC },
+       0,
+       SHARED_BBINFO_MAXBLOCKS,
+       { 0 }
+};
 
-void (*entry_point)(int, int, void *) = (void *)0;
-int block_size = 0;
-int block_count = MAXBLOCKNUM;
-int block_table[MAXBLOCKNUM] = { 0 };
+#ifndef DEFAULT_ENTRY_POINT
+#define        DEFAULT_ENTRY_POINT     0x600000
+#endif
+
+void (*entry_point)(int, int, void *) = (void *)DEFAULT_ENTRY_POINT;
 
 asm("
        .text
@@ -213,8 +221,7 @@
        int arg1, arg2;
        void *openfirm;
 {
-       int fd, blk, chosen, options;
-       int i, bs;
+       int fd, blk, chosen, options, i;
        char *addr;
        char bootpath[128];
 
@@ -239,13 +246,13 @@
        fd = OF_open(bootpath);
 
        addr = (char *)entry_point;
-       bs = block_size;
-       for (i = 0; i < block_count; i++) {
-               blk = block_table[i];
+       for (i = 0; i < bbinfo.bbi_block_count; i++) {
+               if ((blk = bbinfo.bbi_block_table[i]) == 0)
+                       break;
 
                OF_seek(fd, (u_quad_t)blk * 512);
-               OF_read(fd, addr, bs);
-               addr += bs;
+               OF_read(fd, addr, bbinfo.bbi_block_size);
+               addr += bbinfo.bbi_block_size;
        }
 
        /*



Home | Main Index | Thread Index | Old Index