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