diff options
author | nyan <nyan@FreeBSD.org> | 2000-06-05 13:17:23 +0000 |
---|---|---|
committer | nyan <nyan@FreeBSD.org> | 2000-06-05 13:17:23 +0000 |
commit | 6a7aa7f3d9d42126138b256ce2a6fe01ecd4d3a4 (patch) | |
tree | d4ae9bd04b53f4b71a4f6c8597f6153ee9c613e0 | |
parent | 2957ed6969367453170ee419e165102e862b1ecb (diff) | |
download | FreeBSD-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
34 files changed, 610 insertions, 89 deletions
diff --git a/release/Makefile b/release/Makefile index 21decf8..9320451 100644 --- a/release/Makefile +++ b/release/Makefile @@ -88,17 +88,29 @@ MNT= /mnt # Various floppy image parameters. # +.if ${MACHINE} == "pc98" +BOOTSIZE= 1200 +FIXITSIZE= 1440 +MFSSIZE= 2880 +BOOTINODE= 80000 +FIXITINODE= 4000 +MFSINODE= 8000 +BOOTLABEL= fd1200 +FIXITLABEL= fd1440 +MFSLABEL= minimum2 +.else BOOTSIZE= 1440 FIXITSIZE= 1440 MFSSIZE= 2880 BIGBOOTSIZE= 2880 BOOTINODE= 80000 -MFSINODE= 8000 FIXITINODE= 4000 +MFSINODE= 8000 BOOTLABEL= fd1440 FIXITLABEL= fd1440 -BIGBOOTLABEL= minimum2 MFSLABEL= minimum2 +BIGBOOTLABEL= minimum2 +.endif # overrides. .if ${MACHINE_ARCH} == "alpha" @@ -142,9 +154,8 @@ BOOTSTRAPUTILS+= /usr/bin/cpio CRUNCH_TARGETS= boot fixit .endif -.if ${MACHINE_ARCH} == "i386" -# Make both PC-card boot.flp and plain boot.flp -EXTRAS= floppies cdrom.1 ftp.1 +.if ${MACHINE} == "pc98" +EXTRAS= ftp.1 .else EXTRAS= cdrom.1 ftp.1 .endif @@ -291,7 +302,8 @@ rerelease release: chroot ${CHROOTDIR} /mk clean: - rm -rf boot_crunch ${.OBJDIR}/boot_crunch.conf release.[0-9] + rm -rf boot_crunch release.[0-9] + rm -rf ${.OBJDIR}/boot_crunch.conf ${.OBJDIR}/fixit_crunch.conf # Clean out ${_R} and make the directory structure. release.1: @@ -359,19 +371,18 @@ release.3: # See /usr/src/bin/ls/Makefile. release.4: @mkdir -p /stand - cp ${.CURDIR}/boot_crunch.conf.generic ${.OBJDIR}/boot_crunch.conf cd ${.CURDIR}/sysinstall && make obj depend all install rm -rf ${RD}/crunch mkdir -p ${RD}/crunch export RELEASE_BUILD_FIXIT=noway ; \ for j in ${CRUNCH_TARGETS} ; do \ + sed -e "s:MACHINE:${MACHINE}:" \ + ${.CURDIR}/$${j}_crunch.conf > \ + ${.OBJDIR}/$${j}_crunch.conf && \ rm -rf $${j}_crunch && \ mkdir $${j}_crunch && \ ( cd $${j}_crunch && \ - ( ( [ -f ${.CURDIR}/$${j}_crunch.conf ] && \ - crunchgen ${.CURDIR}/$${j}_crunch.conf ) || \ - ( [ -f ${.OBJDIR}/$${j}_crunch.conf ] && \ - crunchgen ${.OBJDIR}/$${j}_crunch.conf ) ) && \ + crunchgen ${.OBJDIR}/$${j}_crunch.conf && \ ${MAKE} -DRELEASE_CRUNCH -f $${j}_crunch.mk subclean all \ NOCRYPT=yes "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \ mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \ @@ -529,7 +540,9 @@ release.8: write_mfs_in_kernel @sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \ ${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL} @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern +.if ${MACHINE} != "pc98" @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot BIGBOOT=YES +.endif @rm mfsroot mfsroot.gz mfsroot.size @echo "Regular and MFS boot floppies made." touch release.8 @@ -718,15 +731,9 @@ installCRUNCH: ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \ fi @chmod 555 ${DIR}/${CRUNCH}_crunch - @if [ -f ${.OBJDIR}/${CRUNCH}_crunch.conf ] ; then \ - for i in `crunchgen -l ${.OBJDIR}/${CRUNCH}_crunch.conf` ; do \ - ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ - done \ - else \ - for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \ - ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ - done \ - fi + @for i in `crunchgen -l ${.OBJDIR}/${CRUNCH}_crunch.conf` ; do \ + ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ + done # # --==## Compile a kernel by name ${KERNEL} ##==-- @@ -736,7 +743,7 @@ installCRUNCH: # doKERNEL: @rm -f ${RD}/kernels/${KERNEL} - @cd ${.CURDIR}/../sys/${MACHINE_ARCH}/conf && config ${KERNEL} + @cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL} @cd ${.CURDIR}/../sys/compile/${KERNEL} && \ make depend && \ make ${KERNEL} && \ @@ -749,14 +756,15 @@ doKERNEL: doMFSKERN: @echo "Running doMFSKERN for ${FSIMAGE}" @rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE} - @cd ${.CURDIR}/../sys/${MACHINE_ARCH}/conf && \ + @cd ${.CURDIR}/../sys/${MACHINE}/conf && \ sh ${.CURDIR}/scripts/dokern.sh ${BIGBOOT} < ${KERNCONF} > BOOTMFS .if ${MACHINE_ARCH} == "i386" - @echo "options INTRO_USERCONFIG" >> ${.CURDIR}/../sys/i386/conf/BOOTMFS + @echo "options INTRO_USERCONFIG" >> \ + ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS .endif .if defined(BIGBOOT) @echo "options \"MD_ROOT_SIZE=`cat mfsroot.size`\"" >> \ - ${.CURDIR}/../sys/${MACHINE_ARCH}/conf/BOOTMFS + ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS .endif @cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS @rm -rf ${RD}/image.${FSIMAGE} diff --git a/release/boot_crunch.conf.generic b/release/alpha/boot_crunch.conf index dc6d98b..6e9446b 100644 --- a/release/boot_crunch.conf.generic +++ b/release/alpha/boot_crunch.conf @@ -1,7 +1,7 @@ # $FreeBSD$ srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin -srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/i386 +srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/MACHINE srcdirs /usr/src/usr.sbin/pccard progs sh find sed test rm @@ -19,4 +19,4 @@ ln test [ ln newfs mount_mfs libs -ll -ledit -lutil -lkvm -lmd -lcrypt -lftpio -lz -lnetgraph -libs -ldialog -lncurses -lmytinfo -L/usr/src/release/libdisk/obj -ldisk -lipx +libs -ldialog -lncurses -lmytinfo -ldisk -lipx diff --git a/release/alpha/fixit_crunch.conf b/release/alpha/fixit_crunch.conf index 7dca737..156d670 100644 --- a/release/alpha/fixit_crunch.conf +++ b/release/alpha/fixit_crunch.conf @@ -5,7 +5,7 @@ srcdirs /usr/src/bin /usr/src/sbin /usr/src/usr.bin /usr/src/usr.sbin srcdirs /usr/src/gnu/usr.bin /usr/src/usr.bin/vi -srcdirs /usr/src/sbin/i386 +srcdirs /usr/src/sbin/MACHINE # second, we list all the programs we want to include in our crunched binary. # The order doesn't matter. Any program that needs hard links to it gets an diff --git a/release/amd64/boot_crunch.conf b/release/amd64/boot_crunch.conf new file mode 100644 index 0000000..6e9446b --- /dev/null +++ b/release/amd64/boot_crunch.conf @@ -0,0 +1,22 @@ +# $FreeBSD$ + +srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin +srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/MACHINE +srcdirs /usr/src/usr.sbin/pccard + +progs sh find sed test rm +progs pwd ppp +progs sysinstall newfs minigzip cpio fsck ifconfig route slattach +progs mount_nfs +progs dhclient arp hostname +progs pccardc pccardd +progs usbd usbdevs +ln minigzip gzip +ln minigzip gunzip +ln minigzip zcat +ln sh -sh +ln test [ +ln newfs mount_mfs + +libs -ll -ledit -lutil -lkvm -lmd -lcrypt -lftpio -lz -lnetgraph +libs -ldialog -lncurses -lmytinfo -ldisk -lipx diff --git a/release/boot_crunch.conf b/release/boot_crunch.conf new file mode 100644 index 0000000..6e9446b --- /dev/null +++ b/release/boot_crunch.conf @@ -0,0 +1,22 @@ +# $FreeBSD$ + +srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin +srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/MACHINE +srcdirs /usr/src/usr.sbin/pccard + +progs sh find sed test rm +progs pwd ppp +progs sysinstall newfs minigzip cpio fsck ifconfig route slattach +progs mount_nfs +progs dhclient arp hostname +progs pccardc pccardd +progs usbd usbdevs +ln minigzip gzip +ln minigzip gunzip +ln minigzip zcat +ln sh -sh +ln test [ +ln newfs mount_mfs + +libs -ll -ledit -lutil -lkvm -lmd -lcrypt -lftpio -lz -lnetgraph +libs -ldialog -lncurses -lmytinfo -ldisk -lipx diff --git a/release/fixit_crunch.conf b/release/fixit_crunch.conf index 7dca737..156d670 100644 --- a/release/fixit_crunch.conf +++ b/release/fixit_crunch.conf @@ -5,7 +5,7 @@ srcdirs /usr/src/bin /usr/src/sbin /usr/src/usr.bin /usr/src/usr.sbin srcdirs /usr/src/gnu/usr.bin /usr/src/usr.bin/vi -srcdirs /usr/src/sbin/i386 +srcdirs /usr/src/sbin/MACHINE # second, we list all the programs we want to include in our crunched binary. # The order doesn't matter. Any program that needs hard links to it gets an diff --git a/release/i386/boot_crunch.conf b/release/i386/boot_crunch.conf new file mode 100644 index 0000000..6e9446b --- /dev/null +++ b/release/i386/boot_crunch.conf @@ -0,0 +1,22 @@ +# $FreeBSD$ + +srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin +srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/MACHINE +srcdirs /usr/src/usr.sbin/pccard + +progs sh find sed test rm +progs pwd ppp +progs sysinstall newfs minigzip cpio fsck ifconfig route slattach +progs mount_nfs +progs dhclient arp hostname +progs pccardc pccardd +progs usbd usbdevs +ln minigzip gzip +ln minigzip gunzip +ln minigzip zcat +ln sh -sh +ln test [ +ln newfs mount_mfs + +libs -ll -ledit -lutil -lkvm -lmd -lcrypt -lftpio -lz -lnetgraph +libs -ldialog -lncurses -lmytinfo -ldisk -lipx diff --git a/release/pc98/boot_crunch.conf b/release/pc98/boot_crunch.conf new file mode 100644 index 0000000..6e9446b --- /dev/null +++ b/release/pc98/boot_crunch.conf @@ -0,0 +1,22 @@ +# $FreeBSD$ + +srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin +srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/MACHINE +srcdirs /usr/src/usr.sbin/pccard + +progs sh find sed test rm +progs pwd ppp +progs sysinstall newfs minigzip cpio fsck ifconfig route slattach +progs mount_nfs +progs dhclient arp hostname +progs pccardc pccardd +progs usbd usbdevs +ln minigzip gzip +ln minigzip gunzip +ln minigzip zcat +ln sh -sh +ln test [ +ln newfs mount_mfs + +libs -ll -ledit -lutil -lkvm -lmd -lcrypt -lftpio -lz -lnetgraph +libs -ldialog -lncurses -lmytinfo -ldisk -lipx diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile index 9074ad2..5bf628c 100644 --- a/release/sysinstall/Makefile +++ b/release/sysinstall/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/release/sysinstall/devices.c b/release/sysinstall/devices.c index b70250e..110f646 100644 --- a/release/sysinstall/devices.c +++ b/release/sysinstall/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/release/sysinstall/disks.c b/release/sysinstall/disks.c index 30c7dee..1dde2b0 100644 --- a/release/sysinstall/disks.c +++ b/release/sysinstall/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/release/sysinstall/floppy.c b/release/sysinstall/floppy.c index 576361e..b37f513 100644 --- a/release/sysinstall/floppy.c +++ b/release/sysinstall/floppy.c @@ -64,6 +64,9 @@ mediaInitFloppy(Device *dev) struct msdosfs_args dosargs; struct ufs_args u_args; char *mp; +#ifdef PC98 + char fddev[24]; +#endif if (floppyMounted) return TRUE; @@ -85,20 +88,51 @@ mediaInitFloppy(Device *dev) } memset(&dosargs, 0, sizeof dosargs); +#ifdef PC98 + dosargs.fspec = fddev; +#else dosargs.fspec = dev->devname; +#endif dosargs.uid = dosargs.gid = 0; dosargs.mask = 0777; memset(&u_args, 0, sizeof(u_args)); +#ifdef PC98 + u_args.fspec = fddev; +#else u_args.fspec = dev->devname; - - if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) == -1) { - if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) == -1) { - msgConfirm("Error mounting floppy %s (%s) on %s : %s", - dev->name, dev->devname, mp, strerror(errno)); - return FALSE; - } - } +#endif + +#ifdef PC98 + sprintf(fddev, "%s.1200", dev->devname); + if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) != -1) + goto success; + if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) != -1) + goto success; + + sprintf(fddev, "%s.1232", dev->devname); + if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) != -1) + goto success; + if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) != -1) + goto success; + + sprintf(fddev, "%s.1440", dev->devname); + if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) != -1) + goto success; + if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) != -1) + goto success; +#else + if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) != -1) + goto success; + if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) != -1) + goto success; +#endif /* PC98 */ + + msgConfirm("Error mounting floppy %s (%s) on %s : %s", + dev->name, dev->devname, mp, strerror(errno)); + return FALSE; + +success: floppyMounted = TRUE; distWanted = NULL; return TRUE; diff --git a/release/sysinstall/main.c b/release/sysinstall/main.c index 1fde541..d16720d 100644 --- a/release/sysinstall/main.c +++ b/release/sysinstall/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/release/sysinstall/menus.c b/release/sysinstall/menus.c index 4df783e..d4c3394 100644 --- a/release/sysinstall/menus.c +++ b/release/sysinstall/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/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index c772a9b..0563473 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.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/release/sysinstall/termcap.c b/release/sysinstall/termcap.c index 1569479..5025dcd 100644 --- a/release/sysinstall/termcap.c +++ b/release/sysinstall/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/release/sysinstall/wizard.c b/release/sysinstall/wizard.c index 19a63de..a42dc62 100644 --- a/release/sysinstall/wizard.c +++ b/release/sysinstall/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"); 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"); diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile index 9074ad2..5bf628c 100644 --- a/usr.sbin/sysinstall/Makefile +++ b/usr.sbin/sysinstall/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/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index b70250e..110f646 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/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/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index 30c7dee..1dde2b0 100644 --- a/usr.sbin/sysinstall/disks.c +++ b/usr.sbin/sysinstall/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/sysinstall/floppy.c b/usr.sbin/sysinstall/floppy.c index 576361e..b37f513 100644 --- a/usr.sbin/sysinstall/floppy.c +++ b/usr.sbin/sysinstall/floppy.c @@ -64,6 +64,9 @@ mediaInitFloppy(Device *dev) struct msdosfs_args dosargs; struct ufs_args u_args; char *mp; +#ifdef PC98 + char fddev[24]; +#endif if (floppyMounted) return TRUE; @@ -85,20 +88,51 @@ mediaInitFloppy(Device *dev) } memset(&dosargs, 0, sizeof dosargs); +#ifdef PC98 + dosargs.fspec = fddev; +#else dosargs.fspec = dev->devname; +#endif dosargs.uid = dosargs.gid = 0; dosargs.mask = 0777; memset(&u_args, 0, sizeof(u_args)); +#ifdef PC98 + u_args.fspec = fddev; +#else u_args.fspec = dev->devname; - - if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) == -1) { - if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) == -1) { - msgConfirm("Error mounting floppy %s (%s) on %s : %s", - dev->name, dev->devname, mp, strerror(errno)); - return FALSE; - } - } +#endif + +#ifdef PC98 + sprintf(fddev, "%s.1200", dev->devname); + if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) != -1) + goto success; + if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) != -1) + goto success; + + sprintf(fddev, "%s.1232", dev->devname); + if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) != -1) + goto success; + if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) != -1) + goto success; + + sprintf(fddev, "%s.1440", dev->devname); + if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) != -1) + goto success; + if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) != -1) + goto success; +#else + if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) != -1) + goto success; + if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) != -1) + goto success; +#endif /* PC98 */ + + msgConfirm("Error mounting floppy %s (%s) on %s : %s", + dev->name, dev->devname, mp, strerror(errno)); + return FALSE; + +success: floppyMounted = TRUE; distWanted = NULL; return TRUE; diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c index 1fde541..d16720d 100644 --- a/usr.sbin/sysinstall/main.c +++ b/usr.sbin/sysinstall/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/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index 4df783e..d4c3394 100644 --- a/usr.sbin/sysinstall/menus.c +++ b/usr.sbin/sysinstall/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/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index c772a9b..0563473 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.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/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c index 1569479..5025dcd 100644 --- a/usr.sbin/sysinstall/termcap.c +++ b/usr.sbin/sysinstall/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/sysinstall/wizard.c b/usr.sbin/sysinstall/wizard.c index 19a63de..a42dc62 100644 --- a/usr.sbin/sysinstall/wizard.c +++ b/usr.sbin/sysinstall/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"); |