Safe WIP: mkimg is a user-space utility for creating disk images.
In its current form and shape, it creates images with the correct
partition contents and overall image layout. What it doesn't do
yet is actually scribble the metadata, such as partition tables
and boot code. This is where I'd like to leverage code from other
places, such as geom_part, and if possible/feasible.
Also, the utility should be a little bit smarter about files and
pipes so that we create temporary files only when needed (e.g.
when we don't know the size of a partition's contents in advance
while wrting the image to stdout).
Now that we can include <sys/diskpc98.h> and <sys/diskmbr.h> at
the same time withiut conflict, use the constants defined in them.
Set BINDIR & WARNS while we're outside the source tree.
Add mkimg.h. It contains the 'part' structure definition and the linked
list (STAILQ) so that it can be shared and re-used in all source files.
Replace the now unneeded scheme_add_part() with scheme_check_part() for
posterity.

Also (should have been a separate commit), remove the enforcement of
creating a GPT table with at least 128 entries. While this is generally
advised as the default or minimum, it's not actually a hard requirement.
We now recreate a table that's precisely enough (rounded of course).

WHile
Expand usage(). This serves even now as a good reminder.
Use linker sets to provide build-time selection of the schemes
that need to be supported. Each scheme provides data and callbacks
for handling the scheme-specifics.
To this end, put each scheme in its own source file.
Check the partition type alias as defined by the scheme.
Replace *_get_leader() and *_get_trailer() with a single *_metadata().
This single function takes a where argument to indicate the kind of
metadata to "size". This way we can also get rid of the "padding"
field in the scheme structure.
This should make it a little more understandable what's going on.
Add a scheme-specific write callback to write the metadata.
While here:
1.  Move FreeBSD-specific headers to a more centralized place, so that
    it's easier to port mkimg.
2.  Remove inclusion of <uuid.h> where we don't need it (copy-pasted).
3.  Check the partition data given on the command line before we do any
    I/O.
4.  Add scheme_round() for rounding the partition size.
5.  Have scheme_write call the scheme-specific write callback and have
    it propagate errors back to the caller.
Dump my WIP of write support for GPT. This compiles, appears to be
complete, but isn't accepted by g_part_gpt. Time to debug and fix.
Fix writing GPT:
1.  Fix copy-paste bug that resulted in not sizing the image correctly
    for the secondary header and table.
2.  The hdr_lba_end field in the header is the LBA of the last usable
    sector, not the one after it.

While here, fix a white-space nit.
Make this work on big-endian architectures by adding encoding.
Add support for partition labels and write them for GPT.
Update usage for label support.
Add more partition types (mostly just the FreeBSD ones) to GPT.
Avoid having schemes use literal strings by introducing an enum
as the intermediate representation (see geom_part).
Handle the -b option for specifying boot code that lives in the
partitioning scheme's meta data. Implement it for GPT.
Vendor import of OpenSSH 6.6p1.
Flesh-out MBR support. The CHS fields need more thought/work...
Revamp:
1.  Make secsz globally visible.
2.  Have all code use the global secsz and nparts, rather than passing
    them around.
3.  Introduce lba_t as the type to use when talking about block addresses.
4.  Work on LBAs instead of offsets. There's just too much division with
    the sector size and there's really no value to use by offsets other
    than that is what lseek() wants. For that we now have mkimg_seek().

The bigger picture is that geometry (cylinders, heads, sectors/track) and
also a possible physical sector size are to be globals that can be used
from anyway. We really don't want to pass all that stuff as arguments to
functions and then add __unused for most of them...
And the magic number is... necessary.