xref: /freebsd/usr.sbin/crunch/crunchgen/crunchgen.1 (revision bb0e9238489e4b48836a5d65820df5562565d76c)
1de566360SJordan K. Hubbard.\"
2de566360SJordan K. Hubbard.\" Copyright (c) 1994 University of Maryland
3de566360SJordan K. Hubbard.\" All Rights Reserved.
4de566360SJordan K. Hubbard.\"
5de566360SJordan K. Hubbard.\" Permission to use, copy, modify, distribute, and sell this software and its
6de566360SJordan K. Hubbard.\" documentation for any purpose is hereby granted without fee, provided that
7de566360SJordan K. Hubbard.\" the above copyright notice appear in all copies and that both that
8de566360SJordan K. Hubbard.\" copyright notice and this permission notice appear in supporting
9de566360SJordan K. Hubbard.\" documentation, and that the name of U.M. not be used in advertising or
10de566360SJordan K. Hubbard.\" publicity pertaining to distribution of the software without specific,
11de566360SJordan K. Hubbard.\" written prior permission.  U.M. makes no representations about the
12de566360SJordan K. Hubbard.\" suitability of this software for any purpose.  It is provided "as is"
13de566360SJordan K. Hubbard.\" without express or implied warranty.
14de566360SJordan K. Hubbard.\"
15de566360SJordan K. Hubbard.\" U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
16de566360SJordan K. Hubbard.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
17de566360SJordan K. Hubbard.\" BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18de566360SJordan K. Hubbard.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19de566360SJordan K. Hubbard.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
20de566360SJordan K. Hubbard.\" IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21de566360SJordan K. Hubbard.\"
22de566360SJordan K. Hubbard.\" Author: James da Silva, Systems Design and Analysis Group
23de566360SJordan K. Hubbard.\"			   Computer Science Department
24de566360SJordan K. Hubbard.\"			   University of Maryland at College Park
2597d92980SPeter Wemm.\" $FreeBSD$
26de566360SJordan K. Hubbard.\"
275589c6deSWarren Block.Dd January 6, 2017
28de566360SJordan K. Hubbard.Dt CRUNCHGEN 1
29a4c37c81SRuslan Ermilov.Os
30de566360SJordan K. Hubbard.Sh NAME
318eee6752SRuslan Ermilov.Nm crunchgen
32de566360SJordan K. Hubbard.Nd generates build environment for a crunched binary
33de566360SJordan K. Hubbard.Sh SYNOPSIS
3450ab935dSRuslan Ermilov.Bk -words
35e97407b4SRuslan Ermilov.Nm
36ba2250ddSJosef Karthauser.Op Fl foql
3708826cadSLuigi Rizzo.Op Fl h Ar makefile-header-name
38de566360SJordan K. Hubbard.Op Fl m Ar makefile-name
39019d04d1SLuigi Rizzo.Op Fl p Ar obj-prefix
40de566360SJordan K. Hubbard.Op Fl c Ar c-file-name
41de566360SJordan K. Hubbard.Op Fl e Ar exec-file-name
425589c6deSWarren Block.Ar conf-file
4350ab935dSRuslan Ermilov.Ek
44de566360SJordan K. Hubbard.Sh DESCRIPTION
45de566360SJordan K. HubbardA crunched binary is a program made up of many other programs linked
468eee6752SRuslan Ermilovtogether into a single executable.
478eee6752SRuslan ErmilovThe crunched binary
488eee6752SRuslan Ermilov.Fn main
49de566360SJordan K. Hubbardfunction determines which component program to run by the contents of
508eee6752SRuslan Ermilov.Va argv[0] .
518eee6752SRuslan ErmilovThe main reason to crunch programs together is for fitting
52de566360SJordan K. Hubbardas many programs as possible onto an installation or system recovery
53de566360SJordan K. Hubbardfloppy.
54de566360SJordan K. Hubbard.Pp
557f94b8deSPhilippe CharnierThe
56b23507f4SGreg Lehey.Nm
577f94b8deSPhilippe Charnierutility reads in the specifications in
58de566360SJordan K. Hubbard.Ar conf-file
598eee6752SRuslan Ermilovfor a crunched binary, and generates a
608eee6752SRuslan Ermilov.Pa Makefile
618eee6752SRuslan Ermilovand accompanying
62a5a18d3cSSteve Pricetop-level C source file that when built creates the crunched executable
638eee6752SRuslan Ermilovfile from the component programs.
648eee6752SRuslan ErmilovFor each component program,
658eee6752SRuslan Ermilov.Nm
66de566360SJordan K. Hubbardcan optionally attempt to determine the object (.o) files that make up
678eee6752SRuslan Ermilovthe program from its source directory
688eee6752SRuslan Ermilov.Pa Makefile .
698eee6752SRuslan ErmilovThis information is cached between runs.
707f94b8deSPhilippe CharnierThe
718eee6752SRuslan Ermilov.Nm
727f94b8deSPhilippe Charnierutility uses the companion program
738eee6752SRuslan Ermilov.Xr crunchide 1
74de566360SJordan K. Hubbardto eliminate link-time conflicts between the component programs by
75de566360SJordan K. Hubbardhiding all unnecessary symbols.
76de566360SJordan K. Hubbard.Pp
777f94b8deSPhilippe CharnierThe
78b23507f4SGreg Lehey.Nm
797f94b8deSPhilippe Charnierutility places specific requirements on package
808eee6752SRuslan Ermilov.Pa Makefile Ns s
81753d686dSRuslan Ermilovwhich make it unsuitable for use with
82753d686dSRuslan Ermilov.No non- Ns Bx
83753d686dSRuslan Ermilovsources.
848eee6752SRuslan ErmilovIn particular, the
858eee6752SRuslan Ermilov.Pa Makefile
86b23507f4SGreg Leheymust contain the target
878eee6752SRuslan Ermilov.Ic depend ,
88b23507f4SGreg Leheyand it must define all object files in the variable
898eee6752SRuslan Ermilov.Va OBJS .
90b23507f4SGreg LeheyIn some cases, you can use a fake
91b23507f4SGreg Lehey.Pa Makefile :
92b23507f4SGreg Leheybefore looking for
93b23507f4SGreg Lehey.Pa Makefile
94b23507f4SGreg Leheyin the source directory
95b23507f4SGreg Lehey.Pa foo ,
96b23507f4SGreg Lehey.Nm
97b23507f4SGreg Leheylooks for the file
98b23507f4SGreg Lehey.Pa Makefile.foo
99b23507f4SGreg Leheyin the current directory.
100b23507f4SGreg Lehey.Pp
101de566360SJordan K. HubbardAfter
102b17e90a9SPhilippe Charnier.Nm
1038eee6752SRuslan Ermilovis run, the crunched binary can be built by running
1048eee6752SRuslan Ermilov.Dq Li make -f <conf-name>.mk .
1058eee6752SRuslan ErmilovThe component programs' object files must already be built.
1068eee6752SRuslan ErmilovAn
1078eee6752SRuslan Ermilov.Ic objs
1088eee6752SRuslan Ermilovtarget, included in the output makefile, will
1098eee6752SRuslan Ermilovrun
1108eee6752SRuslan Ermilov.Xr make 1
1118eee6752SRuslan Ermilovin each component program's source dir to build the object
1128eee6752SRuslan Ermilovfiles for the user.
1138eee6752SRuslan ErmilovThis is not done automatically since in release
1140966c02dSJohn-Mark Gurneyengineering circumstances it is generally not desirable to be
115de566360SJordan K. Hubbardmodifying objects in other directories.
116de566360SJordan K. Hubbard.Pp
117de566360SJordan K. HubbardThe options are as follows:
118de566360SJordan K. Hubbard.Bl -tag -width indent
119de566360SJordan K. Hubbard.It Fl c Ar c-file-name
120de566360SJordan K. HubbardSet output C file name to
121de566360SJordan K. Hubbard.Ar c-file-name .
1228eee6752SRuslan ErmilovThe default name is
12350ab935dSRuslan Ermilov.Pa <conf-name>.c .
124de566360SJordan K. Hubbard.It Fl e Ar exec-file-name
125de566360SJordan K. HubbardSet crunched binary executable file name to
126de566360SJordan K. Hubbard.Ar exec-file-name .
1278eee6752SRuslan ErmilovThe default name is
12850ab935dSRuslan Ermilov.Pa <conf-name> .
129de566360SJordan K. Hubbard.It Fl f
1308eee6752SRuslan ErmilovFlush cache.
1318eee6752SRuslan ErmilovForces the recalculation of cached parameters.
132fb7f926eSPoul-Henning Kamp.It Fl l
1338eee6752SRuslan ErmilovList names.
1348eee6752SRuslan ErmilovLists the names this binary will respond to.
13508826cadSLuigi Rizzo.It Fl h Ar makefile-header-name
13608826cadSLuigi RizzoSet the name of a file to be included at the beginning of the
1378eee6752SRuslan Ermilov.Pa Makefile Ns s
1388eee6752SRuslan Ermilovgenerated by
139e97407b4SRuslan Ermilov.Nm .
140*bb0e9238SWarner LoshThis is useful to define some make variables which might affect the behavior of
1418eee6752SRuslan Ermilov.Xr make 1
1428eee6752SRuslan Ermilovand are annoying to pass through environment variables.
143de566360SJordan K. Hubbard.It Fl m Ar makefile-name
1448eee6752SRuslan ErmilovSet output
1458eee6752SRuslan Ermilov.Pa Makefile
1468eee6752SRuslan Ermilovname to
147de566360SJordan K. Hubbard.Ar makefile-name .
1488eee6752SRuslan ErmilovThe default name is
14950ab935dSRuslan Ermilov.Pa <conf-name>.mk .
150ba2250ddSJosef Karthauser.It Fl o
1518eee6752SRuslan ErmilovAdd
1528eee6752SRuslan Ermilov.Dq Li make obj
1538eee6752SRuslan Ermilovrules to each program make target.
154019d04d1SLuigi Rizzo.It Fl p Ar obj-prefix
155019d04d1SLuigi RizzoSet the pathname to be prepended to the
15650ab935dSRuslan Ermilov.Ic srcdir
157019d04d1SLuigi Rizzowhen computing the
15850ab935dSRuslan Ermilov.Ic objdir .
159019d04d1SLuigi RizzoIf this option is not present, then the prefix used
160019d04d1SLuigi Rizzois the content of the
16150ab935dSRuslan Ermilov.Ev MAKEOBJDIRPREFIX
162019d04d1SLuigi Rizzoenvironment variable, or
16350ab935dSRuslan Ermilov.Pa /usr/obj .
164de566360SJordan K. Hubbard.It Fl q
1658eee6752SRuslan ErmilovQuiet operation.
1668eee6752SRuslan ErmilovStatus messages are suppressed.
167de566360SJordan K. Hubbard.El
168de566360SJordan K. Hubbard.Sh CRUNCHGEN CONFIGURATION FILE COMMANDS
1697f94b8deSPhilippe CharnierThe
1708eee6752SRuslan Ermilov.Nm
1717f94b8deSPhilippe Charnierutility reads specifications from the
172de566360SJordan K. Hubbard.Ar conf-file
1738eee6752SRuslan Ermilovthat describe the components of the crunched binary.
1748eee6752SRuslan ErmilovIn its simplest
175de566360SJordan K. Hubbarduse, the component program names are merely listed along with the
176de566360SJordan K. Hubbardtop-level source directories in which their sources can be found.
1777f94b8deSPhilippe CharnierThe
1788eee6752SRuslan Ermilov.Nm
1797f94b8deSPhilippe Charnierutility then calculates (via the source makefiles) and caches the
1808eee6752SRuslan Ermilovlist of object files and their locations.
1818eee6752SRuslan ErmilovFor more specialized
182de566360SJordan K. Hubbardsituations, the user can specify by hand all the parameters that
183b17e90a9SPhilippe Charnier.Nm
184de566360SJordan K. Hubbardneeds.
185de566360SJordan K. Hubbard.Pp
186de566360SJordan K. HubbardThe
187de566360SJordan K. Hubbard.Ar conf-file
188de566360SJordan K. Hubbardcommands are as follows:
189de566360SJordan K. Hubbard.Bl -tag -width indent
1908eee6752SRuslan Ermilov.It Ic srcdirs Ar dirname ...
191de566360SJordan K. HubbardA list of source trees in which the source directories of the
1928eee6752SRuslan Ermilovcomponent programs can be found.
1938eee6752SRuslan ErmilovThese dirs are searched using the
1948eee6752SRuslan Ermilov.Bx
19550ab935dSRuslan Ermilov.Dq Pa <source-dir>/<progname>/
1968eee6752SRuslan Ermilovconvention.
1978eee6752SRuslan ErmilovMultiple
1988eee6752SRuslan Ermilov.Ic srcdirs
199de566360SJordan K. Hubbardlines can be specified.
2008eee6752SRuslan ErmilovThe directories are searched in the order they are given.
2018eee6752SRuslan Ermilov.It Ic progs Ar progname ...
2028eee6752SRuslan ErmilovA list of programs that make up the crunched binary.
2038eee6752SRuslan ErmilovMultiple
2048eee6752SRuslan Ermilov.Ic progs
2058eee6752SRuslan Ermilovlines can be specified.
2068eee6752SRuslan Ermilov.It Ic libs Ar libspec ...
207de566360SJordan K. HubbardA list of library specifications to be included in the crunched binary link.
208de566360SJordan K. HubbardMultiple
2098eee6752SRuslan Ermilov.Ic libs
210de566360SJordan K. Hubbardlines can be specified.
21155f92f64SCeri Davies.It Ic libs_so Ar libspec ...
21255f92f64SCeri DaviesA list of library specifications to be dynamically linked in the
21355f92f64SCeri Daviescrunched binary.
21455f92f64SCeri DaviesThese libraries will need to be made available via the run-time link-editor
21555f92f64SCeri Davies.Xr rtld 1
21655f92f64SCeri Davieswhen the component program that requires them is executed from
21755f92f64SCeri Daviesthe crunched binary.
21855f92f64SCeri DaviesMultiple
21955f92f64SCeri Davies.Ic libs_so
22055f92f64SCeri Davieslines can be specified.
22155f92f64SCeri DaviesThe
22255f92f64SCeri Davies.Ic libs_so
22355f92f64SCeri Daviesdirective overrides a library specified gratuitously on a
22455f92f64SCeri Davies.Ic libs
22555f92f64SCeri Daviesline.
2268eee6752SRuslan Ermilov.It Ic buildopts Ar buildopts ...
22708a15190SJosef KarthauserA list of build options to be added to every make target.
2288eee6752SRuslan Ermilov.It Ic ln Ar progname linkname
229de566360SJordan K. HubbardCauses the crunched binary to invoke
230de566360SJordan K. Hubbard.Ar progname
231de566360SJordan K. Hubbardwhenever
232de566360SJordan K. Hubbard.Ar linkname
2338eee6752SRuslan Ermilovappears in
2348eee6752SRuslan Ermilov.Va argv[0] .
2358eee6752SRuslan ErmilovThis allows programs that change their behavior when
236de566360SJordan K. Hubbardrun under different names to operate correctly.
237de566360SJordan K. Hubbard.El
2388eee6752SRuslan Ermilov.Pp
239de566360SJordan K. HubbardTo handle specialized situations, such as when the source is not
2408eee6752SRuslan Ermilovavailable or not built via a conventional
2418eee6752SRuslan Ermilov.Pa Makefile ,
2428eee6752SRuslan Ermilovthe following
2438eee6752SRuslan Ermilov.Ic special
244de566360SJordan K. Hubbardcommands can be used to set
245b17e90a9SPhilippe Charnier.Nm
246de566360SJordan K. Hubbardparameters for a component program.
247de566360SJordan K. Hubbard.Bl -tag -width indent
2488eee6752SRuslan Ermilov.It Ic special Ar progname Ic srcdir Ar pathname
249de566360SJordan K. HubbardSet the source directory for
250de566360SJordan K. Hubbard.Ar progname .
251de566360SJordan K. HubbardThis is normally calculated by searching the specified
2528eee6752SRuslan Ermilov.Ic srcdirs
253de566360SJordan K. Hubbardfor a directory named
254de566360SJordan K. Hubbard.Ar progname .
2558eee6752SRuslan Ermilov.It Ic special Ar progname Ic objdir Ar pathname
2568eee6752SRuslan ErmilovSet the
25750ab935dSRuslan Ermilov.Pa obj
2588eee6752SRuslan Ermilovdirectory for
259de566360SJordan K. Hubbard.Ar progname .
260019d04d1SLuigi RizzoThe
26150ab935dSRuslan Ermilov.Pa obj
262019d04d1SLuigi Rizzodirectory is normally calculated by looking for a directory
263019d04d1SLuigi Rizzowhose name is that of the source directory prepended by
264019d04d1SLuigi Rizzoone of the following components, in order of priority:
26550ab935dSRuslan Ermilovthe
26650ab935dSRuslan Ermilov.Fl p
26750ab935dSRuslan Ermilovargument passed to the command line; or,
268019d04d1SLuigi Rizzothe value of the
26950ab935dSRuslan Ermilov.Ev MAKEOBJDIRPREFIX
270019d04d1SLuigi Rizzoenvironment variable, or
27150ab935dSRuslan Ermilov.Pa /usr/obj .
272019d04d1SLuigi RizzoIf the directory is not found, the
2738eee6752SRuslan Ermilov.Ic srcdir
274de566360SJordan K. Hubbarditself becomes the
2758eee6752SRuslan Ermilov.Ic objdir .
2768eee6752SRuslan Ermilov.It Ic special Ar progname Ic buildopts Ar buildopts
2778eee6752SRuslan ErmilovDefine a set of build options that should be added to
2788eee6752SRuslan Ermilov.Xr make 1
2798eee6752SRuslan Ermilovtargets in addition to those specified using
2808eee6752SRuslan Ermilov.Ic buildopts
28134944d48SJosef Karthauserwhen processing
28234944d48SJosef Karthauser.Ar progname .
2838eee6752SRuslan Ermilov.It Ic special Ar progname Ic objs Ar object-file-name ...
284de566360SJordan K. HubbardSet the list of object files for program
285de566360SJordan K. Hubbard.Ar progname .
286de566360SJordan K. HubbardThis is normally calculated by constructing a temporary makefile that includes
2878eee6752SRuslan Ermilov.Dq Ic srcdir Ns / Ns Pa Makefile
2888eee6752SRuslan Ermilovand outputs the value of
2898eee6752SRuslan Ermilov.Va $(OBJS) .
2908eee6752SRuslan Ermilov.It Ic special Ar progname Ic objpaths Ar full-pathname-to-object-file ...
291de566360SJordan K. HubbardSets the pathnames of the object files for program
292de566360SJordan K. Hubbard.Ar progname .
293de566360SJordan K. HubbardThis is normally calculated by prepending the
2948eee6752SRuslan Ermilov.Ic objdir
295de566360SJordan K. Hubbardpathname to each file in the
2968eee6752SRuslan Ermilov.Ic objs
297de566360SJordan K. Hubbardlist.
2988eee6752SRuslan Ermilov.It Ic special Ar progname Ic objvar Ar variable_name
2998eee6752SRuslan ErmilovSets the name of the
3008eee6752SRuslan Ermilov.Xr make 1
3018eee6752SRuslan Ermilovvariable which holds the list of
30208826cadSLuigi Rizzoobject files for program
30308826cadSLuigi Rizzo.Ar progname .
30408826cadSLuigi RizzoThis is normally
3058eee6752SRuslan Ermilov.Va OBJS
3068eee6752SRuslan Ermilovbut some
3078eee6752SRuslan Ermilov.Pa Makefile Ns s
3088eee6752SRuslan Ermilovmight like to use other conventions or
3095589c6deSWarren Blockprepend the program's name to the variable, e.g.,
3108eee6752SRuslan Ermilov.Va SSHD_OBJS .
311252f13abSLuigi Rizzo.It Ic special Ar progname Ic lib Ar library-name ...
312252f13abSLuigi RizzoSpecifies libraries to be linked with object files to produce
3133d8d0006SRuslan Ermilov.Ar progname Ns Pa .lo .
314252f13abSLuigi RizzoThis can be useful with libraries which redefine routines in
315252f13abSLuigi Rizzothe standard libraries, or poorly written libraries which
316252f13abSLuigi Rizzoreference symbols in the object files.
3178eee6752SRuslan Ermilov.It Ic special Ar progname Ic keep Ar symbol-name ...
31842ac3bf1SJoerg WunschAdd specified list of symbols to the keep list for program
31942ac3bf1SJoerg Wunsch.Ar progname .
3208eee6752SRuslan ErmilovAn underscore
3218eee6752SRuslan Ermilov.Pq Ql _
3228eee6752SRuslan Ermilovis prepended to each symbol and it becomes the argument to a
32342ac3bf1SJoerg Wunsch.Fl k
32442ac3bf1SJoerg Wunschoption for the
32542ac3bf1SJoerg Wunsch.Xr crunchide 1
326f2e366a1SSheldon Hearnphase.
327f2e366a1SSheldon HearnThis option is to be used as a last resort as its use can cause a
32842ac3bf1SJoerg Wunschsymbol conflict, however in certain instances it may be the only way to
32942ac3bf1SJoerg Wunschhave a symbol resolve.
33067373d62SRuslan Ermilov.It Ic special Ar progname Ic ident Ar identifier
33167373d62SRuslan ErmilovSet the
33267373d62SRuslan Ermilov.Pa Makefile Ns / Ns Tn C
33367373d62SRuslan Ermilovidentifier for
33467373d62SRuslan Ermilov.Ar progname .
33567373d62SRuslan ErmilovThis is normally generated from a
33667373d62SRuslan Ermilov.Ar progname ,
33767373d62SRuslan Ermilovmapping
33867373d62SRuslan Ermilov.Ql -
33967373d62SRuslan Ermilovto
34067373d62SRuslan Ermilov.Ql _
34167373d62SRuslan Ermilovand ignoring all other non-identifier characters.
34267373d62SRuslan ErmilovThis leads to programs named
34367373d62SRuslan Ermilov.Qq Li foo.bar
34467373d62SRuslan Ermilovand
34567373d62SRuslan Ermilov.Qq Li foobar
34667373d62SRuslan Ermilovto map to the same identifier.
347de566360SJordan K. Hubbard.El
348de566360SJordan K. Hubbard.Pp
349de566360SJordan K. HubbardOnly the
3508eee6752SRuslan Ermilov.Ic objpaths
351de566360SJordan K. Hubbardparameter is actually needed by
352e97407b4SRuslan Ermilov.Nm ,
353de566360SJordan K. Hubbardbut it is calculated from
3548eee6752SRuslan Ermilov.Ic objdir
355de566360SJordan K. Hubbardand
3568eee6752SRuslan Ermilov.Ic objs ,
357de566360SJordan K. Hubbardwhich are in turn calculated from
3588eee6752SRuslan Ermilov.Ic srcdir ,
359de566360SJordan K. Hubbardso is sometimes convenient to specify the earlier parameters and let
360b17e90a9SPhilippe Charnier.Nm
361de566360SJordan K. Hubbardcalculate forward from there if it can.
362de566360SJordan K. Hubbard.Pp
363de566360SJordan K. HubbardThe makefile produced by
364b17e90a9SPhilippe Charnier.Nm
365de566360SJordan K. Hubbardcontains an optional
3668eee6752SRuslan Ermilov.Ic objs
367de566360SJordan K. Hubbardtarget that will build the object files for each component program by
3688eee6752SRuslan Ermilovrunning
3698eee6752SRuslan Ermilov.Xr make 1
3708eee6752SRuslan Ermilovinside that program's source directory.
3718eee6752SRuslan ErmilovFor this to work the
3728eee6752SRuslan Ermilov.Ic srcdir
373de566360SJordan K. Hubbardand
3748eee6752SRuslan Ermilov.Ic objs
3758eee6752SRuslan Ermilovparameters must also be valid.
3768eee6752SRuslan ErmilovIf they are not valid for a particular program, that
377de566360SJordan K. Hubbardprogram is skipped in the
3788eee6752SRuslan Ermilov.Ic objs
379de566360SJordan K. Hubbardtarget.
380251c176fSRuslan Ermilov.Sh EXAMPLES
381de566360SJordan K. HubbardHere is an example
382b17e90a9SPhilippe Charnier.Nm
383de566360SJordan K. Hubbardinput conf file, named
384de566360SJordan K. Hubbard.Dq Pa kcopy.conf :
385726b61abSRuslan Ermilov.Bd -literal -offset indent
386de566360SJordan K. Hubbardsrcdirs /usr/src/bin /usr/src/sbin
387de566360SJordan K. Hubbard
388de566360SJordan K. Hubbardprogs test cp echo sh fsck halt init mount umount myinstall
38934944d48SJosef Karthauserprogs anotherprog
390de566360SJordan K. Hubbardln test [       # test can be invoked via [
391de566360SJordan K. Hubbardln sh -sh       # init invokes the shell with "-sh" in argv[0]
392de566360SJordan K. Hubbard
393de566360SJordan K. Hubbardspecial myprog objpaths /homes/leroy/src/myinstall.o # no sources
394de566360SJordan K. Hubbard
39534944d48SJosef Karthauserspecial anotherprog -DNO_FOO WITHOUT_BAR=YES
39634944d48SJosef Karthauser
397de566360SJordan K. Hubbardlibs -lutil -lcrypt
398726b61abSRuslan Ermilov.Ed
399de566360SJordan K. Hubbard.Pp
400de566360SJordan K. HubbardThis conf file specifies a small crunched binary consisting of some
4018eee6752SRuslan Ermilovbasic system utilities plus a homegrown install program
40250ab935dSRuslan Ermilov.Dq Pa myinstall ,
403de566360SJordan K. Hubbardfor which no source directory is specified, but its object file is
404de566360SJordan K. Hubbardspecified directly with the
4058eee6752SRuslan Ermilov.Ic special
406de566360SJordan K. Hubbardline.
407de566360SJordan K. Hubbard.Pp
4088eee6752SRuslan ErmilovAdditionally when
40950ab935dSRuslan Ermilov.Dq Pa anotherprog
4108eee6752SRuslan Ermilovis built the arguments
4118eee6752SRuslan Ermilov.Pp
4128eee6752SRuslan Ermilov.Dl -DNO_FOO WITHOUT_BAR=YES
4138eee6752SRuslan Ermilov.Pp
41434944d48SJosef Karthauserare added to all build targets.
41534944d48SJosef Karthauser.Pp
4168eee6752SRuslan ErmilovThe crunched binary
41750ab935dSRuslan Ermilov.Dq Pa kcopy
4188eee6752SRuslan Ermilovcan be built as follows:
419726b61abSRuslan Ermilov.Bd -literal -offset indent
420de566360SJordan K. Hubbard% crunchgen -m Makefile kcopy.conf    # gen Makefile and kcopy.c
421f6b31571SWolfram Schneider% make objs             # build the component programs' .o files
422de566360SJordan K. Hubbard% make                  # build the crunched binary kcopy
423de566360SJordan K. Hubbard% kcopy sh              # test that this invokes a sh shell
424de566360SJordan K. Hubbard$			# it works!
425726b61abSRuslan Ermilov.Ed
426de566360SJordan K. Hubbard.Pp
4278eee6752SRuslan ErmilovAt this point the binary
42850ab935dSRuslan Ermilov.Dq Pa kcopy
4298eee6752SRuslan Ermilovcan be copied onto an install floppy
430de566360SJordan K. Hubbardand hard-linked to the names of the component programs.
43155f92f64SCeri Davies.Pp
43255f92f64SCeri DaviesNote that if the
43355f92f64SCeri Davies.Ic libs_so
43455f92f64SCeri Daviescommand had been used, copies of the libraries so named
43555f92f64SCeri Davieswould also need to be copied to the install floppy.
436de566360SJordan K. Hubbard.Sh SEE ALSO
4378eee6752SRuslan Ermilov.Xr crunchide 1 ,
43855f92f64SCeri Davies.Xr make 1 ,
43955f92f64SCeri Davies.Xr rtld 1
4400afc94c1SUlrich Spörlein.Sh AUTHORS
4410afc94c1SUlrich Spörlein.An -nosplit
4420afc94c1SUlrich SpörleinThe
4430afc94c1SUlrich Spörlein.Nm
4440afc94c1SUlrich Spörleinutility was written by
44501c2b8acSBaptiste Daroussin.An James da Silva Aq Mt jds@cs.umd.edu .
4460afc94c1SUlrich Spörlein.Pp
4470afc94c1SUlrich SpörleinCopyright (c) 1994 University of Maryland.
4480afc94c1SUlrich SpörleinAll Rights Reserved.
4490afc94c1SUlrich Spörlein.Pp
4500afc94c1SUlrich SpörleinThe
4510afc94c1SUlrich Spörlein.Ic libs_so
4520afc94c1SUlrich Spörleinkeyword was added in 2005 by
45301c2b8acSBaptiste Daroussin.An Adrian Steinmann Aq Mt ast@marabu.ch
4540afc94c1SUlrich Spörleinand
45501c2b8acSBaptiste Daroussin.An Ceri Davies Aq Mt ceri@FreeBSD.org .
456de566360SJordan K. Hubbard.Sh CAVEATS
457de566360SJordan K. HubbardWhile
4588eee6752SRuslan Ermilov.Nm
459de566360SJordan K. Hubbardtakes care to eliminate link conflicts between the component programs
460de566360SJordan K. Hubbardof a crunched binary, conflicts are still possible between the
4618eee6752SRuslan Ermilovlibraries that are linked in.
4628eee6752SRuslan ErmilovSome shuffling in the order of
463de566360SJordan K. Hubbardlibraries may be required, and in some rare cases two libraries may
464f6b31571SWolfram Schneiderhave an unresolvable conflict and thus cannot be crunched together.
465de566360SJordan K. Hubbard.Pp
466753d686dSRuslan ErmilovSome versions of the
467753d686dSRuslan Ermilov.Bx
468753d686dSRuslan Ermilovbuild environment do not by default build the
4698eee6752SRuslan Ermilovintermediate object file for single-source file programs.
4708eee6752SRuslan ErmilovThe
4718eee6752SRuslan Ermilov.Dq Li make objs
4728eee6752SRuslan Ermilovmust then be used to get those object files built, or
473de566360SJordan K. Hubbardsome other arrangements made.
474