Module Name: src Committed By: tsutsui Date: Sat Sep 4 01:23:25 UTC 2010
Modified Files: src/distrib/utils/sysinst/arch/hpcarm: md.c md.h Log Message: 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>. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/distrib/utils/sysinst/arch/hpcarm/md.c cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/sysinst/arch/hpcarm/md.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/utils/sysinst/arch/hpcarm/md.c diff -u src/distrib/utils/sysinst/arch/hpcarm/md.c:1.7 src/distrib/utils/sysinst/arch/hpcarm/md.c:1.8 --- src/distrib/utils/sysinst/arch/hpcarm/md.c:1.7 Sat Sep 19 14:57:28 2009 +++ src/distrib/utils/sysinst/arch/hpcarm/md.c Sat Sep 4 01:23:25 2010 @@ -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 Index: src/distrib/utils/sysinst/arch/hpcarm/md.h diff -u src/distrib/utils/sysinst/arch/hpcarm/md.h:1.5 src/distrib/utils/sysinst/arch/hpcarm/md.h:1.6 --- src/distrib/utils/sysinst/arch/hpcarm/md.h:1.5 Mon May 10 16:33:45 2010 +++ src/distrib/utils/sysinst/arch/hpcarm/md.h Sat Sep 4 01:23:25 2010 @@ -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.