Module Name:    src
Committed By:   snj
Date:           Thu Jul 16 21:36:59 UTC 2015

Modified Files:
        src/usr.sbin/installboot [netbsd-7]: Makefile installboot.c
        src/usr.sbin/installboot/arch [netbsd-7]: amiga.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #844):
        usr.sbin/installboot/Makefile: revisions 1.49, 1.50
        usr.sbin/installboot/installboot.c: revisions 1.37, 1.38
        usr.sbin/installboot/arch/amiga.c: revision 1.9
Support wedge names.
--
Can't use getfsspecname (and thus wedge names) while building tools.
--
Linking against libutil is not appropiate for tools.
--
Compute bootloader checksum correctly also on little endian systems.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.4.1 src/usr.sbin/installboot/Makefile
cvs rdiff -u -r1.36 -r1.36.18.1 src/usr.sbin/installboot/installboot.c
cvs rdiff -u -r1.8 -r1.8.6.1 src/usr.sbin/installboot/arch/amiga.c

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

Modified files:

Index: src/usr.sbin/installboot/Makefile
diff -u src/usr.sbin/installboot/Makefile:1.48 src/usr.sbin/installboot/Makefile:1.48.4.1
--- src/usr.sbin/installboot/Makefile:1.48	Mon Feb 24 07:23:44 2014
+++ src/usr.sbin/installboot/Makefile	Thu Jul 16 21:36:59 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.48 2014/02/24 07:23:44 skrll Exp $
+#	$NetBSD: Makefile,v 1.48.4.1 2015/07/16 21:36:59 snj Exp $
 #
 
 .include <bsd.own.mk>
@@ -7,7 +7,6 @@ PROG=	installboot
 MAN=	installboot.8
 SRCS=	installboot.c sum.c machines.c fstypes.c
 
-
 ARCH_XLAT= amd64-i386.c news68k-news.c newsmips-news.c
 ARCH_XLAT+= sun2-sun68k.c sun3-sun68k.c
 
@@ -47,6 +46,9 @@ CPPFLAGS+=	-I${.CURDIR} -I.
 .for f in i386 macppc
 COPTS.${f}.c+=  -Wno-pointer-sign
 .endfor
+
+LDADD+= -lutil
+DPADD+= ${LIBUTIL}
 .endif
 
 .include <bsd.prog.mk>

Index: src/usr.sbin/installboot/installboot.c
diff -u src/usr.sbin/installboot/installboot.c:1.36 src/usr.sbin/installboot/installboot.c:1.36.18.1
--- src/usr.sbin/installboot/installboot.c:1.36	Thu Nov  3 20:46:41 2011
+++ src/usr.sbin/installboot/installboot.c	Thu Jul 16 21:36:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.36 2011/11/03 20:46:41 martin Exp $	*/
+/*	$NetBSD: installboot.c,v 1.36.18.1 2015/07/16 21:36:59 snj Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -35,9 +35,10 @@
 
 #include <sys/cdefs.h>
 #if !defined(__lint)
-__RCSID("$NetBSD: installboot.c,v 1.36 2011/11/03 20:46:41 martin Exp $");
+__RCSID("$NetBSD: installboot.c,v 1.36.18.1 2015/07/16 21:36:59 snj Exp $");
 #endif	/* !__lint */
 
+#include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/utsname.h>
 
@@ -50,6 +51,9 @@ __RCSID("$NetBSD: installboot.c,v 1.36 2
 #include <stddef.h>
 #include <string.h>
 #include <unistd.h>
+#if !HAVE_NBTOOL_CONFIG_H
+#include <util.h>
+#endif
 
 #include "installboot.h"
 
@@ -105,6 +109,11 @@ main(int argc, char *argv[])
 	char 		*p;
 	const char	*op;
 	ib_flags	unsupported_flags;
+#if !HAVE_NBTOOL_CONFIG_H
+	char		specname[MAXPATHLEN];
+	char		rawname[MAXPATHLEN];
+	const char	*special, *raw;
+#endif
 
 	setprogname(argv[0]);
 	params = &installboot_params;
@@ -229,7 +238,16 @@ main(int argc, char *argv[])
 		params->stage2 = argv[2];
 	}
 
+#if !HAVE_NBTOOL_CONFIG_H
+	special = getfsspecname(specname, sizeof(specname), argv[0]);
+	raw = getdiskrawname(rawname, sizeof(rawname), special);
+	if (raw != NULL)
+		special = raw;
+	params->filesystem = special;
+#else
 	params->filesystem = argv[0];
+#endif
+
 	if (params->flags & IB_NOWRITE) {
 		op = "only";
 		mode = O_RDONLY;

Index: src/usr.sbin/installboot/arch/amiga.c
diff -u src/usr.sbin/installboot/arch/amiga.c:1.8 src/usr.sbin/installboot/arch/amiga.c:1.8.6.1
--- src/usr.sbin/installboot/arch/amiga.c:1.8	Fri Jun 14 03:54:43 2013
+++ src/usr.sbin/installboot/arch/amiga.c	Thu Jul 16 21:36:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: amiga.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $	*/
+/*	$NetBSD: amiga.c,v 1.8.6.1 2015/07/16 21:36:59 snj Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(__lint)
-__RCSID("$NetBSD: amiga.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $");
+__RCSID("$NetBSD: amiga.c,v 1.8.6.1 2015/07/16 21:36:59 snj Exp $");
 #endif	/* !__lint */
 
 #include <sys/param.h>
@@ -126,8 +126,8 @@ amiga_setboot(ib_params *params)
 		}
 		(void)strncpy(dline, params->command, CMDLN_LEN-1);
 
-		block[1] = 0;
-		block[1] = 0xffffffff - chksum(block, sumlen);
+		block[1] = htobe32(0);
+		block[1] = htobe32(0xffffffff - chksum(block, sumlen));
 	}
 
 	if (params->flags & IB_NOWRITE) {
@@ -164,7 +164,7 @@ chksum(block, size)
 
 	for (i=0; i<size; i++) {
 		lastsum = sum;
-		sum += htobe32(block[i]);
+		sum += be32toh(block[i]);
 		if (sum < lastsum)
 			++sum;
 	}

Reply via email to