summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sade/install.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2006-03-08 18:02:32 +0000
committersam <sam@FreeBSD.org>2006-03-08 18:02:32 +0000
commitfa1fbfedc2f06342ca8bbae5b057d8bd2c14cc59 (patch)
tree87198eeaccc5a4734146e5e9aa6881c4854232fe /usr.sbin/sade/install.c
parentb19c8d2fcc1540312b520fc757d445026667a6ac (diff)
downloadFreeBSD-src-fa1fbfedc2f06342ca8bbae5b057d8bd2c14cc59.zip
FreeBSD-src-fa1fbfedc2f06342ca8bbae5b057d8bd2c14cc59.tar.gz
Revamp base system packaging of kernels to enable up/smp selection
at runtime and to support distributing additional kernels: o remove kernel from the base tarball o add new kernel tarballs o build + package both SMP and GENERIC kernels when an <arch>/conf/SMP config file is present o add sysinstall support for multiple kernels o update sysinstall to probe for the number of cpus on a system and auto-select smp/up kernel accordingly o add a post-kernels install hook to fixup /boot/kernel o add -ldevinfo to boot crunch for sysinstall's cpu probing logic Notes: 1. On HEAD this code is not currently used because GENERIC kernels include SMP. This work is mainly intended for RELENG_6 where the GENERIC kernel is UP. If HEAD changes to match then just enable WITH_SMP in sysinstall/Makefile. 2. The cpu probing support is done with acpi and MPTable; this means some systems will require work for auto-detection to work. 3. The handling of /boot/kernel may need to be revisited; for now we rename one kernel at the last moment (SMP if installed, otherwise GENERIC). There are other, possibly better, approaches. Lots of help from ru, emaste, scottl, and jhb.
Diffstat (limited to 'usr.sbin/sade/install.c')
-rw-r--r--usr.sbin/sade/install.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index 39cfb3f..801cda9 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;
}
OpenPOWER on IntegriCloud