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/hpcmips add some '#ifdef's to cla...
details: https://anonhg.NetBSD.org/src/rev/10c8a0e8216f
branches: trunk
changeset: 480866:10c8a0e8216f
user: shin <shin%NetBSD.org@localhost>
date: Sat Jan 22 02:59:59 2000 +0000
description:
add some '#ifdef's to clarify the difference between i386 and hpcmips.
diffstat:
distrib/utils/sysinst/arch/hpcmips/Makefile | 6 +-
distrib/utils/sysinst/arch/hpcmips/md.c | 57 ++++++++++++++++---------
distrib/utils/sysinst/arch/hpcmips/menus.md.en | 8 +--
3 files changed, 43 insertions(+), 28 deletions(-)
diffs (290 lines):
diff -r 873071e1b034 -r 10c8a0e8216f distrib/utils/sysinst/arch/hpcmips/Makefile
--- a/distrib/utils/sysinst/arch/hpcmips/Makefile Sat Jan 22 01:34:55 2000 +0000
+++ b/distrib/utils/sysinst/arch/hpcmips/Makefile Sat Jan 22 02:59:59 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2000/01/21 11:25:59 shin Exp $
+# $NetBSD: Makefile,v 1.2 2000/01/22 02:59:59 shin Exp $
#
# Makefile for i386
#
@@ -11,6 +11,6 @@
fdisk.o md.o: menu_defs.h msg_defs.h
-.include "../../Makefile.inc"
+CPPFLAGS+=-DINET6
-CPPFLAGS+=-DINET6
+.include "../../Makefile.inc"
diff -r 873071e1b034 -r 10c8a0e8216f distrib/utils/sysinst/arch/hpcmips/md.c
--- a/distrib/utils/sysinst/arch/hpcmips/md.c Sat Jan 22 01:34:55 2000 +0000
+++ b/distrib/utils/sysinst/arch/hpcmips/md.c Sat Jan 22 02:59:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.1 2000/01/21 11:26:00 shin Exp $ */
+/* $NetBSD: md.c,v 1.2 2000/01/22 02:59:59 shin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -47,9 +47,17 @@
#include "md.h"
#include "msg_defs.h"
#include "menu_defs.h"
+#if !defined(__i386__)
#include "endian.h"
#include "mbr.h"
+#endif
+
+#ifdef __i386__
+char mbr[512];
+#else
+extern char mbr[512];
+#endif
int mbr_present, mbr_len;
int c1024_resp;
struct disklist *disklist = NULL;
@@ -58,17 +66,18 @@
int netbsd_mbr_installed = 0;
int netbsd_bootsel_installed = 0;
+#ifdef __i386__
static int md_read_bootcode __P((char *, char *, size_t));
static int count_mbr_parts __P((struct mbr_partition *));
static int mbr_part_above_chs __P((struct mbr_partition *));
static int mbr_partstart_above_chs __P((struct mbr_partition *));
static void configure_bootsel __P((void));
+#endif
static void md_upgrade_mbrtype __P((void));
struct mbr_bootsel *mbs;
int defbootselpart, defbootseldisk;
-static struct mbr_partition mbr_buf[NMBRPART];
/* prototypes */
@@ -76,21 +85,27 @@
int
md_get_info()
{
- read_mbr(diskdev, mbr, MBR_SECSIZE);
+ read_mbr(diskdev, mbr, sizeof mbr);
if (!valid_mbr(mbr)) {
memset(&mbr[MBR_PARTOFF], 0,
NMBRPART * sizeof (struct mbr_partition));
/* XXX check result and give up if < 0 */
+#ifdef __i386__
+ mbr_len = md_read_bootcode(_PATH_MBR, mbr, sizeof mbr);
+#else
*((u_int16_t *)&mbr[MBR_MAGICOFF]) = le_to_native16(MBR_MAGIC);
+#endif
netbsd_mbr_installed = 1;
} else
mbr_len = MBR_SECSIZE;
md_bios_info(diskdev);
+#ifdef __i386__
edit:
+#endif
edit_mbr((struct mbr_partition *)&mbr[MBR_PARTOFF]);
-#if 0
+#ifdef __i386__
if (mbr_part_above_chs(part) &&
(biosdisk == NULL || !(biosdisk->bi_flags & BIFLAG_EXTINT13))) {
msg_display(MSG_partabovechs);
@@ -100,13 +115,13 @@
}
#endif
-#if 0
+#ifdef __i386__
if (count_mbr_parts(part) > 1) {
msg_display(MSG_installbootsel);
process_menu(MENU_yesno);
if (yesno) {
mbr_len =
- md_read_bootcode(_PATH_BOOTSEL, mbr, MBR_SECSIZE);
+ md_read_bootcode(_PATH_BOOTSEL, mbr, sizeof mbr);
configure_bootsel();
netbsd_mbr_installed = netbsd_bootsel_installed = 1;
}
@@ -116,14 +131,16 @@
msg_display(MSG_installmbr);
process_menu(MENU_yesno);
if (yesno) {
- mbr_len = md_read_bootcode(_PATH_MBR, mbr, MBR_SECSIZE);
+ mbr_len = md_read_bootcode(_PATH_MBR, mbr, sizeof mbr);
netbsd_mbr_installed = 1;
}
}
+
#endif
return 1;
}
+#ifdef __i386__
/*
* Read MBR code from a file. It may be a maximum of "len" bytes
* long. This function skips the partition table. Space for this
@@ -160,6 +177,7 @@
return (cc + MBR_MAGICOFF);
}
+#endif
int
md_pre_disklabel()
@@ -167,7 +185,7 @@
msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */
- if (write_mbr(diskdev, mbr, MBR_SECSIZE, 1) != 0) {
+ if (write_mbr(diskdev, mbr, sizeof mbr, 1) != 0) {
msg_display(MSG_wmbrfail);
process_menu(MENU_ok);
return 1;
@@ -190,7 +208,7 @@
int
md_post_newfs(void)
{
-#if 1
+#if !defined(__i386__)
return 0;
#else
/* boot blocks ... */
@@ -217,7 +235,6 @@
int maxpart = getmaxpartitions();
int remain;
-editlab:
/* Ask for layout type -- standard or special */
msg_display(MSG_layout,
(1.0*fsptsize*sectorsize)/MEG,
@@ -372,7 +389,7 @@
return 0;
}
-#if 0
+#ifdef __i386__
/*
* XXX check for int13 extensions.
*/
@@ -453,7 +470,7 @@
struct mbr_partition *mbrp;
int i, netbsdpart = -1, oldbsdpart = -1, oldbsdcount = 0;
- if (read_mbr(diskdev, mbr, MBR_SECSIZE) < 0)
+ if (read_mbr(diskdev, mbr, sizeof mbr) < 0)
return;
mbrp = (struct mbr_partition *)&mbr[MBR_PARTOFF];
@@ -468,7 +485,7 @@
if (netbsdpart == -1 && oldbsdcount == 1) {
mbrp[oldbsdpart].mbrp_typ = MBR_PTYPE_NETBSD;
- write_mbr(diskdev, mbr, MBR_SECSIZE, 0);
+ write_mbr(diskdev, mbr, sizeof mbr, 0);
}
}
@@ -502,14 +519,14 @@
md_bios_info(dev)
char *dev;
{
+#ifdef __i386__
int mib[2], i, len;
-#if 0
struct biosdisk_info *bip;
struct nativedisk_info *nip = NULL, *nat;
#endif
int cyl, head, sec;
-#if 0
+#ifdef __i386__
if (disklist == NULL) {
mib[0] = CTL_MACHDEP;
mib[1] = CPU_DISKINFO;
@@ -528,11 +545,9 @@
break;
}
}
+ if (nip == NULL || nip->ni_nmatches == 0) {
+nogeom:
#endif
-#if 0
- if (nip == NULL || nip->ni_nmatches == 0) {
-#endif
-nogeom:
msg_display(MSG_nobiosgeom, dlcyl, dlhead, dlsec);
if (guess_biosgeom_from_mbr(mbr, &cyl, &head, &sec) >= 0) {
msg_display_add(MSG_biosguess, cyl, head, sec);
@@ -540,7 +555,7 @@
} else
set_bios_geom(dlcyl, dlhead, dlsec);
biosdisk = NULL;
-#if 0
+#ifdef __i386__
} else if (nip->ni_nmatches == 1) {
bip = &disklist->dl_biosdisks[nip->ni_biosmatches[0]];
msg_display(MSG_onebiosmatch);
@@ -568,6 +583,7 @@
return 0;
}
+#ifdef __i386__
static int
count_mbr_parts(pt)
struct mbr_partition *pt;
@@ -631,3 +647,4 @@
i, get_partname(i), mbs->nametab[i]);
}
}
+#endif
diff -r 873071e1b034 -r 10c8a0e8216f distrib/utils/sysinst/arch/hpcmips/menus.md.en
--- a/distrib/utils/sysinst/arch/hpcmips/menus.md.en Sat Jan 22 01:34:55 2000 +0000
+++ b/distrib/utils/sysinst/arch/hpcmips/menus.md.en Sat Jan 22 02:59:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: menus.md.en,v 1.1 2000/01/21 11:26:00 shin Exp $ */
+/* $NetBSD: menus.md.en,v 1.2 2000/01/22 02:59:59 shin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -192,8 +192,8 @@
option "X contrib clients", action { toggle_getit (11); };
option "X11 programming", action { toggle_getit (12); };
+/*
menu biosonematch;
-/*
option "This is the correct geometry", exit, action {
extern struct disklist *disklist;
extern struct nativedisk_info *nativedisk;
@@ -206,14 +206,12 @@
bsec = bip->bi_sec;
biosdisk = bip;
};
-*/
option "Set the geometry by hand", exit, action {
set_bios_geom(dlcyl, dlhead, dlsec);
biosdisk = NULL;
};
menu biosmultmatch;
-/*
option "Use one of these disks", exit, action {
extern struct disklist *disklist;
extern struct nativedisk_info *nativedisk;
@@ -233,7 +231,6 @@
bsec = bip->bi_sec;
biosdisk = bip;
};
-*/
option "Set the geometry by hand", exit, action {
set_bios_geom(dlcyl, dlhead, dlsec);
biosdisk = NULL;
@@ -328,3 +325,4 @@
action { mbs->defkey = SCAN_F1 + 9; defbootseldisk = 5; };
option "First active partition", exit,
action { mbs->defkey = SCAN_ENTER; };
+*/
Home |
Main Index |
Thread Index |
Old Index