Commit Graph

201 Commits

Author SHA1 Message Date
wiz da100ff1d9 Use more macros. New sentence, new line. 2006-09-24 15:52:12 +00:00
jmcneill 4fd9dcb2a0 PR# 28660: how to remove bootmenu text from some partition 2006-09-24 15:22:01 +00:00
lukem 272515842e Support MAKEVERBOSE.
Use CLEANFILES to cleanup temp files instead of rm.
Cosmetic tweaks.
2006-06-28 15:03:00 +00:00
lukem a0f0fb81a8 Convert to using CC instead of LD, as LDFLAGS is for CC not LD. 2006-06-28 15:00:51 +00:00
christos e5ea88eb01 PR/33633: Yoshito Komatsu: /sbin/fdisk does not work
Downgrade error getting heads to a warning.
2006-06-02 17:40:34 +00:00
christos 124bff0089 PR/33522: Peter Bex: Sanity checks to avoid zerodivide. 2006-05-21 16:00:17 +00:00
mrg 16efbf8575 don't do the -Wno-pointer-sign dance for host programs. 2006-05-12 01:18:25 +00:00
mrg aadd7d4847 sprinkle some -fno-strict-aliasing and -Wno-pointer-sign with GCC4. 2006-05-11 23:16:28 +00:00
dsl df7e187ccb Appease Coverty CID 7449. Avoid close(-1) in error path. 2006-03-18 08:36:50 +00:00
rumble e948e1b17f Check for allocation failures in malloc, calloc, realloc, asprintf, and
vasprintf and try to handle them.
2006-03-17 15:53:46 +00:00
dyoung 6c1041b8b7 So that we can build a full-featured fdisk cross-tool with -DBOOTSEL,
condition the definition of DEFAULT_BOOTxxx variables and SCAN_xxx
on defined(BOOTSEL), instead of defined(__i386__) || defined(__x86_64__).

