xref: /freebsd/usr.sbin/crunch/crunchgen/crunchgen.1 (revision b2c76c41be32f904179efed29c0ca04d53f3996c)
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
25de566360SJordan K. Hubbard.\"
265589c6deSWarren Block.Dd January 6, 2017
27de566360SJordan K. Hubbard.Dt CRUNCHGEN 1
28a4c37c81SRuslan Ermilov.Os
29de566360SJordan K. Hubbard.Sh NAME
308eee6752SRuslan Ermilov.Nm crunchgen
31de566360SJordan K. Hubbard.Nd generates build environment for a crunched binary
32de566360SJordan K. Hubbard.Sh SYNOPSIS
3350ab935dSRuslan Ermilov.Bk -words
34e97407b4SRuslan Ermilov.Nm
35ba2250ddSJosef Karthauser.Op Fl foql
3608826cadSLuigi Rizzo.Op Fl h Ar makefile-header-name
37de566360SJordan K. Hubbard.Op Fl m Ar makefile-name
38019d04d1SLuigi Rizzo.Op Fl p Ar obj-prefix
39de566360SJordan K. Hubbard.Op Fl c Ar c-file-name
40de566360SJordan K. Hubbard.Op Fl e Ar exec-file-name
415589c6deSWarren Block.Ar conf-file
4250ab935dSRuslan Ermilov.Ek
43de566360SJordan K. Hubbard.Sh DESCRIPTION
44de566360SJordan K. HubbardA crunched binary is a program made up of many other programs linked
458eee6752SRuslan Ermilovtogether into a single executable.
468eee6752SRuslan ErmilovThe crunched binary
478eee6752SRuslan Ermilov.Fn main
48de566360SJordan K. Hubbardfunction determines which component program to run by the contents of
498eee6752SRuslan Ermilov.Va argv[0] .
508eee6752SRuslan ErmilovThe main reason to crunch programs together is for fitting
51de566360SJordan K. Hubbardas many programs as possible onto an installation or system recovery
52de566360SJordan K. Hubbardfloppy.
53de566360SJordan K. Hubbard.Pp
547f94b8deSPhilippe CharnierThe
55b23507f4SGreg Lehey.Nm
567f94b8deSPhilippe Charnierutility reads in the specifications in
57de566360SJordan K. Hubbard.Ar conf-file
588eee6752SRuslan Ermilovfor a crunched binary, and generates a
598eee6752SRuslan Ermilov.Pa Makefile
608eee6752SRuslan Ermilovand accompanying
61a5a18d3cSSteve Pricetop-level C source file that when built creates the crunched executable
628eee6752SRuslan Ermilovfile from the component programs.
638eee6752SRuslan ErmilovFor each component program,
648eee6752SRuslan Ermilov.Nm
65de566360SJordan K. Hubbardcan optionally attempt to determine the object (.o) files that make up
668eee6752SRuslan Ermilovthe program from its source directory
678eee6752SRuslan Ermilov.Pa Makefile .
688eee6752SRuslan ErmilovThis information is cached between runs.
697f94b8deSPhilippe CharnierThe
708eee6752SRuslan Ermilov.Nm
717f94b8deSPhilippe Charnierutility uses the companion program
728eee6752SRuslan Ermilov.Xr crunchide 1
73de566360SJordan K. Hubbardto eliminate link-time conflicts between the component programs by
74de566360SJordan K. Hubbardhiding all unnecessary symbols.
75de566360SJordan K. Hubbard.Pp
767f94b8deSPhilippe CharnierThe
77b23507f4SGreg Lehey.Nm
787f94b8deSPhilippe Charnierutility places specific requirements on package
798eee6752SRuslan Ermilov.Pa Makefile Ns s
80753d686dSRuslan Ermilovwhich make it unsuitable for use with
81753d686dSRuslan Ermilov.No non- Ns Bx
82753d686dSRuslan Ermilovsources.
838eee6752SRuslan ErmilovIn particular, the
848eee6752SRuslan Ermilov.Pa Makefile
85b23507f4SGreg Leheymust contain the target
868eee6752SRuslan Ermilov.Ic depend ,
87b23507f4SGreg Leheyand it must define all object files in the variable
888eee6752SRuslan Ermilov.Va OBJS .
89b23507f4SGreg LeheyIn some cases, you can use a fake
90b23507f4SGreg Lehey.Pa Makefile :
91b23507f4SGreg Leheybefore looking for
92b23507f4SGreg Lehey.Pa Makefile
93b23507f4SGreg Leheyin the source directory
94b23507f4SGreg Lehey.Pa foo ,
95b23507f4SGreg Lehey.Nm
96b23507f4SGreg Leheylooks for the file
97b23507f4SGreg Lehey.Pa Makefile.foo
98b23507f4SGreg Leheyin the current directory.
99b23507f4SGreg Lehey.Pp
100de566360SJordan K. HubbardAfter
101b17e90a9SPhilippe Charnier.Nm
1028eee6752SRuslan Ermilovis run, the crunched binary can be built by running
1038eee6752SRuslan Ermilov.Dq Li make -f <conf-name>.mk .
1048eee6752SRuslan ErmilovThe component programs' object files must already be built.
1058eee6752SRuslan ErmilovAn
1068eee6752SRuslan Ermilov.Ic objs
1078eee6752SRuslan Ermilovtarget, included in the output makefile, will
1088eee6752SRuslan Ermilovrun
1098eee6752SRuslan Ermilov.Xr make 1
1108eee6752SRuslan Ermilovin each component program's source dir to build the object
1118eee6752SRuslan Ermilovfiles for the user.
1128eee6752SRuslan ErmilovThis is not done automatically since in release
1130966c02dSJohn-Mark Gurneyengineering circumstances it is generally not desirable to be
114de566360SJordan K. Hubbardmodifying objects in other directories.
115de566360SJordan K. Hubbard.Pp
116de566360SJordan K. HubbardThe options are as follows:
117de566360SJordan K. Hubbard.Bl -tag -width indent
118de566360SJordan K. Hubbard.It Fl c Ar c-file-name
119de566360SJordan K. HubbardSet output C file name to
120de566360SJordan K. Hubbard.Ar c-file-name .
1218eee6752SRuslan ErmilovThe default name is
12250ab935dSRuslan Ermilov.Pa <conf-name>.c .
123de566360SJordan K. Hubbard.It Fl e Ar exec-file-name
124de566360SJordan K. HubbardSet crunched binary executable file name to
125de566360SJordan K. Hubbard.Ar exec-file-name .
1268eee6752SRuslan ErmilovThe default name is
12750ab935dSRuslan Ermilov.Pa <conf-name> .
128de566360SJordan K. Hubbard.It Fl f
1298eee6752SRuslan ErmilovFlush cache.
1308eee6752SRuslan ErmilovForces the recalculation of cached parameters.
131fb7f926eSPoul-Henning Kamp.It Fl l
1328eee6752SRuslan ErmilovList names.
1338eee6752SRuslan ErmilovLists the names this binary will respond to.
13408826cadSLuigi Rizzo.It Fl h Ar makefile-header-name
13508826cadSLuigi RizzoSet the name of a file to be included at the beginning of the
1368eee6752SRuslan Ermilov.Pa Makefile Ns s
1378eee6752SRuslan Ermilovgenerated by
138e97407b4SRuslan Ermilov.Nm .
139*bb0e9238SWarner LoshThis is useful to define some make variables which might affect the behavior of
1408eee6752SRuslan Ermilov.Xr make 1
1418eee6752SRuslan Ermilovand are annoying to pass through environment variables.
142de566360SJordan K. Hubbard.It Fl m Ar makefile-name
1438eee6752SRuslan ErmilovSet output
1448eee6752SRuslan Ermilov.Pa Makefile
1458eee6752SRuslan Ermilovname to
146de566360SJordan K. Hubbard.Ar makefile-name .
1478eee6752SRuslan ErmilovThe default name is
14850ab935dSRuslan Ermilov.Pa <conf-name>.mk .
149ba2250ddSJosef Karthauser.It Fl o
1508eee6752SRuslan ErmilovAdd
1518eee6752SRuslan Ermilov.Dq Li make obj
1528eee6752SRuslan Ermilovrules to each program make target.
153019d04d1SLuigi Rizzo.It Fl p Ar obj-prefix
154019d04d1SLuigi RizzoSet the pathname to be prepended to the
15550ab935dSRuslan Ermilov.Ic srcdir
156019d04d1SLuigi Rizzowhen computing the
15750ab935dSRuslan Ermilov.Ic objdir .
158019d04d1SLuigi RizzoIf this option is not present, then the prefix used
159019d04d1SLuigi Rizzois the content of the
16050ab935dSRuslan Ermilov.Ev MAKEOBJDIRPREFIX
161019d04d1SLuigi Rizzoenvironment variable, or
16250ab935dSRuslan Ermilov.Pa /usr/obj .
163de566360SJordan K. Hubbard.It Fl q
1648eee6752SRuslan ErmilovQuiet operation.
1658eee6752SRuslan ErmilovStatus messages are suppressed.
166de566360SJordan K. Hubbard.El
167de566360SJordan K. Hubbard.Sh CRUNCHGEN CONFIGURATION FILE COMMANDS
1687f94b8deSPhilippe CharnierThe
1698eee6752SRuslan Ermilov.Nm
1707f94b8deSPhilippe Charnierutility reads specifications from the
171de566360SJordan K. Hubbard.Ar conf-file
1728eee6752SRuslan Ermilovthat describe the components of the crunched binary.
1738eee6752SRuslan ErmilovIn its simplest
174de566360SJordan K. Hubbarduse, the component program names are merely listed along with the
175de566360SJordan K. Hubbardtop-level source directories in which their sources can be found.
1767f94b8deSPhilippe CharnierThe
1778eee6752SRuslan Ermilov.Nm
1787f94b8deSPhilippe Charnierutility then calculates (via the source makefiles) and caches the
1798eee6752SRuslan Ermilovlist of object files and their locations.
1808eee6752SRuslan ErmilovFor more specialized
181de566360SJordan K. Hubbardsituations, the user can specify by hand all the parameters that
182b17e90a9SPhilippe Charnier.Nm
183de566360SJordan K. Hubbardneeds.
184de566360SJordan K. Hubbard.Pp
185de566360SJordan K. HubbardThe
186de566360SJordan K. Hubbard.Ar conf-file
187de566360SJordan K. Hubbardcommands are as follows:
188de566360SJordan K. Hubbard.Bl -tag -width indent
1898eee6752SRuslan Ermilov.It Ic srcdirs Ar dirname ...
190de566360SJordan K. HubbardA list of source trees in which the source directories of the
1918eee6752SRuslan Ermilovcomponent programs can be found.
1928eee6752SRuslan ErmilovThese dirs are searched using the
1938eee6752SRuslan Ermilov.Bx
19450ab935dSRuslan Ermilov.Dq Pa <source-dir>/<progname>/
1958eee6752SRuslan Ermilovconvention.
1968eee6752SRuslan ErmilovMultiple
1978eee6752SRuslan Ermilov.Ic srcdirs
198de566360SJordan K. Hubbardlines can be specified.
1998eee6752SRuslan ErmilovThe directories are searched in the order they are given.
2008eee6752SRuslan Ermilov.It Ic progs Ar progname ...
2018eee6752SRuslan ErmilovA list of programs that make up the crunched binary.
2028eee6752SRuslan ErmilovMultiple
2038eee6752SRuslan Ermilov.Ic progs
2048eee6752SRuslan Ermilovlines can be specified.
2058eee6752SRuslan Ermilov.It Ic libs Ar libspec ...
206de566360SJordan K. HubbardA list of library specifications to be included in the crunched binary link.
207de566360SJordan K. HubbardMultiple
2088eee6752SRuslan Ermilov.Ic libs
209de566360SJordan K. Hubbardlines can be specified.
21055f92f64SCeri Davies.It Ic libs_so Ar libspec ...
21155f92f64SCeri DaviesA list of library specifications to be dynamically linked in the
21255f92f64SCeri Daviescrunched binary.
21355f92f64SCeri DaviesThese libraries will need to be made available via the run-time link-editor
21455f92f64SCeri Davies.Xr rtld 1
21555f92f64SCeri Davieswhen the component program that requires them is executed from
21655f92f64SCeri Daviesthe crunched binary.
21755f92f64SCeri DaviesMultiple
21855f92f64SCeri Davies.Ic libs_so
21955f92f64SCeri Davieslines can be specified.
22055f92f64SCeri DaviesThe
22155f92f64SCeri Davies.Ic libs_so
22255f92f64SCeri Daviesdirective overrides a library specified gratuitously on a
22355f92f64SCeri Davies.Ic libs
22455f92f64SCeri Daviesline.
2258eee6752SRuslan Ermilov.It Ic buildopts Ar buildopts ...
22608a15190SJosef KarthauserA list of build options to be added to every make target.
2278eee6752SRuslan Ermilov.It Ic ln Ar progname linkname
228de566360SJordan K. HubbardCauses the crunched binary to invoke
229de566360SJordan K. Hubbard.Ar progname
230de566360SJordan K. Hubbardwhenever
231de566360SJordan K. Hubbard.Ar linkname
2328eee6752SRuslan Ermilovappears in
2338eee6752SRuslan Ermilov.Va argv[0] .
2348eee6752SRuslan ErmilovThis allows programs that change their behavior when
235de566360SJordan K. Hubbardrun under different names to operate correctly.
236de566360SJordan K. Hubbard.El
2378eee6752SRuslan Ermilov.Pp
238de566360SJordan K. HubbardTo handle specialized situations, such as when the source is not
2398eee6752SRuslan Ermilovavailable or not built via a conventional
2408eee6752SRuslan Ermilov.Pa Makefile ,
2418eee6752SRuslan Ermilovthe following
2428eee6752SRuslan Ermilov.Ic special
243de566360SJordan K. Hubbardcommands can be used to set
244b17e90a9SPhilippe Charnier.Nm
245de566360SJordan K. Hubbardparameters for a component program.
246de566360SJordan K. Hubbard.Bl -tag -width indent
2478eee6752SRuslan Ermilov.It Ic special Ar progname Ic srcdir Ar pathname
248de566360SJordan K. HubbardSet the source directory for
249de566360SJordan K. Hubbard.Ar progname .
250de566360SJordan K. HubbardThis is normally calculated by searching the specified
2518eee6752SRuslan Ermilov.Ic srcdirs
252de566360SJordan K. Hubbardfor a directory named
253de566360SJordan K. Hubbard.Ar progname .
2548eee6752SRuslan Ermilov.It Ic special Ar progname Ic objdir Ar pathname
2558eee6752SRuslan ErmilovSet the
25650ab935dSRuslan Ermilov.Pa obj
2578eee6752SRuslan Ermilovdirectory for
258de566360SJordan K. Hubbard.Ar progname .
259019d04d1SLuigi RizzoThe
26050ab935dSRuslan Ermilov.Pa obj
261019d04d1SLuigi Rizzodirectory is normally calculated by looking for a directory
262019d04d1SLuigi Rizzowhose name is that of the source directory prepended by
263019d04d1SLuigi Rizzoone of the following components, in order of priority:
26450ab935dSRuslan Ermilovthe
26550ab935dSRuslan Ermilov.Fl p
26650ab935dSRuslan Ermilovargument passed to the command line; or,
267019d04d1SLuigi Rizzothe value of the
26850ab935dSRuslan Ermilov.Ev MAKEOBJDIRPREFIX
269019d04d1SLuigi Rizzoenvironment variable, or
27050ab935dSRuslan Ermilov.Pa /usr/obj .
271019d04d1SLuigi RizzoIf the directory is not found, the
2728eee6752SRuslan Ermilov.Ic srcdir
273de566360SJordan K. Hubbarditself becomes the
2748eee6752SRuslan Ermilov.Ic objdir .
2758eee6752SRuslan Ermilov.It Ic special Ar progname Ic buildopts Ar buildopts
2768eee6752SRuslan ErmilovDefine a set of build options that should be added to
2778eee6752SRuslan Ermilov.Xr make 1
2788eee6752SRuslan Ermilovtargets in addition to those specified using
2798eee6752SRuslan Ermilov.Ic buildopts
28034944d48SJosef Karthauserwhen processing
28134944d48SJosef Karthauser.Ar progname .
2828eee6752SRuslan Ermilov.It Ic special Ar progname Ic objs Ar object-file-name ...
283de566360SJordan K. HubbardSet the list of object files for program
284de566360SJordan K. Hubbard.Ar progname .
285de566360SJordan K. HubbardThis is normally calculated by constructing a temporary makefile that includes
2868eee6752SRuslan Ermilov.Dq Ic srcdir Ns / Ns Pa Makefile
2878eee6752SRuslan Ermilovand outputs the value of
2888eee6752SRuslan Ermilov.Va $(OBJS) .
2898eee6752SRuslan Ermilov.It Ic special Ar progname Ic objpaths Ar full-pathname-to-object-file ...
290de566360SJordan K. HubbardSets the pathnames of the object files for program
291de566360SJordan K. Hubbard.Ar progname .
292de566360SJordan K. HubbardThis is normally calculated by prepending the
2938eee6752SRuslan Ermilov.Ic objdir
294de566360SJordan K. Hubbardpathname to each file in the
2958eee6752SRuslan Ermilov.Ic objs
296de566360SJordan K. Hubbardlist.
2978eee6752SRuslan Ermilov.It Ic special Ar progname Ic objvar Ar variable_name
2988eee6752SRuslan ErmilovSets the name of the
2998eee6752SRuslan Ermilov.Xr make 1
3008eee6752SRuslan Ermilovvariable which holds the list of
30108826cadSLuigi Rizzoobject files for program
30208826cadSLuigi Rizzo.Ar progname .
30308826cadSLuigi RizzoThis is normally
3048eee6752SRuslan Ermilov.Va OBJS
3058eee6752SRuslan Ermilovbut some
3068eee6752SRuslan Ermilov.Pa Makefile Ns s
3078eee6752SRuslan Ermilovmight like to use other conventions or
3085589c6deSWarren Blockprepend the program's name to the variable, e.g.,
3098eee6752SRuslan Ermilov.Va SSHD_OBJS .
310252f13abSLuigi Rizzo.It Ic special Ar progname Ic lib Ar library-name ...
311252f13abSLuigi RizzoSpecifies libraries to be linked with object files to produce
3123d8d0006SRuslan Ermilov.Ar progname Ns Pa .lo .
313252f13abSLuigi RizzoThis can be useful with libraries which redefine routines in
314252f13abSLuigi Rizzothe standard libraries, or poorly written libraries which
315252f13abSLuigi Rizzoreference symbols in the object files.
3168eee6752SRuslan Ermilov.It Ic special Ar progname Ic keep Ar symbol-name ...
31742ac3bf1SJoerg WunschAdd specified list of symbols to the keep list for program
31842ac3bf1SJoerg Wunsch.Ar progname .
3198eee6752SRuslan ErmilovAn underscore
3208eee6752SRuslan Ermilov.Pq Ql _
3218eee6752SRuslan Ermilovis prepended to each symbol and it becomes the argument to a
32242ac3bf1SJoerg Wunsch.Fl k
32342ac3bf1SJoerg Wunschoption for the
32442ac3bf1SJoerg Wunsch.Xr crunchide 1
325f2e366a1SSheldon Hearnphase.
326f2e366a1SSheldon HearnThis option is to be used as a last resort as its use can cause a
32742ac3bf1SJoerg Wunschsymbol conflict, however in certain instances it may be the only way to
32842ac3bf1SJoerg Wunschhave a symbol resolve.
32967373d62SRuslan Ermilov.It Ic special Ar progname Ic ident Ar identifier
33067373d62SRuslan ErmilovSet the
33167373d62SRuslan Ermilov.Pa Makefile Ns / Ns Tn C
33267373d62SRuslan Ermilovidentifier for
33367373d62SRuslan Ermilov.Ar progname .
33467373d62SRuslan ErmilovThis is normally generated from a
33567373d62SRuslan Ermilov.Ar progname ,
33667373d62SRuslan Ermilovmapping
33767373d62SRuslan Ermilov.Ql -
33867373d62SRuslan Ermilovto
33967373d62SRuslan Ermilov.Ql _
34067373d62SRuslan Ermilovand ignoring all other non-identifier characters.
34167373d62SRuslan ErmilovThis leads to programs named
34267373d62SRuslan Ermilov.Qq Li foo.bar
34367373d62SRuslan Ermilovand
34467373d62SRuslan Ermilov.Qq Li foobar
34567373d62SRuslan Ermilovto map to the same identifier.
346de566360SJordan K. Hubbard.El
347de566360SJordan K. Hubbard.Pp
348de566360SJordan K. HubbardOnly the
3498eee6752SRuslan Ermilov.Ic objpaths
350de566360SJordan K. Hubbardparameter is actually needed by
351e97407b4SRuslan Ermilov.Nm ,
352de566360SJordan K. Hubbardbut it is calculated from
3538eee6752SRuslan Ermilov.Ic objdir
354de566360SJordan K. Hubbardand
3558eee6752SRuslan Ermilov.Ic objs ,
356de566360SJordan K. Hubbardwhich are in turn calculated from
3578eee6752SRuslan Ermilov.Ic srcdir ,
358de566360SJordan K. Hubbardso is sometimes convenient to specify the earlier parameters and let
359b17e90a9SPhilippe Charnier.Nm
360de566360SJordan K. Hubbardcalculate forward from there if it can.
361de566360SJordan K. Hubbard.Pp
362de566360SJordan K. HubbardThe makefile produced by
363b17e90a9SPhilippe Charnier.Nm
364de566360SJordan K. Hubbardcontains an optional
3658eee6752SRuslan Ermilov.Ic objs
366de566360SJordan K. Hubbardtarget that will build the object files for each component program by
3678eee6752SRuslan Ermilovrunning
3688eee6752SRuslan Ermilov.Xr make 1
3698eee6752SRuslan Ermilovinside that program's source directory.
3708eee6752SRuslan ErmilovFor this to work the
3718eee6752SRuslan Ermilov.Ic srcdir
372de566360SJordan K. Hubbardand
3738eee6752SRuslan Ermilov.Ic objs
3748eee6752SRuslan Ermilovparameters must also be valid.
3758eee6752SRuslan ErmilovIf they are not valid for a particular program, that
376de566360SJordan K. Hubbardprogram is skipped in the
3778eee6752SRuslan Ermilov.Ic objs
378de566360SJordan K. Hubbardtarget.
379251c176fSRuslan Ermilov.Sh EXAMPLES
380de566360SJordan K. HubbardHere is an example
381b17e90a9SPhilippe Charnier.Nm
382de566360SJordan K. Hubbardinput conf file, named
383de566360SJordan K. Hubbard.Dq Pa kcopy.conf :
384726b61abSRuslan Ermilov.Bd -literal -offset indent
385de566360SJordan K. Hubbardsrcdirs /usr/src/bin /usr/src/sbin
386de566360SJordan K. Hubbard
387de566360SJordan K. Hubbardprogs test cp echo sh fsck halt init mount umount myinstall
38834944d48SJosef Karthauserprogs anotherprog
389de566360SJordan K. Hubbardln test [       # test can be invoked via [
390de566360SJordan K. Hubbardln sh -sh       # init invokes the shell with "-sh" in argv[0]
391de566360SJordan K. Hubbard
392de566360SJordan K. Hubbardspecial myprog objpaths /homes/leroy/src/myinstall.o # no sources
393de566360SJordan K. Hubbard
39434944d48SJosef Karthauserspecial anotherprog -DNO_FOO WITHOUT_BAR=YES
39534944d48SJosef Karthauser
396de566360SJordan K. Hubbardlibs -lutil -lcrypt
397726b61abSRuslan Ermilov.Ed
398de566360SJordan K. Hubbard.Pp
399de566360SJordan K. HubbardThis conf file specifies a small crunched binary consisting of some
4008eee6752SRuslan Ermilovbasic system utilities plus a homegrown install program
40150ab935dSRuslan Ermilov.Dq Pa myinstall ,
402de566360SJordan K. Hubbardfor which no source directory is specified, but its object file is
403de566360SJordan K. Hubbardspecified directly with the
4048eee6752SRuslan Ermilov.Ic special
405de566360SJordan K. Hubbardline.
406de566360SJordan K. Hubbard.Pp
4078eee6752SRuslan ErmilovAdditionally when
40850ab935dSRuslan Ermilov.Dq Pa anotherprog
4098eee6752SRuslan Ermilovis built the arguments
4108eee6752SRuslan Ermilov.Pp
4118eee6752SRuslan Ermilov.Dl -DNO_FOO WITHOUT_BAR=YES
4128eee6752SRuslan Ermilov.Pp
41334944d48SJosef Karthauserare added to all build targets.
41434944d48SJosef Karthauser.Pp
4158eee6752SRuslan ErmilovThe crunched binary
41650ab935dSRuslan Ermilov.Dq Pa kcopy
4178eee6752SRuslan Ermilovcan be built as follows:
418726b61abSRuslan Ermilov.Bd -literal -offset indent
419de566360SJordan K. Hubbard% crunchgen -m Makefile kcopy.conf    # gen Makefile and kcopy.c
420f6b31571SWolfram Schneider% make objs             # build the component programs' .o files
421de566360SJordan K. Hubbard% make                  # build the crunched binary kcopy
422de566360SJordan K. Hubbard% kcopy sh              # test that this invokes a sh shell
423de566360SJordan K. Hubbard$			# it works!
424726b61abSRuslan Ermilov.Ed
425de566360SJordan K. Hubbard.Pp
4268eee6752SRuslan ErmilovAt this point the binary
42750ab935dSRuslan Ermilov.Dq Pa kcopy
4288eee6752SRuslan Ermilovcan be copied onto an install floppy
429de566360SJordan K. Hubbardand hard-linked to the names of the component programs.
43055f92f64SCeri Davies.Pp
43155f92f64SCeri DaviesNote that if the
43255f92f64SCeri Davies.Ic libs_so
43355f92f64SCeri Daviescommand had been used, copies of the libraries so named
43455f92f64SCeri Davieswould also need to be copied to the install floppy.
435de566360SJordan K. Hubbard.Sh SEE ALSO
4368eee6752SRuslan Ermilov.Xr crunchide 1 ,
43755f92f64SCeri Davies.Xr make 1 ,
43855f92f64SCeri Davies.Xr rtld 1
4390afc94c1SUlrich Spörlein.Sh AUTHORS
4400afc94c1SUlrich Spörlein.An -nosplit
4410afc94c1SUlrich SpörleinThe
4420afc94c1SUlrich Spörlein.Nm
4430afc94c1SUlrich Spörleinutility was written by
44401c2b8acSBaptiste Daroussin.An James da Silva Aq Mt jds@cs.umd.edu .
4450afc94c1SUlrich Spörlein.Pp
4460afc94c1SUlrich SpörleinCopyright (c) 1994 University of Maryland.
4470afc94c1SUlrich SpörleinAll Rights Reserved.
4480afc94c1SUlrich Spörlein.Pp
4490afc94c1SUlrich SpörleinThe
4500afc94c1SUlrich Spörlein.Ic libs_so
4510afc94c1SUlrich Spörleinkeyword was added in 2005 by
45201c2b8acSBaptiste Daroussin.An Adrian Steinmann Aq Mt ast@marabu.ch
4530afc94c1SUlrich Spörleinand
45401c2b8acSBaptiste Daroussin.An Ceri Davies Aq Mt ceri@FreeBSD.org .
455de566360SJordan K. Hubbard.Sh CAVEATS
456de566360SJordan K. HubbardWhile
4578eee6752SRuslan Ermilov.Nm
458de566360SJordan K. Hubbardtakes care to eliminate link conflicts between the component programs
459de566360SJordan K. Hubbardof a crunched binary, conflicts are still possible between the
4608eee6752SRuslan Ermilovlibraries that are linked in.
4618eee6752SRuslan ErmilovSome shuffling in the order of
462de566360SJordan K. Hubbardlibraries may be required, and in some rare cases two libraries may
463f6b31571SWolfram Schneiderhave an unresolvable conflict and thus cannot be crunched together.
464de566360SJordan K. Hubbard.Pp
465753d686dSRuslan ErmilovSome versions of the
466753d686dSRuslan Ermilov.Bx
467753d686dSRuslan Ermilovbuild environment do not by default build the
4688eee6752SRuslan Ermilovintermediate object file for single-source file programs.
4698eee6752SRuslan ErmilovThe
4708eee6752SRuslan Ermilov.Dq Li make objs
4718eee6752SRuslan Ermilovmust then be used to get those object files built, or
472de566360SJordan K. Hubbardsome other arrangements made.
473