Source-Changes-HG archive

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

[src/netbsd-6]: src Pull up following revision(s) (requested by tsutsui in ti...



details:   https://anonhg.NetBSD.org/src/rev/32ee2caf798a
branches:  netbsd-6
changeset: 774198:32ee2caf798a
user:      riz <riz%NetBSD.org@localhost>
date:      Tue Jun 12 19:11:50 2012 +0000

description:
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

diffstat:

 sbin/fdisk/Makefile  |   9 ++++++++-
 sbin/fdisk/fdisk.c   |  17 ++++++-----------
 tools/fdisk/Makefile |   6 ++----
 3 files changed, 16 insertions(+), 16 deletions(-)

diffs (90 lines):

diff -r b3ad3148b9ff -r 32ee2caf798a sbin/fdisk/Makefile
--- a/sbin/fdisk/Makefile       Tue Jun 12 19:00:24 2012 +0000
+++ b/sbin/fdisk/Makefile       Tue Jun 12 19:11:50 2012 +0000
@@ -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
diff -r b3ad3148b9ff -r 32ee2caf798a sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c        Tue Jun 12 19:00:24 2012 +0000
+++ b/sbin/fdisk/fdisk.c        Tue Jun 12 19:11:50 2012 +0000
@@ -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 @@
 #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 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
 
diff -r b3ad3148b9ff -r 32ee2caf798a tools/fdisk/Makefile
--- a/tools/fdisk/Makefile      Tue Jun 12 19:00:24 2012 +0000
+++ b/tools/fdisk/Makefile      Tue Jun 12 19:11:50 2012 +0000
@@ -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"



Home | Main Index | Thread Index | Old Index