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.
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.
Implement the APM scheme.
Implement the BSD scheme. This doesn't quite work as geom_part_bsd
finds an invalid label. I'm not going to worry about that right now,
because there's more to worry about: the BSD disk label has the 'c'
partition for the entire disk and we don't handle this at all.
Note also that the BSD disk label wants a geometry, so this will
have to be revisited anyway once a good solution is in place.
Add the fat32 and ebr aliases. The ebr alias is needed to support
the EBR scheme, as it can only live inside a MBR partition of type
5 (= DOSPTYP_EXT).