Module Name: src
Committed By: riz
Date: Tue Jun 12 19:11:51 UTC 2012
Modified Files:
src/sbin/fdisk [netbsd-6]: Makefile fdisk.c
src/tools/fdisk [netbsd-6]: Makefile
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #315):
sbin/fdisk/fdisk.c: revision 1.141
sbin/fdisk/fdisk.c: revision 1.142
tools/fdisk/Makefile: revision 1.5
tools/fdisk/Makefile: revision 1.7
sbin/fdisk/Makefile: revision 1.42
Don't use "#if defined(__i386__) || defined(__x86_64__)" conditionals
in C source file to define option features.
Define proper options in each Makefile per ${MACHINE_ARCH} variable instead.
Previously if a host is x86 and it has /usr/mdec/mbr file in its system,
tools fdisk implicitly installs it as mbr bootcode even for !x86 targets.
Use ${DESTDIR}/usr/mdec for DEFAULT_BOOTDIR on tools fdisk(8)
rather than unknown build host's /usr/mdec directory.
XXX: no option to leave MBR bootcode empty on x86 targets
To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.8.1 src/sbin/fdisk/Makefile
cvs rdiff -u -r1.138 -r1.138.2.1 src/sbin/fdisk/fdisk.c
cvs rdiff -u -r1.4 -r1.4.8.1 src/tools/fdisk/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/fdisk/Makefile
diff -u src/sbin/fdisk/Makefile:1.41 src/sbin/fdisk/Makefile:1.41.8.1
--- src/sbin/fdisk/Makefile:1.41 Fri Nov 27 15:37:32 2009
+++ src/sbin/fdisk/Makefile Tue Jun 12 19:11:50 2012
@@ -1,10 +1,17 @@
-# $NetBSD: Makefile,v 1.41 2009/11/27 15:37:32 tsutsui Exp $
+# $NetBSD: Makefile,v 1.41.8.1 2012/06/12 19:11:50 riz Exp $
PROG= fdisk
SRCS= fdisk.c
MAN= fdisk.8
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+CPPFLAGS+= -DBOOTSEL
+.if (${HOSTPROG:U} == "")
+CPPFLAGS+= -DUSE_DISKLIST
+.endif
+.endif
+
.if ${MACHINE} == "arc"
CPPFLAGS+= -D_PATH_DEFDISK='"/dev/rsd0d"'
.endif
Index: src/sbin/fdisk/fdisk.c
diff -u src/sbin/fdisk/fdisk.c:1.138 src/sbin/fdisk/fdisk.c:1.138.2.1
--- src/sbin/fdisk/fdisk.c:1.138 Fri Dec 2 15:21:15 2011
+++ src/sbin/fdisk/fdisk.c Tue Jun 12 19:11:50 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: fdisk.c,v 1.138 2011/12/02 15:21:15 christos Exp $ */
+/* $NetBSD: fdisk.c,v 1.138.2.1 2012/06/12 19:11:50 riz Exp $ */
/*
* Mach Operating System
@@ -39,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.138 2011/12/02 15:21:15 christos Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.138.2.1 2012/06/12 19:11:50 riz Exp $");
#endif /* not lint */
#define MBRPTYPENAMES
@@ -86,18 +86,13 @@ __RCSID("$NetBSD: fdisk.c,v 1.138 2011/1
#endif
#endif /* HAVE_NBTOOL_CONFIG_H */
+#ifndef DEFAULT_BOOTDIR
#define DEFAULT_BOOTDIR "/usr/mdec"
+#endif
#define LE_MBR_MAGIC htole16(MBR_MAGIC)
#define LE_MBR_BS_MAGIC htole16(MBR_BS_MAGIC)
-#if defined(__i386__) || defined(__x86_64__)
-#if !HAVE_NBTOOL_CONFIG_H
-#include <machine/cpu.h>
-#endif /* !HAVE_NBTOOL_CONFIG_H */
-#define BOOTSEL
-#endif
-
#ifdef BOOTSEL
#define DEFAULT_BOOTCODE "mbr"
@@ -248,8 +243,8 @@ static struct mbr_sector bootcode[8192 /
static int bootsize; /* actual size of bootcode */
static int boot_installed; /* 1 if we've copied code into the mbr */
-#if (defined(__i386__) || defined(__x86_64__)) && !HAVE_NBTOOL_CONFIG_H
-#define USE_DISKLIST
+#if defined(USE_DISKLIST)
+#include <machine/cpu.h>
static struct disklist *dl;
#endif
Index: src/tools/fdisk/Makefile
diff -u src/tools/fdisk/Makefile:1.4 src/tools/fdisk/Makefile:1.4.8.1
--- src/tools/fdisk/Makefile:1.4 Sat Jun 19 23:11:10 2010
+++ src/tools/fdisk/Makefile Tue Jun 12 19:11:51 2012
@@ -1,12 +1,10 @@
-# $NetBSD: Makefile,v 1.4 2010/06/19 23:11:10 riz Exp $
+# $NetBSD: Makefile,v 1.4.8.1 2012/06/12 19:11:51 riz Exp $
HOSTPROGNAME= ${MACHINE_GNU_PLATFORM}-fdisk
HOST_SRCDIR= sbin/fdisk
HOST_SRCS= getcap.c disklabel.c
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
-CPPFLAGS+= -DBOOTSEL
-.endif
+HOST_CPPFLAGS= -DDEFAULT_BOOTDIR=\"${DESTDIR}/usr/mdec\"
.include "${.CURDIR}/../Makefile.nbincludes"
.include "${.CURDIR}/../Makefile.host"