From owner-man-jp-reviewer@jp.freebsd.org  Sat Aug  7 22:39:42 1999
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id WAA98662;
	Sat, 7 Aug 1999 22:39:42 +0900 (JST)
	(envelope-from owner-man-jp-reviewer@jp.FreeBSD.org)
Received: from od3.sharp.co.jp (firewall-user@od3.sharp.co.jp [202.32.86.132])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id WAA98657
	for <man-jp-reviewer@jp.freebsd.org>; Sat, 7 Aug 1999 22:39:41 +0900 (JST)
	(envelope-from kuma@slab.tnr.sharp.co.jp)
Received: by od3.sharp.co.jp; id WAA25292; Sat, 7 Aug 1999 22:39:40 +0900 (JST)
Received: from unknown(133.159.14.115) by od3.sharp.co.jp via smap (4.1)
	id xma025279; Sat, 7 Aug 99 22:39:29 +0900
Received: from td1.tnr.sharp.co.jp (root@td1.tnr.sharp.co.jp [133.159.52.20]) by od.sharp.co.jp (8.8.5/3.5W-98081113) with ESMTP id WAA19234 for <man-jp-reviewer@jp.freebsd.org>; Sat, 7 Aug 1999 22:39:29 +0900 (JST)
Received: from mailfwd.slab.tnr.sharp.co.jp ([10.32.30.11]) by td1.tnr.sharp.co.jp (8.8.5/3.5W-97080613) with ESMTP id WAA02901 for <man-jp-reviewer@jp.freebsd.org>; Sat, 7 Aug 1999 22:39:28 +0900 (JST)
Received: from server01.slab.tnr.sharp.co.jp ([10.32.50.4])
	by mailfwd.slab.tnr.sharp.co.jp (8.8.4+2.7Wbeta4/3.6Wbeta7) with ESMTP id WAA03757
	for <man-jp-reviewer@jp.freebsd.org>; Sat, 7 Aug 1999 22:39:32 +0900 (JST)
Received: from gaye.slab.tnr.sharp.co.jp (gaye.slab.tnr.sharp.co.jp [10.32.49.117])
	by server01.slab.tnr.sharp.co.jp (8.8.5/3.6Wbeta7 98051815) with ESMTP id WAA15230
	for <man-jp-reviewer@jp.freebsd.org>; Sat, 7 Aug 1999 22:39:27 +0900 (JST)
Received: from gaye.slab.tnr.sharp.co.jp (kuma@localhost) by gaye.slab.tnr.sharp.co.jp (8.8.7/3.5Wpl5) with ESMTP id WAA00853 for <man-jp-reviewer@jp.freebsd.org>; Sat, 7 Aug 1999 22:39:27 +0900 (JST)
Message-Id: <199908071339.WAA00853@gaye.slab.tnr.sharp.co.jp>
To: man-jp-reviewer@jp.freebsd.org
Date: Sat, 07 Aug 1999 22:39:27 +0900
From: Norihiro Kumagai <kuma@slab.tnr.sharp.co.jp>
Reply-To: man-jp-reviewer@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+990727
X-Sequence: man-jp-reviewer 1452
Subject: [man-jp-reviewer 1452] kgzip.8
Errors-To: owner-man-jp-reviewer@jp.freebsd.org
Sender: owner-man-jp-reviewer@jp.freebsd.org
X-Originator: kuma@slab.tnr.sharp.co.jp

$B7'C+$G$9!#(B

kgzip.8 $B$rLu$7$^$7$?!#$O$d$$$3$H(B Section.8 $B;D$r$J$/$7$?$$$7!#(B

--
$B7'C+(B $BE5Bg(B


