summaryrefslogtreecommitdiff
path: root/usr.sbin/sade
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2006-03-08 18:02:32 +0000
committerSam Leffler <sam@FreeBSD.org>2006-03-08 18:02:32 +0000
commit9fe7600bbec57a4de3ba70f6cb9027b5182e43d2 (patch)
tree87198eeaccc5a4734146e5e9aa6881c4854232fe /usr.sbin/sade
parent846bc8c6f4bc6fcaa1767b2512beb19b17ea5ef0 (diff)
Notes
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r--usr.sbin/sade/Makefile30
-rw-r--r--usr.sbin/sade/install.c36
-rw-r--r--usr.sbin/sade/menus.c48
-rw-r--r--usr.sbin/sade/sade.h13
4 files changed, 125 insertions, 2 deletions
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
index 751d10c58dd5..c735c2695bf8 100644
--- a/usr.sbin/sade/Makefile
+++ b/usr.sbin/sade/Makefile
@@ -23,6 +23,36 @@ CFLAGS+= -I${.CURDIR}/../../gnu/lib/libdialog -I.
DPADD= ${LIBDIALOG} ${LIBNCURSES} ${LIBUTIL} ${LIBDISK} ${LIBFTPIO}
LDADD= -ldialog -lncurses -lutil -ldisk -lftpio
+#
+# When distributions have both UP and SMP kernels sysinstall
+# will probe for the number of cpus on the target machine and
+# automatically select which is appropriate. This can be overridden
+# through the menus or both kernels can be installed (with the
+# most "appropriate" one setup as /boot/kernel). For now this
+# is done for i386 and amd64; for other systems support must be
+# added to identify the cpu count if acpi and MPTable probing
+# is insufficient.
+#
+# The unmber of cpus probed is passed through the environment in
+# VAR_NCPUS ("ncpus") to scripts.
+#
+# Note that WITH_SMP is a compile time option that enables the
+# builtin menus for the SMP kernel configuration. If this kernel
+# is not built (see release/Makefile) then this should not be
+# enabled as sysinstall may try to select an SMP kernel config
+# where none is available. This option should not be needed--we
+# should probe for an SMP kernel in the distribution but doing
+# that is painful because of media changes and the structure of
+# sysinstall so for now it's a priori.
+#
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
+SRCS+= acpi.c biosmptable.c
+# NB: HEAD has SMP in GENERIC so only one kernel
+#CFLAGS+=-DWITH_SMP
+DPADD+= ${LIBDEVINFO}
+LDADD+= -ldevinfo
+.endif
+
CLEANFILES= makedevs.c rtermcap
CLEANFILES+= keymap.tmp keymap.h countries.tmp countries.h
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index 39cfb3fc5c4d..801cda9075e0 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -61,6 +61,7 @@
*/
int _interactiveHack;
int FixItMode = 0;
+int NCpus;
static void create_termcap(void);
static void fixit_common(void);
@@ -892,6 +893,30 @@ installFixupBase(dialogMenuItem *self)
return DITEM_SUCCESS | DITEM_RESTORE;
}
+int
+installFixupKernel(dialogMenuItem *self, int dists)
+{
+
+ /* All of this is done only as init, just to be safe */
+ if (RunningAsInit) {
+ /*
+ * Install something as /boot/kernel. Prefer SMP
+ * over generic--this should handle the case where
+ * both SMP and GENERIC are installed (otherwise we
+ * select the one kernel that was installed).
+ *
+ * NB: we assume any existing kernel has been saved
+ * already and the /boot/kernel we remove is empty.
+ */
+ vsystem("rm -rf /boot/kernel");
+ if (dists & DIST_KERNEL_SMP)
+ vsystem("mv /boot/SMP /boot/kernel");
+ else
+ vsystem("mv /boot/GENERIC /boot/kernel");
+ }
+ return DITEM_SUCCESS | DITEM_RESTORE;
+}
+
#define QUEUE_YES 1
#define QUEUE_NO 0
static int
@@ -1173,7 +1198,7 @@ getRelname(void)
int
installVarDefaults(dialogMenuItem *self)
{
- char *cp;
+ char *cp, ncpus[10];
/* Set default startup options */
variable_set2(VAR_RELNAME, getRelname(), 0);
@@ -1205,6 +1230,15 @@ installVarDefaults(dialogMenuItem *self)
variable_set2(SYSTEM_STATE, "init", 0);
variable_set2(VAR_NEWFS_ARGS, "-b 16384 -f 2048", 0);
variable_set2(VAR_CONSTERM, "NO", 0);
+#if defined(i386) || defined(amd64)
+ NCpus = acpi_detect();
+ if (NCpus == -1)
+ NCpus = biosmptable_detect();
+#endif
+ if (NCpus <= 0)
+ NCpus = 1;
+ snprintf(ncpus, sizeof(ncpus), "%u", NCpus);
+ variable_set2(VAR_NCPUS, ncpus, 0);
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index 767909ffbef2..6147313066cd 100644
--- a/usr.sbin/sade/menus.c
+++ b/usr.sbin/sade/menus.c
@@ -57,6 +57,22 @@ clearSrc(dialogMenuItem *self)
}
static int
+setKernel(dialogMenuItem *self)
+{
+ Dists |= DIST_KERNEL;
+ KernelDists = DIST_KERNEL_ALL;
+ return DITEM_SUCCESS | DITEM_REDRAW;
+}
+
+static int
+clearKernel(dialogMenuItem *self)
+{
+ Dists &= ~DIST_KERNEL;
+ KernelDists = 0;
+ return DITEM_SUCCESS | DITEM_REDRAW;
+}
+
+static int
setX11Misc(dialogMenuItem *self)
{
XOrgDists |= DIST_XORG_MISC_ALL;
@@ -160,7 +176,8 @@ checkDistEverything(dialogMenuItem *self)
{
return Dists == DIST_ALL &&
_IS_SET(SrcDists, DIST_SRC_ALL) &&
- _IS_SET(XOrgDists, DIST_XORG_ALL);
+ _IS_SET(XOrgDists, DIST_XORG_ALL) &&
+ _IS_SET(KernelDists, DIST_KERNEL_ALL);
}
static int
@@ -181,6 +198,12 @@ x11FlagCheck(dialogMenuItem *item)
}
static int
+kernelFlagCheck(dialogMenuItem *item)
+{
+ return KernelDists;
+}
+
+static int
checkTrue(dialogMenuItem *item)
{
return TRUE;
@@ -965,6 +988,8 @@ DMenu MenuSubDistributions = {
NULL, distReset, NULL, NULL, ' ', ' ', ' ' },
{ " base", "Binary base distribution (required)",
dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_BASE },
+ { " kernels", "Binary kernel distributions (required)",
+ kernelFlagCheck,distSetKernel },
{ " dict", "Spelling checker dictionary files",
dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_DICT },
{ " doc", "Miscellaneous FreeBSD online docs",
@@ -994,6 +1019,27 @@ DMenu MenuSubDistributions = {
{ NULL } },
};
+DMenu MenuKernelDistributions = {
+ DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
+ "Select the operating system kernels you wish to install.",
+ "Please check off those kernels you wish to install.\n",
+ NULL,
+ NULL,
+ { { "X Exit", "Exit this menu (returning to previous)",
+ checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
+ { "All", "Select all of the below",
+ NULL, setKernel, NULL, NULL, ' ', ' ', ' ' },
+ { "Reset", "Reset all of the below",
+ NULL, clearKernel, NULL, NULL, ' ', ' ', ' ' },
+ { " GENERIC", "GENERIC kernel configuration",
+ dmenuFlagCheck, dmenuSetFlag, NULL, &KernelDists, '[', 'X', ']', DIST_KERNEL_GENERIC },
+#ifdef WITH_SMP
+ { " SMP", "GENERIC symmetric multiprocessor kernel configuration",
+ dmenuFlagCheck, dmenuSetFlag, NULL, &KernelDists, '[', 'X', ']', DIST_KERNEL_SMP },
+#endif
+ { NULL } },
+};
+
DMenu MenuSrcDistributions = {
DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
"Select the sub-components of src you wish to install.",
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 994039223566..6e4d09675c8f 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.h
@@ -107,6 +107,7 @@
#define VAR_DIST_MAIN "distMain"
#define VAR_DIST_SRC "distSRC"
#define VAR_DIST_X11 "distX11"
+#define VAR_DIST_KERNEL "distKernel"
#define VAR_DEDICATE_DISK "dedicateDisk"
#define VAR_DOMAINNAME "domainname"
#define VAR_EDITOR "editor"
@@ -147,6 +148,7 @@
#define VAR_MOUSED_PORT "moused_port"
#define VAR_MOUSED_TYPE "moused_type"
#define VAR_NAMESERVER "nameserver"
+#define VAR_NCPUS "ncpus"
#define VAR_NETINTERACTIVE "netInteractive"
#define VAR_NETMASK "netmask"
#define VAR_NETWORK_DEVICE "netDev"
@@ -421,6 +423,7 @@ extern Device *mediaDevice; /* Where we're getting our distribution from */
extern unsigned int Dists; /* Which distributions we want */
extern unsigned int SrcDists; /* Which src distributions we want */
extern unsigned int XOrgDists; /* Which X.Org dists we want */
+extern unsigned int KernelDists; /* Which kernel dists we want */
extern int BootMgr; /* Which boot manager to use */
extern int StatusLine; /* Where to print our status messages */
extern DMenu MenuCountry; /* Country menu */
@@ -470,6 +473,7 @@ extern DMenu MenuDistributions; /* Distribution menu */
extern DMenu MenuDiskDevices; /* Disk type devices */
extern DMenu MenuSubDistributions; /* Custom distribution menu */
extern DMenu MenuSrcDistributions; /* Source distribution menu */
+extern DMenu MenuKernelDistributions;/* Kernel distribution menu */
extern DMenu MenuXOrg; /* X.Org main menu */
extern DMenu MenuXOrgSelect; /* X.Org distribution selection menu */
extern DMenu MenuXOrgSelectCore; /* X.Org core distribution menu */
@@ -482,6 +486,7 @@ extern DMenu MenuFixit; /* Fixit floppy/CDROM/shell menu */
extern DMenu MenuXOrgConfig; /* Select X.Org configuration tool */
extern int FixItMode; /* FixItMode starts shell onc urrent device (ie Serial port) */
extern const char * StartName; /* Which name we were started as */
+extern int NCpus; /* # cpus on machine */
/* Important chunks. */
extern Chunk *HomeChunk;
@@ -500,6 +505,9 @@ extern void display_helpline(WINDOW *w, int y, int width);
/*** Prototypes ***/
+/* acpi.c */
+extern int acpi_detect(void);
+
/* anonFTP.c */
extern int configAnonFTP(dialogMenuItem *self);
@@ -606,6 +614,7 @@ extern int distSetMinimum(dialogMenuItem *self);
extern int distSetEverything(dialogMenuItem *self);
extern int distSetSrc(dialogMenuItem *self);
extern int distSetXOrg(dialogMenuItem *self);
+extern int distSetKernel(dialogMenuItem *self);
extern int distExtractAll(dialogMenuItem *self);
/* dmenu.c */
@@ -683,6 +692,7 @@ extern int installFixitHoloShell(dialogMenuItem *self);
extern int installFixitCDROM(dialogMenuItem *self);
extern int installFixitFloppy(dialogMenuItem *self);
extern int installFixupBase(dialogMenuItem *self);
+extern int installFixupKernel(dialogMenuItem *self, int dists);
extern int installUpgrade(dialogMenuItem *self);
extern int installFilesystems(dialogMenuItem *self);
extern int installVarDefaults(dialogMenuItem *self);
@@ -785,6 +795,9 @@ extern int mousedTest(dialogMenuItem *self);
extern int mousedDisable(dialogMenuItem *self);
extern int setMouseFlags(dialogMenuItem *self);
+/* mptable.c */
+extern int biosmptable_detect(void);
+
/* msg.c */
extern Boolean isDebug(void);
extern void msgInfo(char *fmt, ...) __printf0like(1, 2);