History log of /freebsd-10.1-release/usr.bin/mkimg/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
273098 14-Oct-2014 marcel

MF10 r272774:
Add 3 long options (--version, --formats & --schemes) for getting
information about mkimg itself.

mkimg version: 20140927

Requested by: gjb
Approved by: re (marius)
Relnotes: yes

272819 09-Oct-2014 marcel

MF10 r272773: Add QCOW v1 & v2 support

Requested by: gjb@
Approved by: re (marius)
Relnotes: yes

272461 03-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


272030 23-Sep-2014 marcel

MFC 271881: Fix partition alignment and image rounding when any of
-P (block size), -T (track size) or -H (number of heads) is given.

Approved by: re@ (gjb)


271967 22-Sep-2014 marcel

MFC 271482: Add support for adding empty partition entries.

Relnotes: yes
Approved by: re@ (gjb)


271846 18-Sep-2014 marcel

Be compatible with boot code that starts right after the disk label in
the second sector by only clearing the amount of bytes needed for the
disklabel in the second sector. Previously we were clearing exactly 1
sector worth of bytes and as such writing over boot code that may have
been there.
Since we do support more than 8 partitions, make sure to set all fields
in d_partitions. For the first 8 partitions this is unneeded, but for
partitioons 9 and up this compensates for the fact that we don't clear
an entire sector anymore.
Obviously, one cannot use more than 8 partitions when using boot code
that starts right after the disk label.

Relevant GRNs:
107879 - Employ unused bytes after the disklabel in the second sector.
189500 - Revert the part of change 107879 that employs the unused bytes
after the disklabel in the 2nd sector for boot code.

Obtained from: Juniper Networks, Inc.

Approved by: re@ (gjb)


271843 18-Sep-2014 marcel

Fix checksum calculation:
1. Iterate over all partitions counted in the label, which can be more
than the number of partitions given to mkimg(1).
2. Start the checksum from the beginning of the label; not the beginning
of the bootarea.

Tested with bsdlabel(8).

Approved by: re@ (rodrigc)


269900 13-Aug-2014 marcel

MFC 269745: Create a redundant grain directory and table.


269225 29-Jul-2014 pluknet

MFC r268727 (by delphij):

Add a bandaid to fix GCC build (on sparc64 et al).


269177 28-Jul-2014 marcel

MFC r268236,268264,268524,268646,268802,269021:
This brings VHD support to mkimg(1); both dynamic and fixed file formats.
Dynamic VHD and VMDK file images are now sparsely written, meaning that
"free" sectors do not occupy space.

Relnotes: yes


268161 02-Jul-2014 marcel

MFC mkimg(1) -- revisions 268159, 268134, 266556, 266514, 266513,
266512, 266511, 266510, 266509, 266176, 265468, 265467,
265462, 265170, 263926, 263924, 263923, 263919 and 263918.

Revision 267182 changed mkimg.1 alongside other unrelated manpages.
The change to mkimg.1 has been applied without registering a merge
of the revision. This allows a future merge of r267182 to happen.

Relnotes: yes


263918 29-Mar-2014 marcel

Add mkimg, a utility for making disk images from raw partition contents.
The partitioning scheme can be one of the schemes supported by gpart.

Reviewed by: sjg
Obtained from: Juniper Networks, Inc.


263898 29-Mar-2014 marcel

Build this on sparc64, where we don't have LABELSECTOR nor LABELOFFSET
defined. Improve portability by eliminating their use.


263897 29-Mar-2014 marcel

Make this build on ia64 w/ gcc.


263896 29-Mar-2014 marcel

Fix build on i386 w/ clang.


263895 29-Mar-2014 marcel

Add a paragraph about running mkimg without arguments to get a list
of supported schemes and/or a detailed description of how to specify
partitions.


263894 29-Mar-2014 marcel

Document how labels can be given to partitions.


263893 29-Mar-2014 marcel

Handle the raw partition of the BSD and VTOC schemes.


263867 28-Mar-2014 marcel

Make mkimg a general command and not a maintenance command.


263866 28-Mar-2014 marcel

Define SPARSE_WRITE to enable writing sparse files. Output compares ok...


263865 28-Mar-2014 marcel

Flesh-out manpage.


263864 28-Mar-2014 marcel

Use :- and not :! for pipes. ! needs to be escaped, which adds to the
hassle.


263862 28-Mar-2014 marcel

Write verbosity to stderr. The image may be written to stdout.
While here, fix writing to stderr, by not calling errc()
unconditionally, but only when there's an error.


263857 28-Mar-2014 marcel

Write sparse files by default (when SPARSE_FILE is defined).
While here, detect errors when writing to stdout.


263856 28-Mar-2014 marcel

Partitions start on cylinder boundaries.


263855 28-Mar-2014 marcel

Partitions start on track boundaries.


263854 28-Mar-2014 marcel

Partitions start on track boundaries.


263850 27-Mar-2014 marcel

