NetBSD Problem Report #39436

From martin@duskware.de  Sun Aug 31 00:14:39 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 74AE463B8A9
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 31 Aug 2008 00:14:39 +0000 (UTC)
Message-Id: <20080831001437.69D9C33AA0@mail.duskware.de>
Date: Sun, 31 Aug 2008 02:14:32 +0200 (CEST)
From: martin
Reply-To: martin
To: gnats-bugs@gnats.NetBSD.org
Subject: mkbootimag tests machine arch instead of machine
X-Send-Pr-Version: 3.95

>Number:         39436
>Category:       port-powerpc
>Synopsis:       mkbootimag tests machine arch instead of machine
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-powerpc-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 31 00:15:00 +0000 2008
>Closed-Date:    Mon Sep 01 19:05:39 +0000 2008
>Last-Modified:  Mon Sep 01 19:05:39 +0000 2008
>Originator:     Martin Husemann
>Release:        NetBSD 4.99.72
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD nightprowler.duskware.de 4.99.72 NetBSD 4.99.72 (NIGHTPROWLER) #1: Sun Aug 31 00:30:04 CEST 2008 martin@night-porter.duskware.de:/usr/src/sys/arch/prep/compile/NIGHTPROWLER prep
Architecture: powerpc
Machine: prep
>Description:
The mkbootimage tool tries to figure out which machine it is running on via
sysctl. It useses the hw.machine_arch value, which, obviously, for all supported
machines is "powerpc" instead of the strings they are commpared against.

Using the hw.machine value instead makes it work as expected.

>How-To-Repeat:
Run /usr/mdec/mkbootimage without -m and wonder why it complains that you are
not running it on the target machine.

>Fix:
Index: mkbootimage.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c,v
retrieving revision 1.10
diff -c -u -r1.10 mkbootimage.c
--- mkbootimage.c	24 May 2008 17:34:03 -0000	1.10
+++ mkbootimage.c	30 Aug 2008 23:52:18 -0000
@@ -125,10 +125,10 @@
 		fprintf(stderr, "\n\n");
 	}
 #ifdef USE_SYSCTL
-	fprintf(stderr, "usage: %s [-lsv] [-m machine_arch] [-b bootfile] "
+	fprintf(stderr, "usage: %s [-lsv] [-m machine] [-b bootfile] "
 	    "[-k kernel] [-r rawdev] bootimage\n", getprogname());
 #else
-	fprintf(stderr, "usage: %s [-lsv] -m machine_arch [-b bootfile] "
+	fprintf(stderr, "usage: %s [-lsv] -m machine [-b bootfile] "
 	    "[-k kernel] [-r rawdev] bootimage\n", getprogname());
 #endif
 	exit(1);
@@ -830,8 +830,8 @@
 	char *kernel = NULL, *boot = NULL, *rawdev = NULL, *outname = NULL;
 	char *march = NULL;
 #ifdef USE_SYSCTL
-	char machine_arch[SYS_NMLN];
-	int mib[2] = { CTL_HW, HW_MACHINE_ARCH };
+	char machine[SYS_NMLN];
+	int mib[2] = { CTL_HW, HW_MACHINE };
 #endif

 	setprogname(argv[0]);
@@ -882,12 +882,12 @@
 	if (march == NULL) {
 		int i;
 #ifdef USE_SYSCTL
-		size_t len = sizeof(machine_arch);
+		size_t len = sizeof(machine);

-		if (sysctl(mib, sizeof (mib) / sizeof (mib[0]), machine_arch,
+		if (sysctl(mib, sizeof (mib) / sizeof (mib[0]), machine,
 			&len, NULL, 0) != -1) {
 			for (i=0; sup_plats[i] != NULL; i++) {
-				if (strcmp(sup_plats[i], machine_arch) == 0) {
+				if (strcmp(sup_plats[i], machine) == 0) {
 					march = strdup(sup_plats[i]);
 					break;
 				}

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39436 CVS commit: src/sys/arch/powerpc/stand/mkbootimage
Date: Mon,  1 Sep 2008 19:03:44 +0000 (UTC)

 Module Name:	src
 Committed By:	martin
 Date:		Mon Sep  1 19:03:44 UTC 2008

 Modified Files:
 	src/sys/arch/powerpc/stand/mkbootimage: mkbootimage.c

 Log Message:
 Fix machine_arch vs. machine confusion, PR 39436.
 OK: garbled


 To generate a diff of this commit:
 cvs rdiff -r1.10 -r1.11 src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Mon, 01 Sep 2008 19:05:39 +0000
State-Changed-Why:
Patch commited


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.