Change load address of ofwboot for large (md root) kernel.

This commit is contained in:
tsubai 1998-06-26 12:29:28 +00:00
parent aeb6277b0e
commit 0fe318b3bc
4 changed files with 36 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootxx.c,v 1.1 1998/06/12 21:07:24 tsubai Exp $ */
/* $NetBSD: bootxx.c,v 1.2 1998/06/26 12:29:28 tsubai Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -37,12 +37,12 @@
int (*openfirmware)(void *);
int stack[1024];
#define MAXBLOCKNUM 16
#define MAXBLOCKNUM 32
int block_size = 0;
int block_count = MAXBLOCKNUM;
int block_table[MAXBLOCKNUM] = { 0 };
void (*entry)(void *) = (void *)0x3e0000;
void (*entry_point)(int, int, void *) = (void *)0;
asm("
.text
@ -269,7 +269,7 @@ startup(arg1, arg2, openfirm)
fd = OF_open(bootpath);
addr = (char *)entry;
addr = (char *)entry_point;
for (i = 0; i < block_count; i++) {
blk = block_table[i];
@ -289,7 +289,7 @@ startup(arg1, arg2, openfirm)
isync
" :: "r"(BATU(0)), "r"(BATL(0, 0)));
entry(openfirm);
entry_point(0, 0, openfirm);
OF_exit();
for (;;);

View File

@ -1,4 +1,4 @@
/* $NetBSD: installboot.c,v 1.1 1998/06/12 21:07:24 tsubai Exp $ */
/* $NetBSD: installboot.c,v 1.2 1998/06/26 12:29:29 tsubai Exp $ */
/*
* Copyright (c) 1994 Paul Kranenburg
@ -55,6 +55,10 @@ char *boot, *proto, *dev;
#define BOOTSECTOR_OFFSET 2048
#ifndef DEFAULT_ENTRY
#define DEFAULT_ENTRY 0x6c0000
#endif
struct nlist nl[] = {
#define X_BLOCKTABLE 0
{"_block_table"},
@ -62,12 +66,15 @@ struct nlist nl[] = {
{"_block_count"},
#define X_BLOCKSIZE 2
{"_block_size"},
#define X_ENTRY_POINT 3
{"_entry_point"},
{NULL}
};
daddr_t *block_table; /* block number array in prototype image */
int32_t *block_count_p; /* size of this array */
int32_t *block_size_p; /* filesystem block size */
int32_t *entry_point_p; /* entry point */
int32_t max_block_count;
char *loadprotoblocks __P((char *, long *));
@ -232,6 +239,7 @@ loadprotoblocks(fname, size)
block_table = (daddr_t *)(bp + nl[X_BLOCKTABLE].n_value + off);
block_count_p = (int32_t *)(bp + nl[X_BLOCKCOUNT].n_value + off);
block_size_p = (int32_t *)(bp + nl[X_BLOCKSIZE].n_value + off);
entry_point_p = (int32_t *)(bp + nl[X_ENTRY_POINT].n_value + off);
if ((int)block_table & 3) {
warn("%s: invalid address: block_table = %x",
@ -254,10 +262,17 @@ loadprotoblocks(fname, size)
close(fd);
return NULL;
}
if ((int)entry_point_p & 3) {
warn("%s: invalid address: entry_point_p = %x",
fname, entry_point_p);
free(bp);
close(fd);
return NULL;
}
max_block_count = *block_count_p;
if (verbose) {
printf("proto bootblock size %ld\n", sz);
printf("proto bootblock size: %ld\n", sz);
}
/*
@ -360,6 +375,13 @@ int devfd;
*/
*block_count_p = ndb;
/*
* Register entry point.
*/
*entry_point_p = DEFAULT_ENTRY;
if (verbose)
printf("entry point: 0x%08x\n", *entry_point_p);
if (verbose)
printf("%s: block numbers: ", boot);
ap = ip->di_db;

View File

@ -1,4 +1,4 @@
/* $NetBSD: Locore.c,v 1.1 1998/05/15 10:15:59 tsubai Exp $ */
/* $NetBSD: Locore.c,v 1.2 1998/06/26 12:29:29 tsubai Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -39,7 +39,7 @@
static int (*openfirmware) __P((void *));
static void startup __P((int (*)(void *), char *, int));
static void startup __P((void *, int, int (*)(void *), char *, int));
static void setup __P((void));
static int stack[4096/4];
@ -87,7 +87,9 @@ openfirmware(arg)
#endif
static void
startup(openfirm, arg, argl)
startup(vpd, res, openfirm, arg, argl)
void *vpd;
int res;
int (*openfirm)(void *);
char *arg;
int argl;

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.2 1998/06/12 21:07:24 tsubai Exp $
# $NetBSD: Makefile,v 1.3 1998/06/26 12:29:29 tsubai Exp $
S= ${.CURDIR}/../../../..
@ -16,7 +16,7 @@ NEWVERSWHAT= "OpenFirmware Boot"
# For now...
#RELOC= 20000
RELOC= 3e0000
RELOC= 6c0000
ENTRY= _start
@ -24,7 +24,6 @@ CLEANFILES+= vers.c vers.o ${PROG}.elf
CPPFLAGS+= -I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
CPPFLAGS+= -DRELOC=0x${RELOC}
CPPFLAGS+= -DFIRMWORKSBUGS
CPPFLAGS+= -DPOWERPC_BOOT_AOUT
CPPFLAGS+= -DPOWERPC_BOOT_ELF
#CPPFLAGS+= -DXCOFF_GLUE # for booting PCI Powermacs