Commit Graph

153 Commits

Author SHA1 Message Date
christos
cd40e75014 explain how to clear an entry (without reading the source) 2015-11-22 15:53:10 +00:00
christos
5bf62a09d2 a few more \n's in errors 2015-06-16 23:58:30 +00:00
christos
d3037dba83 fix error messages containing \n 2015-06-16 23:18:54 +00:00
christos
b2fb66aceb remove debugging. 2014-04-04 16:15:30 +00:00
christos
1e0f8240e6 instead of using ugly -1's make args optional 2014-04-03 17:07:11 +00:00
christos
6449a2097b default to something reasonable (like the interactive mode does) instead
of 0 when -1 is specified for the start or size.
2014-04-01 19:08:48 +00:00
christos
58dbdf3810 Allow -1 values in the -s <sysid>/<start>/<size> indicate use the previous
values. For example:
fdisk -f -i /dev/rsd0d # initialize mbr and create an msdos partition.
fdisk -f -u -0 -a -s 169/-1/-1 /dev/rsd0d # converts the msdos partition
to a netbsd one, and makes it active.
2014-03-30 22:18:13 +00:00
jakllsch
6b4d75e30b Always print the MBR drive serial number, even if it's 0. 2014-03-10 15:42:51 +00:00
jakllsch
3106f2915c Improve support for logical sector sizes greater than 512. 2013-04-14 22:48:22 +00:00
christos
c1fffff4c4 Don't produce spurious errors when creating labels on files. 2013-02-13 00:40:28 +00:00
christos
26a38a4618 CID/979997: missing va_end() 2013-02-09 01:50:04 +00:00
tsutsui
0532bb776d Use ${DESTDIR}/usr/mdec for DEFAULT_BOOTDIR on tools fdisk(8)
rather than unknown build host's /usr/mdec directory.

XXX: no option to leave MBR bootcode empty on x86 targets
2012-06-05 13:41:23 +00:00
tsutsui
56ed3d51fc Don't use "#if defined(__i386__) || defined(__x86_64__)" conditionals
in C source file to define option features.
Define proper options in each Makefile per ${MACHINE_ARCH} variable instead.

