Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/utils/sysinst/arch/mac68k Fixed problem initializing...
details: https://anonhg.NetBSD.org/src/rev/4fae873b52dd
branches: trunk
changeset: 538452:4fae873b52dd
user: rnestor <rnestor%NetBSD.org@localhost>
date: Sun Oct 20 22:06:17 2002 +0000
description:
Fixed problem initializing the Partition Map on a blank disk and added
a driver entry for an ATA driver used on Macs with IDE disks. Also did
some cleanup to facilitate use of code on the Macppc port.
diffstat:
distrib/utils/sysinst/arch/mac68k/md.c | 46 +++++++++-------
distrib/utils/sysinst/arch/mac68k/md.h | 71 ++++++++++++++++++++++----
distrib/utils/sysinst/arch/mac68k/menus.md.en | 16 ++++-
distrib/utils/sysinst/arch/mac68k/menus.md.pl | 16 ++++-
distrib/utils/sysinst/arch/mac68k/msg.md.en | 20 +++---
distrib/utils/sysinst/arch/mac68k/msg.md.pl | 4 +-
6 files changed, 121 insertions(+), 52 deletions(-)
diffs (truncated from 462 to 300 lines):
diff -r 383ebd313945 -r 4fae873b52dd distrib/utils/sysinst/arch/mac68k/md.c
--- a/distrib/utils/sysinst/arch/mac68k/md.c Sun Oct 20 21:28:11 2002 +0000
+++ b/distrib/utils/sysinst/arch/mac68k/md.c Sun Oct 20 22:06:17 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.24 2002/09/03 00:35:53 rnestor Exp $ */
+/* $NetBSD: md.c,v 1.25 2002/10/20 22:06:17 rnestor Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -49,14 +49,6 @@
#include "msg_defs.h"
#include "menu_defs.h"
-MAP map = {0, 0, 0, 0, 0, 0, 0, 0, {0}};
-
-/*
- * Define a default Disk Partition Map that can be used for an uninitialized
- * disk.
- */
-Block0 new_block0 = {0x4552, 512, 0};
-
/*
* Compare lexigraphically two strings
*/
@@ -114,9 +106,10 @@
whichType(part)
struct part_map_entry *part;
{
+ MAP_TYPE *map_entry = (MAP_TYPE *)&map_types;
EBZB *bzb;
char partyp[32];
- int type, maxsiz;
+ int type, maxsiz, entry_type = MAP_OTHER;
bzb = (EBZB *)&part->pmBootArgs[0];
if (part->pmSig != PART_ENTRY_MAGIC)
@@ -127,13 +120,23 @@
strncpy(partyp, part->pmPartType, maxsiz);
partyp[maxsiz-1] = '\0';
- if (stricmp(PART_TYPE_DRIVER, partyp) == 0 ||
- stricmp(PART_TYPE_DRIVER43, partyp) == 0 ||
- stricmp(PART_TYPE_DRIVERATA, partyp) == 0 ||
- stricmp(PART_TYPE_FWB_COMPONENT, partyp) == 0 ||
- stricmp(PART_TYPE_PARTMAP, partyp) == 0)
+ /*
+ * Find out how to treat the partition type under NetBSD
+ */
+ while (map_entry->type != MAP_EOL) {
+ if (stricmp(map_entry->name, partyp) == 0) {
+ entry_type = map_entry->type;
+ break;
+ }
+ map_entry++;
+ }
+
+ /*
+ * Now classify the use for NetBSD
+ */
+ if (entry_type == MAP_RESERVED)
type = 0;
- else if (stricmp(PART_TYPE_UNIX, partyp) == 0) {
+ else if (entry_type == MAP_NETBSD) {
if (bzb->magic != BZB_MAGIC)
type = 0;
else if (bzb->type == BZB_TYPEFS) {
@@ -147,7 +150,7 @@
type = SWAP_PART;
else
type = SCRATCH_PART;
- } else if (stricmp(PART_TYPE_MAC, partyp) == 0)
+ } else if (entry_type == MAP_MACOS)
type = HFS_PART;
else
type = SCRATCH_PART;
@@ -334,7 +337,7 @@
* in case we've clobbered the boot code.
*/
part->pmLgDataStart = 0;
- part->pmPartStatus = 0x7f; /* make sure the partition shows up */
+ part->pmPartStatus = 0x77; /* make sure the partition shows up */
part->pmLgBootStart = 0;
part->pmBootSize = 0;
part->pmBootLoad = 0;
@@ -684,13 +687,12 @@
* need to completely initialize the disk.
*/
dlsize = disklabel.d_secperunit;
- new_block0.sbBlkCount = dlsize;
for (i=0;i<NEW_MAP_SIZE;i++) {
if (i > 0)
new_map[i].pmPyPartStart = new_map[i-1].pmPyPartStart +
new_map[i-1].pmPartBlkCnt;
new_map[i].pmDataCnt = new_map[i].pmPartBlkCnt;
- if (new_map[i].pmPartBlkCnt) {
+ if (new_map[i].pmPartBlkCnt == 0) {
new_map[i].pmPartBlkCnt = dlsize;
new_map[i].pmDataCnt = dlsize;
break;
@@ -751,6 +753,7 @@
int fd;
char devname[100];
struct disklabel lp;
+ Block0 new_block0 = {DRIVER_MAP_MAGIC, 512, 0};
/*
* Danger Will Robinson! We're about to turn that nice MacOS disk
@@ -779,6 +782,7 @@
close (fd);
exit (1);
}
+ new_block0.sbBlkCount = dlsize; /* Set disk size */
if (write (fd, &new_block0, bsize) != bsize) {
endwin();
fprintf (stderr, "I/O error writing Block0\n");
@@ -982,7 +986,7 @@
bsdlabel[i].pi_fsize = 0;
fsmount[i][0] = '\0';
}
- bsdlabel[RAW_PART].pi_size = new_block0.sbBlkCount;
+ bsdlabel[RAW_PART].pi_size = dlsize;
/*
* Now, scan through the Disk Partition Map and transfer the
* information into the incore disklabel.
diff -r 383ebd313945 -r 4fae873b52dd distrib/utils/sysinst/arch/mac68k/md.h
--- a/distrib/utils/sysinst/arch/mac68k/md.h Sun Oct 20 21:28:11 2002 +0000
+++ b/distrib/utils/sysinst/arch/mac68k/md.h Sun Oct 20 22:06:17 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.h,v 1.11 2002/06/29 17:00:18 scottr Exp $ */
+/* $NetBSD: md.h,v 1.12 2002/10/20 22:06:17 rnestor Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -44,7 +44,48 @@
#define LIB_MOVE 1
/*
- * Define partition types
+ * Apple Partition Map Types
+ * Reserved - Entry hidden by sysinst from user
+ * NetBSD - Entry used for NetBSD
+ * MacOS - Entry used for MacOS and mapped to NetBSD
+ * Other - Entry use unknown, mapped for scratch. This may
+ * include partitions used by other systems (Linux).
+ */
+#define MAP_EOL 0
+#define MAP_RESERVED 1
+#define MAP_NETBSD 2
+#define MAP_MACOS 3
+#define MAP_OTHER 4
+
+typedef struct {
+ int type; /* Entry type from above */
+ char *name; /* Partition Type string */
+} MAP_TYPE;
+
+/*
+ * Define Apple Partition Map types typically seen on 68k Macs
+ * This should match the definitions in include/machine/disklabel.h
+ * and must conform to the matching rules in arch/mac68k/mac68k/disksubr.c
+ */
+EXTERN MAP_TYPE map_types[]
+#ifdef MAIN
+= {
+ {MAP_RESERVED, PART_TYPE_DRIVER},
+ {MAP_RESERVED, PART_TYPE_DRIVER43},
+ {MAP_RESERVED, PART_TYPE_DRIVERATA},
+ {MAP_RESERVED, PART_TYPE_FWB_COMPONENT},
+ {MAP_MACOS, PART_TYPE_MAC},
+ {MAP_NETBSD, PART_TYPE_NETBSD},
+ {MAP_RESERVED, PART_TYPE_PARTMAP},
+ {MAP_OTHER, PART_TYPE_SCRATCH},
+ {MAP_NETBSD, PART_TYPE_UNIX},
+ {MAP_EOL, NULL}
+}
+#endif
+;
+
+/*
+ * Define NetBSD partition types
*/
#define ROOT_PART 1
#define UFS_PART 2
@@ -77,7 +118,11 @@
*/
#define NEW_MAP_SIZE 15
-EXTERN MAP map;
+EXTERN MAP map
+#ifdef MAIN
+= {0, 0, 0, 0, 0, 0, 0, 0, {0}}
+#endif
+;
int edit_diskmap (void);
void disp_selected_part (int sel);
@@ -151,21 +196,25 @@
unsigned short ddPad[243]; /* ARRAY[0..242] OF INTEGER; not used */
} Block0;
+/*
+ * Default Disk Partition Map used for an uninitilized disk.
+ * Has minimal entry for an old Apple SCSI driver, a newer 43 SCSI
+ * driver and an IDE driver (for those Macs with IDE).
+ */
EXTERN struct part_map_entry new_map[]
#ifdef MAIN
= {
- {PART_ENTRY_MAGIC, 0xa5a5, 5, 1, NEW_MAP_SIZE & 0x7e, "Macintosh",
- "Apple_partition_map", 0,63, 0x37},
- {PART_ENTRY_MAGIC, 0, 5, 64, 32, "Macintosh", "Apple_Driver", 0, 32, 0x37},
- {PART_ENTRY_MAGIC, 0, 5, 96, 32, "Macintosh", "Apple_Driver43", 0, 32, 0x37},
- {PART_ENTRY_MAGIC, 0, 5, 128, 4096, "untitled", "Apple_HFS", 0, 4096, 0x37},
- {PART_ENTRY_MAGIC, 0, 5,4224, 0, "untitled", "Apple_Free", 0, 0, 0x37}
+ {PART_ENTRY_MAGIC, 0xa5a5, 6, 1, NEW_MAP_SIZE & 0x7e, "Apple",
+ "Apple_Partition_Map", 0,NEW_MAP_SIZE, 0x37},
+ {PART_ENTRY_MAGIC, 0, 6, 64, 32, "Macintosh", "Apple_Driver", 0,0,0x37},
+ {PART_ENTRY_MAGIC, 0, 6, 96, 64, "Macintosh", "Apple_Driver43", 0,0,0x37},
+ {PART_ENTRY_MAGIC, 0, 6, 160, 64, "Macintosh", "Apple_Driver_ATA", 0,0,0x37},
+ {PART_ENTRY_MAGIC, 0, 6, 224, 4096, "untitled", "Apple_HFS", 0,0,0x37},
+ {PART_ENTRY_MAGIC, 0, 6,4320, 0, "untitled", "Apple_Free", 0,0,0x37}
}
#endif
;
-EXTERN Block0 new_block0;
-
/* Megs required for a full X installation. */
#define XNEEDMB 50
diff -r 383ebd313945 -r 4fae873b52dd distrib/utils/sysinst/arch/mac68k/menus.md.en
--- a/distrib/utils/sysinst/arch/mac68k/menus.md.en Sun Oct 20 21:28:11 2002 +0000
+++ b/distrib/utils/sysinst/arch/mac68k/menus.md.en Sun Oct 20 22:06:17 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: menus.md.en,v 1.14 2002/06/29 17:00:18 scottr Exp $ */
+/* $NetBSD: menus.md.en,v 1.15 2002/10/20 22:06:17 rnestor Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -44,9 +44,10 @@
menu nodiskmap, title "Choose an option", y=16;
display action { msg_display (MSG_nodiskmap, diskdev); };
- option "Abort install",
- action (endwin) { exit(1); };
- option "Initialize Disk partition Map", action {
+ option "Abort install", exit, action {
+ endwin(); exit(1);
+ };
+ option "Initialize Disk partition Map", exit, action {
int i;
msg_clear();
@@ -167,6 +168,7 @@
reset_part_flags(&map.blk[j]);
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
bzb->magic = BZB_MAGIC;
+ strcpy (map.blk[j].pmPartName, "NetBSD Root");
strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
bzb->type = BZB_TYPEFS;
bzb->flags.root = 1;
@@ -197,6 +199,7 @@
reset_part_flags(&map.blk[j]);
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
bzb->magic = BZB_MAGIC;
+ strcpy (map.blk[j].pmPartName, "NetBSD SWAP");
strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
bzb->type = BZB_TYPESWAP; };
option "NetBSD Usr", exit, action {
@@ -207,6 +210,7 @@
reset_part_flags(&map.blk[j]);
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
bzb->magic = BZB_MAGIC;
+ strcpy (map.blk[j].pmPartName, "NetBSD Usr");
strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
bzb->type = BZB_TYPEFS;
bzb->flags.usr = 1;
@@ -221,6 +225,7 @@
reset_part_flags(&map.blk[j]);
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
bzb->magic = BZB_MAGIC;
+ strcpy (map.blk[j].pmPartName, "NetBSD Root & Usr");
strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
bzb->type = BZB_TYPEFS;
bzb->flags.root = 1;
@@ -240,6 +245,7 @@
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
bzb->magic = 0;
bzb->mount_point[0] = '\0';
+ strcpy (map.blk[j].pmPartName, "untitled (HFS)");
strcpy (map.blk[j].pmPartType, "Apple_HFS"); };
option "Scratch", exit, action {
int j;
@@ -250,6 +256,7 @@
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
bzb->magic = 0;
bzb->mount_point[0] = '\0';
+ strcpy (map.blk[j].pmPartName, "untitled (Scratch)");
strcpy (map.blk[j].pmPartType, "Apple_Scratch"); };
option "Free", exit, action {
Home |
Main Index |
Thread Index |
Old Index