Subject: patch rfc: "host tools" disklabel, fdisk
To: None <tech-toolchain@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-toolchain
Date: 03/23/2005 18:34:10
--uxuisgdDHaNETlh8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Y'all,
I am building NetBSD CompactFlash images for "rooftop" wireless routers
based on the Soekris SBC. It's important that I can put both a DOS MBR
and a proper NetBSD disklabel on the system. I badly need to support
developers who want to build CF images on 1.6.2 and Linux. Hence the
attached patches, that make fdisk and disklabel into "host tools."
I would like to get your feedback on this before I commit to -current.
I hope that this can make it into the 3.1 release.
In broad overview, here are the changes I've made to the tools and
build system:
In disklabel and fdisk, I've conditioned uses of ioctl(2) and
sysctl(3) on !defined(HAVE_NBTOOL_CONFIG_H).
If defined(HAVE_NBTOOL_CONFIG_H), I #include many system
header files using relative paths.
sys/disklabel.h #includes <machine/disklabel.h>. Working around
this was kind of tricky. My solution is to install all the
machine/*.h header files in $TOOLDIR/nbmachine/nbmachine/.
I made some changes to bsd.kinc.mk for this purpose, and I added
src/tools/nbmachine/Makefile.
Dave
P.S. There are some extraneous changes I intend to commit separately.
Use standard type names (uint -> u_int, ulong -> u_long).
Removed whitespace at EOL.
Changed all subroutine and variable names from KNF to Pascal/Java
style (disklabel -> DiskLabel).
(Switched to GNU)
{
indentation style;
}
thoughout.
Changed from British to Yankee spellings (judgement -> judgment,
colour -> color).
--
David Young OJC Technologies
dyoung@ojctech.com Urbana, IL * (217) 278-3933
--uxuisgdDHaNETlh8
Content-Type: application/x-gzip
Content-Disposition: attachment; filename="host-fdisk-disklabel-3.gz"
Content-Transfer-Encoding: base64
H4sICPUTQUIAA2hvc3QtZmRpc2stZGlza2xhYmVsLTMAxTr5c9pK0j/Lf8WEZPOBQSAJsDme
k/jADl9scBn7JSnHpRLSAFqDREnCx+b5f9/umdGJcOzdylsngDTT3dPX9DHSR+LPDI/WFre1
6ti3qre2Y1YXt1X/frn1kQSuO/drznhhmDPbobXqmXFLJ/acinl/b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