The interface for enabling dump compression mirrors that for compressed
user program core dumps. Specifically, the kern.compress_kernel_dumps
sysctl determines whether kernel dumps will be compressed, and
kern.compress_kernel_dumps_gzlevel specifies the compression level.
The compression sysctl has no effect until a dumper is chosen, since the
compression buffer size is determined by the max I/O size of the
underlying dump device.
The implementation works by interposing a compression stream between the
MI kernel dump routines and the raw dump device. The compression stream
flushes to disk whenever its input buffer is full, and once in
dump_finish(), so no modifications to (mini)dumpsys are needed.
The kernel dump header is modified slightly: in addition to the
dumplength field, which gives the size of the dump, we now also have a
dumpextent field, which gives the space between kernel dump headers.
With uncompressed dumps, these are equivalent. The kernel dump header
version is bumped accordingly, and we add a new header magic type,
GZDUMPMAGIC.