Rework sysinst so that it actually works for common cases. Notably, the
partition handling has been completely rewritten to address serious data loss issues with Mac HFS partitions, and the a.out -> ELF upgrade has been addressed. From Bob Nestor; part 1 of 2 of a fix for PR 15528.
This commit is contained in:
parent
97a9e02381
commit
e307d4c847
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.2 2001/01/14 02:38:19 mrg Exp $
|
||||
# $NetBSD: Makefile,v 1.3 2002/06/29 17:00:18 scottr Exp $
|
||||
#
|
||||
# Makefile for mac68k
|
||||
#
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
SRCS= menu_defs.c msg_defs.c main.c install.c upgrade.c \
|
||||
txtwalk.c run.c factor.c net.c disks.c disks_lfs.c util.c geom.c \
|
||||
label.c target.c md.c
|
||||
label.c target.c md.c aout2elf.c
|
||||
|
||||
md.o: menu_defs.h msg_defs.h
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: md.h,v 1.10 2001/11/29 23:24:24 thorpej Exp $ */
|
||||
/* $NetBSD: md.h,v 1.11 2002/06/29 17:00:18 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -40,30 +40,23 @@
|
||||
|
||||
/* md.h -- Machine specific definitions for the mac68k */
|
||||
|
||||
#define LIB_COUNT 0
|
||||
#define LIB_MOVE 1
|
||||
|
||||
/*
|
||||
* Define partition types
|
||||
*/
|
||||
#define ROOT_PART 1
|
||||
#define UFS_PART 2
|
||||
#define SWAP_PART 3
|
||||
#define HFS_PART 4
|
||||
#define SCRATCH_PART 5
|
||||
|
||||
EXTERN int bcyl, bhead, bsec, bsize, bcylsize;
|
||||
EXTERN int part[4][5] INIT({{0}});
|
||||
EXTERN int bsdpart; /* partition in use by NetBSD */
|
||||
EXTERN int usefull; /* on install, clobber entire disk */
|
||||
|
||||
/*
|
||||
* Known partition types on a MacOS initialized disk
|
||||
* Note: Setting the usable field on the last entry defines
|
||||
* how unknown partition types will be handled.
|
||||
*/
|
||||
typedef struct {
|
||||
int usable; /* Use type: 0=>reserved */
|
||||
char *partype;
|
||||
char *fstyp;
|
||||
} PTYPES;
|
||||
|
||||
/*
|
||||
* Define the classes of partitions types we can handle
|
||||
*/
|
||||
#define TYP_RSRVD 0 /* Unusable low-level part of disk */
|
||||
#define TYP_AVAIL 1 /* Anything not used by MacOS or NetBSD */
|
||||
#define TYP_HFS 2 /* In use by MacOS */
|
||||
#define TYP_BSD 3 /* In use by NetBSD */
|
||||
|
||||
typedef struct {
|
||||
int size; /* number of blocks in map for I/O */
|
||||
int in_use_cnt; /* number of block in current use in map */
|
||||
@ -88,14 +81,22 @@ EXTERN MAP map;
|
||||
|
||||
int edit_diskmap (void);
|
||||
void disp_selected_part (int sel);
|
||||
int part_type(int entry, char *fstyp, char *use, char *name);
|
||||
int strnicmp(const char *c1, const char *c2, int n);
|
||||
int whichType(struct part_map_entry *);
|
||||
char *getFstype(struct part_map_entry *, int, char *);
|
||||
char *getUse(struct part_map_entry *, int, char *);
|
||||
char *getName(struct part_map_entry *, int, char *);
|
||||
int stricmp(const char *c1, const char *c2);
|
||||
int getFreeLabelEntry(char *);
|
||||
int findStdType(int, char *, int, int *, int);
|
||||
void setpartition(struct part_map_entry *, char *, int);
|
||||
void sortmerge(void);
|
||||
void reset_part_flags(int part);
|
||||
void reset_part_flags(struct part_map_entry *);
|
||||
int check_for_errors(void);
|
||||
void report_errors(void);
|
||||
void set_fdisk_info (void); /* write incore info into disk */
|
||||
int get_diskmap_info (void);
|
||||
void md_select_kernel(void);
|
||||
int md_debug_dump(char *);
|
||||
|
||||
/* constants and defines */
|
||||
|
||||
@ -113,7 +114,8 @@ typedef struct {
|
||||
unsigned int root : 1; /* FS contains a Root FS */
|
||||
unsigned int usr : 1; /* FS contains a Usr FS */
|
||||
unsigned int crit : 1; /* FS contains a "Critical"? FS */
|
||||
unsigned int : 8;
|
||||
unsigned int used : 1; /* FS in use */
|
||||
unsigned int : 7;
|
||||
unsigned int slice : 5; /* Slice number to assocate with plus one */
|
||||
unsigned int part : 16; /* reserved, but we'll hide disk part here */
|
||||
} flags;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: menus.md.en,v 1.13 2001/11/29 23:20:58 thorpej Exp $ */
|
||||
/* $NetBSD: menus.md.en,v 1.14 2002/06/29 17:00:18 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -82,6 +82,7 @@ menu editparttable, title "Choose your partition", exit, y=15;
|
||||
option "Split selected partition", action {
|
||||
int i, j, k, size, free_size;
|
||||
char buf[40];
|
||||
EBZB *bzb;
|
||||
|
||||
j = map.mblk[map.selected];
|
||||
msg_display(MSG_split_part, map.blk[j].pmPartBlkCnt);
|
||||
@ -96,6 +97,9 @@ menu editparttable, title "Choose your partition", exit, y=15;
|
||||
strcpy (map.blk[j].pmPartType, "Apple_Scratch");
|
||||
map.blk[j].pmPartBlkCnt = size;
|
||||
map.blk[j].pmDataCnt = size;
|
||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||
bzb->magic = 0;
|
||||
bzb->mount_point[0] = '\0';
|
||||
strcpy (map.blk[k].pmPartType, "Apple_Free");
|
||||
map.blk[k].pmPyPartStart += size;
|
||||
if ((map.blk[k].pmPyPartStart + free_size) > dlsize)
|
||||
@ -104,7 +108,11 @@ menu editparttable, title "Choose your partition", exit, y=15;
|
||||
else
|
||||
map.blk[k].pmPartBlkCnt = free_size;
|
||||
map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt;
|
||||
map.in_use_cnt += 1;
|
||||
bzb = (EBZB *)&map.blk[k].pmBootArgs[0];
|
||||
bzb->magic = 0;
|
||||
bzb->mount_point[0] = '\0';
|
||||
map.in_use_cnt += 1; /* Count new part as usable */
|
||||
sortmerge();
|
||||
} else {
|
||||
msg_display (MSG_diskfull);
|
||||
process_menu (MENU_okabort);
|
||||
@ -143,18 +151,20 @@ menu editparttable, title "Choose your partition", exit, y=15;
|
||||
};
|
||||
|
||||
|
||||
menu okabort, title "What do you want to do?";
|
||||
option "OK", exit, action { yesno = 1; };
|
||||
menu ok2, title "Abort?", y=17;
|
||||
option "OK", exit, action { };
|
||||
|
||||
menu okabort, title "What do you want to do?", y=17;
|
||||
option "Continue", exit, action { yesno = 1; };
|
||||
option "Abort install", exit, action { yesno = 0; };
|
||||
|
||||
menu chooseid, title "Partition Type?";
|
||||
option "NetBSD Root", exit, action {
|
||||
int i, j;
|
||||
char fstyp[16], use[16], name[64];
|
||||
EBZB *bzb;
|
||||
|
||||
j = map.mblk[map.selected];
|
||||
reset_part_flags(j);
|
||||
reset_part_flags(&map.blk[j]);
|
||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||
bzb->magic = BZB_MAGIC;
|
||||
strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
|
||||
@ -169,7 +179,7 @@ menu chooseid, title "Partition Type?";
|
||||
*/
|
||||
for (i=0,map.root_cnt=0;i<map.usable_cnt;i++) {
|
||||
j = map.mblk[i];
|
||||
if (part_type(j, fstyp, use, name) == TYP_BSD) {
|
||||
if (whichType(&map.blk[j]) == ROOT_PART) {
|
||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||
if (bzb->type == BZB_TYPEFS && bzb->flags.root) {
|
||||
if (map.root_cnt++ == 0)
|
||||
@ -184,7 +194,7 @@ menu chooseid, title "Partition Type?";
|
||||
EBZB *bzb;
|
||||
|
||||
j = map.mblk[map.selected];
|
||||
reset_part_flags(j);
|
||||
reset_part_flags(&map.blk[j]);
|
||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||
bzb->magic = BZB_MAGIC;
|
||||
strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
|
||||
@ -194,13 +204,13 @@ menu chooseid, title "Partition Type?";
|
||||
EBZB *bzb;
|
||||
|
||||
j = map.mblk[map.selected];
|
||||
reset_part_flags(j);
|
||||
reset_part_flags(&map.blk[j]);
|
||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||
bzb->magic = BZB_MAGIC;
|
||||
strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
|
||||
bzb->type = BZB_TYPEFS;
|
||||
bzb->flags.usr = 1;
|
||||
if (!map.usr_cnt)
|
||||
if (map.usr_cnt++ == 0)
|
||||
strcpy (bzb->mount_point, "/usr");
|
||||
};
|
||||
option "NetBSD Root&Usr", exit, action {
|
||||
@ -208,17 +218,17 @@ menu chooseid, title "Partition Type?";
|
||||
EBZB *bzb;
|
||||
|
||||
j = map.mblk[map.selected];
|
||||
reset_part_flags(j);
|
||||
reset_part_flags(&map.blk[j]);
|
||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||
bzb->magic = BZB_MAGIC;
|
||||
strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
|
||||
bzb->type = BZB_TYPEFS;
|
||||
bzb->flags.root = 1;
|
||||
bzb->flags.usr = 1;
|
||||
if (!map.root_cnt)
|
||||
if (map.root_cnt++ == 0)
|
||||
strcpy (bzb->mount_point, "/");
|
||||
else {
|
||||
if (!map.usr_cnt)
|
||||
if (map.usr_cnt++ == 0)
|
||||
strcpy (bzb->mount_point, "/usr");
|
||||
} };
|
||||
option "MacOS HFS", exit, action {
|
||||
@ -226,8 +236,9 @@ menu chooseid, title "Partition Type?";
|
||||
EBZB *bzb;
|
||||
|
||||
j = map.mblk[map.selected];
|
||||
reset_part_flags(j);
|
||||
reset_part_flags(&map.blk[j]);
|
||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||
bzb->magic = 0;
|
||||
bzb->mount_point[0] = '\0';
|
||||
strcpy (map.blk[j].pmPartType, "Apple_HFS"); };
|
||||
option "Scratch", exit, action {
|
||||
@ -235,8 +246,9 @@ menu chooseid, title "Partition Type?";
|
||||
EBZB *bzb;
|
||||
|
||||
j = map.mblk[map.selected];
|
||||
reset_part_flags(j);
|
||||
reset_part_flags(&map.blk[j]);
|
||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||
bzb->magic = 0;
|
||||
bzb->mount_point[0] = '\0';
|
||||
strcpy (map.blk[j].pmPartType, "Apple_Scratch"); };
|
||||
option "Free", exit, action {
|
||||
@ -244,8 +256,9 @@ menu chooseid, title "Partition Type?";
|
||||
EBZB *bzb;
|
||||
|
||||
j = map.mblk[map.selected];
|
||||
reset_part_flags(j);
|
||||
reset_part_flags(&map.blk[j]);
|
||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||
bzb->magic = 0;
|
||||
bzb->mount_point[0] = '\0';
|
||||
strcpy (map.blk[j].pmPartType, "Apple_Free"); };
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msg.md.en,v 1.10 2001/07/26 22:47:34 wiz Exp $ */
|
||||
/* $NetBSD: msg.md.en,v 1.11 2002/06/29 17:00:18 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -80,11 +80,11 @@ you have completed your partition setups.
|
||||
Shall we continue?}
|
||||
|
||||
message part_header
|
||||
{Part size offset fstype use mount point (name)
|
||||
{Part size offset fstype use mount point (name)
|
||||
---- ---------- ---------- ------ --------- ------------------\n}
|
||||
|
||||
message part_row
|
||||
{%3s%c %-10d %-10d %-6s %-9s %s\n}
|
||||
{%3s%c %10d %10d %6s %-9s %s\n}
|
||||
|
||||
message ovrwrite
|
||||
{Your disk currently has at least one MacOS HFS partition. Overwriting
|
||||
@ -157,6 +157,13 @@ message dodiskmap
|
||||
{Setting up the Disk Partition Map ...
|
||||
}
|
||||
|
||||
message label_error
|
||||
{The new on-disk partition label does not match the one currently in-core.
|
||||
Any attempt to proceed will most likely result in damage to any pre-existing
|
||||
disk partitions. However your new Disk Partition Map has been written to
|
||||
the disk and will be available the next time NetBSD is booted. Please
|
||||
reboot immediately and restart the Installation Process.\n}
|
||||
|
||||
message mapdebug
|
||||
{Partition Map:
|
||||
HFS count: %d
|
||||
@ -219,3 +226,13 @@ message parttable_fix_fixing
|
||||
|
||||
message parttable_fix_fine
|
||||
{Partition %s%c is just fine!\n}
|
||||
|
||||
message dump_line
|
||||
{%s\n}
|
||||
|
||||
message emulbackup
|
||||
{Either the /emul/aout or /emul directory on your system was a symbolic link
|
||||
pointing to an unmounted filesystem. It has been given a '.old' extension.
|
||||
Once you bring your upgraded system back up, you may need to take care
|
||||
of merging the newly created /emul/aout directory with the old one.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user