xref: /titanic_41/usr/src/tools/README.tools (revision eef1c0f44cd22770cc506dadb89d71aab3c071e3)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#ident	"%Z%%M%	%I%	%E% SMI"
26
27This directory contains the tools used to do a full build of the
28OS/Net workspace.  They usually live in the /opt/onbld directory on build
29machines. From here, 'make install' will build and install the tools
30in $ROOT/opt/onbld. If you like, 'make pkg' will build the SUNWonbld
31package in $(PKGARCHIVE). Installing that package will populate the
32/opt/onbld directory, and create a root account for building called 'gk',
33which uses csh and has a home directory of /opt/onbld/gk. You can
34use this account to do full builds with 'nightly'. You don't have to,
35but the 'gk' account has the path setup properly, has a .make.machines
36file for dmake, and has a .login that sets up for dmake.
37
38Layout of /opt/onbld
39--------------------
40
41/opt/onbld/etc/abi
42	contains Solaris ABI database (ABI_*.db) and exceptions
43	for ABI Auditing tool (intf_check).
44
45/opt/onbld/gk
46	gk account's home directory.
47
48/opt/onbld/bin
49	basic bin directory - contains scripts.
50
51/opt/onbld/bin/${MACH}
52	architecture-specific bin directory for binaries.
53
54/opt/onbld/env
55	build environment files.
56
57/opt/onbld/man
58	rudimentary man pages for some of the tools.
59
60
61Tool Summary
62------------
63
64bfu
65	bonwick/faulkner upgrade. Loads a set of cpio archives created
66	by 'mkbfu' onto a machine, either live or on alternate root
67	and /usr filesystems. Attempts to preserve important files,
68	but may require manual intervention before reboot to resolve
69	changes to preserved files.
70
71bfuld
72	Used by bfu to survive getting a new runtime linker when extracting
73	new cpio archives onto a live system. Patches binaries to use
74	a saved runtime linker in /tmp during the bfu process.
75	Not run by anything but bfu.
76
77bldenv
78	companion to 'nightly.' Takes the same environment file you
79	used with 'nightly,' and starts a shell with the environment
80	set up the same way as 'nightly' set it up. This is useful
81	if you're trying to quickly rebuild portions of a workspace
82	built by 'nightly'. 'ws' should not be used for this since it
83	sets the environment up differently and may cause everything
84	to rebuild (because of different -I or -L paths).
85
86build_cscope
87
88	builds cscope databases in the uts, the platform subdirectories
89	of uts, and in usr/src. Uses cscope-fast.
90
91check_rtime
92
93	checks ELF attributes used by ELF dynamic objects in the proto area.
94	Used by 'nightly's -r option, to check a number of ELF runtime
95	attributes for consistency with common build rules.  nightly uses
96	the -o option to simplify the output for diffing with previous
97	build results.  It also uses the -i option to obtain NEEDED and RUNPATH
98	entries, which help detect changes in software dependencies and makes
99	sure objects don't have any strange runpaths like /opt/SUNWspro/lib.
100
101checkproto
102
103	Runs protocmp and protolist on a workspace (or uses the environment
104	variable CODEMGR_WS to determine the workspace). Checks the proto area
105	against the packages.
106
107codereview
108
109	Given two filenames, creates a postscript file with the file
110	differences highlighted.
111
112cscope-fast
113	The fast version of cscope that we use internally. Seems to work,
114	but may need more testing before it's placed in the gate. The source
115	just really needs to be here.
116
117cstyle
118	checks C source for compliance with OS/Net guidelines.
119
120ctfconvert
121	Convert symbolic debugging information in an object file to the Compact
122	ANSI-C Type Format (CTF).
123
124ctfdump
125	Decode and display CTF data stored in a raw file or in an ELF file.
126
127ctfmerge
128	Merge the CTF data from one or more object files.
129
130depcheck
131	A tool to try an assess the dependencies of executables.  This tool
132	is not a definitive dependency check, but it does use "strings" and
133	"ldd" to gather as much information as it can.  The dependency check
134	tool can handle filenames and pkgnames.  Before using the dependency
135	checker you must build a database which reflects the properties and
136	files in your system.
137
138elfcmp
139	Compares two ELF modules (e.g. .o files, executables) section by
140	section.  Useful for determining whether "trivial" changes -
141	cstyle, lint, etc - actually changed the code.  The -S option
142	is used to test whether two binaries are the same except for
143	the elfsign signature.
144
145elfsign
146	Built from the same sources as the shipped elfsign(1), this
147	version is used in nightly -t builds to assure that the signing
148	process and format is the same as will be used on the target
149	system.
150
151elfsigncmp
152	This script can be used in lieu of elfsign during a build.
153	It uses elfsign to sign a copy of the object and elfcmp -S to
154	verify that the signing caused no damage before updating
155	the object to be signed.
156
157findunref
158	Finds all files in a source tree that have access times older than a
159	certain time and are not in a specified list of exceptions.  Since
160	'nightly' timestamps the start of the build, and findunref uses its
161	timestamp (by default), this can be used to find all files that were
162	unreferenced during a nightly build).  Since some files are only used
163	during a SPARC or Intel build, 'findunref' needs to be run on
164	workspaces from both architectures and the results need to be merged.
165	For instance, if $INTELSRC and $SPARCSRC are set to the usr/src
166	directories of your Intel and SPARC nightly workspaces, then you
167	can merge the results like so:
168
169	$ findunref $INTELSRC $INTELSRC/tools/findunref/exception_list | \
170	  sort > ~/unref-i386.out
171	$ findunref $SPARCSRC $SPARCSRC/tools/findunref/exception_list | \
172	  sort > ~/unref-sparc.out
173	$ comm -12 ~/unref-i386.out ~/unref-sparc.out > ~/unref.out
174
175hdrchk
176	checks headers for compliance with OS/Net standards (form, includes,
177	C++ guards).
178
179install.bin
180	binary version of /usr/sbin/install. Used to be vastly faster
181	(since /usr/sbin/install is a shell script), but may only be a bit
182	faster now. One speedup includes avoiding the name service for the
183	well-known, never-changing password entries like 'root' and 'sys.'
184
185intf_check
186	detects and reports ABI versioning and stability problems.
187
188lintdump
189	dumps the contents of one or more lint libraries; see lintdump(1)
190
191keywords
192	checks files for proper SCCS keywords.
193
194makebfu
195	simple wrapper around 'mkbfu' for use outside nightly (when in a build
196	shell from 'ws' or 'bldenv').
197
198mkbfu
199	makes cpio archives out of the proto area suitable for bfu'ing.
200	Used by 'nightly' and 'makebfu'.
201
202nightly
203	nightly build script. Takes an environment (or 'env') file describing
204	such things as the workspace, the parent, and what to build. See
205	env/developer and env/gatekeeper for sample, hopefully well-commented
206	env files.
207
208pmodes
209	enforces proper file ownership and permissions in pkgmap and package
210	prototype* files.  converts files if necessary
211
212protocmp
213	compares proto lists and the package definitions. Used by nightly
214	to determine if the proto area matches the packages, and to detect
215	differences between a childs proto area and a parents.
216
217protocmp.terse
218	transforms the output of protocmp into something a bit more friendly
219
220protolist
221	create a list of what's in the proto area, to feed to protocmp.
222
223sccscp
224	copy a file under SCCS control to another location in a workspace.
225	also updates teamware's nametable.
226
227sccshist
228	Display the history, comments and diffs, of a file under SCCS
229	control.
230
231sccsmv
232	rename a file under SCCS control to another location in a workspace.
233	also updates teamware's nametable.
234
235sccsrm
236	delete a file under SCCS control workspace. also updates teamware's
237	nametable. Actually renames it to .del-<file>-`date` so that others
238	will see it move when it is brought over (in case they were working
239	on it).
240
241ws
242	creates a shell with the environment set up to build in the given
243	workspace. Used mostly for non-full-build workspaces, so it sets up
244	to pull headers and libraries from the proto area of the parent if
245	they aren't in the childs proto area.
246
247wx
248	A great workspace tool by bonwick. See wx.README for information
249	and warnings.
250
251tokenize
252	Used to build the sun4u boot block.
253
254webrev
255	Generates a set of HTML pages that show side-by-side diffs of
256	changes in your workspace, for easy communication of code
257	review materials.  Can automagically find edited files or use a
258	manually-generated list; knows how to use wx's active file for
259	lists of checked-out files and proposed SCCS comments.
260
261wsdiff
262	Detect object differences between two ON proto areas. Used by
263	nightly(1) to determine what changed between two builds. Handy
264	for identifying the set of built objects impacted by a given
265	source change. This information is needed for patch construction.
266
267
268How to do a full build
269----------------------
270
2711. Find an environment file that might do what you want to do. If you're just
272   a developer wanting to do a full build in a child of the gate, copy the
273   'developer' environment file to a new name (private to you and/or the
274   work being done in this workspace, to avoid collisions with others). Then
275   edit the file and tailor it to your workspace. Remember that this file
276   is a shell script, so it can do more than set environment variables.
277
2782. Login as 'gk' (or root, but your PATH and .make.machines for dmake will
279   not be right). Run 'nightly' and give it your environment file as an
280   option. 'nightly' will first look for your environment file in
281   /opt/onbld/env, and if it's not there then it will look for it as an
282   absolute or relative path. Some people put their environment files in
283   their workspace to keep them close.
284
2853. When 'nightly' is complete, it will send a summary of what happened to
286   $MAILTO. Usually, the less info in the mail the better. If you have failures,
287   you can go look at the full log of what happened, generally in
288   $CODEMGR_WS/log/log.<date>/nightly.log (the mail_msg it sent and the proto
289   list are there too). You can also find the individual build logs, like
290   'make clobber' and 'make install' output in $SRC, under names like
291   clobber-${MACH}.out and install-${MACH}.out (for a DEBUG build). These
292   will be smaller than nightly.log, and maybe more searchable.
293
294Files you have to update to add a tool
295--------------------------------------
296
2971.  Add the tool in its appropriate place.
2982.  Update the Makefile as required.
2993.  Update usr/src/tools/SUNWonbld/prototype_*.
3004.  Update usr/src/tools/README.tools (this file).
3015.  Repeat 1-4 for any man pages.
302