While I'm here, only build get_diskname in the same conditions as
get_geometry is built, since only the latter calls the former.
2006-02-14 04:48:15 +00:00
dsl c28e0ae4af Byteswap the constant MBR_{BS_}MAGIC throughout, should genetate better code.
Except that non all architectures have that optimisation :-(
2006-01-29 12:55:16 +00:00
uwe 39ab40b2aa PRI* macros should not contain percent sign.
While here, conditionalise use of "lld" for PRId64 on HAVE_LONG_LONG.
2005-10-07 23:57:10 +00:00
dogcow 7babc7145c Fix cross-compilation on FreeBSD 4.x (and other OSes) where PRId64 isn't
defined.
2005-10-07 01:04:08 +00:00
uwe 25503c6713 When building as host tool don't include "../../include/util.h".
opendisk() declared in that file is not used in this case anyway, and
<util.h> pulls in unwatned includes (e.g. <utmpx.h> doesn't exist on
FreeBSD 4.*).
2005-08-27 22:43:40 +00:00
christos 2c6eadc9ce Move WARNS=3 to the Makefile.inc, and add a little const to the remaining
programs that did not compile before.
2005-06-27 01:00:04 +00:00
fvdl a33a5a18b5 If HOSTPROG is empty, do not pull in libutil, since we do not need it in that
case, and several host platforms do not have libutil. Fixes the build of
these programs as host tools on platforms without libutil.
2005-06-23 00:54:47 +00:00
dyoung 4580f13f42 Turn fdisk(8) into a host tool. Still todo: commit the host-tool
build infrastructure to src/tools/fdisk/.
2005-06-12 19:14:10 +00:00
dyoung 023801f122 For portability, use standard types: s/uint/unsigned int/,
s/ulong/unsigned long/, s/u_int8_t/uint8_t/.
2005-06-12 19:06:43 +00:00
lukem dfee67134f Make fdisk(8) available on all platforms, since MS-DOS partitioning
is the de-facto standard for many removable media types.
2005-05-22 03:45:30 +00:00
dsl 4118385742 Allow partition sizes to be input in GB 2005-04-07 20:23:13 +00:00
xtraeme 76500fc2f9 WARNS=2 is the default defined in sbin/Makefile.inc. (thanks wiz) 2005-01-20 16:39:22 +00:00
xtraeme 784c275927 Remove main() prototype; WARNS=2 2005-01-20 16:01:02 +00:00
wiz 7913b43af5 Fix typo in error message, reported by Nicolas Joly in PR 28347. 2004-11-18 12:00:18 +00:00
christos fdad6cabc9 Use the 1st element's size as the argument to bsearch. 2004-11-15 21:59:23 +00:00
christos 88825a8a55 Use ptype table from <sys/bootblock.h> 2004-11-12 16:57:46 +00:00
christos 88ddc79ebd Add 0xBF for Solaris. From Larry Lee <lclee at west.sun.com> 2004-11-10 02:39:48 +00:00
dsl 25b17683bd Add (unsigned char) to isdigit() calls 2004-10-28 19:48:41 +00:00
gavan 0560d8b947 Initial import of iyonix port.
The Iyonix is a desktop machine from Castle Technology, based on a 600MHz
XScale[tm] 80321 processor.

* Uses the bootloader from NetBSD/acorn32, which is now 32-bit compatible.
* Currently boots multiuser with a serial console.
* Device support is not yet complete.

With help from abs.
2004-10-13 23:28:34 +00:00
dsl 9721e88965 Fix intuit_translated_geometry() calculation.
From Izumi Tsutsui in PR bin/26917
2004-09-12 07:46:24 +00:00
dbj 3aca86e05b check sysctl error return on both calls.
this prevents sysctl from coredumping if the second call fails while the
first succeeds.  This isn't supposed to happen, but there is another bug
in the i386 kernel implementation of sysctl machdep.diskinfo that excites this
2004-07-30 23:42:29 +00:00
uwe 3eac78fb64 s/Nm/Nx/, as it's NetBSD that has ports, not fdisk. 2004-07-13 19:24:03 +00:00
wiz af679c56e7 Bump date for previous; new sentence, new line;
sort list of ports where fdisk is available.
2004-07-13 13:38:39 +00:00
darcy e3937fb4c5 Add note top man page explaining that fdisk is not used on all platforms
and list the ones that is is.

Partial fix to PR#25943
2004-07-13 10:45:49 +00:00
dyoung 87598533f6 Insert missing space so fdisk prints "primary partition table
invalid, no magic in sector 0", not "primarypartition ...".
2004-05-19 07:36:14 +00:00
dsl b31522861f Use the disk size from the device driver, not the bios when checking
whether partitions are valid.
Stops problems with broken BIOS, fixes PR bin/25491
2004-05-10 20:32:07 +00:00
dsl 503ee58711 Don't output the 'Installed bootfile doesn't support required options'
message when we are updating the mbr code because the user did fdisk -i ...
2004-05-08 20:52:59 +00:00
lukem a5a429b354 Only examine mbr_bootsel* #ifdef BOOTSEL.
Noted on current-users@ by Markus Hennecke.
2004-03-24 02:49:37 +00:00
lukem 455da8e60b Move mbr_bootsel from offset 404 to offset 400 in struct mbr_sector to
leave 4 bytes for the Windows NT Drive Serial Number (DSN) at 440-443
(as mbr_sector.mbr_dsn).

Ensure that all the MBR & PBR code reserves space for mbr_sector.mbr_dsn.

Leave the bootsel magic number at 444-445 as mbr_sector.mbr_bootsel_magic
(instead of mbr_sector.mbr_bootsel.mbrbs_magic), but use 0xb5e1 (MBR_BS_MAGIC)
instead of 0xaa55 (MBR_MAGIC) to indicate that this change has occurred.

Rework MBR_BS_NEWMBR to mean "mbr_bootsel has moved to 400".

Modify fdisk(8) to automatically relocate the mbr_bootsel from 404 to 400
if mbr_bootsel_magic is the old value (0xaa55), and unset MBR_BS_NEWMBR
to flag that new mbr_bootsel code must be used if updating the MBR.


These changes fixes a problem where Windows 2000 or Windows XP would corrupt
the last 3 bytes + NUL of MBR partition 3's bootsel name if the bootsel name
was 5 characters long, replacing bytes 6-9 with the DSN.
Also, by explicitly reserving the space for the DSN we prevent problems in the
future if non bootsel MBR or PBR code had other information at bytes 440-443.
2004-03-22 07:11:00 +00:00
lukem fcfc427464 Use .Pp instead of .br as appropriate.
(This needs more work)
2004-03-22 05:07:56 +00:00
wiz 24be734e2d Nm needs no argument; also, correct wrong Nm usage. 2004-03-20 18:49:33 +00:00
snj 17ed0d0099 Bump date for last. Use Sq for single quotes. Drop trailing space.
New sentence, new line.  Sort xrefs.  Fix a spelling error.
2004-03-19 22:21:36 +00:00
dyoung 6c02382b7e Add flag -F, options -t disktab and -T disktype to fdisk. Flag -F
indicates that the target of the fdisk operation is a file, not a
disk. With -t and -T, the user tells fdisk the geometry for the
file If the default geometry that fdisk will "fake up" for a file
are not satisfactory, the user may tell the geometry to fdisk using
-t disktab -T disktype.
2004-03-19 18:19:17 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
lukem 2a42af8c7a Add "DISK" to -S output. 2003-11-21 21:47:42 +00:00
lukem 7a699e2bed unconditionally #define DEFAULT_BOOTDIR. should fix non-x86 builds 2003-10-11 04:50:49 +00:00
lukem 1c33b4e6a4 Overhaul MBR handling (part 1):
<sys/bootblock.h>:
    *	Added definitions for the Master Boot Record (MBR) used by
	a variety of systems (primarily i386), including the format
	of the BIOS Parameter Block (BPB).
	This information was cribbed from a variety of sources
	including <sys/disklabel_mbr.h> which this is a superset of.

	As part of this, some data structure elements and #defines
	were renamed to be more "namespace friendly" and consistent
	with other bootblocks and MBR documentation.
	Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
    *	Deprecated in favor of <sys/bootblock.h> (the latter is more
	"host tool" friendly).

amd64 & i386:
    *	Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
	be consistent with the naming convention of the msdosfs tools.

    *	Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
	and it's confusing to have two functionally equivalent bootblocks,
	especially given that "ufs" has multiple meanings (it could be
	a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

    *	Rework pbr.S (the first sector of bootxx_*):
	    +	Ensure that BPB (bytes 11..89) and the partition table
		(bytes 446..509) do not contain code.
	    +	Add support for booting from FAT partitions if BOOT_FROM_FAT
		is defined.  (Only set for bootxx_msdos).
	    +	Remove "dummy" partition 3; if people want to installboot(8)
		these to the start of the disk they can use fdisk(8) to
		create a real MBR partition table...
	    +	Compile with TERSE_ERROR so it fits because of the above.
		Whilst this is less user friendly, I feel it's important
		to have a valid partition table and BPB in the MBR/PBR.

    *	Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
	with other platforms.

    *	Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
    	we can boot off FAT partitions.

    *	Crank version of /usr/mdec/boot to 3.1, and fix some of the other
	entries in the version file.

installboot(8) (i386):
    *	Read the existing MBR of the filesystem and retain the BIOS
    	Parameter Block (BPB) in bytes 11..89 and the MBR partition
	table in bytes 446..509.  (Previously installboot(8) would
	trash those two sections of the MBR.)

mbrlabel(8):
    *	Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
	to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
2003-10-08 04:25:43 +00:00
lukem f41de51799 be consistent about "MS-DOS" 2003-10-06 12:02:52 +00:00
itojun 731ae88ecd realloc pedant 2003-09-19 08:35:15 +00:00
dsl 1ce757782d Define and use PRIdaddr for printing disk block numbers.
Should fix bin/22638 for compilation on amd64.
2003-08-29 16:31:30 +00:00