.\" Copyright (c) 1999 Global Technology Associates, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\"	$Id: kgzip.8,v 1.1.1.1.2.1 1999/07/28 09:05:25 rnordier Exp $
.\" jpman %Id: kgzip.8,v 0.0 1999/07/31 07:33:28 horikawa Stab %
.\"
.Dd July 19, 1999
.Dt KGZIP 8
.Os FreeBSD
.Sh $BL>A0(B
.Nm kgzip
.Nd $B%+!<%M%k$r05=L$9$k(B
.Sh $B=q<0(B
.Nm kgzip
.Op Fl cv
.Op Fl l Ar loader
.Op Fl o Ar output
.Ar file
.Sh $B2r@b(B
.\"X The
.Nm
.\"X utility compresses a kernel or some other bootable binary.  Operation
.\"X is in two phases as follows:
$B%f!<%F%#%j%F%$$O!"%+!<%M%k$=$NB>$N%V!<%H2DG=%P%$%J%j$r05=L$7$^$9!#$3$N(B
$BF0:n$O<!$N(B 2 $B$D$N%U%'!<%:$+$i$J$j$^$9!#(B
.Bl -enum
.It
.\"X A load image of the executable file is built which omits all but
.\"X the
$B<B9T2DG=%U%!%$%k$N%m!<%I%$%a!<%8$O!"(B
.Sq text
$B%;%0%a%s%H$H(B
.\"X and
.Sq data
$B%;%0%a%s%H0J30$N$9$Y$F$r>JN,$7$F:n@.$5$l$^$9!#(B
.\"X segments.  This image is compressed using
$B$3$N%$%a!<%8$r(B
.Xr gzip 1
$B$rMQ$$$F05=L$7!"(B
.\"X and output as data in relocatable object format.
$B:FG[CV2DG=$J%*%V%8%'%/%H7A<0$H$7$F=PNO$7$^$9!#(B
.It
.\"X The object file is linked with a special self-hosting loader, producing
.\"X an executable suitable for booting with either the second- or
.\"X third-level bootstraps.
$B=PNO$5$l$k%*%V%8%'%/%H%U%!%$%k$O!"FC<l$J<+N)%m!<%@$H$H$b$K%j%s%/$5$l!"(B
2 $B%l%Y%k$b$7$/$O(B 3 $B%l%Y%k$N%V!<%H%9%H%i%C%W%W%m%0%i%`$K$h$k%V!<%H$K(B
$BE,$7$?<B9T%U%!%$%k$,@8@.$5$l$^$9!#(B
.El
.Pp
.\"X Supported input formats are ELF and a.out ZMAGIC; the output format
.\"X is always ELF.	Only 32-bit objects are supported.
$B%5%]!<%H$9$kF~NO%U%!%$%k$O(B ELF $B7A<0$H(B ZMAGIC $BIU$-$N(B a.out $B7A<0$G$9!#(B
$B=PNO$N7A<0$O>o$K(B ELF $B$G$9!#(B32 $B%S%C%H%*%V%8%'%/%H$N$_$,%5%]!<%H$5$l$F$$$^$9!#(B
.Pp
.\"X If the
.Ar file
.\"X operand has a
$B%*%Z%i%s%I$,(B
.Sq .o
.\"X suffix, input is assumed to be for the link phase, and the first phase
.\"X is omitted.
$B@\Hx;R$r;}$D>l9g!"F~NO$O%j%s%/%U%'!<%:$K$"$k$H8+$J$5$l!":G=i$N%U%'!<%:$O(B
$B>JN,$5$l$^$9!#(B
.Pp
.\"X The options are:
$B%*%W%7%g%s$O<!$N$H$*$j$G$9!#(B
.Bl -tag -width Fl
.It Fl c
.\"X Omit the link phase.
$B%j%s%/%U%'!<%:$r>JN,$7$^$9!#(B
.It Fl v
.\"X Display object file information.
$B%*%V%8%'%/%H%U%!%$%k>pJs$rI=<($7$^$9!#(B
.It Fl l Ar loader
.\"X Link
.Ar loader
.\"X as the loader.
$B$r%m!<%@$H$7$F%j%s%/$7$^$9!#(B
.It Fl o Ar output
.\"X Name the output file
$B=PNO%U%!%$%k$NL>A0$r(B
.Ar output
$B$H$7$^$9!#(B
.\"X The default is to use the input name with the suffix
$B%G%U%)%k%H$NL>A0$O!"(B($B:FG[CV2DG=7A<0$K$D$$$F$O(B) $BF~NO%U%!%$%kL>$N@\Hx;R$r(B
.Sq .o
.\"X (for relocatables) or
$B$K$7$?$b$N$G$9!#$^$?$O!"(B($B<B9T2DG=7A<0$K$D$$$F$O(B) $BF~NO%U%!%$%k$N@\Hx;R$r(B
.Sq .kgz
.\"X (for executables).
$B$K$7$?$b$N$G$9!#(B
.El
.Sh $BCm<a(B
.\"X Global variables equivalent to the following are defined in the output:
$B0J2<$HEy2A$JBg0hJQ?t$,=PNO$NCf$GDj5A$5$l$^$9!#(B
.Bd -literal
struct kgz_hdr {
    char	ident[4];	/* identification: "KGZ" */
    uint32_t	dload;		/* decoded image load address */
    uint32_t	dsize;		/* decoded image size */
    uint32_t	isize;		/* image size in memory */
    uint32_t	entry;		/* entry point */
    uint32_t	nsize;		/* encoded image size */
 } kgz;

uint8_t kgz_ndata[];		/* encoded data */
.Ed
.Pp
.\"X The encoded data is simply
$B%3!<%I2=$5$l$?%G!<%?$O!"C1$K(B
.Xr gzip 1
.\"X output: a header (with no optional fields); compressed data; and 32-bit
.\"X CRC and size values.
$B$N=PNO$G$9!#%X%C%@(B ($B%*%W%7%g%s%U%#!<%k%I$O0l@Z;}$A$^$;$s(B)$B!"05=L$5$l$?(B
$B%G!<%?!"(B32-bit $B$N(B CRC $B$H%5%$%:$NCM$r;}$A$^$9!#(B
.Sh $B4XO"%U%!%$%k(B
.Bl -tag -width /usr/lib/kgzldr.o -compact
.It Pa /usr/lib/kgzldr.o
.\"X The default loader
$B%G%U%)%k%H$N%m!<%@!#(B
.El
.Sh $B4XO"9`L\(B
.Xr gzip 1 ,
.Xr ld 1 ,
.Xr a.out 5 ,
.Xr boot 8 ,
.Xr loader 8
.Sh $B?GCG(B
.\"X Exit status is 0 on success and >0 on error.
$B@.8y$9$l$P=*N;%9%F!<%?%9$O(B 0 $B$H$J$j!"%(%i!<$,H/@8$9$l$P(B >0 $B$H$J$j$^$9!#(B
.Sh $B:n<T(B
.An Robert Nordier Aq rnordier@FreeBSD.org
.Sh $B%P%0(B
.\"X As symbols are lost, the usefulness of this utility for compressing
.\"X kernels is limited to situations where
$B%7%s%\%k>pJs$O<:$o$l$F$$$^$9$N$G!"%+!<%M%k$N05=L$K$3$N%f!<%F%#%j%F%#$r(B
$B;H$C$FM-1W$JE@$O!"(B
.Xr loader 8
.\"X cannot be used; otherwise the preferred method of compressing a kernel
.\"X is simply to
$B$,;HMQ$G$-$J$$>u67$K8B$i$l$k$3$H$G$9!#$=$l0J30$N>l9g!"C1$K(B
.Xr gzip 1
.\"X it.
$B$r;H$C$F%+!<%M%k$r05=L$9$kJ}$,K>$^$7$$$G$7$g$&!#(B
