First cut at a "copy userconfig changes from installation kernel to installed
kernel" mechanism. This is just the foundation - more work follows and will be committed over the next few hours. Submitted-by: "Eric L. Hernes" <erich@lodgenet.com> & jkh
This commit is contained in:
parent
a1406d7cf0
commit
f4cd25007b
@ -9,9 +9,10 @@ SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c devices.c \
|
||||
ftp_strat.c globals.c index.c install.c installUpgrade.c \
|
||||
label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
|
||||
msg.c network.c nfs.c options.c package.c samba.c system.c \
|
||||
tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
|
||||
tape.c tcpip.c termcap.c ufs.c variable.c wizard.c \
|
||||
uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c uc_scsi.c
|
||||
|
||||
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog
|
||||
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog -I/sys -DUC_PRIVATE
|
||||
|
||||
#CFLAGS+= -DLOAD_CONFIG_FILE=\"install.cfg\"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: disks.c,v 1.64 1996/09/22 00:48:55 jkh Exp $
|
||||
* $Id: disks.c,v 1.65 1996/10/01 04:56:31 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -48,12 +48,13 @@ static int current_chunk;
|
||||
static void
|
||||
record_chunks(Disk *d)
|
||||
{
|
||||
struct chunk *c1;
|
||||
struct chunk *c1 = NULL;
|
||||
int i = 0;
|
||||
int last_free = 0;
|
||||
|
||||
if (!d->chunks)
|
||||
msgFatal("No chunk list found for %s!", d->name);
|
||||
current_chunk = 0;
|
||||
|
||||
for (c1 = d->chunks->part; c1; c1 = c1->next) {
|
||||
if (c1->type == unused && c1->size > last_free) {
|
||||
last_free = c1->size;
|
||||
@ -167,19 +168,24 @@ void
|
||||
diskPartition(Device *dev, Disk *d)
|
||||
{
|
||||
char *p;
|
||||
int key = 0;
|
||||
int rv, key = 0;
|
||||
Boolean chunking;
|
||||
char *msg = NULL;
|
||||
u_char *mbrContents;
|
||||
WINDOW *w;
|
||||
WINDOW *w = savescr();
|
||||
|
||||
chunking = TRUE;
|
||||
keypad(stdscr, TRUE);
|
||||
|
||||
w = savescr();
|
||||
clear();
|
||||
record_chunks(d);
|
||||
/* Flush both the dialog and curses library views of the screen
|
||||
since we don't always know who called us */
|
||||
dialog_clear_norefresh(), clear();
|
||||
|
||||
while (chunking) {
|
||||
/* Set up the chunk array */
|
||||
record_chunks(d);
|
||||
|
||||
/* Now print our overall state */
|
||||
print_chunks(d);
|
||||
print_command_summary();
|
||||
if (msg) {
|
||||
@ -187,14 +193,20 @@ diskPartition(Device *dev, Disk *d)
|
||||
beep();
|
||||
msg = NULL;
|
||||
}
|
||||
else {
|
||||
move(23, 0);
|
||||
clrtoeol();
|
||||
}
|
||||
|
||||
/* Get command character */
|
||||
key = getch();
|
||||
switch (toupper(key)) {
|
||||
|
||||
/* redraw */
|
||||
case '\014': /* ^L */
|
||||
clear();
|
||||
print_command_summary();
|
||||
continue;
|
||||
msg = NULL;
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case '-':
|
||||
@ -225,9 +237,7 @@ diskPartition(Device *dev, Disk *d)
|
||||
clear();
|
||||
break;
|
||||
|
||||
case 'A': {
|
||||
int rv;
|
||||
|
||||
case 'A':
|
||||
rv = msgYesNo("Do you want to do this with a true partition entry\n"
|
||||
"so as to remain cooperative with any future possible\n"
|
||||
"operating systems on the drive(s)?");
|
||||
@ -249,10 +259,8 @@ diskPartition(Device *dev, Disk *d)
|
||||
if (rv)
|
||||
d->bios_hd = d->bios_sect = d->bios_cyl = 1;
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
record_chunks(d);
|
||||
}
|
||||
clear();
|
||||
break;
|
||||
clear();
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
if (chunk_info[current_chunk]->type != freebsd)
|
||||
@ -301,10 +309,9 @@ diskPartition(Device *dev, Disk *d)
|
||||
Create_Chunk(d, chunk_info[current_chunk]->offset, size, partitiontype, subtype,
|
||||
(chunk_info[current_chunk]->flags & CHUNK_ALIGN));
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
record_chunks(d);
|
||||
clear();
|
||||
}
|
||||
}
|
||||
clear();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -315,7 +322,6 @@ diskPartition(Device *dev, Disk *d)
|
||||
else {
|
||||
Delete_Chunk(d, chunk_info[current_chunk]);
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
record_chunks(d);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -355,7 +361,6 @@ diskPartition(Device *dev, Disk *d)
|
||||
dev->private = d;
|
||||
variable_unset(DISK_PARTITIONED);
|
||||
variable_unset(DISK_LABELLED);
|
||||
record_chunks(d);
|
||||
clear();
|
||||
break;
|
||||
|
||||
@ -387,26 +392,18 @@ diskPartition(Device *dev, Disk *d)
|
||||
case '|':
|
||||
if (!msgYesNo("Are you SURE you want to go into Wizard mode?\n"
|
||||
"No seat belts whatsoever are provided!")) {
|
||||
WINDOW *w;
|
||||
|
||||
w = savescr();
|
||||
dialog_clear();
|
||||
end_dialog();
|
||||
DialogActive = FALSE;
|
||||
clear();
|
||||
refresh();
|
||||
slice_wizard(d);
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
dialog_clear_norefresh();
|
||||
DialogActive = TRUE;
|
||||
record_chunks(d);
|
||||
restorescr(w);
|
||||
}
|
||||
else
|
||||
msg = "Wise choice!";
|
||||
clear();
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
chunking = FALSE;
|
||||
clear();
|
||||
/* 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.
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dist.c,v 1.69 1996/09/26 22:12:07 pst Exp $
|
||||
* $Id: dist.c,v 1.70 1996/10/02 00:52:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -574,6 +574,12 @@ distExtractAll(dialogMenuItem *self)
|
||||
msgConfirm("Couldn't extract the following distributions. This may\n"
|
||||
"be because they were not available on the installation\n"
|
||||
"media you've chosen:\n\n\t%s", buf);
|
||||
/* Assume that if we couldn't get all the dists, our media probably needs changing at this point */
|
||||
if (mediaDevice->type == DEVICE_TYPE_FTP)
|
||||
variable_unset(VAR_FTP_PATH);
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
return DITEM_FAILURE | DITEM_RESTORE;
|
||||
}
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: install.c,v 1.122 1996/10/02 08:25:09 jkh Exp $
|
||||
* $Id: install.c,v 1.123 1996/10/02 10:44:31 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -35,6 +35,7 @@
|
||||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
#include "uc_main.h"
|
||||
#include <ctype.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/errno.h>
|
||||
@ -380,12 +381,8 @@ installNovice(dialogMenuItem *self)
|
||||
if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE)
|
||||
return DITEM_FAILURE;
|
||||
|
||||
dialog_clear_norefresh();
|
||||
msgConfirm("Now it is time to select an installation subset. There are a number of\n"
|
||||
"canned distribution sets, ranging from minimal installation sets to full\n"
|
||||
"X11 developer oriented configurations. You can also select a custom set\n"
|
||||
"of distributions if none of the provided ones are suitable.");
|
||||
while (1) {
|
||||
dialog_clear_norefresh();
|
||||
if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists)
|
||||
return DITEM_FAILURE | DITEM_RECREATE;
|
||||
|
||||
@ -397,27 +394,24 @@ installNovice(dialogMenuItem *self)
|
||||
return DITEM_FAILURE | DITEM_RECREATE;
|
||||
|
||||
if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) {
|
||||
dialog_clear();
|
||||
dialog_clear_norefresh();
|
||||
msgConfirm("Installation completed with some errors. You may wish to\n"
|
||||
"scroll through the debugging messages on VTY1 with the\n"
|
||||
"scroll-lock feature. You can also chose \"No\" at the next\n"
|
||||
"prompt and go back into the installation menus to try and retry\n"
|
||||
"whichever operations have failed.");
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
if (mediaDevice->type == DEVICE_TYPE_FTP)
|
||||
variable_unset(VAR_FTP_PATH);
|
||||
return i | DITEM_RECREATE;
|
||||
|
||||
}
|
||||
else
|
||||
dialog_clear();
|
||||
else {
|
||||
dialog_clear_norefresh();
|
||||
msgConfirm("Congratulations! You now have FreeBSD installed on your system.\n\n"
|
||||
"We will now move on to the final configuration questions.\n"
|
||||
"For any option you do not wish to configure, simply select\n"
|
||||
"No.\n\n"
|
||||
"If you wish to re-enter this utility after the system is up, you\n"
|
||||
"may do so by typing: /stand/sysinstall.");
|
||||
|
||||
}
|
||||
if (mediaDevice->type != DEVICE_TYPE_FTP && mediaDevice->type != DEVICE_TYPE_NFS) {
|
||||
if (!msgYesNo("Would you like to configure any SLIP/PPP or network interface devices?")) {
|
||||
Device *save = mediaDevice;
|
||||
@ -430,6 +424,7 @@ installNovice(dialogMenuItem *self)
|
||||
}
|
||||
}
|
||||
|
||||
dialog_clear_norefresh();
|
||||
if (!msgYesNo("Would you like to configure Samba for connecting NETBUI clients to this\n"
|
||||
"machine? Windows 95, Windows NT and Windows for Workgroups\n"
|
||||
"machines can use NETBUI transport for disk and printer sharing."))
|
||||
@ -573,17 +568,6 @@ installCommit(dialogMenuItem *self)
|
||||
else if (!(Dists & DIST_BIN))
|
||||
(void)installFixup(self);
|
||||
|
||||
/* Don't print this if we're express or novice installing - they have their own error reporting */
|
||||
if (strcmp(str, "express") && strcmp(str, "novice")) {
|
||||
if (Dists || DITEM_STATUS(i) == DITEM_FAILURE)
|
||||
msgConfirm("Installation completed with some errors. You may wish to\n"
|
||||
"scroll through the debugging messages on VTY1 with the\n"
|
||||
"scroll-lock feature.");
|
||||
else
|
||||
msgConfirm("Installation completed successfully.\n\n"
|
||||
"If you have any network devices you have not yet configured,\n"
|
||||
"see the Interfaces configuration item on the Configuration menu.");
|
||||
}
|
||||
variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install");
|
||||
return i | DITEM_RECREATE;
|
||||
}
|
||||
@ -911,8 +895,57 @@ create_termcap(void)
|
||||
}
|
||||
}
|
||||
|
||||
static char *isa_list[] = {
|
||||
"device",
|
||||
"ioport",
|
||||
"irq",
|
||||
"drq",
|
||||
"iomem",
|
||||
"iosize",
|
||||
"flags",
|
||||
"alive",
|
||||
"enabled",
|
||||
};
|
||||
|
||||
static void
|
||||
save_userconfig_to_kernel(char *kern)
|
||||
{
|
||||
/* place-holder for now */
|
||||
struct kernel *core, *boot;
|
||||
struct list *c_isa, *c_dev, *b_dev;
|
||||
int i, d;
|
||||
|
||||
core = uc_open("-incore");
|
||||
if (!core) {
|
||||
msgDebug("Can't read in-core information for kernel.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
boot = uc_open(kern);
|
||||
if (!boot) {
|
||||
msgDebug("Can't read device information for kernel image %s\n", kern);
|
||||
return;
|
||||
}
|
||||
msgDebug("Kernel open, getting core ISA devices\n");
|
||||
c_isa = uc_getdev(core, "-isa");
|
||||
for (d = 0; d < c_isa->ac; d++) {
|
||||
msgDebug("Outer loop, c_isa->av[%d] = %s\n", d, c_isa->av[d]);
|
||||
if (strcmp(c_isa->av[d], "npx0")) { /* special case npx0, which
|
||||
mucks with its id_irq member */
|
||||
c_dev = uc_getdev(core, c_isa->av[d]);
|
||||
b_dev = uc_getdev(boot, c_isa->av[d]);
|
||||
for (i = 0; i < c_dev->ac; i++) {
|
||||
msgDebug("Inner loop, c_dev->av[%d] = %s\n", i, c_dev->av[i]);
|
||||
if (strcmp(c_dev->av[i], b_dev->av[i])) {
|
||||
msgDebug("%s %s changed: %s (boot) -> %s (core)\n",
|
||||
c_dev->av[0], isa_list[i], b_dev->av[i], c_dev->av[i]);
|
||||
isa_setdev(boot, c_dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
msgDebug("skipping npx0\n");
|
||||
}
|
||||
msgDebug("Closing kernels\n");
|
||||
uc_close(core, 0);
|
||||
uc_close(boot, 1);
|
||||
}
|
||||
|
168
release/sysinstall/uc_eisa.c
Normal file
168
release/sysinstall/uc_eisa.c
Normal file
@ -0,0 +1,168 @@
|
||||
/***************************************************
|
||||
* file: userconfig/uc_eisa.c
|
||||
*
|
||||
* Copyright (c) 1996 Eric L. Hernes (erich@rrnet.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software withough specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <nlist.h>
|
||||
#include <i386/eisa/eisaconf.h>
|
||||
#ifdef TCL
|
||||
#include <tcl.h>
|
||||
#endif
|
||||
|
||||
#include "uc_main.h"
|
||||
|
||||
struct eisa_device_node {
|
||||
struct eisa_device dev;
|
||||
struct eisa_device_node *next;
|
||||
};
|
||||
|
||||
/* module prototypes */
|
||||
static void eisa_fill_in(struct kernel *, struct uc_eisa *, struct eisa_device_node *);
|
||||
|
||||
void
|
||||
get_eisa_info(struct kernel *kp){
|
||||
int i, total;
|
||||
u_int *ls;
|
||||
struct eisa_driver *ed;
|
||||
struct uc_eisa *ep, *epc;
|
||||
char *name;
|
||||
|
||||
if(kp->nl[EISA_SET].n_value || kp->nl[EISA_LIST].n_value) {
|
||||
ep=epc=(struct uc_eisa *)malloc(sizeof(struct uc_eisa));
|
||||
if(!kp->incore) {
|
||||
if(kp->nl[EISA_SET].n_value) {
|
||||
u_int ndev;
|
||||
ls=(u_int *)kv_to_u(kp, kp->nl[EISA_SET].n_value, sizeof(u_int)*10); /* XXX, size? */
|
||||
ndev=ls[0];
|
||||
for(i=1;i<(ndev+1);i++){
|
||||
ep=(struct uc_eisa *)realloc(ep, sizeof(struct uc_eisa)*i);
|
||||
epc = ep+(i-1);
|
||||
ed=(struct eisa_driver *)kv_to_u(kp, ls[i], sizeof(struct eisa_driver));
|
||||
name=(char *)kv_to_u(kp, (u_int)ed->name, 10); /* XXX, size? */
|
||||
asprintf(&epc->device, "%s", name);
|
||||
asprintf(&epc->full_name, "?");
|
||||
}
|
||||
ep=(struct uc_eisa *)realloc(ep, sizeof(struct uc_eisa)*i);
|
||||
epc = ep+(i-1);
|
||||
bzero(epc, sizeof(struct uc_eisa));
|
||||
kp->eisa_devp=ep;
|
||||
} else { /* not incore and no symbol, we have no EISA devs... */
|
||||
kp->eisa_devp=(struct uc_eisa *)0;
|
||||
}
|
||||
} else {
|
||||
/* if we're incore, we can get data from _eisa_dev_list, */
|
||||
/* which should be much more useful, but I'll need a machine */
|
||||
/* to test :( */
|
||||
if(kp->nl[EISA_LIST].n_value) {
|
||||
u_int t;
|
||||
struct eisa_device_node *edn;
|
||||
|
||||
t=kv_dref_p(kp, kp->nl[EISA_LIST].n_value);
|
||||
total=0;
|
||||
while(t) {
|
||||
edn=(struct eisa_device_node *)
|
||||
kv_to_u(kp, t,sizeof(struct eisa_device_node));
|
||||
ep=(struct uc_eisa *)realloc(ep, sizeof(struct uc_eisa)*(total+1));
|
||||
epc=ep+total;
|
||||
eisa_fill_in(kp, epc, edn);
|
||||
t=(u_int)edn->next;
|
||||
free(edn);
|
||||
total++;
|
||||
}
|
||||
|
||||
ep=(struct uc_eisa *)realloc(ep, sizeof(struct uc_eisa)*(total+1));
|
||||
epc=ep+total;
|
||||
bzero(epc, sizeof(struct uc_eisa));
|
||||
kp->eisa_devp=ep;
|
||||
} else {
|
||||
kp->eisa_devp=(struct uc_eisa *)0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
kp->eisa_devp=(struct uc_eisa *)0;
|
||||
}
|
||||
}
|
||||
|
||||
struct list *
|
||||
get_eisa_devlist(struct kernel *kp){
|
||||
struct list *dl;
|
||||
struct uc_eisa *kdp;
|
||||
|
||||
dl=list_new();
|
||||
|
||||
for(kdp=kp->eisa_devp; kdp->device; kdp++){
|
||||
list_append(dl, kdp->device);
|
||||
}
|
||||
return(dl);
|
||||
}
|
||||
|
||||
|
||||
struct list *
|
||||
get_eisa_device(struct uc_eisa *ep){
|
||||
struct list *list;
|
||||
list=list_new();
|
||||
|
||||
list_append(list, ep->device);
|
||||
list_append(list, ep->full_name);
|
||||
|
||||
return(list);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
eisa_fill_in(struct kernel *kp, struct uc_eisa *epc, struct eisa_device_node *edn){
|
||||
struct eisa_driver *edrv;
|
||||
char *n;
|
||||
|
||||
edrv=(struct eisa_driver *)kv_to_u(kp, (u_int)edn->dev.driver,
|
||||
sizeof(struct eisa_driver));
|
||||
|
||||
n=(char *)kv_to_u(kp, (u_int)edrv->name, 20);
|
||||
asprintf(&epc->device, "%s%d", n, edn->dev.unit);
|
||||
free(n);
|
||||
|
||||
n=(char *)kv_to_u(kp, (u_int)edn->dev.full_name, 40); /*XXX*/
|
||||
asprintf(&epc->full_name, "%s", n);
|
||||
free(n);
|
||||
free(edrv);
|
||||
}
|
||||
|
||||
void
|
||||
eisa_free(struct kernel *kp, int writeback){
|
||||
struct uc_eisa *ep;
|
||||
|
||||
for(ep=kp->eisa_devp;ep->device;ep++){
|
||||
free(ep->device);
|
||||
free(ep->full_name);
|
||||
}
|
||||
free(kp->eisa_devp);
|
||||
kp->eisa_devp=0;
|
||||
}
|
||||
|
||||
/* end of userconfig/uc_eisa.c */
|
210
release/sysinstall/uc_isa.c
Normal file
210
release/sysinstall/uc_isa.c
Normal file
@ -0,0 +1,210 @@
|
||||
/***************************************************
|
||||
* file: userconfig/uc_isa.c
|
||||
*
|
||||
* Copyright (c) 1996 Eric L. Hernes (erich@rrnet.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software withough specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <nlist.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
|
||||
#include "uc_main.h"
|
||||
|
||||
void
|
||||
get_isa_info(struct kernel *kp){
|
||||
int total, i, j;
|
||||
struct uc_isa *idp;
|
||||
struct isa_device *p, *isa_dp;
|
||||
struct isa_driver *drv;
|
||||
char *name;
|
||||
|
||||
if(kp->nl[ISA_BIOTAB].n_value || kp->nl[ISA_TTYTAB].n_value || kp->nl[ISA_NETTAB].n_value ||
|
||||
kp->nl[ISA_NULLTAB].n_value || kp->nl[ISA_WDCTAB].n_value || kp->nl[ISA_FDCTAB].n_value) {
|
||||
|
||||
idp = kp->isa_devp = (struct uc_isa *)malloc(sizeof(struct uc_isa));
|
||||
total=0; /* a running total of the number of isa devices */
|
||||
|
||||
for (i=0; i<6; i++) { /* the isa devices */
|
||||
if(kp->nl[i].n_value) {
|
||||
p = isa_dp = (struct isa_device *)kv_to_u(kp, kp->nl[i].n_value, /* XXX size? */
|
||||
sizeof(struct isa_device)*30);
|
||||
/* build the device list */
|
||||
/* `total' keeps a running total of all the devices found */
|
||||
for (j=0; p->id_id; j++, p++, total++) {
|
||||
kp->isa_devp = (struct uc_isa *)realloc(kp->isa_devp,
|
||||
sizeof(struct uc_isa)*(total+1));
|
||||
idp=kp->isa_devp+total;
|
||||
|
||||
drv=(struct isa_driver *)kv_to_u(kp, (u_int)p->id_driver, sizeof(struct isa_driver));
|
||||
name=(char *)kv_to_u(kp, (u_int)drv->name, 64);
|
||||
|
||||
if (i==ISA_WDCTAB || i==ISA_FDCTAB) { /* special case the disk devices */
|
||||
char n[10];
|
||||
strncpy(n, name, 10);
|
||||
n[strlen(n)-1]=0; /* chop off the trailing 'c' */
|
||||
asprintf(&idp->device, "%s%d", n, j);
|
||||
} else {
|
||||
asprintf(&idp->device, "%s%d", name, p->id_unit);
|
||||
}
|
||||
idp->port=p->id_iobase;
|
||||
idp->irq=p->id_irq;
|
||||
idp->drq=p->id_drq;
|
||||
idp->iomem=p->id_maddr;
|
||||
idp->iosize=p->id_msize;
|
||||
idp->flags=p->id_flags;
|
||||
idp->alive=p->id_alive;
|
||||
idp->enabled=p->id_enabled;
|
||||
idp->modified=0;
|
||||
if(!kp->incore){
|
||||
idp->idp=p;
|
||||
} else {
|
||||
free(name);
|
||||
free(drv);
|
||||
}
|
||||
}
|
||||
if(kp->incore){
|
||||
free(isa_dp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
idp=kp->isa_devp+total;
|
||||
bzero(idp, sizeof(struct uc_isa));
|
||||
} else {
|
||||
kp->isa_devp=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct list *
|
||||
get_isa_devlist(struct kernel *kp){
|
||||
struct list *dl;
|
||||
struct uc_isa *kdp;
|
||||
|
||||
dl=list_new();
|
||||
|
||||
for(kdp=kp->isa_devp; kdp->device; kdp++){
|
||||
list_append(dl, kdp->device);
|
||||
}
|
||||
return(dl);
|
||||
}
|
||||
|
||||
|
||||
struct list *
|
||||
get_isa_device(struct uc_isa *ip){
|
||||
struct list *list;
|
||||
char *tmp;
|
||||
|
||||
list=list_new();
|
||||
|
||||
asprintf(&tmp, "%s", ip->device );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "0x%04x", ip->port );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "%d", ip->irq>0 ? ffs(ip->irq)-1 : ip->irq);
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "%d", ip->drq );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "0x%08x", ip->iomem );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "0x%x", ip->iosize );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "0x%x", ip->flags );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "%d", ip->alive );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "%d", ip->enabled );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
return(list);
|
||||
}
|
||||
|
||||
int
|
||||
isa_setdev(struct kernel *kp, struct list *list){
|
||||
int r=1, irq;
|
||||
struct uc_isa *ip;
|
||||
|
||||
if(kp->isa_devp)
|
||||
for(ip=kp->isa_devp;ip->device;ip++){
|
||||
if(strcmp(list->av[0], ip->device)==0){
|
||||
ip->modified=1;
|
||||
ip->port = strtol(list->av[1], (char **)NULL, 0);
|
||||
irq=strtol(list->av[2], (char **)NULL, 0);
|
||||
ip->irq= irq > 0 ? 1 << (irq) : irq;
|
||||
ip->drq = strtol(list->av[3], (char **)NULL, 0);
|
||||
ip->iomem = (caddr_t)strtol(list->av[4], (char **)NULL, 0);
|
||||
ip->iosize = strtol(list->av[5], (char **)NULL, 0);
|
||||
ip->flags = strtol(list->av[6], (char **)NULL, 0);
|
||||
ip->enabled = strtol(list->av[8], (char **)NULL, 0);
|
||||
r=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(r);
|
||||
}
|
||||
|
||||
void
|
||||
isa_free(struct kernel *kp, int writeback){
|
||||
struct uc_isa *ip;
|
||||
for(ip=kp->isa_devp; ip->device; ip++){
|
||||
if((!kp->incore) && ip->modified && writeback) {
|
||||
/* save any changes */
|
||||
ip->idp->id_iobase=ip->port;
|
||||
ip->idp->id_irq = ip->irq;
|
||||
ip->idp->id_drq = ip->drq;
|
||||
ip->idp->id_maddr = ip->iomem;
|
||||
ip->idp->id_msize = ip->iosize;
|
||||
ip->idp->id_flags = ip->flags;
|
||||
ip->idp->id_enabled = ip->enabled;
|
||||
}
|
||||
/* and, be free... */
|
||||
free(ip->device);
|
||||
}
|
||||
/* and free the whole ball of wax */
|
||||
free(kp->isa_devp);
|
||||
kp->isa_devp=0;
|
||||
}
|
||||
|
||||
/* end of userconfig/uc_isa.c */
|
87
release/sysinstall/uc_kmem.c
Normal file
87
release/sysinstall/uc_kmem.c
Normal file
@ -0,0 +1,87 @@
|
||||
/***************************************************
|
||||
* file: userconfig/uc_kmem.c
|
||||
*
|
||||
* Copyright (c) 1996 Eric L. Hernes (erich@rrnet.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software withough specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <a.out.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "uc_main.h"
|
||||
|
||||
/* translate a kv pointer to user space */
|
||||
/* malloc()-ing if we aren't mmaped */
|
||||
u_int
|
||||
kv_to_u(struct kernel *kp, u_int adr, u_int size){
|
||||
u_int tadr;
|
||||
if(!kp->incore){
|
||||
struct exec *ep;
|
||||
ep=(struct exec *)kp->core;
|
||||
tadr=(u_int)((adr - ep->a_entry + (N_DATOFF(*ep) - ep->a_text))+kp->core);
|
||||
} else {
|
||||
caddr_t ptr;
|
||||
ptr = malloc(size);
|
||||
lseek(kp->fd, adr, SEEK_SET);
|
||||
read(kp->fd, ptr, size);
|
||||
tadr=(u_int)ptr;
|
||||
}
|
||||
return(tadr);
|
||||
}
|
||||
|
||||
/* dereference a pointer to kernel space */
|
||||
u_int
|
||||
kv_dref_p(struct kernel *kp, u_int adr){
|
||||
u_int tadr;
|
||||
if(!kp->incore){
|
||||
struct exec *ep;
|
||||
ep=(struct exec *)kp->core;
|
||||
tadr=*(u_int*)((adr - ep->a_entry + (N_DATOFF(*ep) - ep->a_text))+kp->core);
|
||||
} else {
|
||||
lseek(kp->fd, adr, SEEK_SET);
|
||||
read(kp->fd, &tadr, sizeof(tadr));
|
||||
}
|
||||
return(tadr);
|
||||
}
|
||||
|
||||
/* deref a pointer to kernel text */
|
||||
u_int
|
||||
kv_dref_t(struct kernel *kp, u_int adr){
|
||||
u_int tadr;
|
||||
if(!kp->incore){
|
||||
struct exec *ep;
|
||||
ep=(struct exec *)kp->core;
|
||||
tadr=*(u_int*)((adr - ep->a_entry) + N_TXTOFF(*ep) + (u_int)kp->core);
|
||||
} else {
|
||||
lseek(kp->fd, adr, SEEK_SET);
|
||||
read(kp->fd, &tadr, sizeof(tadr));
|
||||
}
|
||||
return(tadr);
|
||||
}
|
||||
|
||||
/* end of userconfig/uc_kmem.c */
|
76
release/sysinstall/uc_list.c
Normal file
76
release/sysinstall/uc_list.c
Normal file
@ -0,0 +1,76 @@
|
||||
/***************************************************
|
||||
* file: userconfig/uc_isa.c
|
||||
*
|
||||
* Copyright (c) 1996 Eric L. Hernes (erich@rrnet.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software withough specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <nlist.h>
|
||||
#include "uc_main.h"
|
||||
|
||||
struct list *
|
||||
list_new(void){
|
||||
struct list *rv;
|
||||
rv=(struct list *)malloc(sizeof(struct list));
|
||||
rv->ac=0;
|
||||
rv->av=(char **)0;
|
||||
return(rv);
|
||||
}
|
||||
|
||||
void
|
||||
list_append(struct list *list , char *item){
|
||||
|
||||
if(list->ac==0) {
|
||||
list->av=(char **)malloc(sizeof(char *)*(list->ac+1));
|
||||
} else {
|
||||
list->av=(char **)realloc(list->av, sizeof(char *)*(list->ac+1));
|
||||
}
|
||||
asprintf(list->av+list->ac, "%s", item);
|
||||
list->ac++;
|
||||
}
|
||||
|
||||
void
|
||||
list_print(struct list *list, char *separator){
|
||||
int i;
|
||||
for(i=0; i<list->ac; i++)
|
||||
printf("%s%s", list->av[i], separator);
|
||||
}
|
||||
|
||||
void
|
||||
list_destroy(struct list *list){
|
||||
int i;
|
||||
for(i=0;i<list->ac;i++){
|
||||
free(list->av[i]);
|
||||
list->av[i]=0;
|
||||
}
|
||||
free(list->av);
|
||||
list->av=0;
|
||||
free(list);
|
||||
}
|
||||
|
||||
/* end of userconfig/uc_list.c */
|
256
release/sysinstall/uc_main.c
Normal file
256
release/sysinstall/uc_main.c
Normal file
@ -0,0 +1,256 @@
|
||||
/***************************************************
|
||||
* file: userconfig/uc_main.c
|
||||
*
|
||||
* Copyright (c) 1996 Eric L. Hernes (erich@rrnet.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software withough specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* library functions for userconfig library
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <paths.h>
|
||||
#include <sys/mman.h>
|
||||
#include <nlist.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <tcl.h>
|
||||
|
||||
#include "uc_main.h"
|
||||
|
||||
struct nlist nl[] = {
|
||||
{"_isa_devtab_bio"},
|
||||
{"_isa_devtab_tty"},
|
||||
{"_isa_devtab_net"},
|
||||
{"_isa_devtab_null"},
|
||||
{"_isa_biotab_wdc"},
|
||||
{"_isa_biotab_fdc"},
|
||||
{"_eisadriver_set"},
|
||||
{"_eisa_dev_list"},
|
||||
{"_pcidevice_set"},
|
||||
{"_device_list"},
|
||||
{"_scbusses"},
|
||||
{"_scsi_cinit"},
|
||||
{"_scsi_dinit"},
|
||||
{"_scsi_tinit"},
|
||||
{""},
|
||||
};
|
||||
|
||||
|
||||
struct kernel *
|
||||
uc_open(char *name){
|
||||
int kd, i, flags, incore;
|
||||
struct kernel *kern;
|
||||
struct stat sb;
|
||||
char kname[80];
|
||||
|
||||
if (strcmp(name, "-incore")==0){
|
||||
incore=1;
|
||||
} else {
|
||||
incore=0;
|
||||
}
|
||||
|
||||
if (incore||(strcmp(name,"-bootfile")==0)) {
|
||||
strncpy(kname, getbootfile(), 79);
|
||||
} else {
|
||||
strncpy(kname, name, 79);
|
||||
}
|
||||
|
||||
kern=(struct kernel *)malloc(sizeof(struct kernel));
|
||||
|
||||
i=nlist(kname, nl);
|
||||
kern->nl=(struct nlist *)malloc(sizeof(nl));
|
||||
bcopy(nl, kern->nl, sizeof(nl));
|
||||
|
||||
if(incore){
|
||||
if((kd=open("/dev/kmem", O_RDONLY))<0){
|
||||
free(kern);
|
||||
kern=(struct kernel *)-3;
|
||||
return(kern);
|
||||
}
|
||||
|
||||
kern->core=(caddr_t)NULL;
|
||||
kern->incore=1;
|
||||
kern->size=0;
|
||||
|
||||
} else {
|
||||
if(stat(kname, &sb)<0){
|
||||
free(kern);
|
||||
kern=(struct kernel *)-1;
|
||||
return(kern);
|
||||
}
|
||||
kern->size=sb.st_size;
|
||||
flags=sb.st_flags;
|
||||
|
||||
if (chflags(kname, 0)<0){
|
||||
free(kern);
|
||||
kern=(struct kernel *)-2;
|
||||
return(kern);
|
||||
}
|
||||
|
||||
if((kd=open(kname, O_RDWR, 0644))<0){
|
||||
free(kern);
|
||||
kern=(struct kernel *)-3;
|
||||
return(kern);
|
||||
}
|
||||
|
||||
fchflags(kd, flags);
|
||||
|
||||
kern->core=mmap((caddr_t)0, sb.st_size, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED, kd, 0);
|
||||
kern->incore=0;
|
||||
|
||||
if(kern->core == (caddr_t)0){
|
||||
free(kern);
|
||||
kern=(struct kernel *)-4;
|
||||
return(kern);
|
||||
}
|
||||
}
|
||||
|
||||
kern->fd=kd;
|
||||
|
||||
get_isa_info(kern);
|
||||
|
||||
get_pci_info(kern);
|
||||
|
||||
get_eisa_info(kern);
|
||||
|
||||
get_scsi_info(kern);
|
||||
|
||||
return(kern);
|
||||
}
|
||||
|
||||
int
|
||||
uc_close(struct kernel *kern, int writeback){
|
||||
if(kern->isa_devp){
|
||||
isa_free(kern, writeback);
|
||||
}
|
||||
|
||||
if(kern->eisa_devp){
|
||||
eisa_free(kern, writeback); /* `writeback' isn't really useful here */
|
||||
}
|
||||
|
||||
if(kern->pci_devp){
|
||||
pci_free(kern, writeback); /* or here */
|
||||
}
|
||||
|
||||
if(kern->scsi_devp){
|
||||
scsi_free(kern, writeback);
|
||||
}
|
||||
|
||||
if(!kern->incore) {
|
||||
munmap(kern->core, kern->size);
|
||||
}
|
||||
close(kern->fd);
|
||||
free(kern->nl);
|
||||
free(kern);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
struct list *
|
||||
uc_getdev(struct kernel *kern, char *dev){
|
||||
struct list *list=(struct list *)0;
|
||||
|
||||
if(*dev=='-'){ /* asked for -isa, -eisa, -pci, -scsi, -all */
|
||||
if(strcmp(dev, "-all")==0) {
|
||||
list=list_new();
|
||||
if(kern->isa_devp) {
|
||||
list_append(list, "isa");
|
||||
}
|
||||
|
||||
if(kern->eisa_devp) {
|
||||
list_append(list, "eisa");
|
||||
}
|
||||
|
||||
if(kern->pci_devp) {
|
||||
list_append(list, "pci");
|
||||
}
|
||||
|
||||
if(kern->scsi_devp) {
|
||||
list_append(list, "scsi");
|
||||
}
|
||||
|
||||
} else if (strcmp(dev, "-isa")==0) {
|
||||
list=get_isa_devlist(kern);
|
||||
} else if (strcmp(dev, "-eisa")==0) {
|
||||
list=get_eisa_devlist(kern);
|
||||
} else if (strcmp(dev, "-pci")==0) {
|
||||
list=get_pci_devlist(kern);
|
||||
} else if (strcmp(dev, "-scsi")==0) {
|
||||
list=get_scsi_devlist(kern);
|
||||
}
|
||||
} else {
|
||||
/* we gotta figure out which real device to report */
|
||||
struct uc_isa *ip;
|
||||
struct uc_scsi *sp;
|
||||
struct uc_pci *pp;
|
||||
struct uc_eisa *ep;
|
||||
|
||||
if(kern->isa_devp){
|
||||
for(ip=kern->isa_devp;ip->device;ip++){
|
||||
if(strcmp(dev, ip->device)==0) {
|
||||
list=get_isa_device(ip);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (kern->scsi_devp) {
|
||||
for(sp=kern->scsi_devp;sp->device;sp++){
|
||||
if(strcmp(dev, sp->device)==0){
|
||||
list=get_scsi_device(sp);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (kern->pci_devp) {
|
||||
for(pp=kern->pci_devp;pp->device;pp++){
|
||||
if(strcmp(dev, pp->device)==0){
|
||||
list=get_pci_device(pp);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (kern->eisa_devp) {
|
||||
for(ep=kern->eisa_devp;ep->device;ep++){
|
||||
if(strcmp(dev, ep->device)==0){
|
||||
list=get_eisa_device(ep);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
end:
|
||||
return(list);
|
||||
}
|
||||
|
||||
|
||||
/* end of userconfig/uc_main.c */
|
||||
|
167
release/sysinstall/uc_main.h
Normal file
167
release/sysinstall/uc_main.h
Normal file
@ -0,0 +1,167 @@
|
||||
/***************************************************
|
||||
* file: userconfig/uc_main.h
|
||||
*
|
||||
* Copyright (c) 1996 Eric L. Hernes (erich@rrnet.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software withough specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define ISA_BIOTAB 0
|
||||
#define ISA_TTYTAB 1
|
||||
#define ISA_NETTAB 2
|
||||
#define ISA_NULLTAB 3
|
||||
#define ISA_WDCTAB 4
|
||||
#define ISA_FDCTAB 5
|
||||
#define EISA_SET 6
|
||||
#define EISA_LIST 7
|
||||
#define PCI_SET 8
|
||||
#define SCSI_LIST 9
|
||||
#define SCSI_BUSSES 10
|
||||
#define SCSI_CINIT 11
|
||||
#define SCSI_DINIT 12
|
||||
#define SCSI_TINIT 13
|
||||
/* symbols + the null terminator */
|
||||
#define NSYMBOLS 15
|
||||
|
||||
struct kernel {
|
||||
int fd; /* file descriptor for the kernel image, either a binary or /dev/kmem */
|
||||
caddr_t core; /* either the mmap()ed kernel image, or a scratch area */
|
||||
u_int size; /* size of the object at ->core */
|
||||
int incore; /* true if the kernel is running */
|
||||
#ifdef UC_PRIVATE
|
||||
struct nlist *nl; /* the symbol table */
|
||||
#else
|
||||
void *nl;
|
||||
#endif
|
||||
struct uc_isa *isa_devp; /* pointer to the isa devices (if any) */
|
||||
struct uc_eisa *eisa_devp; /* pointer to the eisa devices (if any) */
|
||||
struct uc_pci *pci_devp; /* pointer to the pci devices (if any) */
|
||||
struct uc_scsi *scsi_devp; /* pointer to the scsi devices (if any) */
|
||||
struct uc_scsibus *scsibus_devp; /* internal pointer to scsibus wirings */
|
||||
};
|
||||
|
||||
struct uc_isa {
|
||||
char *device;
|
||||
u_short port;
|
||||
u_short irq;
|
||||
short drq;
|
||||
caddr_t iomem;
|
||||
int iosize;
|
||||
int flags;
|
||||
int alive;
|
||||
int enabled;
|
||||
#ifdef UC_PRIVATE
|
||||
struct isa_device *idp;
|
||||
#else
|
||||
void *idp;
|
||||
#endif
|
||||
int modified;
|
||||
};
|
||||
|
||||
struct uc_pci {
|
||||
char *device;
|
||||
};
|
||||
|
||||
struct uc_eisa {
|
||||
char *device;
|
||||
char *full_name;
|
||||
};
|
||||
|
||||
struct uc_scsibus {
|
||||
int bus_no;
|
||||
int unit;
|
||||
char *driver;
|
||||
#ifdef UC_PRIVATE
|
||||
struct scsi_ctlr_config *config;
|
||||
#else
|
||||
void *config;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct uc_scsi {
|
||||
char *device;
|
||||
char *adapter;
|
||||
u_short target;
|
||||
u_short lun;
|
||||
char *desc;
|
||||
#ifdef UC_PRIVATE
|
||||
struct scsi_device_config *config;
|
||||
#else
|
||||
void *config;
|
||||
#endif
|
||||
int modified;
|
||||
};
|
||||
|
||||
/* nearly everything useful returns a list */
|
||||
|
||||
struct list {
|
||||
int ac;
|
||||
char **av;
|
||||
};
|
||||
|
||||
/* prototypes */
|
||||
|
||||
/* uc_main.c */
|
||||
/* these are really the only public ones */
|
||||
struct kernel *uc_open(char *name);
|
||||
int uc_close(struct kernel *kern, int writeback);
|
||||
struct list *uc_getdev(struct kernel *kern, char *dev);
|
||||
|
||||
/* uc_isa.c */
|
||||
void get_isa_info(struct kernel *kp);
|
||||
struct list *get_isa_devlist(struct kernel *kp);
|
||||
struct list *get_isa_device(struct uc_isa *ip);
|
||||
int isa_setdev(struct kernel *kp, struct list *list);
|
||||
void isa_free(struct kernel *kp, int writeback);
|
||||
|
||||
/* uc_eisa.c */
|
||||
void get_eisa_info(struct kernel *kp);
|
||||
struct list *get_eisa_devlist(struct kernel *kp);
|
||||
struct list *get_eisa_device(struct uc_eisa *ep);
|
||||
void eisa_free(struct kernel *kp, int writeback);
|
||||
|
||||
/* uc_pci.c */
|
||||
void get_pci_info(struct kernel *kp);
|
||||
struct list *get_pci_devlist(struct kernel *kp);
|
||||
struct list *get_pci_device(struct uc_pci *pp);
|
||||
void pci_free(struct kernel *kp, int writeback);
|
||||
|
||||
/* uc_scsi.c */
|
||||
void get_scsi_info(struct kernel *kp);
|
||||
struct list *get_scsi_devlist(struct kernel *kp);
|
||||
struct list *get_scsi_device(struct uc_scsi *sp);
|
||||
int scsi_setdev(struct kernel *kp, struct list *list);
|
||||
void scsi_free(struct kernel *kp, int writeback);
|
||||
|
||||
/* uc_kmem.c */
|
||||
u_int kv_to_u(struct kernel *kp, u_int adr, u_int size);
|
||||
u_int kv_dref_p(struct kernel *kp, u_int adr);
|
||||
u_int kv_dref_t(struct kernel *kp, u_int adr);
|
||||
|
||||
/* uc_list.c */
|
||||
struct list *list_new(void);
|
||||
void list_append(struct list *list, char *item);
|
||||
void list_print(struct list *list, char *separator);
|
||||
void list_destroy(struct list *list);
|
||||
|
||||
/* end of userconfig/uc_main.h */
|
122
release/sysinstall/uc_pci.c
Normal file
122
release/sysinstall/uc_pci.c
Normal file
@ -0,0 +1,122 @@
|
||||
/***************************************************
|
||||
* file: userconfig/uc_pci.c
|
||||
*
|
||||
* Copyright (c) 1996 Eric L. Hernes (erich@rrnet.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software withough specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <nlist.h>
|
||||
#include <pci/pcivar.h>
|
||||
#include <tcl.h>
|
||||
|
||||
#include "uc_main.h"
|
||||
|
||||
void
|
||||
get_pci_info(struct kernel *kp){
|
||||
int i, total;
|
||||
u_int *ls, ndev;
|
||||
struct pci_device *pd;
|
||||
struct uc_pci *pp,*ppc;
|
||||
char *name;
|
||||
|
||||
if(kp->nl[PCI_SET].n_value){
|
||||
pp = ppc = (struct uc_pci *)malloc(sizeof(struct uc_pci));
|
||||
ls=(u_int *)kv_to_u(kp, kp->nl[PCI_SET].n_value, sizeof(u_int)*30); /* XXX, size? */
|
||||
ndev=ls[0];
|
||||
total=0;
|
||||
for(i=1;i<(ndev+1);i++){
|
||||
pp=(struct uc_pci *)realloc(pp, sizeof(struct uc_pci)*(total+1));
|
||||
ppc = pp+(total);
|
||||
pd=(struct pci_device *)kv_to_u(kp, ls[i], sizeof(struct pci_device));
|
||||
/* don't try to dereference a null pointer */
|
||||
name=pd->pd_name ? (char *)kv_to_u(kp, (u_int)pd->pd_name, 10) :
|
||||
pd->pd_name; /* XXX, size? */
|
||||
if(kp->incore){
|
||||
int u, k;
|
||||
/* incore, we can get unit numbers */
|
||||
|
||||
u=kv_dref_p(kp, (u_int)pd->pd_count);
|
||||
for(k=0;k<u;k++,total++){
|
||||
pp=(struct uc_pci *)realloc(pp, sizeof(struct uc_pci)*(total+1));
|
||||
ppc = pp+(total);
|
||||
asprintf(&ppc->device, "%s%d", name, k);
|
||||
}
|
||||
free(pd);
|
||||
if(name)
|
||||
free(name);
|
||||
} else {
|
||||
asprintf(&ppc->device, "%s?", name);
|
||||
total++;
|
||||
}
|
||||
}
|
||||
pp=(struct uc_pci *)realloc(pp, sizeof(struct uc_pci)*(total+1));
|
||||
ppc = pp+(total);
|
||||
bzero(ppc, sizeof(struct uc_pci));
|
||||
kp->pci_devp=pp;
|
||||
} else {
|
||||
kp->pci_devp=(struct uc_pci *)0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct list *
|
||||
get_pci_devlist(struct kernel *kp){
|
||||
struct list *dl;
|
||||
struct uc_pci *kdp;
|
||||
|
||||
dl=list_new();
|
||||
|
||||
for(kdp=kp->pci_devp; kdp->device; kdp++){
|
||||
list_append(dl, kdp->device);
|
||||
}
|
||||
return(dl);
|
||||
}
|
||||
|
||||
|
||||
struct list *
|
||||
get_pci_device(struct uc_pci *pp){
|
||||
struct list *list;
|
||||
list=list_new();
|
||||
|
||||
list_append(list, pp->device);
|
||||
|
||||
return(list);
|
||||
}
|
||||
|
||||
void
|
||||
pci_free(struct kernel *kp, int writeback){
|
||||
struct uc_pci *pp;
|
||||
|
||||
for(pp=kp->pci_devp;pp->device;pp++){
|
||||
free(pp->device);
|
||||
}
|
||||
free(kp->pci_devp);
|
||||
kp->pci_devp=0;
|
||||
|
||||
}
|
||||
|
||||
/* end of userconfig/uc_pci.c */
|
470
release/sysinstall/uc_scsi.c
Normal file
470
release/sysinstall/uc_scsi.c
Normal file
@ -0,0 +1,470 @@
|
||||
/***************************************************
|
||||
* file: userconfig/uc_scsi.c
|
||||
*
|
||||
* Copyright (c) 1996 Eric L. Hernes (erich@rrnet.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software withough specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <nlist.h>
|
||||
#include <scsi/scsiconf.h>
|
||||
#include <tcl.h>
|
||||
|
||||
#include "uc_main.h"
|
||||
|
||||
/* this stuff is hidden under an #ifdef KERNEL in scsiconf.h */
|
||||
#define SCCONF_UNSPEC 255
|
||||
#define SCCONF_ANY 254
|
||||
|
||||
struct scsi_ctlr_config {
|
||||
int scbus;
|
||||
char *driver;
|
||||
int unit;
|
||||
int bus;
|
||||
};
|
||||
|
||||
struct scsi_device_config {
|
||||
char *name; /* SCSI device name (sd, st, etc) */
|
||||
int unit; /* desired device unit */
|
||||
int cunit; /* Controller unit */
|
||||
int target; /* SCSI ID (target) */
|
||||
int lun; /* SCSI lun */
|
||||
int flags; /* Flags from config */
|
||||
};
|
||||
|
||||
/* module prototypes */
|
||||
static void get_sl_info(struct kernel *kp, struct uc_scsi *spc,
|
||||
struct scsi_link *sl);
|
||||
|
||||
void
|
||||
get_scsi_info(struct kernel *kp){
|
||||
int i, j, k;
|
||||
|
||||
if(kp->incore){
|
||||
if (kp->nl[SCSI_BUSSES].n_value) {
|
||||
u_int *es, *sba;
|
||||
struct scsibus_data *sbd;
|
||||
int nsbd, nscsibus, total;
|
||||
struct uc_scsi *sp, *spc;
|
||||
struct uc_scsibus *sbp, *sbpc;
|
||||
struct scsi_link *s_l;
|
||||
u_int *slp;
|
||||
char *temp;
|
||||
struct scsi_device *sdev;
|
||||
u_int t;
|
||||
char name[10];
|
||||
|
||||
sp=(struct uc_scsi*)malloc(sizeof(struct uc_scsi));
|
||||
total=0;
|
||||
sbp=(struct uc_scsibus*)malloc(sizeof(struct uc_scsibus));
|
||||
nscsibus=0;
|
||||
|
||||
es=(u_int *)kv_to_u(kp, kv_dref_p(kp,kp->nl[SCSI_BUSSES].n_value),
|
||||
sizeof(u_int)*2);
|
||||
nsbd=es[0];
|
||||
sba=(u_int *)kv_to_u(kp, es[1], sizeof(u_int)*nsbd);
|
||||
free(es);
|
||||
|
||||
for(i=0;i<nsbd;i++){
|
||||
if(sba[i]){
|
||||
/* first grab the adapter info */
|
||||
sbd=(struct scsibus_data *)kv_to_u(kp, sba[i],
|
||||
sizeof(struct scsibus_data));
|
||||
sbp=(struct uc_scsibus *)realloc(sbp, sizeof(struct uc_scsibus)*
|
||||
(nscsibus+1));
|
||||
|
||||
sp=(struct uc_scsi*)realloc(sp, (sizeof(struct uc_scsi)*(total+1)));
|
||||
spc=sp+total;
|
||||
s_l=(struct scsi_link*)kv_to_u(kp, (u_int)sbd->adapter_link,
|
||||
sizeof(struct scsi_link));
|
||||
get_sl_info(kp, spc, s_l);
|
||||
free(s_l);
|
||||
|
||||
sbpc=sbp+nscsibus;
|
||||
sbpc->bus_no=nscsibus;
|
||||
sscanf(spc->device, "%[a-z]%d", name, &sbpc->unit);
|
||||
asprintf(&sbpc->driver, "%s", name);
|
||||
|
||||
total++;
|
||||
t=kv_dref_p(kp, (u_int)sbd->sc_link);
|
||||
t=(u_int)sbd->sc_link;
|
||||
for(j=0;j<8;j++) {
|
||||
slp=(u_int *)kv_to_u(kp, t+(j*8*sizeof(u_int)), /* XXX */
|
||||
(sizeof(u_int)*sbd->maxlun));
|
||||
for(k=0;k<sbd->maxlun && slp[k]; k++){
|
||||
struct scsi_link *slt;
|
||||
sp=(struct uc_scsi*)realloc(sp,
|
||||
(sizeof(struct uc_scsi)*(total+1)));
|
||||
spc=sp+total;
|
||||
slt=(struct scsi_link*)kv_to_u(kp, slp[k],
|
||||
sizeof(struct scsi_link));
|
||||
get_sl_info(kp, spc, slt);
|
||||
free(slt);
|
||||
spc->config=(struct scsi_device_config *)0;
|
||||
total++;
|
||||
}
|
||||
free(slp);
|
||||
}
|
||||
free(sbd);
|
||||
}
|
||||
}
|
||||
/* now stuff in the list of drivers configured in the system */
|
||||
t=kv_dref_p(kp, kp->nl[SCSI_LIST].n_value);
|
||||
while(t) {
|
||||
sdev=(struct scsi_device*)kv_to_u(kp, t, sizeof(struct scsi_device));
|
||||
sp=(struct uc_scsi*)realloc(sp, (sizeof(struct uc_scsi)*(total+1)));
|
||||
spc=sp+total;
|
||||
total++;
|
||||
temp=(char *)kv_to_u(kp, (u_int)sdev->name, 10);
|
||||
asprintf(&spc->device, "%s*", temp);
|
||||
free(temp);
|
||||
asprintf(&spc->adapter, "any");
|
||||
|
||||
spc->target=SCCONF_ANY;
|
||||
spc->lun=SCCONF_ANY;
|
||||
|
||||
temp=(char *)kv_to_u(kp, (u_int)sdev->desc, 20);
|
||||
asprintf(&spc->desc, "%s", temp);
|
||||
free(temp);
|
||||
|
||||
spc->config=(struct scsi_device_config *)0;
|
||||
|
||||
t=(u_int)sdev->next;
|
||||
free(sdev);
|
||||
}
|
||||
sp=(struct uc_scsi*)realloc(sp, (sizeof(struct uc_scsi)*(total+1)));
|
||||
spc=sp+total;
|
||||
bzero(spc, sizeof(struct uc_scsi));
|
||||
kp->scsi_devp=sp;
|
||||
kp->scsibus_devp=sbp;
|
||||
} else { /* no symbol, and incore, no scsi */
|
||||
kp->scsi_devp=(struct uc_scsi *)0;
|
||||
kp->scsibus_devp=(struct uc_scsibus *)0;
|
||||
}
|
||||
} else { /* on disk */
|
||||
|
||||
if (kp->nl[SCSI_CINIT].n_value || kp->nl[SCSI_DINIT].n_value ||
|
||||
kp->nl[SCSI_TINIT].n_value) {
|
||||
int total=0;
|
||||
struct uc_scsi *sp, *spc;
|
||||
struct scsi_ctlr_config *sctl_c;
|
||||
struct scsi_device_config *sdev_c;
|
||||
struct scsi_device *sdev;
|
||||
|
||||
struct uc_scsibus *uc_scbus, *uc_scbusc;
|
||||
|
||||
u_int t, ctrl_total;
|
||||
char *temp;
|
||||
u_int initp;
|
||||
|
||||
spc=sp=(struct uc_scsi*)malloc(sizeof(struct uc_scsi));
|
||||
total=0;
|
||||
ctrl_total=0;
|
||||
|
||||
/* static kernel, we'll first get the wired controllers/devices */
|
||||
if((t=kp->nl[SCSI_CINIT].n_value)){
|
||||
/* get controller info*/
|
||||
sctl_c=(struct scsi_ctlr_config*)kv_to_u(kp, t, sizeof(struct scsi_ctlr_config));
|
||||
uc_scbus=(struct uc_scsibus*)malloc(sizeof(struct uc_scsibus));
|
||||
|
||||
while(sctl_c->driver){
|
||||
|
||||
/* remember the bus info, for later */
|
||||
uc_scbus=(struct uc_scsibus*)realloc(uc_scbus, sizeof(struct uc_scsibus)*(ctrl_total+1));
|
||||
uc_scbusc=uc_scbus+ctrl_total;
|
||||
uc_scbusc->bus_no=sctl_c->scbus;
|
||||
temp=(char *)kv_to_u(kp, (u_int)sctl_c->driver, 20);
|
||||
uc_scbusc->driver=temp;
|
||||
uc_scbusc->unit=sctl_c->unit;
|
||||
uc_scbusc->config=sctl_c;
|
||||
|
||||
sp=(struct uc_scsi*)realloc(sp,sizeof(struct uc_scsi)*(total+1));
|
||||
spc=sp+total;
|
||||
asprintf(&spc->device, "%s%d", temp, sctl_c->unit);
|
||||
asprintf(&spc->adapter, "%s%d", temp, sctl_c->unit);
|
||||
spc->target=0;
|
||||
spc->lun=0;
|
||||
spc->modified=0;
|
||||
asprintf(&spc->desc, "%s", temp);
|
||||
total++;
|
||||
ctrl_total++;
|
||||
sctl_c++;
|
||||
}
|
||||
}
|
||||
|
||||
if((t=kp->nl[SCSI_DINIT].n_value)){
|
||||
/* get wired device info */
|
||||
sdev_c=(struct scsi_device_config*)kv_to_u(kp, t, sizeof(struct scsi_device_config));
|
||||
while(sdev_c->name){
|
||||
sp=(struct uc_scsi*)realloc(sp, sizeof(struct uc_scsi)*(total+1));
|
||||
spc=sp+total;
|
||||
temp=(char*)kv_to_u(kp, (u_int)sdev_c->name, 10);
|
||||
asprintf(&spc->device, "%s%d", temp, sdev_c->unit);
|
||||
/* figure out controller */
|
||||
if(sdev_c->cunit == SCCONF_ANY){
|
||||
asprintf(&spc->adapter, "any");
|
||||
} else {
|
||||
if(ctrl_total){
|
||||
for(i=0;i<ctrl_total;i++){
|
||||
if(sdev_c->cunit==uc_scbus[i].bus_no){
|
||||
asprintf(&spc->adapter, "%s%d",
|
||||
uc_scbus[i].driver, uc_scbus[i].unit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i==ctrl_total) { /* made it through the whole list */
|
||||
asprintf(&spc->adapter, "any?");
|
||||
}
|
||||
} else {
|
||||
asprintf(&spc->adapter, "any?");
|
||||
}
|
||||
}
|
||||
spc->target= sdev_c->target;
|
||||
spc->lun= sdev_c->lun;
|
||||
spc->desc=(char *)0; /* filled in later */
|
||||
spc->config=sdev_c;
|
||||
spc->modified=0;
|
||||
sdev_c++;
|
||||
total++;
|
||||
}
|
||||
}
|
||||
kp->scsibus_devp=uc_scbus;
|
||||
|
||||
if((t=kp->nl[SCSI_TINIT].n_value)) {
|
||||
/* WARNING: This is teetering on the brink of stupid.
|
||||
|
||||
this ugly little hack only works because the
|
||||
<scsi driver>init routines are macro-generated,
|
||||
so the offset of the device pointers will be
|
||||
the same (hopefully).
|
||||
*/
|
||||
|
||||
while((initp=kv_dref_p(kp,t))) {
|
||||
u_int tadr;
|
||||
u_int sl;
|
||||
|
||||
t+=4;
|
||||
tadr=kv_dref_t(kp, initp+4); /* offset in *.text* */
|
||||
sdev=(struct scsi_device*)kv_to_u(kp, tadr, sizeof(struct scsi_device));
|
||||
sp=(struct uc_scsi*)realloc(sp, (sizeof(struct uc_scsi)*(total+1)));
|
||||
spc=sp+total;
|
||||
total++;
|
||||
temp=(char *)kv_to_u(kp, (u_int)sdev->name, 10);
|
||||
asprintf(&spc->device, "%s*", temp);
|
||||
|
||||
asprintf(&spc->adapter, "any");
|
||||
|
||||
spc->target=SCCONF_ANY;
|
||||
spc->lun=SCCONF_ANY;
|
||||
spc->modified=0;
|
||||
temp=(char *)kv_to_u(kp, (u_int)sdev->desc, 20);
|
||||
asprintf(&spc->desc, "%s", temp);
|
||||
/* now try to fill in any device descriptions from above */
|
||||
sl=strlen(spc->device)-1;
|
||||
for(i=0;i<(total-1);i++){ /* don't look at this device */
|
||||
struct uc_scsi *usp;
|
||||
|
||||
usp=sp+i;
|
||||
if(strncmp(usp->device, spc->device, sl)==0 && usp->desc==0) {
|
||||
asprintf(&usp->desc, "%s", spc->desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(total){
|
||||
sp=(struct uc_scsi*)realloc(sp, (sizeof(struct uc_scsi)*(total+1)));
|
||||
spc=sp+total;
|
||||
bzero(spc, sizeof(struct uc_scsi));
|
||||
kp->scsi_devp=sp;
|
||||
} else {
|
||||
free(sp);
|
||||
kp->scsi_devp=(struct uc_scsi *)0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
kp->scsi_devp=(struct uc_scsi *)0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct list *
|
||||
get_scsi_devlist(struct kernel *kp){
|
||||
struct list *dl;
|
||||
struct uc_scsi *kdp;
|
||||
|
||||
dl=list_new();
|
||||
|
||||
for(kdp=kp->scsi_devp; kdp->device; kdp++){
|
||||
list_append(dl, kdp->device);
|
||||
}
|
||||
|
||||
return(dl);
|
||||
}
|
||||
|
||||
struct list *
|
||||
get_scsi_device(struct uc_scsi *sp){
|
||||
struct list *list;
|
||||
char *tmp;
|
||||
|
||||
list=list_new();
|
||||
|
||||
list_append(list, sp->device);
|
||||
list_append(list, sp->adapter);
|
||||
|
||||
asprintf(&tmp, "%d", sp->target );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "%d", sp->lun );
|
||||
list_append(list, tmp);
|
||||
free(tmp);
|
||||
|
||||
list_append(list, sp->desc);
|
||||
|
||||
return(list);
|
||||
}
|
||||
|
||||
/* given a scsi_link and a uc_scsi pointer, fill it in */
|
||||
static void
|
||||
get_sl_info(struct kernel *kp, struct uc_scsi *spc, struct scsi_link *sl){
|
||||
|
||||
struct scsi_adapter *sadp;
|
||||
struct scsi_device *sdev;
|
||||
char *temp;
|
||||
|
||||
sadp=(struct scsi_adapter*)kv_to_u(kp, (u_int)sl->adapter,
|
||||
sizeof(struct scsi_adapter));
|
||||
|
||||
sdev=(struct scsi_device*)kv_to_u(kp, (u_int)sl->device,
|
||||
sizeof(struct scsi_device));
|
||||
|
||||
temp=(char *)kv_to_u(kp, (u_int)sdev->name, 20);
|
||||
asprintf(&spc->device, "%s%d", temp, sl->dev_unit);
|
||||
free(temp);
|
||||
temp=(char *)kv_to_u(kp, (u_int)sadp->name, 20);
|
||||
asprintf(&spc->adapter, "%s%d", temp, sl->adapter_unit);
|
||||
free(temp);
|
||||
spc->target = sl->target;
|
||||
spc->lun = sl->lun;
|
||||
|
||||
temp=(char *)kv_to_u(kp, (u_int)sdev->desc, 30);
|
||||
asprintf(&spc->desc, "%s", temp);
|
||||
free(temp);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
scsi_setdev(struct kernel *kp, struct list *list){
|
||||
int r=1, bus_valid=0;
|
||||
struct uc_scsi *sp;
|
||||
struct uc_scsibus *sbp;
|
||||
char *t;
|
||||
|
||||
if(kp->scsi_devp)
|
||||
for(sp=kp->scsi_devp;sp->device;sp++){
|
||||
if(strcmp(list->av[0], sp->device)==0){
|
||||
for(sbp=kp->scsibus_devp;sbp->driver; sbp++){
|
||||
asprintf(&t, "%s%d", sbp->driver, sbp->unit);
|
||||
if(strcmp(list->av[1], t)==0) {
|
||||
bus_valid=1;
|
||||
}
|
||||
free(t);
|
||||
}
|
||||
if(bus_valid){
|
||||
sp->modified=1;
|
||||
free(sp->adapter);
|
||||
asprintf(&sp->adapter, "%s", list->av[1]);
|
||||
sp->target = strtol(list->av[2], (char **)NULL, 0);
|
||||
sp->lun = strtol(list->av[3], (char **)NULL, 0);
|
||||
r=0;
|
||||
goto done;
|
||||
} else {
|
||||
r=2;
|
||||
}
|
||||
}
|
||||
}
|
||||
done:
|
||||
return(r);
|
||||
}
|
||||
|
||||
void
|
||||
scsi_free(struct kernel *kp, int writeback){
|
||||
struct uc_scsi *sp;
|
||||
struct uc_scsibus *sbp;
|
||||
char *t;
|
||||
int scbus, i;
|
||||
|
||||
for(sp=kp->scsi_devp; sp->device; sp++){
|
||||
if((!kp->incore) && sp->modified && writeback) {
|
||||
/* save info */
|
||||
|
||||
/* I'm not sure this is necessary */
|
||||
#if 0
|
||||
sscanf(sp->device, "%[a-z]%d", name, &unit);
|
||||
sp->config->unit= unit;
|
||||
#endif
|
||||
|
||||
/* figger out the controller, which may have changed */
|
||||
scbus=-1;
|
||||
for(sbp=kp->scsibus_devp, i=0;sbp->driver; sbp++,i++){
|
||||
asprintf(&t, "%s%d", sbp->driver, sbp->unit);
|
||||
if(strcmp(sp->adapter, t)==0) {
|
||||
scbus=i;
|
||||
}
|
||||
free(t);
|
||||
}
|
||||
|
||||
/* if we fell through, don't change anything */
|
||||
if(scbus!=-1){
|
||||
sp->config->cunit= scbus;
|
||||
}
|
||||
|
||||
sp->config->target= sp->target;
|
||||
sp->config->lun= sp->lun;
|
||||
/* sp->config->flags= ; XXX this should be here*/
|
||||
|
||||
}
|
||||
free(sp->device);
|
||||
free(sp->adapter);
|
||||
free(sp->desc);
|
||||
}
|
||||
free(kp->scsi_devp);
|
||||
kp->scsi_devp=(struct uc_scsi *)0;
|
||||
#define WANT_TO_COREDUMP 1
|
||||
#if WANT_TO_COREDUMP /* ugly hack until scsi_getdev() gets -incore
|
||||
busses correctly */
|
||||
/* now free the bus info */
|
||||
if(kp->incore){
|
||||
for(sbp=kp->scsibus_devp;sbp->driver; sbp++){
|
||||
free(sbp->driver);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (kp->scsibus_devp)
|
||||
free(kp->scsibus_devp);
|
||||
kp->scsibus_devp=(struct uc_scsibus *)0;
|
||||
}
|
||||
|
||||
/* end of userconfig/uc_scsi.c */
|
@ -9,9 +9,10 @@ SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c devices.c \
|
||||
ftp_strat.c globals.c index.c install.c installUpgrade.c \
|
||||
label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
|
||||
msg.c network.c nfs.c options.c package.c samba.c system.c \
|
||||
tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
|
||||
tape.c tcpip.c termcap.c ufs.c variable.c wizard.c \
|
||||
uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c uc_scsi.c
|
||||
|
||||
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog
|
||||
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog -I/sys -DUC_PRIVATE
|
||||
|
||||
#CFLAGS+= -DLOAD_CONFIG_FILE=\"install.cfg\"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: disks.c,v 1.64 1996/09/22 00:48:55 jkh Exp $
|
||||
* $Id: disks.c,v 1.65 1996/10/01 04:56:31 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -48,12 +48,13 @@ static int current_chunk;
|
||||
static void
|
||||
record_chunks(Disk *d)
|
||||
{
|
||||
struct chunk *c1;
|
||||
struct chunk *c1 = NULL;
|
||||
int i = 0;
|
||||
int last_free = 0;
|
||||
|
||||
if (!d->chunks)
|
||||
msgFatal("No chunk list found for %s!", d->name);
|
||||
current_chunk = 0;
|
||||
|
||||
for (c1 = d->chunks->part; c1; c1 = c1->next) {
|
||||
if (c1->type == unused && c1->size > last_free) {
|
||||
last_free = c1->size;
|
||||
@ -167,19 +168,24 @@ void
|
||||
diskPartition(Device *dev, Disk *d)
|
||||
{
|
||||
char *p;
|
||||
int key = 0;
|
||||
int rv, key = 0;
|
||||
Boolean chunking;
|
||||
char *msg = NULL;
|
||||
u_char *mbrContents;
|
||||
WINDOW *w;
|
||||
WINDOW *w = savescr();
|
||||
|
||||
chunking = TRUE;
|
||||
keypad(stdscr, TRUE);
|
||||
|
||||
w = savescr();
|
||||
clear();
|
||||
record_chunks(d);
|
||||
/* Flush both the dialog and curses library views of the screen
|
||||
since we don't always know who called us */
|
||||
dialog_clear_norefresh(), clear();
|
||||
|
||||
while (chunking) {
|
||||
/* Set up the chunk array */
|
||||
record_chunks(d);
|
||||
|
||||
/* Now print our overall state */
|
||||
print_chunks(d);
|
||||
print_command_summary();
|
||||
if (msg) {
|
||||
@ -187,14 +193,20 @@ diskPartition(Device *dev, Disk *d)
|
||||
beep();
|
||||
msg = NULL;
|
||||
}
|
||||
else {
|
||||
move(23, 0);
|
||||
clrtoeol();
|
||||
}
|
||||
|
||||
/* Get command character */
|
||||
key = getch();
|
||||
switch (toupper(key)) {
|
||||
|
||||
/* redraw */
|
||||
case '\014': /* ^L */
|
||||
clear();
|
||||
print_command_summary();
|
||||
continue;
|
||||
msg = NULL;
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case '-':
|
||||
@ -225,9 +237,7 @@ diskPartition(Device *dev, Disk *d)
|
||||
clear();
|
||||
break;
|
||||
|
||||
case 'A': {
|
||||
int rv;
|
||||
|
||||
case 'A':
|
||||
rv = msgYesNo("Do you want to do this with a true partition entry\n"
|
||||
"so as to remain cooperative with any future possible\n"
|
||||
"operating systems on the drive(s)?");
|
||||
@ -249,10 +259,8 @@ diskPartition(Device *dev, Disk *d)
|
||||
if (rv)
|
||||
d->bios_hd = d->bios_sect = d->bios_cyl = 1;
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
record_chunks(d);
|
||||
}
|
||||
clear();
|
||||
break;
|
||||
clear();
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
if (chunk_info[current_chunk]->type != freebsd)
|
||||
@ -301,10 +309,9 @@ diskPartition(Device *dev, Disk *d)
|
||||
Create_Chunk(d, chunk_info[current_chunk]->offset, size, partitiontype, subtype,
|
||||
(chunk_info[current_chunk]->flags & CHUNK_ALIGN));
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
record_chunks(d);
|
||||
clear();
|
||||
}
|
||||
}
|
||||
clear();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -315,7 +322,6 @@ diskPartition(Device *dev, Disk *d)
|
||||
else {
|
||||
Delete_Chunk(d, chunk_info[current_chunk]);
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
record_chunks(d);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -355,7 +361,6 @@ diskPartition(Device *dev, Disk *d)
|
||||
dev->private = d;
|
||||
variable_unset(DISK_PARTITIONED);
|
||||
variable_unset(DISK_LABELLED);
|
||||
record_chunks(d);
|
||||
clear();
|
||||
break;
|
||||
|
||||
@ -387,26 +392,18 @@ diskPartition(Device *dev, Disk *d)
|
||||
case '|':
|
||||
if (!msgYesNo("Are you SURE you want to go into Wizard mode?\n"
|
||||
"No seat belts whatsoever are provided!")) {
|
||||
WINDOW *w;
|
||||
|
||||
w = savescr();
|
||||
dialog_clear();
|
||||
end_dialog();
|
||||
DialogActive = FALSE;
|
||||
clear();
|
||||
refresh();
|
||||
slice_wizard(d);
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
dialog_clear_norefresh();
|
||||
DialogActive = TRUE;
|
||||
record_chunks(d);
|
||||
restorescr(w);
|
||||
}
|
||||
else
|
||||
msg = "Wise choice!";
|
||||
clear();
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
chunking = FALSE;
|
||||
clear();
|
||||
/* 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.
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: install.c,v 1.122 1996/10/02 08:25:09 jkh Exp $
|
||||
* $Id: install.c,v 1.123 1996/10/02 10:44:31 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -35,6 +35,7 @@
|
||||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
#include "uc_main.h"
|
||||
#include <ctype.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/errno.h>
|
||||
@ -380,12 +381,8 @@ installNovice(dialogMenuItem *self)
|
||||
if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE)
|
||||
return DITEM_FAILURE;
|
||||
|
||||
dialog_clear_norefresh();
|
||||
msgConfirm("Now it is time to select an installation subset. There are a number of\n"
|
||||
"canned distribution sets, ranging from minimal installation sets to full\n"
|
||||
"X11 developer oriented configurations. You can also select a custom set\n"
|
||||
"of distributions if none of the provided ones are suitable.");
|
||||
while (1) {
|
||||
dialog_clear_norefresh();
|
||||
if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists)
|
||||
return DITEM_FAILURE | DITEM_RECREATE;
|
||||
|
||||
@ -397,27 +394,24 @@ installNovice(dialogMenuItem *self)
|
||||
return DITEM_FAILURE | DITEM_RECREATE;
|
||||
|
||||
if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) {
|
||||
dialog_clear();
|
||||
dialog_clear_norefresh();
|
||||
msgConfirm("Installation completed with some errors. You may wish to\n"
|
||||
"scroll through the debugging messages on VTY1 with the\n"
|
||||
"scroll-lock feature. You can also chose \"No\" at the next\n"
|
||||
"prompt and go back into the installation menus to try and retry\n"
|
||||
"whichever operations have failed.");
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
if (mediaDevice->type == DEVICE_TYPE_FTP)
|
||||
variable_unset(VAR_FTP_PATH);
|
||||
return i | DITEM_RECREATE;
|
||||
|
||||
}
|
||||
else
|
||||
dialog_clear();
|
||||
else {
|
||||
dialog_clear_norefresh();
|
||||
msgConfirm("Congratulations! You now have FreeBSD installed on your system.\n\n"
|
||||
"We will now move on to the final configuration questions.\n"
|
||||
"For any option you do not wish to configure, simply select\n"
|
||||
"No.\n\n"
|
||||
"If you wish to re-enter this utility after the system is up, you\n"
|
||||
"may do so by typing: /stand/sysinstall.");
|
||||
|
||||
}
|
||||
if (mediaDevice->type != DEVICE_TYPE_FTP && mediaDevice->type != DEVICE_TYPE_NFS) {
|
||||
if (!msgYesNo("Would you like to configure any SLIP/PPP or network interface devices?")) {
|
||||
Device *save = mediaDevice;
|
||||
@ -430,6 +424,7 @@ installNovice(dialogMenuItem *self)
|
||||
}
|
||||
}
|
||||
|
||||
dialog_clear_norefresh();
|
||||
if (!msgYesNo("Would you like to configure Samba for connecting NETBUI clients to this\n"
|
||||
"machine? Windows 95, Windows NT and Windows for Workgroups\n"
|
||||
"machines can use NETBUI transport for disk and printer sharing."))
|
||||
@ -573,17 +568,6 @@ installCommit(dialogMenuItem *self)
|
||||
else if (!(Dists & DIST_BIN))
|
||||
(void)installFixup(self);
|
||||
|
||||
/* Don't print this if we're express or novice installing - they have their own error reporting */
|
||||
if (strcmp(str, "express") && strcmp(str, "novice")) {
|
||||
if (Dists || DITEM_STATUS(i) == DITEM_FAILURE)
|
||||
msgConfirm("Installation completed with some errors. You may wish to\n"
|
||||
"scroll through the debugging messages on VTY1 with the\n"
|
||||
"scroll-lock feature.");
|
||||
else
|
||||
msgConfirm("Installation completed successfully.\n\n"
|
||||
"If you have any network devices you have not yet configured,\n"
|
||||
"see the Interfaces configuration item on the Configuration menu.");
|
||||
}
|
||||
variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install");
|
||||
return i | DITEM_RECREATE;
|
||||
}
|
||||
@ -911,8 +895,57 @@ create_termcap(void)
|
||||
}
|
||||
}
|
||||
|
||||
static char *isa_list[] = {
|
||||
"device",
|
||||
"ioport",
|
||||
"irq",
|
||||
"drq",
|
||||
"iomem",
|
||||
"iosize",
|
||||
"flags",
|
||||
"alive",
|
||||
"enabled",
|
||||
};
|
||||
|
||||
static void
|
||||
save_userconfig_to_kernel(char *kern)
|
||||
{
|
||||
/* place-holder for now */
|
||||
struct kernel *core, *boot;
|
||||
struct list *c_isa, *c_dev, *b_dev;
|
||||
int i, d;
|
||||
|
||||
core = uc_open("-incore");
|
||||
if (!core) {
|
||||
msgDebug("Can't read in-core information for kernel.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
boot = uc_open(kern);
|
||||
if (!boot) {
|
||||
msgDebug("Can't read device information for kernel image %s\n", kern);
|
||||
return;
|
||||
}
|
||||
msgDebug("Kernel open, getting core ISA devices\n");
|
||||
c_isa = uc_getdev(core, "-isa");
|
||||
for (d = 0; d < c_isa->ac; d++) {
|
||||
msgDebug("Outer loop, c_isa->av[%d] = %s\n", d, c_isa->av[d]);
|
||||
if (strcmp(c_isa->av[d], "npx0")) { /* special case npx0, which
|
||||
mucks with its id_irq member */
|
||||
c_dev = uc_getdev(core, c_isa->av[d]);
|
||||
b_dev = uc_getdev(boot, c_isa->av[d]);
|
||||
for (i = 0; i < c_dev->ac; i++) {
|
||||
msgDebug("Inner loop, c_dev->av[%d] = %s\n", i, c_dev->av[i]);
|
||||
if (strcmp(c_dev->av[i], b_dev->av[i])) {
|
||||
msgDebug("%s %s changed: %s (boot) -> %s (core)\n",
|
||||
c_dev->av[0], isa_list[i], b_dev->av[i], c_dev->av[i]);
|
||||
isa_setdev(boot, c_dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
msgDebug("skipping npx0\n");
|
||||
}
|
||||
msgDebug("Closing kernels\n");
|
||||
uc_close(core, 0);
|
||||
uc_close(boot, 1);
|
||||
}
|
||||
|
@ -9,9 +9,10 @@ SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c devices.c \
|
||||
ftp_strat.c globals.c index.c install.c installUpgrade.c \
|
||||
label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
|
||||
msg.c network.c nfs.c options.c package.c samba.c system.c \
|
||||
tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
|
||||
tape.c tcpip.c termcap.c ufs.c variable.c wizard.c \
|
||||
uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c uc_scsi.c
|
||||
|
||||
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog
|
||||
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog -I/sys -DUC_PRIVATE
|
||||
|
||||
#CFLAGS+= -DLOAD_CONFIG_FILE=\"install.cfg\"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: disks.c,v 1.64 1996/09/22 00:48:55 jkh Exp $
|
||||
* $Id: disks.c,v 1.65 1996/10/01 04:56:31 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -48,12 +48,13 @@ static int current_chunk;
|
||||
static void
|
||||
record_chunks(Disk *d)
|
||||
{
|
||||
struct chunk *c1;
|
||||
struct chunk *c1 = NULL;
|
||||
int i = 0;
|
||||
int last_free = 0;
|
||||
|
||||
if (!d->chunks)
|
||||
msgFatal("No chunk list found for %s!", d->name);
|
||||
current_chunk = 0;
|
||||
|
||||
for (c1 = d->chunks->part; c1; c1 = c1->next) {
|
||||
if (c1->type == unused && c1->size > last_free) {
|
||||
last_free = c1->size;
|
||||
@ -167,19 +168,24 @@ void
|
||||
diskPartition(Device *dev, Disk *d)
|
||||
{
|
||||
char *p;
|
||||
int key = 0;
|
||||
int rv, key = 0;
|
||||
Boolean chunking;
|
||||
char *msg = NULL;
|
||||
u_char *mbrContents;
|
||||
WINDOW *w;
|
||||
WINDOW *w = savescr();
|
||||
|
||||
chunking = TRUE;
|
||||
keypad(stdscr, TRUE);
|
||||
|
||||
w = savescr();
|
||||
clear();
|
||||
record_chunks(d);
|
||||
/* Flush both the dialog and curses library views of the screen
|
||||
since we don't always know who called us */
|
||||
dialog_clear_norefresh(), clear();
|
||||
|
||||
while (chunking) {
|
||||
/* Set up the chunk array */
|
||||
record_chunks(d);
|
||||
|
||||
/* Now print our overall state */
|
||||
print_chunks(d);
|
||||
print_command_summary();
|
||||
if (msg) {
|
||||
@ -187,14 +193,20 @@ diskPartition(Device *dev, Disk *d)
|
||||
beep();
|
||||
msg = NULL;
|
||||
}
|
||||
else {
|
||||
move(23, 0);
|
||||
clrtoeol();
|
||||
}
|
||||
|
||||
/* Get command character */
|
||||
key = getch();
|
||||
switch (toupper(key)) {
|
||||
|
||||
/* redraw */
|
||||
case '\014': /* ^L */
|
||||
clear();
|
||||
print_command_summary();
|
||||
continue;
|
||||
msg = NULL;
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case '-':
|
||||
@ -225,9 +237,7 @@ diskPartition(Device *dev, Disk *d)
|
||||
clear();
|
||||
break;
|
||||
|
||||
case 'A': {
|
||||
int rv;
|
||||
|
||||
case 'A':
|
||||
rv = msgYesNo("Do you want to do this with a true partition entry\n"
|
||||
"so as to remain cooperative with any future possible\n"
|
||||
"operating systems on the drive(s)?");
|
||||
@ -249,10 +259,8 @@ diskPartition(Device *dev, Disk *d)
|
||||
if (rv)
|
||||
d->bios_hd = d->bios_sect = d->bios_cyl = 1;
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
record_chunks(d);
|
||||
}
|
||||
clear();
|
||||
break;
|
||||
clear();
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
if (chunk_info[current_chunk]->type != freebsd)
|
||||
@ -301,10 +309,9 @@ diskPartition(Device *dev, Disk *d)
|
||||
Create_Chunk(d, chunk_info[current_chunk]->offset, size, partitiontype, subtype,
|
||||
(chunk_info[current_chunk]->flags & CHUNK_ALIGN));
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
record_chunks(d);
|
||||
clear();
|
||||
}
|
||||
}
|
||||
clear();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -315,7 +322,6 @@ diskPartition(Device *dev, Disk *d)
|
||||
else {
|
||||
Delete_Chunk(d, chunk_info[current_chunk]);
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
record_chunks(d);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -355,7 +361,6 @@ diskPartition(Device *dev, Disk *d)
|
||||
dev->private = d;
|
||||
variable_unset(DISK_PARTITIONED);
|
||||
variable_unset(DISK_LABELLED);
|
||||
record_chunks(d);
|
||||
clear();
|
||||
break;
|
||||
|
||||
@ -387,26 +392,18 @@ diskPartition(Device *dev, Disk *d)
|
||||
case '|':
|
||||
if (!msgYesNo("Are you SURE you want to go into Wizard mode?\n"
|
||||
"No seat belts whatsoever are provided!")) {
|
||||
WINDOW *w;
|
||||
|
||||
w = savescr();
|
||||
dialog_clear();
|
||||
end_dialog();
|
||||
DialogActive = FALSE;
|
||||
clear();
|
||||
refresh();
|
||||
slice_wizard(d);
|
||||
variable_set2(DISK_PARTITIONED, "yes");
|
||||
dialog_clear_norefresh();
|
||||
DialogActive = TRUE;
|
||||
record_chunks(d);
|
||||
restorescr(w);
|
||||
}
|
||||
else
|
||||
msg = "Wise choice!";
|
||||
clear();
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
chunking = FALSE;
|
||||
clear();
|
||||
/* 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.
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dist.c,v 1.69 1996/09/26 22:12:07 pst Exp $
|
||||
* $Id: dist.c,v 1.70 1996/10/02 00:52:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -574,6 +574,12 @@ distExtractAll(dialogMenuItem *self)
|
||||
msgConfirm("Couldn't extract the following distributions. This may\n"
|
||||
"be because they were not available on the installation\n"
|
||||
"media you've chosen:\n\n\t%s", buf);
|
||||
/* Assume that if we couldn't get all the dists, our media probably needs changing at this point */
|
||||
if (mediaDevice->type == DEVICE_TYPE_FTP)
|
||||
variable_unset(VAR_FTP_PATH);
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
return DITEM_FAILURE | DITEM_RESTORE;
|
||||
}
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: install.c,v 1.122 1996/10/02 08:25:09 jkh Exp $
|
||||
* $Id: install.c,v 1.123 1996/10/02 10:44:31 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -35,6 +35,7 @@
|
||||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
#include "uc_main.h"
|
||||
#include <ctype.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/errno.h>
|
||||
@ -380,12 +381,8 @@ installNovice(dialogMenuItem *self)
|
||||
if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE)
|
||||
return DITEM_FAILURE;
|
||||
|
||||
dialog_clear_norefresh();
|
||||
msgConfirm("Now it is time to select an installation subset. There are a number of\n"
|
||||
"canned distribution sets, ranging from minimal installation sets to full\n"
|
||||
"X11 developer oriented configurations. You can also select a custom set\n"
|
||||
"of distributions if none of the provided ones are suitable.");
|
||||
while (1) {
|
||||
dialog_clear_norefresh();
|
||||
if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists)
|
||||
return DITEM_FAILURE | DITEM_RECREATE;
|
||||
|
||||
@ -397,27 +394,24 @@ installNovice(dialogMenuItem *self)
|
||||
return DITEM_FAILURE | DITEM_RECREATE;
|
||||
|
||||
if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) {
|
||||
dialog_clear();
|
||||
dialog_clear_norefresh();
|
||||
msgConfirm("Installation completed with some errors. You may wish to\n"
|
||||
"scroll through the debugging messages on VTY1 with the\n"
|
||||
"scroll-lock feature. You can also chose \"No\" at the next\n"
|
||||
"prompt and go back into the installation menus to try and retry\n"
|
||||
"whichever operations have failed.");
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
if (mediaDevice->type == DEVICE_TYPE_FTP)
|
||||
variable_unset(VAR_FTP_PATH);
|
||||
return i | DITEM_RECREATE;
|
||||
|
||||
}
|
||||
else
|
||||
dialog_clear();
|
||||
else {
|
||||
dialog_clear_norefresh();
|
||||
msgConfirm("Congratulations! You now have FreeBSD installed on your system.\n\n"
|
||||
"We will now move on to the final configuration questions.\n"
|
||||
"For any option you do not wish to configure, simply select\n"
|
||||
"No.\n\n"
|
||||
"If you wish to re-enter this utility after the system is up, you\n"
|
||||
"may do so by typing: /stand/sysinstall.");
|
||||
|
||||
}
|
||||
if (mediaDevice->type != DEVICE_TYPE_FTP && mediaDevice->type != DEVICE_TYPE_NFS) {
|
||||
if (!msgYesNo("Would you like to configure any SLIP/PPP or network interface devices?")) {
|
||||
Device *save = mediaDevice;
|
||||
@ -430,6 +424,7 @@ installNovice(dialogMenuItem *self)
|
||||
}
|
||||
}
|
||||
|
||||
dialog_clear_norefresh();
|
||||
if (!msgYesNo("Would you like to configure Samba for connecting NETBUI clients to this\n"
|
||||
"machine? Windows 95, Windows NT and Windows for Workgroups\n"
|
||||
"machines can use NETBUI transport for disk and printer sharing."))
|
||||
@ -573,17 +568,6 @@ installCommit(dialogMenuItem *self)
|
||||
else if (!(Dists & DIST_BIN))
|
||||
(void)installFixup(self);
|
||||
|
||||
/* Don't print this if we're express or novice installing - they have their own error reporting */
|
||||
if (strcmp(str, "express") && strcmp(str, "novice")) {
|
||||
if (Dists || DITEM_STATUS(i) == DITEM_FAILURE)
|
||||
msgConfirm("Installation completed with some errors. You may wish to\n"
|
||||
"scroll through the debugging messages on VTY1 with the\n"
|
||||
"scroll-lock feature.");
|
||||
else
|
||||
msgConfirm("Installation completed successfully.\n\n"
|
||||
"If you have any network devices you have not yet configured,\n"
|
||||
"see the Interfaces configuration item on the Configuration menu.");
|
||||
}
|
||||
variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install");
|
||||
return i | DITEM_RECREATE;
|
||||
}
|
||||
@ -911,8 +895,57 @@ create_termcap(void)
|
||||
}
|
||||
}
|
||||
|
||||
static char *isa_list[] = {
|
||||
"device",
|
||||
"ioport",
|
||||
"irq",
|
||||
"drq",
|
||||
"iomem",
|
||||
"iosize",
|
||||
"flags",
|
||||
"alive",
|
||||
"enabled",
|
||||
};
|
||||
|
||||
static void
|
||||
save_userconfig_to_kernel(char *kern)
|
||||
{
|
||||
/* place-holder for now */
|
||||
struct kernel *core, *boot;
|
||||
struct list *c_isa, *c_dev, *b_dev;
|
||||
int i, d;
|
||||
|
||||
core = uc_open("-incore");
|
||||
if (!core) {
|
||||
msgDebug("Can't read in-core information for kernel.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
boot = uc_open(kern);
|
||||
if (!boot) {
|
||||
msgDebug("Can't read device information for kernel image %s\n", kern);
|
||||
return;
|
||||
}
|
||||
msgDebug("Kernel open, getting core ISA devices\n");
|
||||
c_isa = uc_getdev(core, "-isa");
|
||||
for (d = 0; d < c_isa->ac; d++) {
|
||||
msgDebug("Outer loop, c_isa->av[%d] = %s\n", d, c_isa->av[d]);
|
||||
if (strcmp(c_isa->av[d], "npx0")) { /* special case npx0, which
|
||||
mucks with its id_irq member */
|
||||
c_dev = uc_getdev(core, c_isa->av[d]);
|
||||
b_dev = uc_getdev(boot, c_isa->av[d]);
|
||||
for (i = 0; i < c_dev->ac; i++) {
|
||||
msgDebug("Inner loop, c_dev->av[%d] = %s\n", i, c_dev->av[i]);
|
||||
if (strcmp(c_dev->av[i], b_dev->av[i])) {
|
||||
msgDebug("%s %s changed: %s (boot) -> %s (core)\n",
|
||||
c_dev->av[0], isa_list[i], b_dev->av[i], c_dev->av[i]);
|
||||
isa_setdev(boot, c_dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
msgDebug("skipping npx0\n");
|
||||
}
|
||||
msgDebug("Closing kernels\n");
|
||||
uc_close(core, 0);
|
||||
uc_close(boot, 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user