summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sade
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2000-06-05 13:17:23 +0000
committernyan <nyan@FreeBSD.org>2000-06-05 13:17:23 +0000
commit6a7aa7f3d9d42126138b256ce2a6fe01ecd4d3a4 (patch)
treed4ae9bd04b53f4b71a4f6c8597f6153ee9c613e0 /usr.sbin/sade
parent2957ed6969367453170ee419e165102e862b1ecb (diff)
downloadFreeBSD-src-6a7aa7f3d9d42126138b256ce2a6fe01ecd4d3a4.zip
FreeBSD-src-6a7aa7f3d9d42126138b256ce2a6fe01ecd4d3a4.tar.gz
- Remove obsolete PC-card boot.flp hack. It was for making both PC-card
boot.flp and plain boot.flp. - Clean up crunchgen related routine. - Add PC-98 support. TODO: o Documentation o Fix some messages for PC-98 o Decrease the size of fixit.flp to 1.2MB o I18N (See: http://www.jp.FreeBSD.org/BootAsia/index.html) No response from jkh
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r--usr.sbin/sade/Makefile8
-rw-r--r--usr.sbin/sade/devices.c6
-rw-r--r--usr.sbin/sade/disks.c89
-rw-r--r--usr.sbin/sade/main.c9
-rw-r--r--usr.sbin/sade/menus.c6
-rw-r--r--usr.sbin/sade/sade.h1
-rw-r--r--usr.sbin/sade/termcap.c11
-rw-r--r--usr.sbin/sade/wizard.c19
8 files changed, 134 insertions, 15 deletions
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
index 9074ad2..5bf628c 100644
--- a/usr.sbin/sade/Makefile
+++ b/usr.sbin/sade/Makefile
@@ -18,6 +18,9 @@ SRCS= anonFTP.c cdrom.c command.c config.c devices.c dhcp.c kget.c \
wizard.c keymap.h
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog -I${.OBJDIR}
+.if ${MACHINE} == "pc98"
+CFLAGS+= -DPC98
+.endif
.if ${MACHINE_ARCH} != "i386" || defined(X_AS_PKG)
CFLAGS+= -DX_AS_PKG
.endif
@@ -31,6 +34,9 @@ makedevs.c: Makefile rtermcap keymap.h
./rtermcap ansi | \
file2c 'const char termcap_ansi[] = {' ',0};' \
>> makedevs.tmp
+ ./rtermcap cons25w | \
+ file2c 'const char termcap_cons25w[] = {' ',0};' \
+ >> makedevs.tmp
./rtermcap cons25 | \
file2c 'const char termcap_cons25[] = {' ',0};' \
>> makedevs.tmp
@@ -52,7 +58,7 @@ makedevs.c: Makefile rtermcap keymap.h
./rtermcap vt100 | \
file2c 'const char termcap_vt100[] = {' ',0};' \
>> makedevs.tmp
-.if ${MACHINE_ARCH} != "alpha"
+.if ${MACHINE} == "i386"
file2c 'u_char boot0[] = {' '};' < /boot/boot0 >> makedevs.tmp
file2c 'u_char mbr[] = {' '};' < /boot/mbr >> makedevs.tmp
.endif
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c
index b70250e..110f646 100644
--- a/usr.sbin/sade/devices.c
+++ b/usr.sbin/sade/devices.c
@@ -115,6 +115,12 @@ static struct _devname {
{ DEVICE_TYPE_NETWORK, "cuaa%d", "%s on device %s (COM%d)", 28, 128, 1, 16, 'c' },
{ DEVICE_TYPE_NETWORK, "lp", "Parallel Port IP (PLIP) peer connection" },
{ DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" },
+#ifdef PC98
+ { DEVICE_TYPE_DISK, "wd%d", "IDE disk device", 3, 65538, 8, 16, 'c' },
+ { DEVICE_TYPE_CDROM, "wcd%dc", "ATAPI IDE CDROM", 69, 2, 8, 4, 'c' },
+ { DEVICE_TYPE_FLOPPY, "wfd%d", "ATAPI floppy drive unit A", 87, 0, 8, 4, 'c' },
+ { DEVICE_TYPE_DISK, "wfd%d", "ATAPI floppy device", 87, 65538, 8, 4, 'c' },
+#endif
{ 0 },
};
diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c
index 30c7dee..1dde2b0 100644
--- a/usr.sbin/sade/disks.c
+++ b/usr.sbin/sade/disks.c
@@ -42,6 +42,14 @@
enum size_units_t { UNIT_BLOCKS, UNIT_KILO, UNIT_MEG, UNIT_SIZE };
+#ifdef PC98
+#define SUBTYPE_FREEBSD 50324
+#define SUBTYPE_FAT 37218
+#else
+#define SUBTYPE_FREEBSD 165
+#define SUBTYPE_FAT 6
+#endif
+
/* Where we start displaying chunk information on the screen */
#define CHUNK_START_ROW 5
@@ -87,6 +95,7 @@ print_chunks(Disk *d, int u)
for (i = Total = 0; chunk_info[i]; i++)
Total += chunk_info[i]->size;
+#ifndef PC98
if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
dialog_clear_norefresh();
msgConfirm("WARNING: A geometry of %d/%d/%d for %s is incorrect. Using\n"
@@ -101,6 +110,7 @@ print_chunks(Disk *d, int u)
d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
Sanitize_Bios_Geom(d);
}
+#endif
attrset(A_NORMAL);
mvaddstr(0, 0, "Disk name:\t");
clrtobot();
@@ -153,6 +163,7 @@ print_command_summary()
move(0, 0);
}
+#ifndef PC98
static u_char *
getBootMgr(char *dname)
{
@@ -193,6 +204,7 @@ getBootMgr(char *dname)
#endif
return NULL;
}
+#endif
int
diskGetSelectCount(Device ***devs)
@@ -220,7 +232,9 @@ diskPartition(Device *dev)
int rv, key = 0;
Boolean chunking;
char *msg = NULL;
+#ifndef PC98
u_char *mbrContents;
+#endif
WINDOW *w = savescr();
Disk *d = (Disk *)dev->private;
int size_unit;
@@ -321,9 +335,19 @@ diskPartition(Device *dev)
msg = "Slice in use, delete it first or move to an unused one.";
else {
char *val, tmp[20], *cp;
- int size, subtype;
+ int size;
+#ifdef PC98
+ char name[16];
+
+ snprintf(name, 16, "%s", "FreeBSD");
+ val = msgGetInput(name,
+ "Please specify the name for new FreeBSD slice.");
+ if (val)
+ strncpy(name, val, 16);
+#else
+ int subtype;
chunk_e partitiontype;
-
+#endif
snprintf(tmp, 20, "%lu", chunk_info[current_chunk]->size);
val = msgGetInput(tmp, "Please specify the size for new FreeBSD slice in blocks\n"
"or append a trailing `M' for megabytes (e.g. 20M).");
@@ -332,7 +356,15 @@ diskPartition(Device *dev)
size *= ONE_MEG;
else if (*cp && toupper(*cp) == 'G')
size *= ONE_GIG;
- strcpy(tmp, "165");
+#ifdef PC98
+ Create_Chunk(d, chunk_info[current_chunk]->offset, size,
+ freebsd, 3,
+ (chunk_info[current_chunk]->flags & CHUNK_ALIGN),
+ name);
+ variable_set2(DISK_PARTITIONED, "yes", 0);
+ record_chunks(d);
+#else
+ sprintf(tmp, "%d", SUBTYPE_FREEBSD);
val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 165). You can choose other types, 6 for a\n"
@@ -342,9 +374,9 @@ diskPartition(Device *dev)
"for you to use another tool, such as DOS FORMAT, to later format\n"
"and use the partition.");
if (val && (subtype = strtol(val, NULL, 0)) > 0) {
- if (subtype == 165)
+ if (subtype == SUBTYPE_FREEBSD)
partitiontype = freebsd;
- else if (subtype == 6)
+ else if (subtype == SUBTYPE_FAT)
partitiontype = fat;
else
partitiontype = unknown;
@@ -358,6 +390,7 @@ diskPartition(Device *dev)
variable_set2(DISK_PARTITIONED, "yes", 0);
record_chunks(d);
}
+#endif /* PC98 */
}
clear();
}
@@ -382,7 +415,17 @@ diskPartition(Device *dev)
int subtype;
chunk_e partitiontype;
- strcpy(tmp, "165");
+ sprintf(tmp, "%d", SUBTYPE_FREEBSD);
+#ifdef PC98
+ val = msgGetInput(tmp, "New partition type:\n\n"
+ "Pressing Enter will choose the default, a native FreeBSD\n"
+ "slice (type 50324). Other popular values are 37218 for\n"
+ "DOS FAT partition.\n\n"
+ "Note: If you choose a non-FreeBSD partition type, it will not\n"
+ "be formatted or otherwise prepared, it will simply reserve space\n"
+ "for you to use another tool, such as DOS format, to later format\n"
+ "and actually use the partition.");
+#else
val = msgGetInput(tmp, "New partition type:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 165). Other popular values are 6 for\n"
@@ -392,10 +435,11 @@ diskPartition(Device *dev)
"be formatted or otherwise prepared, it will simply reserve space\n"
"for you to use another tool, such as DOS format, to later format\n"
"and actually use the partition.");
+#endif /* PC98 */
if (val && (subtype = strtol(val, NULL, 0)) > 0) {
- if (subtype == 165)
+ if (subtype == SUBTYPE_FREEBSD)
partitiontype = freebsd;
- else if (subtype == 6)
+ else if (subtype == SUBTYPE_FAT)
partitiontype = fat;
else
partitiontype = unknown;
@@ -457,6 +501,7 @@ diskPartition(Device *dev)
"Are you absolutely sure you want to do this now?")) {
variable_set2(DISK_PARTITIONED, "yes", 0);
+#ifndef PC98
/* Don't trash the MBR if the first (and therefore only) chunk is marked for a truly dedicated
* disk (i.e., the disklabel starts at sector 0), even in cases where the user has requested
* booteasy or a "standard" MBR -- both would be fatal in this case.
@@ -470,6 +515,7 @@ diskPartition(Device *dev)
else
mbrContents = NULL;
Set_Boot_Mgr(d, mbrContents);
+#endif /* !PC98 */
if (DITEM_STATUS(diskPartitionWrite(NULL)) != DITEM_SUCCESS)
msgConfirm("Disk partition write returned an error status!");
@@ -496,6 +542,7 @@ diskPartition(Device *dev)
case '\033': /* ESC */
case 'Q':
chunking = FALSE;
+#ifndef PC98
/* Don't trash the MBR if the first (and therefore only) chunk is marked for a truly dedicated
* disk (i.e., the disklabel starts at sector 0), even in cases where the user has requested
* booteasy or a "standard" MBR -- both would be fatal in this case.
@@ -513,10 +560,11 @@ diskPartition(Device *dev)
(mbrContents = getBootMgr(d->name)) != NULL)
Set_Boot_Mgr(d, mbrContents);
#endif
+#endif /* !PC98 */
break;
case 'Z':
- size_unit = (size_unit + 1) % UNIT_SIZE;
+ size_unit = (size_unit + 1) % UNIT_SIZE;
break;
default:
@@ -714,7 +762,9 @@ diskPartitionNonInteractive(Device *dev)
{
char *cp;
int i, sz, all_disk = 0;
+#ifndef PC98
u_char *mbrContents;
+#endif
Disk *d = (Disk *)dev->private;
record_chunks(d);
@@ -733,8 +783,16 @@ diskPartitionNonInteractive(Device *dev)
for (i = 0; chunk_info[i]; i++) {
/* If a chunk is at least 10MB in size, use it. */
if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
- Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size, freebsd, 3,
+#ifdef PC98
+ Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
+ freebsd, 3,
+ (chunk_info[i]->flags & CHUNK_ALIGN),
+ "FreeBSD");
+#else
+ Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
+ freebsd, 3,
(chunk_info[i]->flags & CHUNK_ALIGN));
+#endif
variable_set2(DISK_PARTITIONED, "yes", 0);
break;
}
@@ -765,7 +823,14 @@ diskPartitionNonInteractive(Device *dev)
for (i = 0; chunk_info[i]; i++) {
/* If a chunk is at least sz MB, use it. */
if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
- Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3, (chunk_info[i]->flags & CHUNK_ALIGN));
+#ifdef PC98
+ Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
+ (chunk_info[i]->flags & CHUNK_ALIGN),
+ "FreeBSD");
+#else
+ Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
+ (chunk_info[i]->flags & CHUNK_ALIGN));
+#endif
variable_set2(DISK_PARTITIONED, "yes", 0);
break;
}
@@ -790,10 +855,12 @@ diskPartitionNonInteractive(Device *dev)
msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_PARTITION);
return;
}
+#ifndef PC98
if (!all_disk) {
mbrContents = getBootMgr(d->name);
Set_Boot_Mgr(d, mbrContents);
}
+#endif
variable_set2(DISK_PARTITIONED, "yes", 0);
}
}
diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c
index 1fde541..d16720d 100644
--- a/usr.sbin/sade/main.c
+++ b/usr.sbin/sade/main.c
@@ -63,6 +63,15 @@ main(int argc, char **argv)
return 1;
}
+#ifdef PC98
+ {
+ /* XXX */
+ char *p = getenv("TERM");
+ if (p && strcmp(p, "cons25") == 0)
+ putenv("TERM=cons25w");
+ }
+#endif
+
/* Set up whatever things need setting up */
systemInitialize(argc, argv);
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index 4df783e..d4c3394 100644
--- a/usr.sbin/sade/menus.c
+++ b/usr.sbin/sade/menus.c
@@ -36,9 +36,11 @@
#include "sysinstall.h"
-#ifdef __alpha__
+#if defined(__alpha__)
#define _AS(str) str "alpha/"
-#else /* i386 */
+#elif defined(PC98)
+#define _AS(str) str "pc98/"
+#else
#define _AS(str) str "i386/"
#endif
#define _AP(str) _AS(str "/pub/FreeBSD/releases/")
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index c772a9b..0563473 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.h
@@ -592,6 +592,7 @@ extern int lndir(char *from, char *to);
/* makedevs.c (auto-generated) */
extern const char termcap_ansi[];
extern const char termcap_vt100[];
+extern const char termcap_cons25w[];
extern const char termcap_cons25[];
extern const char termcap_cons25_m[];
extern const char termcap_cons25r[];
diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c
index 1569479..5025dcd 100644
--- a/usr.sbin/sade/termcap.c
+++ b/usr.sbin/sade/termcap.c
@@ -29,6 +29,7 @@ prompt_term(char **termp, char **termcapp)
const char *term, *termcap;
} lookup[] = { { "ansi", termcap_ansi },
{ "vt100", termcap_vt100 },
+ { "cons25w", termcap_cons25w },
{ "cons25", termcap_cons25 },
{ "cons25-m", termcap_cons25_m } };
@@ -109,6 +110,15 @@ set_termcap(void)
DebugFD, i, !i ? "success" : strerror(errno));
}
}
+
+#ifdef PC98
+ if (!term) {
+ if (setenv("TERM", "cons25w", 1) < 0)
+ return -1;
+ if (setenv("TERMCAP", termcap_cons25w, 1) < 0)
+ return -1;
+ }
+#else
if (ColorDisplay) {
if (!term) {
if (setenv("TERM", "cons25", 1) < 0)
@@ -125,6 +135,7 @@ set_termcap(void)
return -1;
}
}
+#endif
}
if (ioctl(0, TIOCGSIZE, &ts) == -1) {
msgDebug("Unable to get terminal size - errno %d\n", errno);
diff --git a/usr.sbin/sade/wizard.c b/usr.sbin/sade/wizard.c
index 19a63de..a42dc62 100644
--- a/usr.sbin/sade/wizard.c
+++ b/usr.sbin/sade/wizard.c
@@ -125,8 +125,20 @@ slice_wizard(Disk *d)
free(cp);
continue;
}
+#ifdef PC98
+ if (!strcasecmp(*cmds,"create") && ncmd == 7) {
+ printf("Create=%d\n",
+ Create_Chunk(d,
+ strtol(cmds[1],0,0),
+ strtol(cmds[2],0,0),
+ strtol(cmds[3],0,0),
+ strtol(cmds[4],0,0),
+ strtol(cmds[5],0,0),
+ cmds[6]));
+ continue;
+ }
+#else
if (!strcasecmp(*cmds,"create") && ncmd == 6) {
-
printf("Create=%d\n",
Create_Chunk(d,
strtol(cmds[1],0,0),
@@ -136,6 +148,7 @@ slice_wizard(Disk *d)
strtol(cmds[5],0,0)));
continue;
}
+#endif
if (!strcasecmp(*cmds,"read")) {
db = d;
if (ncmd > 1)
@@ -166,7 +179,11 @@ slice_wizard(Disk *d)
printf("dedicate\t\t");
printf("bios cyl hd sect\n");
printf("collapse [pointer]\t\t");
+#ifdef PC98
+ printf("create offset size enum subtype flags name\n");
+#else
printf("create offset size enum subtype flags\n");
+#endif
printf("subtype(part): swap=1, ffs=7\t\t");
printf("delete pointer\n");
printf("list\t\t");
OpenPOWER on IntegriCloud