Sort out (and remember) the disk partition we will install into.
This should stop the i386 code splatting all over the start of the disk during upgrade. Upgrade will still use partition 'a' (unless you loop through the install far enough first!)
This commit is contained in:
parent
a72609cec0
commit
6da321c1aa
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: md.c,v 1.90 2003/07/07 12:30:25 dsl Exp $ */
|
||||
/* $NetBSD: md.c,v 1.91 2003/07/08 17:39:00 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -296,7 +296,8 @@ md_post_newfs(void)
|
||||
/* Copy bootstrap in by hand - /sbin/installboot explodes ramdisks */
|
||||
ret = 1;
|
||||
|
||||
td = opendisk(diskdev, O_RDWR, bootxx, sizeof bootxx, 0);
|
||||
snprintf(bootxx, sizeof bootxx, "/dev/r%s%c", diskdev, 'a' + rootpart);
|
||||
td = open(bootxx, O_RDWR, 0);
|
||||
sd = open("/usr/mdec/bootxx_ffsv1", O_RDONLY);
|
||||
if (td == -1 || sd == -1)
|
||||
goto bad_bootxx;
|
||||
@ -312,10 +313,10 @@ md_post_newfs(void)
|
||||
bp.bp_conspeed = atoi(boottype + 6);
|
||||
}
|
||||
|
||||
if (pwrite(td, bootxx, 512, ptstart * (off_t)512) != 512)
|
||||
if (pwrite(td, bootxx, 512, 0) != 512)
|
||||
goto bad_bootxx;
|
||||
len -= 512 * 2;
|
||||
if (pwrite(td, bootxx + 512*2, len, (ptstart + 2) * (off_t)512) != len)
|
||||
if (pwrite(td, bootxx + 512 * 2, len, 2 * (off_t)512) != len)
|
||||
goto bad_bootxx;
|
||||
ret = 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: defs.h,v 1.94 2003/07/07 12:30:19 dsl Exp $ */
|
||||
/* $NetBSD: defs.h,v 1.95 2003/07/08 17:38:54 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -200,12 +200,10 @@ EXTERN int sectorsize;
|
||||
|
||||
/* Actual name of the disk. */
|
||||
EXTERN char diskdev[SSTRSIZE] INIT("");
|
||||
EXTERN int rootpart; /* partition we install into */
|
||||
EXTERN char disknames[STRSIZE];
|
||||
EXTERN int numdisks;
|
||||
EXTERN char *disktype; /* ST506, SCSI, ... */
|
||||
|
||||
/* Used in editing partitions ... BSD disklabel and others */
|
||||
EXTERN int editpart;
|
||||
EXTERN char *disktype INIT("unknown"); /* ST506, SCSI, ... */
|
||||
|
||||
/* Area of disk we can allocate, start and size in disk sectors. */
|
||||
EXTERN int ptstart, ptsize;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: disks.c,v 1.62 2003/07/07 12:30:19 dsl Exp $ */
|
||||
/* $NetBSD: disks.c,v 1.63 2003/07/08 17:38:55 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -549,7 +549,7 @@ fsck_root(void)
|
||||
char rootdev[STRSIZE];
|
||||
|
||||
/* cons up the root name: partition 'a' on the target diskdev.*/
|
||||
snprintf(rootdev, STRSIZE, "%s%c", diskdev, 'a');
|
||||
snprintf(rootdev, STRSIZE, "%s%c", diskdev, 'a' + rootpart);
|
||||
#ifdef DEBUG
|
||||
printf("fsck_root: rootdev is %s\n", rootdev);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: label.c,v 1.34 2003/07/07 12:30:20 dsl Exp $ */
|
||||
/* $NetBSD: label.c,v 1.35 2003/07/08 17:38:56 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Jonathan Stone
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: label.c,v 1.34 2003/07/07 12:30:20 dsl Exp $");
|
||||
__RCSID("$NetBSD: label.c,v 1.35 2003/07/08 17:38:56 dsl Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -139,6 +139,28 @@ checklabel(partinfo *lp, int nparts, int rawpart, int bsdpart,
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
check_one_root(partinfo *lp, int nparts)
|
||||
{
|
||||
int part;
|
||||
int foundroot = 0;
|
||||
|
||||
for (part = 0; part < nparts; lp++, part++) {
|
||||
if (!PI_ISBSDFS(lp))
|
||||
continue;
|
||||
if (!(lp->pi_flags & PIF_MOUNT))
|
||||
continue;
|
||||
if (strcmp(lp->pi_mount, "/") != 0)
|
||||
continue;
|
||||
if (foundroot)
|
||||
return 0;
|
||||
foundroot = 1;
|
||||
/* Save partition number, a few things need to know it */
|
||||
rootpart = part;
|
||||
}
|
||||
return foundroot;
|
||||
}
|
||||
|
||||
static int
|
||||
edit_fs_start(menudesc *m, menu_ent *e, void *arg)
|
||||
{
|
||||
@ -471,15 +493,19 @@ edit_and_check_label(partinfo *lp, int nparts, int rawpart, int bsdpart)
|
||||
/* first give the user the option to edit the label... */
|
||||
process_menu(menu_no, &pi);
|
||||
|
||||
/* User thinks the label is OK. check for overlaps */
|
||||
if (checklabel(lp, nparts, rawpart, bsdpart, &i, &j) == 0) {
|
||||
/* partitions are OK */
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* User thinks the label is OK. */
|
||||
/* check we have a single root fs */
|
||||
if (check_one_root(lp, nparts) == 0)
|
||||
msg_display(MSG_must_be_one_root);
|
||||
else
|
||||
/* Check for overlaps */
|
||||
if (checklabel(lp, nparts, rawpart, bsdpart, &i, &j))
|
||||
/* partitions overlap */
|
||||
msg_display(MSG_partitions_overlap, 'a' + i, 'a' + j);
|
||||
/*XXX*/
|
||||
msg_display(MSG_partitions_overlap,'a'+i,'a'+j);
|
||||
else
|
||||
return 1;
|
||||
|
||||
/*XXX ???*/
|
||||
msg_display_add(MSG_edit_partitions_again);
|
||||
process_menu(MENU_yesno, NULL);
|
||||
if (!yesno)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mbr.c,v 1.45 2003/07/08 11:58:57 dsl Exp $ */
|
||||
/* $NetBSD: mbr.c,v 1.46 2003/07/08 17:38:56 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -1291,9 +1291,14 @@ read_mbr(const char *disk, mbr_info_t *mbri)
|
||||
next_ext = mbrp->mbrp_start;
|
||||
if (ext_base == 0)
|
||||
ext_size = mbrp->mbrp_size;
|
||||
} else
|
||||
} else {
|
||||
mbri->last_mounted[i] = strdup(get_last_mounted(
|
||||
fd, mbri->sector + mbrp->mbrp_start));
|
||||
if (ombri->install == 0 &&
|
||||
strcmp(mbri->last_mounted[i], "/") == 0)
|
||||
ombri->install = mbri->sector +
|
||||
mbrp->mbrp_start;
|
||||
}
|
||||
#if BOOTSEL
|
||||
if (mbri->nametab[i][0] != 0 && bootkey-- == 0)
|
||||
ombri->bootsec = mbri->sector +
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msg.mi.en,v 1.111 2003/07/07 21:26:33 dsl Exp $ */
|
||||
/* $NetBSD: msg.mi.en,v 1.112 2003/07/08 17:38:57 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -856,6 +856,9 @@ complete.
|
||||
|
||||
Continue extracting sets?}
|
||||
|
||||
message must_be_one_root
|
||||
{There must be a single partition marked to be mounted on '/'.}
|
||||
|
||||
message partitions_overlap
|
||||
{partitions %c and %c overlap.}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msg.mi.fr,v 1.61 2003/07/07 21:26:33 dsl Exp $ */
|
||||
/* $NetBSD: msg.mi.fr,v 1.62 2003/07/08 17:38:57 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -881,6 +881,9 @@ correctement et que votre syst
|
||||
|
||||
Voulez-vous continuer à extraire les composants ?}
|
||||
|
||||
message must_be_one_root /* XXX translate */
|
||||
{There must be a single partition marked to be mounted on '/'.}
|
||||
|
||||
message partitions_overlap
|
||||
{Les partitions %c et %c se recouvrent.}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msg.mi.pl,v 1.23 2003/07/07 21:26:33 dsl Exp $ */
|
||||
/* $NetBSD: msg.mi.pl,v 1.24 2003/07/08 17:38:58 dsl Exp $ */
|
||||
/* Based on english version: */
|
||||
/* NetBSD: msg.mi.en,v 1.86 2002/04/04 14:26:44 ad Exp */
|
||||
|
||||
@ -841,6 +841,9 @@ nie bedzie kompletny.
|
||||
|
||||
Kontynuowac rozpakowywanie pakietow?}
|
||||
|
||||
message must_be_one_root /* XXX translate */
|
||||
{There must be a single partition marked to be mounted on '/'.}
|
||||
|
||||
message partitions_overlap
|
||||
{partycje %c i %c pokrycia.}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: target.c,v 1.37 2003/07/07 12:30:22 dsl Exp $ */
|
||||
/* $NetBSD: target.c,v 1.38 2003/07/08 17:38:58 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Jonathan Stone
|
||||
@ -75,7 +75,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: target.c,v 1.37 2003/07/07 12:30:22 dsl Exp $");
|
||||
__RCSID("$NetBSD: target.c,v 1.38 2003/07/08 17:38:58 dsl Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -267,11 +267,12 @@ target_already_root(void)
|
||||
|
||||
if (strcmp(diskdev, "") == 0) {
|
||||
/* no root partition was ever selected. Assume that
|
||||
* the currently mounted one should be used */
|
||||
* the currently mounted one should be used
|
||||
*/
|
||||
result = 1;
|
||||
} else {
|
||||
/* append 'a' to the partitionless target disk device name. */
|
||||
snprintf(diskdevroot, STRSIZE, "%s%c", diskdev, 'a');
|
||||
snprintf(diskdevroot, STRSIZE, "%s%c", diskdev, 'a' + rootpart);
|
||||
result = is_active_rootpart(diskdevroot);
|
||||
}
|
||||
return (result);
|
||||
|
Loading…
Reference in New Issue
Block a user