Commit Graph

260 Commits

Author SHA1 Message Date
wiz 82924459cb Use more markup, fix xref, serial comma, other misc. fixes. 2006-02-04 20:10:53 +00:00
dsl 79bd2ddb02 Update/rewrite to match reality and in a muchmore succinct format. 2006-01-29 00:04:26 +00:00
jmc fa63539af8 Fix acorn builds 2005-12-07 04:38:32 +00:00
dsl 409a3e040d Fix alpha build - pointed out by Kurt Schreiner on port-alpha 2005-10-20 20:08:33 +00:00
dsl 65151c95f1 Rototil the way disklabel -r reads and writes labels.
In particular the 'read' part plays 'hunt the disklabel' in order to get a
label into a local buffer - from where it can be displayed/edited.
The 'write' part makes a separate scan of the disk looking for places to
write the label.
The main changes are:
- It can no longer write the first 8k of the mbr to the pbr (or v.v.)
- All labels on the disk (that it can find) get updated during a write
- With -A all the labels are displayed (inc. those deleted by -D)
- Addition of -D which will delete (by one's complimenting dk_magic{2}) and
  existing labels before writing labels to the expected locations.
- -v gives some verbose output to stderr, -vv more etc
A better basis for processing incorrect endian labels, or labels from other
architectures.
2005-10-19 21:22:21 +00:00
tsutsui 40d804cfae Sync DK types and FS types with <sys/disklabel.h>.
XXX: More other stuff should be sync'ed?
2005-09-21 14:51:20 +00:00
uwe 066571f357 Oops, brain fart. PRIu32 should be "u", not "d". 2005-08-27 23:34:52 +00:00
uwe d42d0f4fb3 Define PRIu32 in host environments that don't have it defined.
Define it to "d", as we are unlikely to support hosts where int is
smaller than 32 bits anyway :).
2005-08-27 22:38:02 +00:00
uwe a71ee33abc When building as host tool don't include "../../include/util.h".
getlabel{offset,sector} and opendisk functions declared in that file
are not used in this case anyway, and <util.h> pulls in unwatned
includes (e.g. <utmpx.h> doesn't exist on FreeBSD 4.*).

XXX: We can probably undo the #if !HAVE_NBTOOL_CONFIG_H kludge in
<util.h> now.
2005-08-27 22:21:14 +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
wiz a2074cd992 Quote Fr so options are sorted properly. 2005-06-19 17:24:20 +00:00
dsl 506fe1826c Rip out the support for writing bootstrap code. installboot(8) contains
support for hp300, hp700 and vax, $MACHINE is never arm32.
Fix usage output to only contain progname() once - bug introduced in rev 1.89
2005-06-17 21:20:18 +00:00
dsl 37bbe98710 Remove the never changed 'bootxx' variable 2005-06-15 20:49:41 +00:00
dsl efb521dba8 Rip out the references to the installation of more than one bootstrap file.
Only arm32 needs the -B stuff at all, all other ports use installboot(8).
2005-06-15 20:31:47 +00:00
dsl f74e227614 Remove all the code that was under 'NUMBOOT > 1' nothing has set that for
a long time.
2005-06-15 20:19:03 +00:00
dyoung 1726c417de Make disklabel(8) into a host-tool, "nbdisklabel." Move disklabel.c
to main.c to avoid a name collision with lib/libc/gen/disklabel.c
when we build nbdisklabel.  Still todo: commit host-tool build
infrastructure to src/tools/disklabel/.
2005-06-12 19:18:34 +00:00
christos 8dba43fbdf Recognize more units and be more helpful when we enter bad units. 2005-04-07 21:27:44 +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 ad7c30a166 WARNS=2 2005-01-20 15:52:09 +00:00
hubertf 531272da6c Translate an error message from C to english.
Before:	disklabel: warning, partition g: offset % cylinder-size != 0
After:	disklabel: warning, partition g: not starting on cylinder boundary
2004-11-12 01:00:40 +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
enami fdca3f0cf1 Warn overlapping partitions (except the one marked as FS_UNUSED).
Address PR#10777.
2004-07-13 21:23:13 +00:00
jkunz 93856baf4d Add hp700 MD options for proper boot code handling. 2004-06-28 18:21:43 +00:00
enami 4a723d4f79 A variable referenced isn't `write only'.
Wrap long line and fix some indent while here.
2004-06-24 03:13:00 +00:00
abs cb52ff7f22 Fix some interesting disklabel lossage:
If the input to 'disklabel' (non -i) referenced a partition two or more
larger than that permitted by npartitions it would error out with 'bad
partition name' (and the option given to re-edit if -e). If a partition one
larger was used it would be dropped from the disklabel with a warning and the
label written anyway! The (off by one) check for a bad partition name was
against npartitions anyway, rather than MAXPARTITIONS. npartitions was just
read from the disklabel and could have been set to an arbitrary value.

Given 'disklabel -i' sets npartitions automatically, make the normal case
check partition names against MAXPARTITIONS, and if necessary increase
npartitions to the size needed to hold the last partition used.

While here remove two 'write only' uses of a 'part' variable.
2004-06-22 18:32:45 +00:00
snj 0e4b8938d9 Bump date for last. Put the exit EXIT STATUS section in the right place.
New sentence, new line.  Correct two typos.
2004-05-28 20:46:52 +00:00
erh 932a41d42e Make it possible to distinguish between exit values that indicate errors,
and those that are warnings.  Document the exit statuses in the man page.
2004-05-28 17:46:49 +00:00
wiz d5ca829d8b Single-letter options do not need a line each; add more
commas; drop trailing whitespace; use Pa where appropriate.
2004-03-20 18:51:06 +00:00
dyoung 863043691e Add flag -F to disklabel. Flag -F indicates that the target of the
disklabel operation is a file, not a disk. With -t disktab and -T
disktype, the user may tell disklabel the "geometry" for the file.
2004-03-19 18:22:31 +00:00
wiz f05120b375 Add Xref to mscdlabel, bump date. 2004-03-18 21:13:19 +00:00
christos c89e18bcd0 Fix remaining issues:
- use getulong everywhere for proper range checking
	- fix error checking in getulong
2004-03-14 00:39:53 +00:00
dsl f1c67110ff Fix breakage of last commit (disklabel -R just plain didn't work!)
Convert two large nasty #defines into much smaller (still nasty) #defines
that call proper functions.
Fixes PR 24765
2004-03-13 22:04:37 +00:00
itojun 6c57d297ac use strtoul() instead of atoi(). have proper range check for each fields. 2004-02-29 21:31:14 +00:00
dsl 7d06c8be4a Print everything unsigned - helps a bit for disks with [2^31..2^32) sectors. 2004-02-28 18:19:00 +00:00
lukem 1fa0b4f2cc * Enable SAVEBOOTAREA on i386 and amd64 (by merging the Makefile
controls with the section for the other MBR-using platforms that
  already enable this)
* Don't prompt the user to "erase the previous contents of the disk"
  when there's no NetBSD MBR partition; SAVEBOOTAREA is sufficient.

These fixes mean that you can create a disklabel (on an i386/amd64) on a disk
that doesn't have a NetBSD MBR partition without trashing the existing MBR.
The previous behaviour was extremely annoying when working with media such
as FAT-formatted CF cards, and didn't really protect people with such from
accidentally trashing part of sector 1 of such disks, and made it extremely
easy to trash sectors 0..15 of those disks instead.
2004-01-18 22:34:22 +00:00
dsl b2cf925344 Use correct sector number when the netbsd partition is in the extended
partition chain (and not the first extended partition).
2004-01-18 16:25:59 +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
jdc 3dcb42ad4b Add missing ' in prompt text.
Pointed out by Allen Briggs.
2003-12-29 21:21:25 +00:00
jdc dbc3f17967 If a partition is adjusted so that it falls off the end of the disk, display
a '+' character (aka the '*').

OK'ed by Christos.
2003-12-29 19:13:19 +00:00
jdc 256b6fecd8 Add the ability to define a partition as starting after another partition.
If chaining is on, display all changed partitions (not just this one).

OK'ed by Christos.
2003-12-29 19:12:29 +00:00
dyoung f28870d8ac fix spelling, s/extented/extended/ 2003-12-11 05:11:50 +00:00
bouyer 6fb817f5dd Commit changes proposed on tech-kern Thu, 6 Nov 2003
- factor out disksubr.c between sun3, sparc and sparc64. Keep the sun3
  groveling code to find a NetBSD disklabel in the first sector (so that it
  can find a label at the old sun3 LABELOFFSET) as a fallback is not
  label at LABELOFFSET, or sun label is present.
- Fix the sun3 LABELOFFSET (was 64, but the kernel wrote the NetBSD label at
  128)
- Make next68k disksubr.c always write a next-compatible disklabel.
- remove #ifdef __sparc__ hack from disklabel(8), and change it to issue
  a DIOCWDINFO after writing the disklabel to the raw partition in the
  -r/-I case (so that the kernel can convert the label if needed).
2003-11-15 17:52:30 +00:00
fvdl fe6b4c315f Bring back disklabel -B for now, since hp300 installboot isn't ready
for prime time yet.
2003-11-10 09:22:09 +00:00
dsl 6db70be120 Rip out all the '-B bootblock' support, everything should use installboot(8).
(can only affect arm32, hp300 and vax ports, and doesn't affect sysinst).
2003-11-08 09:25:01 +00:00
shin 2c415ee56d playstation2 needs MBR support in disklabel(8). 2003-11-02 02:52:58 +00:00
pooka bb95bd5936 Handle partition offset and size as unsigned entities. 2003-10-20 13:20:20 +00:00
pooka 84a1b52c43 Partition size and offset inside the disklabel are unsigned. Print
them as unsigned so that we don't print negative values when we're
halfway through.
2003-10-20 13:10:48 +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
agc bf07c8719a Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22308, verified by myself.
2003-08-07 10:04:11 +00:00