Remove the -z flag. Let's just write a sparse file whenever we can.


263849 27-Mar-2014 marcel

Properly fill in d_nsectors, d_ntracks, d_ncylinders & d_secpercyl.
Round the image size to a multiple of the cyclinder size.


263848 27-Mar-2014 marcel

Remember operator precedence?


263845 27-Mar-2014 marcel

Give vtoc8 a change to work: when setting the physical block size to 4K,
sectors/track to 8 and number or heads to 1, partitions that are block
aligned are also cyclinder aligned. With that trick, fix the vtoc8:
1. Set physcyls, ncyls, altcyls, nheads and nsecs appropriately.
2. Truncate the image size to exactly ncyls * nheads * nsecs * secsz.
3. Properly write the cylinder number as the start of the partition.
4. Oh, and actually calculate the checksum of the label...


263844 27-Mar-2014 marcel

1. When calculating block addresses, round to the physical block
size.
2. Replace scheme_first_block() & scheme_next_block() with
scheme_metadata(). When we round to block sizes, we can't
reliably fixup any miscalculations.
3. In scheme_write, calculate ncyls (number of cyclinders), based
on the total size, sectors/track and number of heads.
4. Add verbosity when constructing the partitions. This includes
the starting block address and size in bytes and blocks.
5. Add verbosity about the sectors/track and number of heads.


263843 27-Mar-2014 marcel

Remove trksz, which was hardcoded to 1, and replace it by secs, which
can be set on the command line.


263841 27-Mar-2014 marcel

Fix writing the start and size fields.


263831 27-Mar-2014 marcel

1. Add -v option to increase vebosity levels
2. Fix copy-paste bug -- acrually check secsz for being a power of 2
3. Check secsz and blksz parameters
4. Print the sector and block size when -v is given


263829 27-Mar-2014 marcel

Add scheme_max_secsz() for returning the maximum sector size supported
by the partitioning scheme.


263709 25-Mar-2014 marcel

First batch of media control:
1. Change -h to -H and change -t to -T. Use -H to specify the number of
heads and -T to specify the track size (number of sectors per track).
2. Add -S and -P. Use -S to specify the logical sector size and -P to
specify the physical sector size.

Default to 512 for both the logical and physical sector size.
Set nheads and nsecs to 1 by default.


263706 25-Mar-2014 marcel

Move setting CHS fields to mbr_chs() in preparation of ...


263700 25-Mar-2014 marcel

Allow schemes to specify a maximum sector size. The minimum is fixed
at 512. This allows checking of the sector size up-front when given
on the command line.


263699 25-Mar-2014 marcel

Mostly implement the vtoc8 scheme. The vtoc8 scheme uses cylinders for
the beginning of partitions, which makes it sensitive to geometry.
Again, we'll need to revisit this.


263697 25-Mar-2014 marcel

Mostly implement the pc98 scheme. The partition table has no LBA
fields at all, so we're entirely dependent upon CHS addressing.
And CHS addressing is what needs more work.


263674 23-Mar-2014 marcel

Implement the EBR scheme. Use a function for filling in the CHS fields.
For now, put 0xff in each field. This needs to be revisited when we
have proper geometry. Note that even without proper CHS values, it's
already accepted by the kernel.


263673 23-Mar-2014 marcel

Add support for the fat32 and ebr aliases.


263672 23-Mar-2014 marcel

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).


263669 23-Mar-2014 marcel

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.


263656 23-Mar-2014 marcel

Implement the APM scheme.


263654 23-Mar-2014 marcel

And the magic number is... necessary.


263653 23-Mar-2014 marcel

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...


263652 22-Mar-2014 marcel

Flesh-out MBR support. The CHS fields need more thought/work...


263537 21-Mar-2014 marcel

Handle the -b option for specifying boot code that lives in the
partitioning scheme's meta data. Implement it for GPT.


263487 21-Mar-2014 marcel

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).


263467 21-Mar-2014 marcel

Update usage for label support.


263466 21-Mar-2014 marcel

Add support for partition labels and write them for GPT.


263465 21-Mar-2014 marcel

Make this work on big-endian architectures by adding encoding.


263462 21-Mar-2014 marcel

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.


263461 21-Mar-2014 marcel

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.


263442 20-Mar-2014 marcel

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.


263440 20-Mar-2014 marcel

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.


263414 20-Mar-2014 marcel

Check the partition type alias as defined by the scheme.


263409 20-Mar-2014 marcel

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.


263383 19-Mar-2014 marcel

Expand usage(). This serves even now as a good reminder.


263382 19-Mar-2014 marcel

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


263381 19-Mar-2014 marcel

Set BINDIR & WARNS while we're outside the source tree.


254156 09-Aug-2013 marcel

Now that we can include <sys/diskpc98.h> and <sys/diskmbr.h> at
the same time withiut conflict, use the constants defined in them.


253923 04-Aug-2013 marcel

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).