xref: /titanic_41/usr/src/tools/README.tools (revision 2c65c8b07fc9eb4a059c4c47b7d637cd6905909e)
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 2007 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	builds cscope databases in the uts, the platform subdirectories
88	of uts, and in usr/src. Uses cscope-fast.
89
90check_rtime
91	checks ELF attributes used by ELF dynamic objects in the proto area.
92	Used by 'nightly's -r option, to check a number of ELF runtime
93	attributes for consistency with common build rules.  nightly uses
94	the -o option to simplify the output for diffing with previous
95	build results.  It also uses the -i option to obtain NEEDED and RUNPATH
96	entries, which help detect changes in software dependencies and makes
97	sure objects don't have any strange runpaths like /opt/SUNWspro/lib.
98
99checkproto
100	Runs protocmp and protolist on a workspace (or uses the environment
101	variable CODEMGR_WS to determine the workspace). Checks the proto area
102	against the packages.
103
104codereview
105	Given two filenames, creates a postscript file with the file
106	differences highlighted.
107
108codesign
109	Tools for signing cryptographic modules using the official
110	Sun release keys stored on a remote signing server. This
111	directory contains signit, a client program for signing
112	files with the signing server; signproto, a shell script
113	that finds crypto modules in $ROOT and signs them using
114	signit; and codesign_server.pl, the code that runs on the
115	server. The codesign_server code is not used on an ON
116	build machine but is kept here for source control purposes.
117
118cscope-fast
119	The fast version of cscope that we use internally. Seems to work,
120	but may need more testing before it's placed in the gate. The source
121	just really needs to be here.
122
123cstyle
124	checks C source for compliance with OS/Net guidelines.
125
126ctfconvert
127	Convert symbolic debugging information in an object file to the Compact
128	ANSI-C Type Format (CTF).
129
130ctfdump
131	Decode and display CTF data stored in a raw file or in an ELF file.
132
133ctfmerge
134	Merge the CTF data from one or more object files.
135
136depcheck
137	A tool to try an assess the dependencies of executables.  This tool
138	is not a definitive dependency check, but it does use "strings" and
139	"ldd" to gather as much information as it can.  The dependency check
140	tool can handle filenames and pkgnames.  Before using the dependency
141	checker you must build a database which reflects the properties and
142	files in your system.
143
144elfcmp
145	Compares two ELF modules (e.g. .o files, executables) section by
146	section.  Useful for determining whether "trivial" changes -
147	cstyle, lint, etc - actually changed the code.  The -S option
148	is used to test whether two binaries are the same except for
149	the elfsign signature.
150
151elfsign
152	Built from the same sources as the shipped elfsign(1), this
153	version is used in nightly -t builds to assure that the signing
154	process and format is the same as will be used on the target
155	system.
156
157elfsigncmp
158	This script can be used in lieu of elfsign during a build.
159	It uses elfsign to sign a copy of the object and elfcmp -S to
160	verify that the signing caused no damage before updating
161	the object to be signed.
162
163findunref
164	Finds all files in a source tree that have access times older than a
165	certain time and are not in a specified list of exceptions.  Since
166	'nightly' timestamps the start of the build, and findunref uses its
167	timestamp (by default), this can be used to find all files that were
168	unreferenced during a nightly build).  Since some files are only used
169	during a SPARC or Intel build, 'findunref' needs to be run on
170	workspaces from both architectures and the results need to be merged.
171	For instance, if $INTELSRC and $SPARCSRC are set to the usr/src
172	directories of your Intel and SPARC nightly workspaces, then you
173	can merge the results like so:
174
175	$ findunref $INTELSRC $INTELSRC/tools/findunref/exception_list | \
176	  sort > ~/unref-i386.out
177	$ findunref $SPARCSRC $SPARCSRC/tools/findunref/exception_list | \
178	  sort > ~/unref-sparc.out
179	$ comm -12 ~/unref-i386.out ~/unref-sparc.out > ~/unref.out
180
181hdrchk
182	checks headers for compliance with OS/Net standards (form, includes,
183	C++ guards).
184
185install.bin
186	binary version of /usr/sbin/install. Used to be vastly faster
187	(since /usr/sbin/install is a shell script), but may only be a bit
188	faster now. One speedup includes avoiding the name service for the
189	well-known, never-changing password entries like 'root' and 'sys.'
190
191intf_check
192	detects and reports ABI versioning and stability problems.
193
194lintdump
195	dumps the contents of one or more lint libraries; see lintdump(1)
196
197keywords
198	checks files for proper SCCS keywords.
199
200makebfu
201	simple wrapper around 'mkbfu' for use outside nightly (when in a build
202	shell from 'ws' or 'bldenv').
203
204mkbfu
205	makes cpio archives out of the proto area suitable for bfu'ing.
206	Used by 'nightly' and 'makebfu'.
207
208ndrgen
209	Network Data Language (NDL) RPC protocol compiler to support DCE
210	RPC/MSRPC and SMB/CIFS.  ndrgen takes an input protocol definition
211	file (say, proto.ndl) and generates an output C source file
212	(proto_ndr.c) containing the Network Data Representation (NDR)
213	marshalling routines to implement the RPC protocol.
214
215nightly
216	nightly build script. Takes an environment (or 'env') file describing
217	such things as the workspace, the parent, and what to build. See
218	env/developer and env/gatekeeper for sample, hopefully well-commented
219	env files.
220
221pmodes
222	enforces proper file ownership and permissions in pkgmap and package
223	prototype* files.  converts files if necessary
224
225protocmp
226	compares proto lists and the package definitions. Used by nightly
227	to determine if the proto area matches the packages, and to detect
228	differences between a childs proto area and a parents.
229
230protocmp.terse
231	transforms the output of protocmp into something a bit more friendly
232
233protolist
234	create a list of what's in the proto area, to feed to protocmp.
235
236sccscp
237	copy a file under SCCS control to another location in a workspace.
238	also updates teamware's nametable.
239
240sccshist
241	Display the history, comments and diffs, of a file under SCCS
242	control.
243
244sccsmv
245	rename a file under SCCS control to another location in a workspace.
246	also updates teamware's nametable.
247
248sccsrm
249	delete a file under SCCS control workspace. also updates teamware's
250	nametable. Actually renames it to .del-<file>-`date` so that others
251	will see it move when it is brought over (in case they were working
252	on it).
253
254ws
255	creates a shell with the environment set up to build in the given
256	workspace. Used mostly for non-full-build workspaces, so it sets up
257	to pull headers and libraries from the proto area of the parent if
258	they aren't in the childs proto area.
259
260wx
261	A great workspace tool by bonwick. See wx.README for information
262	and warnings.
263
264tokenize
265	Used to build the sun4u boot block.
266
267webrev
268	Generates a set of HTML pages that show side-by-side diffs of
269	changes in your workspace, for easy communication of code
270	review materials.  Can automagically find edited files or use a
271	manually-generated list; knows how to use wx's active file for
272	lists of checked-out files and proposed SCCS comments.
273
274wsdiff
275	Detect object differences between two ON proto areas. Used by
276	nightly(1) to determine what changed between two builds. Handy
277	for identifying the set of built objects impacted by a given
278	source change. This information is needed for patch construction.
279
280
281How to do a full build
282----------------------
283
2841. Find an environment file that might do what you want to do. If you're just
285   a developer wanting to do a full build in a child of the gate, copy the
286   'developer' environment file to a new name (private to you and/or the
287   work being done in this workspace, to avoid collisions with others). Then
288   edit the file and tailor it to your workspace. Remember that this file
289   is a shell script, so it can do more than set environment variables.
290
2912. Login as 'gk' (or root, but your PATH and .make.machines for dmake will
292   not be right). Run 'nightly' and give it your environment file as an
293   option. 'nightly' will first look for your environment file in
294   /opt/onbld/env, and if it's not there then it will look for it as an
295   absolute or relative path. Some people put their environment files in
296   their workspace to keep them close.
297
2983. When 'nightly' is complete, it will send a summary of what happened to
299   $MAILTO. Usually, the less info in the mail the better. If you have failures,
300   you can go look at the full log of what happened, generally in
301   $CODEMGR_WS/log/log.<date>/nightly.log (the mail_msg it sent and the proto
302   list are there too). You can also find the individual build logs, like
303   'make clobber' and 'make install' output in $SRC, under names like
304   clobber-${MACH}.out and install-${MACH}.out (for a DEBUG build). These
305   will be smaller than nightly.log, and maybe more searchable.
306
307Files you have to update to add a tool
308--------------------------------------
309
3101.  Add the tool in its appropriate place.
3112.  Update the Makefile as required.
3123.  Update usr/src/tools/SUNWonbld/prototype_*.
3134.  Update usr/src/tools/README.tools (this file).
3145.  Repeat 1-4 for any man pages.
315