Previously if a host is x86 and it has /usr/mdec/mbr file in its system,
tools fdisk implicitly installs it as mbr bootcode even for !x86 targets.
2012-05-05 16:03:55 +00:00
christos
788118e647 support sector sizes > 512. 2012-04-06 20:09:26 +00:00
joerg
66dd2755f5 Add __printflike attribution to use vprintf and friends with an argument
as format string.
2012-03-15 02:02:20 +00:00
christos
765bd39696 Also ignore out of space conditions for -I so we can create overlapping
partitions on a full disk. Document and add it to the options.
2011-12-02 15:21:15 +00:00
enami
ecc71da821 Add missing -F flag and -I flag in usage. Sort the order to match
manpage.
2011-12-02 04:05:20 +00:00
christos
6d19ec83d5 put the error check in the conditional where it belongs. 2011-12-02 03:04:11 +00:00
christos
7bef7412af Add a flag to support writing overlapping partitions and explain why. 2011-12-01 22:24:29 +00:00
gson
d2c5449570 fix the sparc build 2011-08-28 15:46:26 +00:00
christos
4d53e32690 one static is enough, otherwise you risk zapping yourself. 2011-08-27 20:49:03 +00:00
joerg
9c28fb5747 staticfy. __dead. 2011-08-27 17:16:01 +00:00
pgoyette
821775e983 Fix parsing of -A option so that the [/ptn_0_offset] part is optional, as
described in the man page.
2011-05-08 14:22:16 +00:00
dsl
4d8b353d15 Put #endif in correct place - fixes PR/42500
Update usage() for -A, and rename one of the variables for clarity.
2009-12-23 18:50:40 +00:00
dsl
9193c05dda Add support for partition being aligned on non-cylinder boundaries.
Info can be specified with -A parameter.
Default is based on how the first partition is defined.
For empty disks larger than 128GB (arbitrary figure) use 1MB alignment.
2009-12-22 21:55:12 +00:00
dsl
5cb32d7a27 Editing partitions larger than 1TB works better if 'decimal' returns
64 bit integer values!
2009-12-22 21:04:37 +00:00
dsl
795733c59e Add a large comment about disk geometries.
Rename (with #defines) the variables use for aligning partitions to
separate them from the bios geometry.
All in advance of allowing other partition alignments (eg 2048 sectors).
2009-12-20 17:32:09 +00:00
pooka
3d1523b600 Use implicit -F for regular files, much like disklabel(8). 2009-12-17 14:27:49 +00:00
dsl
fb64c309b2 Allow MB, GB and CYL (not just M, G and C) and lower case.
Don't output a splurious 'd' before "cyl".
Fixes PR/37414.
Patch in PR is wrong!
2009-11-04 22:25:56 +00:00
dsl
3b8f95158f Make absence of /usr/mdec/mbr only a warning.
Fixes PR/26510
2009-10-31 20:41:00 +00:00
dsl
68a8748cf1 Change arguments to decimal() to be int64_t.
They need to be able to hold disk sector numbers > 2^31 and also -1.
Should fix PR/34807
2009-08-05 21:31:50 +00:00
christos
1f751faed6 make this compile one non mbr machines (move #define to the general section) 2009-06-02 21:15:53 +00:00
christos
cb3a6fdee7 Delete GPT partitions if we overwrite with MBR to avoid confusion with disks
that have both MBR and a secondary left over GPT partition signature. From
Mike M. Volokhov
2009-06-01 19:57:33 +00:00
drochner
dff56c2587 also fix a comment wrt use of the csysid/cstart/csize vars 2009-04-20 17:06:55 +00:00
sborrill
45a4197562 When using -s flag, read start and size as unsigned to allow for larger
disks. (Thanks to drochner@ for catching it).
2009-04-20 15:03:56 +00:00
lukem
428fc016ff fix sign-compare issues 2009-04-06 12:18:19 +00:00
apb
44f43cf298 Remove local definitions of PRIxxxx macros in favour of the
centralised definitions from tools/compat/compat_defs.h, which
are included via nbtool_config.h.
2009-01-18 21:15:14 +00:00
tnn
bc465dcf63 mbr_dsn is unsigned, print it as such. 2008-03-09 14:57:10 +00:00
dsl
7ddd81a137 Add support for mbr code with ascii keycodes 2008-01-25 23:19:10 +00:00
tsutsui
aa7cb7b8f0 - add a sanity check to avoid possible division by zero
- adjust sector numbers _after_ "Sanity check the data against all zeroes"

Should close PR bin/37656.
2008-01-20 06:39:31 +00:00
apb
ca6bb6217d Track zero is not strictly reserved for the BIOS, that's just a
convention, so don't make it an error in check_overlap().  Sector 0 is
reserved for the MBR, so make that an error in check_overlap().
2007-12-23 10:43:57 +00:00
apb
49b1fa58d7 Report the first active partition. 2007-12-23 08:58:34 +00:00
apb
29a92a49d4 If the partition is unused, then attempting to decode the PBR would
actually decode the MBR from sector 0 of the disk.  Don't do it if
v_flag < 3.
2007-12-23 08:14:28 +00:00
dsl
fe8a8005c1 Make this compile without -Wno-pointer-sign
(Needs updated bootblock.h)
2007-11-29 23:19:25 +00:00
dsl
0d1f6529aa Change -F to not use opendisk().
Don't change default to the boot volume until after we've found we aren't
  doing -F.
For tool-fdisk enforce -F and use #defines to make code that can no
  longer possibly execute compile.
2007-11-29 23:02:00 +00:00
apb
02c42d6bae Remove unwanted ">" from a printed message. 2007-11-18 19:19:00 +00:00
tsutsui
b682074ae4 Don't print Drive serial number if -S (setting shell variables) is specified. 2007-10-28 10:02:08 +00:00
tls
ae75a5cdbe This program is a host tool, so when we use newfangled C features like
PRIxyz we have to ensure it still builds on hosts with Old compilers.
Noticed while building a cross-toolchain on FreeBSD 4.
2007-09-04 00:34:58 +00:00
dsl
4c11bfb2e9 Preserve the mbr 'driver serial number' when copying in the netbsd
mbr code.  Should leave windows vista bootable.
Print the dsn from the mbr, not each pbr.
2007-07-05 20:30:29 +00:00
christos
7731d9378a PR/36223: Milos Negovanovic: Don't ask if we want to install mbr_bootselect
with -f.
2007-04-26 18:51:00 +00:00