Commit Graph

8 Commits

Author SHA1 Message Date
marcel
ace52aef3d 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).
2014-03-21 16:11:49 +00:00
marcel
ee34aed1b5 Add support for partition labels and write them for GPT. 2014-03-21 05:30:27 +00:00
marcel
edfa576ac7 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.
2014-03-21 03:27:42 +00:00
marcel
0dddaf6f49 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.
2014-03-20 20:14:26 +00:00
marcel
3f2295fee5 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.
2014-03-20 19:37:30 +00:00
marcel
7f983a3b38 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.
2014-03-20 00:38:17 +00:00
marcel
cf8b12efb7 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
2014-03-19 21:44:51 +00:00
marcel
20dbae1acc 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).
2013-08-04 02:37:05 +00:00