Commit Graph

190 Commits

Author SHA1 Message Date
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
dsl 26461e4412 Put cylinder number 1023 into the mbr for sectors beyond the CHS limit
(rather than encoding the highest CHS addressable sector).
2003-08-10 10:20:08 +00:00
dsl ae60f83e33 Remove old i386 mbr stuff (move to arch/i386/stand/mbr a while ago)
mbr.8 moved to src/share/man/man8/man8.i386
2003-07-16 11:11:49 +00:00
dsl 02af72a142 Fix code that detects bios geometry from mbr table. 2003-07-14 09:32:12 +00:00
dsl 93e88fd2eb Only look at each pair of CHS values once when trying to guess geometry. 2003-07-07 11:45:00 +00:00
joda e5986b088f add missing . before Fl 2003-06-03 12:35:54 +00:00
itojun 00868410fd asprintf is easier 2003-05-17 23:14:42 +00:00
dsl b081987b73 delete a diagnostic printf that was accidentally left in 2003-05-14 11:24:05 +00:00
wiz c94730c38a MBR, not mbr. 2003-05-06 07:56:03 +00:00
dsl 5e53f766f8 Change a couple of .Em to .Ar 2003-05-01 13:36:25 +00:00
wiz 0682f1a427 Replace some raw roff with mdoc. 2003-05-01 13:01:17 +00:00
wiz 0d14e41651 Improve formatting for [/bootmenu], requested by dsl; add some commas. 2003-05-01 12:55:52 +00:00