Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/utils/sysinst/arch/hpcarm Add dumb code to select an...



details:   https://anonhg.NetBSD.org/src/rev/8f5ec4972736
branches:  trunk
changeset: 757545:8f5ec4972736
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Sep 04 01:23:25 2010 +0000

description:
Add dumb code to select an appropriate kernel set to be installed
per running INSTALL kernel name taken from sysctl kern.version.

XXX: on all arm ports, sysctl hw.cpu_model returns a processor name,
XXX: not machine model as mentioned in <sys/sysctl.h>.

diffstat:

 distrib/utils/sysinst/arch/hpcarm/md.c |  30 ++++++++++++++++++++++++++++--
 distrib/utils/sysinst/arch/hpcarm/md.h |   6 +++++-
 2 files changed, 33 insertions(+), 3 deletions(-)

diffs (64 lines):

diff -r 7a67db2aee01 -r 8f5ec4972736 distrib/utils/sysinst/arch/hpcarm/md.c
--- a/distrib/utils/sysinst/arch/hpcarm/md.c    Sat Sep 04 01:16:49 2010 +0000
+++ b/distrib/utils/sysinst/arch/hpcarm/md.c    Sat Sep 04 01:23:25 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.7 2009/09/19 14:57:28 abs Exp $ */
+/*     $NetBSD: md.c,v 1.8 2010/09/04 01:23:25 tsutsui Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -59,7 +59,33 @@
 void
 md_init_set_status(int minimal)
 {
-       (void)minimal;
+       static const struct {
+               const char *name;
+               const int set;
+       } kern_sets[] = {
+               { "IPAQ",       SET_KERNEL_IPAQ },
+               { "JORNADA720", SET_KERNEL_JORNADA720 },
+               { "WZERO3",     SET_KERNEL_WZERO3 }
+       };
+       static const int mib[2] = {CTL_KERN, KERN_VERSION};
+       size_t len;
+       char *version;
+       u_int i;
+
+       /* check INSTALL kernel name to select an appropriate kernel set */
+       /* XXX: hw.cpu_model has a processor name on arm ports */
+       sysctl(mib, 2, NULL, &len, NULL, 0);
+       version = malloc(len);
+       if (version == NULL)
+               return;
+       sysctl(mib, 2, version, &len, NULL, 0);
+       for (i = 0; i < __arraycount(kern_sets); i++) {
+               if (strstr(version, kern_sets[i].name) != NULL) {
+                       set_kernel_set(kern_sets[i].set);
+                       break;
+               }
+       }
+       free(version);
 }
 
 int
diff -r 7a67db2aee01 -r 8f5ec4972736 distrib/utils/sysinst/arch/hpcarm/md.h
--- a/distrib/utils/sysinst/arch/hpcarm/md.h    Sat Sep 04 01:16:49 2010 +0000
+++ b/distrib/utils/sysinst/arch/hpcarm/md.h    Sat Sep 04 01:23:25 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.h,v 1.5 2010/05/10 16:33:45 tsutsui Exp $   */
+/*     $NetBSD: md.h,v 1.6 2010/09/04 01:23:25 tsutsui Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -63,6 +63,10 @@
 #define SET_KERNEL_2_NAME      "kern-JORNADA720"
 #define SET_KERNEL_3_NAME      "kern-WZERO3"
 
+#define SET_KERNEL_IPAQ                SET_KERNEL_1
+#define SET_KERNEL_JORNADA720  SET_KERNEL_2
+#define SET_KERNEL_WZERO3      SET_KERNEL_3
+
 
 /*
  * Machine-specific command to write a new label to a disk.



Home | Main Index | Thread Index | Old Index