environment variables to override the sector number, and the
bytes-offset in the sector, where disklabel(8) writes a disklabel.
If disklabel(8) was compiled as a host tool, then the defaults
still come from the port's LABELOFFSET and LABELSECTOR #defines.
Otherwise, the defaults still come from the sysctls, kern.labelsector
and kern.labeloffset.
This change helps me create a bootable CompactFlash image with both
a Master Boot Record (MBR) and a BSD disklabel for the RouterBOARD
153. The RB 153 is an evbmips board with a CompactFlash slot. It
searches the MBR on a CompactFlash card for a partition containing
an ELF kernel. When disklabel(8) is built for evbmips, it will
ordinarily overwrite an MBR with the BSD disklabel.
logical operation, rather than compliment, as in praise, the magic
number of the disk.
There are probably other instances of this in the tree. We should fix
them.
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.
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.
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/.
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.
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.