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.\" 27*5589c6deSWarren 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 42*5589c6deSWarren 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 . 14008826cadSLuigi RizzoThis is useful to define some make variables such as 1418eee6752SRuslan Ermilov.Va RELEASE_CRUNCH 14255f92f64SCeri Daviesor similar, which might affect the behavior of 1438eee6752SRuslan Ermilov.Xr make 1 1448eee6752SRuslan Ermilovand are annoying to pass through environment variables. 145de566360SJordan K. Hubbard.It Fl m Ar makefile-name 1468eee6752SRuslan ErmilovSet output 1478eee6752SRuslan Ermilov.Pa Makefile 1488eee6752SRuslan Ermilovname to 149de566360SJordan K. Hubbard.Ar makefile-name . 1508eee6752SRuslan ErmilovThe default name is 15150ab935dSRuslan Ermilov.Pa <conf-name>.mk . 152ba2250ddSJosef Karthauser.It Fl o 1538eee6752SRuslan ErmilovAdd 1548eee6752SRuslan Ermilov.Dq Li make obj 1558eee6752SRuslan Ermilovrules to each program make target. 156019d04d1SLuigi Rizzo.It Fl p Ar obj-prefix 157019d04d1SLuigi RizzoSet the pathname to be prepended to the 15850ab935dSRuslan Ermilov.Ic srcdir 159019d04d1SLuigi Rizzowhen computing the 16050ab935dSRuslan Ermilov.Ic objdir . 161019d04d1SLuigi RizzoIf this option is not present, then the prefix used 162019d04d1SLuigi Rizzois the content of the 16350ab935dSRuslan Ermilov.Ev MAKEOBJDIRPREFIX 164019d04d1SLuigi Rizzoenvironment variable, or 16550ab935dSRuslan Ermilov.Pa /usr/obj . 166de566360SJordan K. Hubbard.It Fl q 1678eee6752SRuslan ErmilovQuiet operation. 1688eee6752SRuslan ErmilovStatus messages are suppressed. 169de566360SJordan K. Hubbard.El 170de566360SJordan K. Hubbard.Sh CRUNCHGEN CONFIGURATION FILE COMMANDS 1717f94b8deSPhilippe CharnierThe 1728eee6752SRuslan Ermilov.Nm 1737f94b8deSPhilippe Charnierutility reads specifications from the 174de566360SJordan K. Hubbard.Ar conf-file 1758eee6752SRuslan Ermilovthat describe the components of the crunched binary. 1768eee6752SRuslan ErmilovIn its simplest 177de566360SJordan K. Hubbarduse, the component program names are merely listed along with the 178de566360SJordan K. Hubbardtop-level source directories in which their sources can be found. 1797f94b8deSPhilippe CharnierThe 1808eee6752SRuslan Ermilov.Nm 1817f94b8deSPhilippe Charnierutility then calculates (via the source makefiles) and caches the 1828eee6752SRuslan Ermilovlist of object files and their locations. 1838eee6752SRuslan ErmilovFor more specialized 184de566360SJordan K. Hubbardsituations, the user can specify by hand all the parameters that 185b17e90a9SPhilippe Charnier.Nm 186de566360SJordan K. Hubbardneeds. 187de566360SJordan K. Hubbard.Pp 188de566360SJordan K. HubbardThe 189de566360SJordan K. Hubbard.Ar conf-file 190de566360SJordan K. Hubbardcommands are as follows: 191de566360SJordan K. Hubbard.Bl -tag -width indent 1928eee6752SRuslan Ermilov.It Ic srcdirs Ar dirname ... 193de566360SJordan K. HubbardA list of source trees in which the source directories of the 1948eee6752SRuslan Ermilovcomponent programs can be found. 1958eee6752SRuslan ErmilovThese dirs are searched using the 1968eee6752SRuslan Ermilov.Bx 19750ab935dSRuslan Ermilov.Dq Pa <source-dir>/<progname>/ 1988eee6752SRuslan Ermilovconvention. 1998eee6752SRuslan ErmilovMultiple 2008eee6752SRuslan Ermilov.Ic srcdirs 201de566360SJordan K. Hubbardlines can be specified. 2028eee6752SRuslan ErmilovThe directories are searched in the order they are given. 2038eee6752SRuslan Ermilov.It Ic progs Ar progname ... 2048eee6752SRuslan ErmilovA list of programs that make up the crunched binary. 2058eee6752SRuslan ErmilovMultiple 2068eee6752SRuslan Ermilov.Ic progs 2078eee6752SRuslan Ermilovlines can be specified. 2088eee6752SRuslan Ermilov.It Ic libs Ar libspec ... 209de566360SJordan K. HubbardA list of library specifications to be included in the crunched binary link. 210de566360SJordan K. HubbardMultiple 2118eee6752SRuslan Ermilov.Ic libs 212de566360SJordan K. Hubbardlines can be specified. 21355f92f64SCeri Davies.It Ic libs_so Ar libspec ... 21455f92f64SCeri DaviesA list of library specifications to be dynamically linked in the 21555f92f64SCeri Daviescrunched binary. 21655f92f64SCeri DaviesThese libraries will need to be made available via the run-time link-editor 21755f92f64SCeri Davies.Xr rtld 1 21855f92f64SCeri Davieswhen the component program that requires them is executed from 21955f92f64SCeri Daviesthe crunched binary. 22055f92f64SCeri DaviesMultiple 22155f92f64SCeri Davies.Ic libs_so 22255f92f64SCeri Davieslines can be specified. 22355f92f64SCeri DaviesThe 22455f92f64SCeri Davies.Ic libs_so 22555f92f64SCeri Daviesdirective overrides a library specified gratuitously on a 22655f92f64SCeri Davies.Ic libs 22755f92f64SCeri Daviesline. 2288eee6752SRuslan Ermilov.It Ic buildopts Ar buildopts ... 22908a15190SJosef KarthauserA list of build options to be added to every make target. 2308eee6752SRuslan Ermilov.It Ic ln Ar progname linkname 231de566360SJordan K. HubbardCauses the crunched binary to invoke 232de566360SJordan K. Hubbard.Ar progname 233de566360SJordan K. Hubbardwhenever 234de566360SJordan K. Hubbard.Ar linkname 2358eee6752SRuslan Ermilovappears in 2368eee6752SRuslan Ermilov.Va argv[0] . 2378eee6752SRuslan ErmilovThis allows programs that change their behavior when 238de566360SJordan K. Hubbardrun under different names to operate correctly. 239de566360SJordan K. Hubbard.El 2408eee6752SRuslan Ermilov.Pp 241de566360SJordan K. HubbardTo handle specialized situations, such as when the source is not 2428eee6752SRuslan Ermilovavailable or not built via a conventional 2438eee6752SRuslan Ermilov.Pa Makefile , 2448eee6752SRuslan Ermilovthe following 2458eee6752SRuslan Ermilov.Ic special 246de566360SJordan K. Hubbardcommands can be used to set 247b17e90a9SPhilippe Charnier.Nm 248de566360SJordan K. Hubbardparameters for a component program. 249de566360SJordan K. Hubbard.Bl -tag -width indent 2508eee6752SRuslan Ermilov.It Ic special Ar progname Ic srcdir Ar pathname 251de566360SJordan K. HubbardSet the source directory for 252de566360SJordan K. Hubbard.Ar progname . 253de566360SJordan K. HubbardThis is normally calculated by searching the specified 2548eee6752SRuslan Ermilov.Ic srcdirs 255de566360SJordan K. Hubbardfor a directory named 256de566360SJordan K. Hubbard.Ar progname . 2578eee6752SRuslan Ermilov.It Ic special Ar progname Ic objdir Ar pathname 2588eee6752SRuslan ErmilovSet the 25950ab935dSRuslan Ermilov.Pa obj 2608eee6752SRuslan Ermilovdirectory for 261de566360SJordan K. Hubbard.Ar progname . 262019d04d1SLuigi RizzoThe 26350ab935dSRuslan Ermilov.Pa obj 264019d04d1SLuigi Rizzodirectory is normally calculated by looking for a directory 265019d04d1SLuigi Rizzowhose name is that of the source directory prepended by 266019d04d1SLuigi Rizzoone of the following components, in order of priority: 26750ab935dSRuslan Ermilovthe 26850ab935dSRuslan Ermilov.Fl p 26950ab935dSRuslan Ermilovargument passed to the command line; or, 270019d04d1SLuigi Rizzothe value of the 27150ab935dSRuslan Ermilov.Ev MAKEOBJDIRPREFIX 272019d04d1SLuigi Rizzoenvironment variable, or 27350ab935dSRuslan Ermilov.Pa /usr/obj . 274019d04d1SLuigi RizzoIf the directory is not found, the 2758eee6752SRuslan Ermilov.Ic srcdir 276de566360SJordan K. Hubbarditself becomes the 2778eee6752SRuslan Ermilov.Ic objdir . 2788eee6752SRuslan Ermilov.It Ic special Ar progname Ic buildopts Ar buildopts 2798eee6752SRuslan ErmilovDefine a set of build options that should be added to 2808eee6752SRuslan Ermilov.Xr make 1 2818eee6752SRuslan Ermilovtargets in addition to those specified using 2828eee6752SRuslan Ermilov.Ic buildopts 28334944d48SJosef Karthauserwhen processing 28434944d48SJosef Karthauser.Ar progname . 2858eee6752SRuslan Ermilov.It Ic special Ar progname Ic objs Ar object-file-name ... 286de566360SJordan K. HubbardSet the list of object files for program 287de566360SJordan K. Hubbard.Ar progname . 288de566360SJordan K. HubbardThis is normally calculated by constructing a temporary makefile that includes 2898eee6752SRuslan Ermilov.Dq Ic srcdir Ns / Ns Pa Makefile 2908eee6752SRuslan Ermilovand outputs the value of 2918eee6752SRuslan Ermilov.Va $(OBJS) . 2928eee6752SRuslan Ermilov.It Ic special Ar progname Ic objpaths Ar full-pathname-to-object-file ... 293de566360SJordan K. HubbardSets the pathnames of the object files for program 294de566360SJordan K. Hubbard.Ar progname . 295de566360SJordan K. HubbardThis is normally calculated by prepending the 2968eee6752SRuslan Ermilov.Ic objdir 297de566360SJordan K. Hubbardpathname to each file in the 2988eee6752SRuslan Ermilov.Ic objs 299de566360SJordan K. Hubbardlist. 3008eee6752SRuslan Ermilov.It Ic special Ar progname Ic objvar Ar variable_name 3018eee6752SRuslan ErmilovSets the name of the 3028eee6752SRuslan Ermilov.Xr make 1 3038eee6752SRuslan Ermilovvariable which holds the list of 30408826cadSLuigi Rizzoobject files for program 30508826cadSLuigi Rizzo.Ar progname . 30608826cadSLuigi RizzoThis is normally 3078eee6752SRuslan Ermilov.Va OBJS 3088eee6752SRuslan Ermilovbut some 3098eee6752SRuslan Ermilov.Pa Makefile Ns s 3108eee6752SRuslan Ermilovmight like to use other conventions or 311*5589c6deSWarren Blockprepend the program's name to the variable, e.g., 3128eee6752SRuslan Ermilov.Va SSHD_OBJS . 313252f13abSLuigi Rizzo.It Ic special Ar progname Ic lib Ar library-name ... 314252f13abSLuigi RizzoSpecifies libraries to be linked with object files to produce 3153d8d0006SRuslan Ermilov.Ar progname Ns Pa .lo . 316252f13abSLuigi RizzoThis can be useful with libraries which redefine routines in 317252f13abSLuigi Rizzothe standard libraries, or poorly written libraries which 318252f13abSLuigi Rizzoreference symbols in the object files. 3198eee6752SRuslan Ermilov.It Ic special Ar progname Ic keep Ar symbol-name ... 32042ac3bf1SJoerg WunschAdd specified list of symbols to the keep list for program 32142ac3bf1SJoerg Wunsch.Ar progname . 3228eee6752SRuslan ErmilovAn underscore 3238eee6752SRuslan Ermilov.Pq Ql _ 3248eee6752SRuslan Ermilovis prepended to each symbol and it becomes the argument to a 32542ac3bf1SJoerg Wunsch.Fl k 32642ac3bf1SJoerg Wunschoption for the 32742ac3bf1SJoerg Wunsch.Xr crunchide 1 328f2e366a1SSheldon Hearnphase. 329f2e366a1SSheldon HearnThis option is to be used as a last resort as its use can cause a 33042ac3bf1SJoerg Wunschsymbol conflict, however in certain instances it may be the only way to 33142ac3bf1SJoerg Wunschhave a symbol resolve. 33267373d62SRuslan Ermilov.It Ic special Ar progname Ic ident Ar identifier 33367373d62SRuslan ErmilovSet the 33467373d62SRuslan Ermilov.Pa Makefile Ns / Ns Tn C 33567373d62SRuslan Ermilovidentifier for 33667373d62SRuslan Ermilov.Ar progname . 33767373d62SRuslan ErmilovThis is normally generated from a 33867373d62SRuslan Ermilov.Ar progname , 33967373d62SRuslan Ermilovmapping 34067373d62SRuslan Ermilov.Ql - 34167373d62SRuslan Ermilovto 34267373d62SRuslan Ermilov.Ql _ 34367373d62SRuslan Ermilovand ignoring all other non-identifier characters. 34467373d62SRuslan ErmilovThis leads to programs named 34567373d62SRuslan Ermilov.Qq Li foo.bar 34667373d62SRuslan Ermilovand 34767373d62SRuslan Ermilov.Qq Li foobar 34867373d62SRuslan Ermilovto map to the same identifier. 349de566360SJordan K. Hubbard.El 350de566360SJordan K. Hubbard.Pp 351de566360SJordan K. HubbardOnly the 3528eee6752SRuslan Ermilov.Ic objpaths 353de566360SJordan K. Hubbardparameter is actually needed by 354e97407b4SRuslan Ermilov.Nm , 355de566360SJordan K. Hubbardbut it is calculated from 3568eee6752SRuslan Ermilov.Ic objdir 357de566360SJordan K. Hubbardand 3588eee6752SRuslan Ermilov.Ic objs , 359de566360SJordan K. Hubbardwhich are in turn calculated from 3608eee6752SRuslan Ermilov.Ic srcdir , 361de566360SJordan K. Hubbardso is sometimes convenient to specify the earlier parameters and let 362b17e90a9SPhilippe Charnier.Nm 363de566360SJordan K. Hubbardcalculate forward from there if it can. 364de566360SJordan K. Hubbard.Pp 365de566360SJordan K. HubbardThe makefile produced by 366b17e90a9SPhilippe Charnier.Nm 367de566360SJordan K. Hubbardcontains an optional 3688eee6752SRuslan Ermilov.Ic objs 369de566360SJordan K. Hubbardtarget that will build the object files for each component program by 3708eee6752SRuslan Ermilovrunning 3718eee6752SRuslan Ermilov.Xr make 1 3728eee6752SRuslan Ermilovinside that program's source directory. 3738eee6752SRuslan ErmilovFor this to work the 3748eee6752SRuslan Ermilov.Ic srcdir 375de566360SJordan K. Hubbardand 3768eee6752SRuslan Ermilov.Ic objs 3778eee6752SRuslan Ermilovparameters must also be valid. 3788eee6752SRuslan ErmilovIf they are not valid for a particular program, that 379de566360SJordan K. Hubbardprogram is skipped in the 3808eee6752SRuslan Ermilov.Ic objs 381de566360SJordan K. Hubbardtarget. 382251c176fSRuslan Ermilov.Sh EXAMPLES 383de566360SJordan K. HubbardHere is an example 384b17e90a9SPhilippe Charnier.Nm 385de566360SJordan K. Hubbardinput conf file, named 386de566360SJordan K. Hubbard.Dq Pa kcopy.conf : 387726b61abSRuslan Ermilov.Bd -literal -offset indent 388de566360SJordan K. Hubbardsrcdirs /usr/src/bin /usr/src/sbin 389de566360SJordan K. Hubbard 390de566360SJordan K. Hubbardprogs test cp echo sh fsck halt init mount umount myinstall 39134944d48SJosef Karthauserprogs anotherprog 392de566360SJordan K. Hubbardln test [ # test can be invoked via [ 393de566360SJordan K. Hubbardln sh -sh # init invokes the shell with "-sh" in argv[0] 394de566360SJordan K. Hubbard 395de566360SJordan K. Hubbardspecial myprog objpaths /homes/leroy/src/myinstall.o # no sources 396de566360SJordan K. Hubbard 39734944d48SJosef Karthauserspecial anotherprog -DNO_FOO WITHOUT_BAR=YES 39834944d48SJosef Karthauser 399de566360SJordan K. Hubbardlibs -lutil -lcrypt 400726b61abSRuslan Ermilov.Ed 401de566360SJordan K. Hubbard.Pp 402de566360SJordan K. HubbardThis conf file specifies a small crunched binary consisting of some 4038eee6752SRuslan Ermilovbasic system utilities plus a homegrown install program 40450ab935dSRuslan Ermilov.Dq Pa myinstall , 405de566360SJordan K. Hubbardfor which no source directory is specified, but its object file is 406de566360SJordan K. Hubbardspecified directly with the 4078eee6752SRuslan Ermilov.Ic special 408de566360SJordan K. Hubbardline. 409de566360SJordan K. Hubbard.Pp 4108eee6752SRuslan ErmilovAdditionally when 41150ab935dSRuslan Ermilov.Dq Pa anotherprog 4128eee6752SRuslan Ermilovis built the arguments 4138eee6752SRuslan Ermilov.Pp 4148eee6752SRuslan Ermilov.Dl -DNO_FOO WITHOUT_BAR=YES 4158eee6752SRuslan Ermilov.Pp 41634944d48SJosef Karthauserare added to all build targets. 41734944d48SJosef Karthauser.Pp 4188eee6752SRuslan ErmilovThe crunched binary 41950ab935dSRuslan Ermilov.Dq Pa kcopy 4208eee6752SRuslan Ermilovcan be built as follows: 421726b61abSRuslan Ermilov.Bd -literal -offset indent 422de566360SJordan K. Hubbard% crunchgen -m Makefile kcopy.conf # gen Makefile and kcopy.c 423f6b31571SWolfram Schneider% make objs # build the component programs' .o files 424de566360SJordan K. Hubbard% make # build the crunched binary kcopy 425de566360SJordan K. Hubbard% kcopy sh # test that this invokes a sh shell 426de566360SJordan K. Hubbard$ # it works! 427726b61abSRuslan Ermilov.Ed 428de566360SJordan K. Hubbard.Pp 4298eee6752SRuslan ErmilovAt this point the binary 43050ab935dSRuslan Ermilov.Dq Pa kcopy 4318eee6752SRuslan Ermilovcan be copied onto an install floppy 432de566360SJordan K. Hubbardand hard-linked to the names of the component programs. 43355f92f64SCeri Davies.Pp 43455f92f64SCeri DaviesNote that if the 43555f92f64SCeri Davies.Ic libs_so 43655f92f64SCeri Daviescommand had been used, copies of the libraries so named 43755f92f64SCeri Davieswould also need to be copied to the install floppy. 438de566360SJordan K. Hubbard.Sh SEE ALSO 4398eee6752SRuslan Ermilov.Xr crunchide 1 , 44055f92f64SCeri Davies.Xr make 1 , 44155f92f64SCeri Davies.Xr rtld 1 4420afc94c1SUlrich Spörlein.Sh AUTHORS 4430afc94c1SUlrich Spörlein.An -nosplit 4440afc94c1SUlrich SpörleinThe 4450afc94c1SUlrich Spörlein.Nm 4460afc94c1SUlrich Spörleinutility was written by 44701c2b8acSBaptiste Daroussin.An James da Silva Aq Mt jds@cs.umd.edu . 4480afc94c1SUlrich Spörlein.Pp 4490afc94c1SUlrich SpörleinCopyright (c) 1994 University of Maryland. 4500afc94c1SUlrich SpörleinAll Rights Reserved. 4510afc94c1SUlrich Spörlein.Pp 4520afc94c1SUlrich SpörleinThe 4530afc94c1SUlrich Spörlein.Ic libs_so 4540afc94c1SUlrich Spörleinkeyword was added in 2005 by 45501c2b8acSBaptiste Daroussin.An Adrian Steinmann Aq Mt ast@marabu.ch 4560afc94c1SUlrich Spörleinand 45701c2b8acSBaptiste Daroussin.An Ceri Davies Aq Mt ceri@FreeBSD.org . 458de566360SJordan K. Hubbard.Sh CAVEATS 459de566360SJordan K. HubbardWhile 4608eee6752SRuslan Ermilov.Nm 461de566360SJordan K. Hubbardtakes care to eliminate link conflicts between the component programs 462de566360SJordan K. Hubbardof a crunched binary, conflicts are still possible between the 4638eee6752SRuslan Ermilovlibraries that are linked in. 4648eee6752SRuslan ErmilovSome shuffling in the order of 465de566360SJordan K. Hubbardlibraries may be required, and in some rare cases two libraries may 466f6b31571SWolfram Schneiderhave an unresolvable conflict and thus cannot be crunched together. 467de566360SJordan K. Hubbard.Pp 468753d686dSRuslan ErmilovSome versions of the 469753d686dSRuslan Ermilov.Bx 470753d686dSRuslan Ermilovbuild environment do not by default build the 4718eee6752SRuslan Ermilovintermediate object file for single-source file programs. 4728eee6752SRuslan ErmilovThe 4738eee6752SRuslan Ermilov.Dq Li make objs 4748eee6752SRuslan Ermilovmust then be used to get those object files built, or 475de566360SJordan K. Hubbardsome other arrangements made. 476