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