]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/kgzip/kgzip.8
This commit was generated by cvs2svn to compensate for changes in r51384,
[FreeBSD/FreeBSD.git] / usr.sbin / kgzip / kgzip.8
1 .\" Copyright (c) 1999 Global Technology Associates, Inc.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
17 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
18 .\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
19 .\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
20 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
22 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd July 19, 1999
28 .Dt KGZIP 8
29 .Os FreeBSD
30 .Sh NAME
31 .Nm kgzip
32 .Nd compress a kernel
33 .Sh SYNOPSIS
34 .Nm kgzip
35 .Op Fl cv
36 .Op Fl l Ar loader
37 .Op Fl o Ar output
38 .Ar file
39 .Sh DESCRIPTION
40 The
41 .Nm
42 utility compresses a kernel or some other bootable binary.  Operation
43 is in two phases as follows:
44 .Bl -enum
45 .It
46 A load image of the executable file is built which omits all but
47 the
48 .Sq text
49 and
50 .Sq data
51 segments.  This image is compressed using
52 .Xr gzip 1
53 and output as data in relocatable object format.
54 .It
55 The object file is linked with a special self-hosting loader, producing
56 an executable suitable for booting with either the second- or
57 third-level bootstraps.
58 .El
59 .Pp
60 Supported input formats are ELF and a.out ZMAGIC; the output format
61 is always ELF.  Only 32-bit objects are supported.
62 .Pp
63 If the
64 .Ar file
65 operand has a
66 .Sq .o
67 suffix, input is assumed to be for the link phase, and the first phase
68 is omitted.
69 .Pp
70 The options are:
71 .Bl -tag -width Fl
72 .It Fl c
73 Omit the link phase.
74 .It Fl v
75 Display object file information.
76 .It Fl l Ar loader
77 Link
78 .Ar loader
79 as the loader.
80 .It Fl o Ar output
81 Name the output file
82 .Ar output .
83 The default is to use the input name with the suffix
84 .Sq .o
85 (for relocatables) or
86 .Sq .kgz
87 (for executables).
88 .El
89 .Sh NOTES
90 Global variables equivalent to the following are defined in the output:
91 .Bd -literal
92 struct kgz_hdr {
93     char        ident[4];       /* identification: "KGZ" */
94     uint32_t    dload;          /* decoded image load address */
95     uint32_t    dsize;          /* decoded image size */
96     uint32_t    isize;          /* image size in memory */
97     uint32_t    entry;          /* entry point */
98     uint32_t    nsize;          /* encoded image size */
99 } kgz;
100
101 uint8_t kgz_ndata[];            /* encoded data */
102 .Ed
103 .Pp
104 The encoded data is simply
105 .Xr gzip 1
106 output: a header (with no optional fields); compressed data; and 32-bit
107 CRC and size values.
108 .Sh FILES
109 .Bl -tag -width /usr/lib/kgzldr.o -compact
110 .It Pa /usr/lib/kgzldr.o
111 The default loader
112 .El
113 .Sh SEE ALSO
114 .Xr gzip 1 ,
115 .Xr ld 1 ,
116 .Xr a.out 5 ,
117 .Xr boot 8 ,
118 .Xr loader 8
119 .Sh DIAGNOSTICS
120 Exit status is 0 on success and >0 on error.
121 .Sh AUTHORS
122 .An Robert Nordier Aq rnordier@FreeBSD.org .
123 .Sh BUGS
124 As symbols are lost, the usefulness of this utility for compressing
125 kernels is limited to situations where
126 .Xr loader 8
127 cannot be used; otherwise the preferred method of compressing a kernel
128 is simply to
129 .Xr gzip 1
130 it.