Change interface between bootxx.S and boot1() - always linked together.

This allows boot1() to change the sector number (of the boot partition)
that bootxx.S passes through to boot2().
This means that boot2() will find the correct partition when boot1()
reads /boot from the 'a' partition instead of the mbr boot partition.
This all happens when you update a system that used a small 'wd0h' partition
to boot a raid1 set to the new bootcode.  Deleting /boot from the 'wd0h'
partition will make the new bootcode find /boot and the root filesystem
inside the raid set.
This commit is contained in:
dsl 2004-06-27 15:37:11 +00:00
parent 430f0ecf15
commit 5cf67adbc4
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot1.c,v 1.5 2004/02/28 22:32:23 dsl Exp $ */
/* $NetBSD: boot1.c,v 1.6 2004/06/27 15:37:11 dsl Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: boot1.c,v 1.5 2004/02/28 22:32:23 dsl Exp $");
__RCSID("$NetBSD: boot1.c,v 1.6 2004/06/27 15:37:11 dsl Exp $");
#include <lib/libsa/stand.h>
#include <lib/libkern/libkern.h>
@ -51,24 +51,22 @@ __RCSID("$NetBSD: boot1.c,v 1.5 2004/02/28 22:32:23 dsl Exp $");
#define XSTR(x) #x
#define STR(x) XSTR(x)
static uint32_t bios_dev;
static uint32_t bios_sector;
struct biosdisk_ll d;
static struct biosdisk_ll d;
const char *boot1(uint32_t biosdev, uint32_t sector);
const char *boot1(uint32_t, uint32_t *);
extern void putstr(const char *);
extern struct disklabel ptn_disklabel;
const char *
boot1(uint32_t biosdev, uint32_t sector)
boot1(uint32_t biosdev, uint32_t *sector)
{
struct stat sb;
int fd;
bios_sector = sector;
bios_dev = biosdev;
bios_sector = *sector;
d.dev = biosdev;
putstr("\r\nNetBSD/" MACHINE " " STR(FS) " Primary Bootstrap\r\n");
@ -106,6 +104,7 @@ boot1(uint32_t biosdev, uint32_t sector)
if (ptn_disklabel.d_partitions[0].p_fstype == FS_UNUSED)
break;
bios_sector = ptn_disklabel.d_partitions[0].p_offset;
*sector = bios_sector;
if (ptn_disklabel.d_partitions[0].p_fstype == FS_RAID)
bios_sector += RF_PROTECTED_SECTORS;
fd = open("boot", 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootxx.S,v 1.4 2004/02/28 23:01:55 dsl Exp $ */
/* $NetBSD: bootxx.S,v 1.5 2004/06/27 15:37:11 dsl Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -77,6 +77,7 @@ bootparams: /* space for patchable variables */
and $0xff, %edx
push %esi /* save args for secondary bootstrap */
movl %esp, %esi /* address of sector number */
push %edx
push %esi /* args for boot1 */
push %edx