summaryrefslogtreecommitdiff
path: root/tools/disklabel
diff options
context:
space:
mode:
authortsutsui <tsutsui@NetBSD.org>2010-01-05 15:45:26 +0000
committertsutsui <tsutsui@NetBSD.org>2010-01-05 15:45:26 +0000
commitd3724ba41f945cdea9b92e08fb7a2002c3ed974e (patch)
tree31102ea6343428266e5a41b6dd5710875ed6e142 /tools/disklabel
parent7fe4e168035d55f7eb061acc3a986f046d703e24 (diff)
Add necessary byteswap ops for tools disklabel(8) used with -F option
(treating a target disk as a regular file and suppressing ioctl(2)s) on reading/writing disklabel in a target file. This allows cross build enviroment creating bootable disk images for targets in different endian. No functional changes to native (non-tools) disklabel(8) command. Closes PR toolchain/42357.
Diffstat (limited to 'tools/disklabel')
-rw-r--r--tools/disklabel/Makefile14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/disklabel/Makefile b/tools/disklabel/Makefile
index 343c13dfcb1..75e2e13319d 100644
--- a/tools/disklabel/Makefile
+++ b/tools/disklabel/Makefile
@@ -1,8 +1,18 @@
-# $NetBSD: Makefile,v 1.2 2006/12/09 20:13:13 dyoung Exp $
+# $NetBSD: Makefile,v 1.3 2010/01/05 15:45:26 tsutsui Exp $
HOSTPROGNAME= nbdisklabel-${MAKEWRAPPERMACHINE}
HOST_SRCDIR= sbin/disklabel
-HOST_SRCS= getcap.c disklabel.c
+HOST_SRCS= getcap.c disklabel.c bswap.c
+
+NOMAN= # defined
+
+.include <bsd.endian.mk>
+
+.if ${TARGET_ENDIANNESS} == "1234"
+CPPFLAGS+= -DTARGET_BYTE_ORDER=LITTLE_ENDIAN
+.elif ${TARGET_ENDIANNESS} == "4321"
+CPPFLAGS+= -DTARGET_BYTE_ORDER=BIG_ENDIAN
+.endif
.include "${.CURDIR}/../Makefile.disklabel"
.include "${.CURDIR}/../Makefile.host"