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