1994-06-15 10:33:49 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1994 University of Maryland
|
|
|
|
.\" All Rights Reserved.
|
|
|
|
.\"
|
|
|
|
.\" Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
.\" documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
.\" the above copyright notice appear in all copies and that both that
|
|
|
|
.\" copyright notice and this permission notice appear in supporting
|
|
|
|
.\" documentation, and that the name of U.M. not be used in advertising or
|
|
|
|
.\" publicity pertaining to distribution of the software without specific,
|
|
|
|
.\" written prior permission. U.M. makes no representations about the
|
|
|
|
.\" suitability of this software for any purpose. It is provided "as is"
|
|
|
|
.\" without express or implied warranty.
|
|
|
|
.\"
|
|
|
|
.\" U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
|
|
|
|
.\" BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
|
|
.\" IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
.\"
|
|
|
|
.\" Author: James da Silva, Systems Design and Analysis Group
|
|
|
|
.\" Computer Science Department
|
|
|
|
.\" University of Maryland at College Park
|
1999-08-28 01:35:59 +00:00
|
|
|
.\" $FreeBSD$
|
1994-06-15 10:33:49 +00:00
|
|
|
.\"
|
2005-12-23 15:33:31 +00:00
|
|
|
.Dd December 23, 2005
|
1994-06-15 10:33:49 +00:00
|
|
|
.Dt CRUNCHGEN 1
|
2001-07-10 15:12:08 +00:00
|
|
|
.Os
|
1994-06-15 10:33:49 +00:00
|
|
|
.Sh NAME
|
2000-11-16 13:21:17 +00:00
|
|
|
.Nm crunchgen
|
1994-06-15 10:33:49 +00:00
|
|
|
.Nd generates build environment for a crunched binary
|
|
|
|
.Sh SYNOPSIS
|
2000-12-01 08:17:15 +00:00
|
|
|
.Bk -words
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm
|
2000-11-03 15:48:58 +00:00
|
|
|
.Op Fl foql
|
2000-02-05 10:29:19 +00:00
|
|
|
.Op Fl h Ar makefile-header-name
|
1994-06-15 10:33:49 +00:00
|
|
|
.Op Fl m Ar makefile-name
|
2000-11-30 21:14:54 +00:00
|
|
|
.Op Fl p Ar obj-prefix
|
1994-06-15 10:33:49 +00:00
|
|
|
.Op Fl c Ar c-file-name
|
|
|
|
.Op Fl e Ar exec-file-name
|
|
|
|
.Op Ar conf-file
|
2000-12-01 08:17:15 +00:00
|
|
|
.Ek
|
1994-06-15 10:33:49 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
A crunched binary is a program made up of many other programs linked
|
2000-11-16 13:21:17 +00:00
|
|
|
together into a single executable.
|
|
|
|
The crunched binary
|
|
|
|
.Fn main
|
1994-06-15 10:33:49 +00:00
|
|
|
function determines which component program to run by the contents of
|
2000-11-16 13:21:17 +00:00
|
|
|
.Va argv[0] .
|
|
|
|
The main reason to crunch programs together is for fitting
|
1994-06-15 10:33:49 +00:00
|
|
|
as many programs as possible onto an installation or system recovery
|
|
|
|
floppy.
|
|
|
|
.Pp
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
2000-08-28 05:47:05 +00:00
|
|
|
.Nm
|
2002-04-20 12:27:18 +00:00
|
|
|
utility reads in the specifications in
|
1994-06-15 10:33:49 +00:00
|
|
|
.Ar conf-file
|
2000-11-16 13:21:17 +00:00
|
|
|
for a crunched binary, and generates a
|
|
|
|
.Pa Makefile
|
|
|
|
and accompanying
|
2000-11-09 02:31:02 +00:00
|
|
|
top-level C source file that when built creates the crunched executable
|
2000-11-16 13:21:17 +00:00
|
|
|
file from the component programs.
|
|
|
|
For each component program,
|
|
|
|
.Nm
|
1994-06-15 10:33:49 +00:00
|
|
|
can optionally attempt to determine the object (.o) files that make up
|
2000-11-16 13:21:17 +00:00
|
|
|
the program from its source directory
|
|
|
|
.Pa Makefile .
|
|
|
|
This information is cached between runs.
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
2000-11-16 13:21:17 +00:00
|
|
|
.Nm
|
2002-04-20 12:27:18 +00:00
|
|
|
utility uses the companion program
|
2000-11-16 13:21:17 +00:00
|
|
|
.Xr crunchide 1
|
1994-06-15 10:33:49 +00:00
|
|
|
to eliminate link-time conflicts between the component programs by
|
|
|
|
hiding all unnecessary symbols.
|
2000-08-28 05:47:05 +00:00
|
|
|
.Pp
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
2000-11-16 13:21:17 +00:00
|
|
|
.Nm
|
2002-04-20 12:27:18 +00:00
|
|
|
utility places specific requirements on package
|
2000-11-16 13:21:17 +00:00
|
|
|
.Pa Makefile Ns s
|
2001-08-14 10:01:54 +00:00
|
|
|
which make it unsuitable for use with
|
|
|
|
.No non- Ns Bx
|
|
|
|
sources.
|
2000-11-16 13:21:17 +00:00
|
|
|
In particular, the
|
|
|
|
.Pa Makefile
|
2000-08-28 05:47:05 +00:00
|
|
|
must contain the target
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic depend ,
|
2000-08-28 05:47:05 +00:00
|
|
|
and it must define all object files in the variable
|
2000-11-16 13:21:17 +00:00
|
|
|
.Va OBJS .
|
2000-08-28 05:47:05 +00:00
|
|
|
In some cases, you can use a fake
|
|
|
|
.Pa Makefile :
|
|
|
|
before looking for
|
|
|
|
.Pa Makefile
|
|
|
|
in the source directory
|
|
|
|
.Pa foo ,
|
|
|
|
.Nm
|
|
|
|
looks for the file
|
|
|
|
.Pa Makefile.foo
|
|
|
|
in the current directory.
|
1994-06-15 10:33:49 +00:00
|
|
|
.Pp
|
|
|
|
After
|
1997-09-15 06:41:09 +00:00
|
|
|
.Nm
|
2000-11-16 13:21:17 +00:00
|
|
|
is run, the crunched binary can be built by running
|
|
|
|
.Dq Li make -f <conf-name>.mk .
|
|
|
|
The component programs' object files must already be built.
|
|
|
|
An
|
|
|
|
.Ic objs
|
|
|
|
target, included in the output makefile, will
|
|
|
|
run
|
|
|
|
.Xr make 1
|
|
|
|
in each component program's source dir to build the object
|
|
|
|
files for the user.
|
|
|
|
This is not done automatically since in release
|
1997-08-30 11:04:03 +00:00
|
|
|
engineering circumstances it is generally not desirable to be
|
1994-06-15 10:33:49 +00:00
|
|
|
modifying objects in other directories.
|
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Fl c Ar c-file-name
|
|
|
|
Set output C file name to
|
|
|
|
.Ar c-file-name .
|
2000-11-16 13:21:17 +00:00
|
|
|
The default name is
|
2000-12-01 08:17:15 +00:00
|
|
|
.Pa <conf-name>.c .
|
1994-06-15 10:33:49 +00:00
|
|
|
.It Fl e Ar exec-file-name
|
|
|
|
Set crunched binary executable file name to
|
|
|
|
.Ar exec-file-name .
|
2000-11-16 13:21:17 +00:00
|
|
|
The default name is
|
2000-12-01 08:17:15 +00:00
|
|
|
.Pa <conf-name> .
|
1994-06-15 10:33:49 +00:00
|
|
|
.It Fl f
|
2000-11-16 13:21:17 +00:00
|
|
|
Flush cache.
|
|
|
|
Forces the recalculation of cached parameters.
|
1995-02-25 07:25:31 +00:00
|
|
|
.It Fl l
|
2000-11-16 13:21:17 +00:00
|
|
|
List names.
|
|
|
|
Lists the names this binary will respond to.
|
2000-02-05 10:29:19 +00:00
|
|
|
.It Fl h Ar makefile-header-name
|
|
|
|
Set the name of a file to be included at the beginning of the
|
2000-11-16 13:21:17 +00:00
|
|
|
.Pa Makefile Ns s
|
|
|
|
generated by
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm .
|
2000-02-05 10:29:19 +00:00
|
|
|
This is useful to define some make variables such as
|
2000-11-16 13:21:17 +00:00
|
|
|
.Va RELEASE_CRUNCH
|
Commands like gmirror, graid3, ... and others which use dlopen() to load
classes from say, /lib/geom, cannot be statically linked completely.
Moreover, those shared objects may require other shared objects (i.e.
for geom, libraries like -lmd, -lcrypto).
The libs_so extension to crunchgen fixes this by allowing some libraries
to be linked in dynamically. This requires that a copy of rtld and the
shared libraries be made available to the crunched binary, and so is not
suitable for all environments. Crunchgen configurations which do not
use the 'libs_so' keyword are unaffected and produce identical binaries
with and without this commit.
Approved by: murray (mentor, in spirit), jhb
In collaboration with: Adrian Steinmann <ast at marabu dot ch>
MFC After: 6 weeks
2005-12-23 15:31:37 +00:00
|
|
|
or similar, which might affect the behavior of
|
2000-11-16 13:21:17 +00:00
|
|
|
.Xr make 1
|
|
|
|
and are annoying to pass through environment variables.
|
1994-06-15 10:33:49 +00:00
|
|
|
.It Fl m Ar makefile-name
|
2000-11-16 13:21:17 +00:00
|
|
|
Set output
|
|
|
|
.Pa Makefile
|
|
|
|
name to
|
1994-06-15 10:33:49 +00:00
|
|
|
.Ar makefile-name .
|
2000-11-16 13:21:17 +00:00
|
|
|
The default name is
|
2000-12-01 08:17:15 +00:00
|
|
|
.Pa <conf-name>.mk .
|
2000-11-03 15:48:58 +00:00
|
|
|
.It Fl o
|
2000-11-16 13:21:17 +00:00
|
|
|
Add
|
|
|
|
.Dq Li make obj
|
|
|
|
rules to each program make target.
|
2000-11-30 21:14:54 +00:00
|
|
|
.It Fl p Ar obj-prefix
|
|
|
|
Set the pathname to be prepended to the
|
2000-12-01 08:17:15 +00:00
|
|
|
.Ic srcdir
|
2000-11-30 21:14:54 +00:00
|
|
|
when computing the
|
2000-12-01 08:17:15 +00:00
|
|
|
.Ic objdir .
|
2000-11-30 21:14:54 +00:00
|
|
|
If this option is not present, then the prefix used
|
|
|
|
is the content of the
|
2000-12-01 08:17:15 +00:00
|
|
|
.Ev MAKEOBJDIRPREFIX
|
2000-11-30 21:14:54 +00:00
|
|
|
environment variable, or
|
2000-12-01 08:17:15 +00:00
|
|
|
.Pa /usr/obj .
|
1994-06-15 10:33:49 +00:00
|
|
|
.It Fl q
|
2000-11-16 13:21:17 +00:00
|
|
|
Quiet operation.
|
|
|
|
Status messages are suppressed.
|
1994-06-15 10:33:49 +00:00
|
|
|
.El
|
|
|
|
.Sh CRUNCHGEN CONFIGURATION FILE COMMANDS
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
2000-11-16 13:21:17 +00:00
|
|
|
.Nm
|
2002-04-20 12:27:18 +00:00
|
|
|
utility reads specifications from the
|
1994-06-15 10:33:49 +00:00
|
|
|
.Ar conf-file
|
2000-11-16 13:21:17 +00:00
|
|
|
that describe the components of the crunched binary.
|
|
|
|
In its simplest
|
1994-06-15 10:33:49 +00:00
|
|
|
use, the component program names are merely listed along with the
|
|
|
|
top-level source directories in which their sources can be found.
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
2000-11-16 13:21:17 +00:00
|
|
|
.Nm
|
2002-04-20 12:27:18 +00:00
|
|
|
utility then calculates (via the source makefiles) and caches the
|
2000-11-16 13:21:17 +00:00
|
|
|
list of object files and their locations.
|
|
|
|
For more specialized
|
|
|
|
situations, the user can specify by hand all the parameters that
|
1997-09-15 06:41:09 +00:00
|
|
|
.Nm
|
1994-06-15 10:33:49 +00:00
|
|
|
needs.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Ar conf-file
|
|
|
|
commands are as follows:
|
|
|
|
.Bl -tag -width indent
|
2000-11-16 13:21:17 +00:00
|
|
|
.It Ic srcdirs Ar dirname ...
|
1994-06-15 10:33:49 +00:00
|
|
|
A list of source trees in which the source directories of the
|
2000-11-16 13:21:17 +00:00
|
|
|
component programs can be found.
|
|
|
|
These dirs are searched using the
|
|
|
|
.Bx
|
2000-12-01 08:17:15 +00:00
|
|
|
.Dq Pa <source-dir>/<progname>/
|
2000-11-16 13:21:17 +00:00
|
|
|
convention.
|
|
|
|
Multiple
|
|
|
|
.Ic srcdirs
|
|
|
|
lines can be specified.
|
|
|
|
The directories are searched in the order they are given.
|
|
|
|
.It Ic progs Ar progname ...
|
|
|
|
A list of programs that make up the crunched binary.
|
|
|
|
Multiple
|
|
|
|
.Ic progs
|
1994-06-15 10:33:49 +00:00
|
|
|
lines can be specified.
|
2000-11-16 13:21:17 +00:00
|
|
|
.It Ic libs Ar libspec ...
|
1994-06-15 10:33:49 +00:00
|
|
|
A list of library specifications to be included in the crunched binary link.
|
|
|
|
Multiple
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic libs
|
1994-06-15 10:33:49 +00:00
|
|
|
lines can be specified.
|
Commands like gmirror, graid3, ... and others which use dlopen() to load
classes from say, /lib/geom, cannot be statically linked completely.
Moreover, those shared objects may require other shared objects (i.e.
for geom, libraries like -lmd, -lcrypto).
The libs_so extension to crunchgen fixes this by allowing some libraries
to be linked in dynamically. This requires that a copy of rtld and the
shared libraries be made available to the crunched binary, and so is not
suitable for all environments. Crunchgen configurations which do not
use the 'libs_so' keyword are unaffected and produce identical binaries
with and without this commit.
Approved by: murray (mentor, in spirit), jhb
In collaboration with: Adrian Steinmann <ast at marabu dot ch>
MFC After: 6 weeks
2005-12-23 15:31:37 +00:00
|
|
|
.It Ic libs_so Ar libspec ...
|
|
|
|
A list of library specifications to be dynamically linked in the
|
|
|
|
crunched binary.
|
|
|
|
These libraries will need to be made available via the run-time link-editor
|
|
|
|
.Xr rtld 1
|
|
|
|
when the component program that requires them is executed from
|
|
|
|
the crunched binary.
|
|
|
|
Multiple
|
|
|
|
.Ic libs_so
|
|
|
|
lines can be specified.
|
|
|
|
The
|
|
|
|
.Ic libs_so
|
|
|
|
directive overrides a library specified gratuitously on a
|
|
|
|
.Ic libs
|
|
|
|
line.
|
2000-11-16 13:21:17 +00:00
|
|
|
.It Ic buildopts Ar buildopts ...
|
2000-11-15 14:33:29 +00:00
|
|
|
A list of build options to be added to every make target.
|
2000-11-16 13:21:17 +00:00
|
|
|
.It Ic ln Ar progname linkname
|
1994-06-15 10:33:49 +00:00
|
|
|
Causes the crunched binary to invoke
|
|
|
|
.Ar progname
|
|
|
|
whenever
|
|
|
|
.Ar linkname
|
2000-11-16 13:21:17 +00:00
|
|
|
appears in
|
|
|
|
.Va argv[0] .
|
|
|
|
This allows programs that change their behavior when
|
|
|
|
run under different names to operate correctly.
|
1994-06-15 10:33:49 +00:00
|
|
|
.El
|
2000-11-16 13:21:17 +00:00
|
|
|
.Pp
|
1994-06-15 10:33:49 +00:00
|
|
|
To handle specialized situations, such as when the source is not
|
2000-11-16 13:21:17 +00:00
|
|
|
available or not built via a conventional
|
|
|
|
.Pa Makefile ,
|
|
|
|
the following
|
|
|
|
.Ic special
|
|
|
|
commands can be used to set
|
1997-09-15 06:41:09 +00:00
|
|
|
.Nm
|
1994-06-15 10:33:49 +00:00
|
|
|
parameters for a component program.
|
|
|
|
.Bl -tag -width indent
|
2000-11-16 13:21:17 +00:00
|
|
|
.It Ic special Ar progname Ic srcdir Ar pathname
|
1994-06-15 10:33:49 +00:00
|
|
|
Set the source directory for
|
|
|
|
.Ar progname .
|
|
|
|
This is normally calculated by searching the specified
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic srcdirs
|
1994-06-15 10:33:49 +00:00
|
|
|
for a directory named
|
|
|
|
.Ar progname .
|
2000-11-16 13:21:17 +00:00
|
|
|
.It Ic special Ar progname Ic objdir Ar pathname
|
|
|
|
Set the
|
2000-12-01 08:17:15 +00:00
|
|
|
.Pa obj
|
2000-11-16 13:21:17 +00:00
|
|
|
directory for
|
1994-06-15 10:33:49 +00:00
|
|
|
.Ar progname .
|
2000-11-30 21:14:54 +00:00
|
|
|
The
|
2000-12-01 08:17:15 +00:00
|
|
|
.Pa obj
|
2000-11-30 21:14:54 +00:00
|
|
|
directory is normally calculated by looking for a directory
|
|
|
|
whose name is that of the source directory prepended by
|
|
|
|
one of the following components, in order of priority:
|
2000-12-01 08:17:15 +00:00
|
|
|
the
|
|
|
|
.Fl p
|
|
|
|
argument passed to the command line; or,
|
2000-11-30 21:14:54 +00:00
|
|
|
the value of the
|
2000-12-01 08:17:15 +00:00
|
|
|
.Ev MAKEOBJDIRPREFIX
|
2000-11-30 21:14:54 +00:00
|
|
|
environment variable, or
|
2000-12-01 08:17:15 +00:00
|
|
|
.Pa /usr/obj .
|
2000-11-30 21:14:54 +00:00
|
|
|
If the directory is not found, the
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic srcdir
|
1994-06-15 10:33:49 +00:00
|
|
|
itself becomes the
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic objdir .
|
|
|
|
.It Ic special Ar progname Ic buildopts Ar buildopts
|
|
|
|
Define a set of build options that should be added to
|
|
|
|
.Xr make 1
|
|
|
|
targets in addition to those specified using
|
|
|
|
.Ic buildopts
|
2000-11-10 15:21:37 +00:00
|
|
|
when processing
|
|
|
|
.Ar progname .
|
2000-11-16 13:21:17 +00:00
|
|
|
.It Ic special Ar progname Ic objs Ar object-file-name ...
|
1994-06-15 10:33:49 +00:00
|
|
|
Set the list of object files for program
|
|
|
|
.Ar progname .
|
|
|
|
This is normally calculated by constructing a temporary makefile that includes
|
2000-11-16 13:21:17 +00:00
|
|
|
.Dq Ic srcdir Ns / Ns Pa Makefile
|
|
|
|
and outputs the value of
|
|
|
|
.Va $(OBJS) .
|
|
|
|
.It Ic special Ar progname Ic objpaths Ar full-pathname-to-object-file ...
|
1994-06-15 10:33:49 +00:00
|
|
|
Sets the pathnames of the object files for program
|
|
|
|
.Ar progname .
|
|
|
|
This is normally calculated by prepending the
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic objdir
|
1994-06-15 10:33:49 +00:00
|
|
|
pathname to each file in the
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic objs
|
1994-06-15 10:33:49 +00:00
|
|
|
list.
|
2000-11-16 13:21:17 +00:00
|
|
|
.It Ic special Ar progname Ic objvar Ar variable_name
|
|
|
|
Sets the name of the
|
|
|
|
.Xr make 1
|
|
|
|
variable which holds the list of
|
2000-02-05 10:29:19 +00:00
|
|
|
object files for program
|
|
|
|
.Ar progname .
|
|
|
|
This is normally
|
2000-11-16 13:21:17 +00:00
|
|
|
.Va OBJS
|
|
|
|
but some
|
|
|
|
.Pa Makefile Ns s
|
|
|
|
might like to use other conventions or
|
|
|
|
prepend the program's name to the variable, e.g.\&
|
|
|
|
.Va SSHD_OBJS .
|
2002-03-30 16:48:30 +00:00
|
|
|
.It Ic special Ar progname Ic lib Ar library-name ...
|
|
|
|
Specifies libraries to be linked with object files to produce
|
2002-05-30 07:51:22 +00:00
|
|
|
.Ar progname Ns Pa .lo .
|
2002-03-30 16:48:30 +00:00
|
|
|
This can be useful with libraries which redefine routines in
|
|
|
|
the standard libraries, or poorly written libraries which
|
|
|
|
reference symbols in the object files.
|
2000-11-16 13:21:17 +00:00
|
|
|
.It Ic special Ar progname Ic keep Ar symbol-name ...
|
1997-10-05 13:35:05 +00:00
|
|
|
Add specified list of symbols to the keep list for program
|
|
|
|
.Ar progname .
|
2000-11-16 13:21:17 +00:00
|
|
|
An underscore
|
|
|
|
.Pq Ql _
|
|
|
|
is prepended to each symbol and it becomes the argument to a
|
1997-10-05 13:35:05 +00:00
|
|
|
.Fl k
|
|
|
|
option for the
|
|
|
|
.Xr crunchide 1
|
2000-03-01 14:09:25 +00:00
|
|
|
phase.
|
|
|
|
This option is to be used as a last resort as its use can cause a
|
1997-10-05 13:35:05 +00:00
|
|
|
symbol conflict, however in certain instances it may be the only way to
|
|
|
|
have a symbol resolve.
|
2001-04-04 08:28:00 +00:00
|
|
|
.It Ic special Ar progname Ic ident Ar identifier
|
|
|
|
Set the
|
|
|
|
.Pa Makefile Ns / Ns Tn C
|
|
|
|
identifier for
|
|
|
|
.Ar progname .
|
|
|
|
This is normally generated from a
|
|
|
|
.Ar progname ,
|
|
|
|
mapping
|
|
|
|
.Ql -
|
|
|
|
to
|
|
|
|
.Ql _
|
|
|
|
and ignoring all other non-identifier characters.
|
|
|
|
This leads to programs named
|
|
|
|
.Qq Li foo.bar
|
|
|
|
and
|
|
|
|
.Qq Li foobar
|
|
|
|
to map to the same identifier.
|
1994-06-15 10:33:49 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2000-11-16 13:21:17 +00:00
|
|
|
Only the
|
|
|
|
.Ic objpaths
|
1994-06-15 10:33:49 +00:00
|
|
|
parameter is actually needed by
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm ,
|
1994-06-15 10:33:49 +00:00
|
|
|
but it is calculated from
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic objdir
|
1994-06-15 10:33:49 +00:00
|
|
|
and
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic objs ,
|
1994-06-15 10:33:49 +00:00
|
|
|
which are in turn calculated from
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic srcdir ,
|
|
|
|
so is sometimes convenient to specify the earlier parameters and let
|
1997-09-15 06:41:09 +00:00
|
|
|
.Nm
|
1994-06-15 10:33:49 +00:00
|
|
|
calculate forward from there if it can.
|
|
|
|
.Pp
|
|
|
|
The makefile produced by
|
1997-09-15 06:41:09 +00:00
|
|
|
.Nm
|
1994-06-15 10:33:49 +00:00
|
|
|
contains an optional
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic objs
|
1994-06-15 10:33:49 +00:00
|
|
|
target that will build the object files for each component program by
|
2000-11-16 13:21:17 +00:00
|
|
|
running
|
|
|
|
.Xr make 1
|
|
|
|
inside that program's source directory.
|
|
|
|
For this to work the
|
|
|
|
.Ic srcdir
|
1994-06-15 10:33:49 +00:00
|
|
|
and
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic objs
|
|
|
|
parameters must also be valid.
|
|
|
|
If they are not valid for a particular program, that
|
|
|
|
program is skipped in the
|
|
|
|
.Ic objs
|
1994-06-15 10:33:49 +00:00
|
|
|
target.
|
2000-11-17 11:44:16 +00:00
|
|
|
.Sh EXAMPLES
|
1994-06-15 10:33:49 +00:00
|
|
|
Here is an example
|
1997-09-15 06:41:09 +00:00
|
|
|
.Nm
|
1994-06-15 10:33:49 +00:00
|
|
|
input conf file, named
|
|
|
|
.Dq Pa kcopy.conf :
|
|
|
|
.Pp
|
2000-11-10 17:46:15 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
srcdirs /usr/src/bin /usr/src/sbin
|
1994-06-15 10:33:49 +00:00
|
|
|
|
2000-11-10 17:46:15 +00:00
|
|
|
progs test cp echo sh fsck halt init mount umount myinstall
|
|
|
|
progs anotherprog
|
|
|
|
ln test [ # test can be invoked via [
|
|
|
|
ln sh -sh # init invokes the shell with "-sh" in argv[0]
|
1994-06-15 10:33:49 +00:00
|
|
|
|
2000-11-10 17:46:15 +00:00
|
|
|
special myprog objpaths /homes/leroy/src/myinstall.o # no sources
|
1994-06-15 10:33:49 +00:00
|
|
|
|
2000-11-10 17:46:15 +00:00
|
|
|
special anotherprog -DNO_FOO WITHOUT_BAR=YES
|
2000-11-10 15:21:37 +00:00
|
|
|
|
2000-11-10 17:46:15 +00:00
|
|
|
libs -lutil -lcrypt
|
|
|
|
.Ed
|
1994-06-15 10:33:49 +00:00
|
|
|
.Pp
|
|
|
|
This conf file specifies a small crunched binary consisting of some
|
2000-11-16 13:21:17 +00:00
|
|
|
basic system utilities plus a homegrown install program
|
2000-12-01 08:17:15 +00:00
|
|
|
.Dq Pa myinstall ,
|
1994-06-15 10:33:49 +00:00
|
|
|
for which no source directory is specified, but its object file is
|
|
|
|
specified directly with the
|
2000-11-16 13:21:17 +00:00
|
|
|
.Ic special
|
1994-06-15 10:33:49 +00:00
|
|
|
line.
|
|
|
|
.Pp
|
2000-11-16 13:21:17 +00:00
|
|
|
Additionally when
|
2000-12-01 08:17:15 +00:00
|
|
|
.Dq Pa anotherprog
|
2000-11-16 13:21:17 +00:00
|
|
|
is built the arguments
|
|
|
|
.Pp
|
|
|
|
.Dl -DNO_FOO WITHOUT_BAR=YES
|
|
|
|
.Pp
|
2000-11-10 15:21:37 +00:00
|
|
|
are added to all build targets.
|
|
|
|
.Pp
|
2000-11-16 13:21:17 +00:00
|
|
|
The crunched binary
|
2000-12-01 08:17:15 +00:00
|
|
|
.Dq Pa kcopy
|
2000-11-16 13:21:17 +00:00
|
|
|
can be built as follows:
|
1994-06-15 10:33:49 +00:00
|
|
|
.Pp
|
2000-11-10 17:46:15 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
% crunchgen -m Makefile kcopy.conf # gen Makefile and kcopy.c
|
|
|
|
% make objs # build the component programs' .o files
|
|
|
|
% make # build the crunched binary kcopy
|
|
|
|
% kcopy sh # test that this invokes a sh shell
|
|
|
|
$ # it works!
|
|
|
|
.Ed
|
1994-06-15 10:33:49 +00:00
|
|
|
.Pp
|
2000-11-16 13:21:17 +00:00
|
|
|
At this point the binary
|
2000-12-01 08:17:15 +00:00
|
|
|
.Dq Pa kcopy
|
2000-11-16 13:21:17 +00:00
|
|
|
can be copied onto an install floppy
|
1994-06-15 10:33:49 +00:00
|
|
|
and hard-linked to the names of the component programs.
|
Commands like gmirror, graid3, ... and others which use dlopen() to load
classes from say, /lib/geom, cannot be statically linked completely.
Moreover, those shared objects may require other shared objects (i.e.
for geom, libraries like -lmd, -lcrypto).
The libs_so extension to crunchgen fixes this by allowing some libraries
to be linked in dynamically. This requires that a copy of rtld and the
shared libraries be made available to the crunched binary, and so is not
suitable for all environments. Crunchgen configurations which do not
use the 'libs_so' keyword are unaffected and produce identical binaries
with and without this commit.
Approved by: murray (mentor, in spirit), jhb
In collaboration with: Adrian Steinmann <ast at marabu dot ch>
MFC After: 6 weeks
2005-12-23 15:31:37 +00:00
|
|
|
.Pp
|
2006-09-29 17:57:04 +00:00
|
|
|
Note that if the
|
Commands like gmirror, graid3, ... and others which use dlopen() to load
classes from say, /lib/geom, cannot be statically linked completely.
Moreover, those shared objects may require other shared objects (i.e.
for geom, libraries like -lmd, -lcrypto).
The libs_so extension to crunchgen fixes this by allowing some libraries
to be linked in dynamically. This requires that a copy of rtld and the
shared libraries be made available to the crunched binary, and so is not
suitable for all environments. Crunchgen configurations which do not
use the 'libs_so' keyword are unaffected and produce identical binaries
with and without this commit.
Approved by: murray (mentor, in spirit), jhb
In collaboration with: Adrian Steinmann <ast at marabu dot ch>
MFC After: 6 weeks
2005-12-23 15:31:37 +00:00
|
|
|
.Ic libs_so
|
|
|
|
command had been used, copies of the libraries so named
|
|
|
|
would also need to be copied to the install floppy.
|
1994-06-15 10:33:49 +00:00
|
|
|
.Sh SEE ALSO
|
2000-11-16 13:21:17 +00:00
|
|
|
.Xr crunchide 1 ,
|
Commands like gmirror, graid3, ... and others which use dlopen() to load
classes from say, /lib/geom, cannot be statically linked completely.
Moreover, those shared objects may require other shared objects (i.e.
for geom, libraries like -lmd, -lcrypto).
The libs_so extension to crunchgen fixes this by allowing some libraries
to be linked in dynamically. This requires that a copy of rtld and the
shared libraries be made available to the crunched binary, and so is not
suitable for all environments. Crunchgen configurations which do not
use the 'libs_so' keyword are unaffected and produce identical binaries
with and without this commit.
Approved by: murray (mentor, in spirit), jhb
In collaboration with: Adrian Steinmann <ast at marabu dot ch>
MFC After: 6 weeks
2005-12-23 15:31:37 +00:00
|
|
|
.Xr make 1 ,
|
|
|
|
.Xr rtld 1
|
1994-06-15 10:33:49 +00:00
|
|
|
.Sh CAVEATS
|
|
|
|
While
|
2000-11-16 13:21:17 +00:00
|
|
|
.Nm
|
1994-06-15 10:33:49 +00:00
|
|
|
takes care to eliminate link conflicts between the component programs
|
|
|
|
of a crunched binary, conflicts are still possible between the
|
2000-11-16 13:21:17 +00:00
|
|
|
libraries that are linked in.
|
|
|
|
Some shuffling in the order of
|
1994-06-15 10:33:49 +00:00
|
|
|
libraries may be required, and in some rare cases two libraries may
|
1997-09-13 16:01:53 +00:00
|
|
|
have an unresolvable conflict and thus cannot be crunched together.
|
1994-06-15 10:33:49 +00:00
|
|
|
.Pp
|
2001-08-14 10:01:54 +00:00
|
|
|
Some versions of the
|
|
|
|
.Bx
|
|
|
|
build environment do not by default build the
|
2000-11-16 13:21:17 +00:00
|
|
|
intermediate object file for single-source file programs.
|
|
|
|
The
|
|
|
|
.Dq Li make objs
|
|
|
|
must then be used to get those object files built, or
|
1994-06-15 10:33:49 +00:00
|
|
|
some other arrangements made.
|
1998-03-23 08:31:20 +00:00
|
|
|
.Sh AUTHORS
|
2006-09-29 17:57:04 +00:00
|
|
|
.An -nosplit
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
2000-11-16 13:21:17 +00:00
|
|
|
.Nm
|
2002-04-20 12:27:18 +00:00
|
|
|
utility was written by
|
1998-03-23 08:31:20 +00:00
|
|
|
.An James da Silva Aq jds@cs.umd.edu .
|
2000-11-16 13:21:17 +00:00
|
|
|
.Pp
|
|
|
|
Copyright (c) 1994 University of Maryland.
|
|
|
|
All Rights Reserved.
|
Commands like gmirror, graid3, ... and others which use dlopen() to load
classes from say, /lib/geom, cannot be statically linked completely.
Moreover, those shared objects may require other shared objects (i.e.
for geom, libraries like -lmd, -lcrypto).
The libs_so extension to crunchgen fixes this by allowing some libraries
to be linked in dynamically. This requires that a copy of rtld and the
shared libraries be made available to the crunched binary, and so is not
suitable for all environments. Crunchgen configurations which do not
use the 'libs_so' keyword are unaffected and produce identical binaries
with and without this commit.
Approved by: murray (mentor, in spirit), jhb
In collaboration with: Adrian Steinmann <ast at marabu dot ch>
MFC After: 6 weeks
2005-12-23 15:31:37 +00:00
|
|
|
.Pp
|
2006-09-29 17:57:04 +00:00
|
|
|
The
|
Commands like gmirror, graid3, ... and others which use dlopen() to load
classes from say, /lib/geom, cannot be statically linked completely.
Moreover, those shared objects may require other shared objects (i.e.
for geom, libraries like -lmd, -lcrypto).
The libs_so extension to crunchgen fixes this by allowing some libraries
to be linked in dynamically. This requires that a copy of rtld and the
shared libraries be made available to the crunched binary, and so is not
suitable for all environments. Crunchgen configurations which do not
use the 'libs_so' keyword are unaffected and produce identical binaries
with and without this commit.
Approved by: murray (mentor, in spirit), jhb
In collaboration with: Adrian Steinmann <ast at marabu dot ch>
MFC After: 6 weeks
2005-12-23 15:31:37 +00:00
|
|
|
.Ic libs_so
|
|
|
|
keyword was added in 2005 by
|
|
|
|
.An Adrian Steinmann Aq ast@marabu.ch
|
|
|
|
and
|
|
|
|
.An Ceri Davies Aq ceri@FreeBSD.org .
|