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