From d3724ba41f945cdea9b92e08fb7a2002c3ed974e Mon Sep 17 00:00:00 2001 From: tsutsui Date: Tue, 5 Jan 2010 15:45:26 +0000 Subject: 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. --- tools/disklabel/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tools/disklabel') 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 + +.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" -- cgit