xref: /titanic_51/usr/src/tools/README.tools (revision e764248d4606662e466d4ee282fa5ef20e3dc578)
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 (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
23
24
25This directory contains the tools used to do a full build of the
26OS/Net workspace.  They usually live in the /opt/onbld directory on build
27machines. From here, 'make install' will build and install the tools
28in $ROOT/opt/onbld. If you like, 'make pkg' will build the SUNWonbld
29package in $(PKGARCHIVE). Installing that package will populate the
30/opt/onbld directory, and create a root account for building called 'gk',
31which uses csh and has a home directory of /opt/onbld/gk. You can
32use this account to do full builds with 'nightly'. You don't have to,
33but the 'gk' account has the path setup properly, has a .make.machines
34file for dmake, and has a .login that sets up for dmake.
35
36Layout of /opt/onbld
37--------------------
38
39/opt/onbld/etc/abi
40	contains Solaris ABI database (ABI_*.db) and exceptions
41	for ABI Auditing tool (interface_check, interface_cmp).
42
43/opt/onbld/gk
44	gk account's home directory.
45
46/opt/onbld/bin
47	basic bin directory - contains scripts.
48
49/opt/onbld/bin/${MACH}
50	architecture-specific bin directory for binaries.
51
52/opt/onbld/env
53	build environment files.
54
55/opt/onbld/lib
56	libraries used by the build tools.
57
58/opt/onbld/lib/python<version>/
59	python modules used by the build tools.
60
61/opt/onbld/lib/python/
62        symlink to the modules directory of the currently preferred
63        python version.
64
65/opt/onbld/man
66	rudimentary man pages for some of the tools.
67
68
69Tool Summary
70------------
71
72bldenv
73	companion to 'nightly.' Takes the same environment file you
74	used with 'nightly,' and starts a shell with the environment
75	set up the same way as 'nightly' set it up. This is useful
76	if you're trying to quickly rebuild portions of a workspace
77	built by 'nightly'. 'ws' should not be used for this since it
78	sets the environment up differently and may cause everything
79	to rebuild (because of different -I or -L paths).
80
81build_cscope
82	builds cscope databases in the uts, the platform subdirectories
83	of uts, and in usr/src. Uses cscope-fast.
84
85check_rtime
86	checks ELF attributes used by ELF dynamic objects in the proto area.
87	Used by 'nightly's -r option, to check a number of ELF runtime
88	attributes for consistency with common build rules.  nightly uses
89	the -o option to simplify the output for diffing with previous
90	build results.  It also uses the -i option to obtain NEEDED and RUNPATH
91	entries, which help detect changes in software dependencies and makes
92	sure objects don't have any strange runpaths like /opt/SUNWspro/lib.
93
94checkproto
95	Runs protocmp and protolist on a workspace (or uses the environment
96	variable CODEMGR_WS to determine the workspace). Checks the proto area
97	against the packages.
98
99codereview
100	Given two filenames, creates a postscript file with the file
101	differences highlighted.
102
103codesign
104	Tools for signing cryptographic modules using the official
105	Sun release keys stored on a remote signing server. This
106	directory contains signit, a client program for signing
107	files with the signing server; signproto, a shell script
108	that finds crypto modules in $ROOT and signs them using
109	signit; and codesign_server.pl, the code that runs on the
110	server. The codesign_server code is not used on an ON
111	build machine but is kept here for source control purposes.
112
113copyrightchk
114	Checks that files have appropriate SMI copyright notices.
115	Primarily used by wx
116
117cscope-fast
118	The fast version of cscope that we use internally. Seems to work,
119	but may need more testing before it's placed in the gate. The source
120	just really needs to be here.
121
122cstyle
123	checks C source for compliance with OS/Net guidelines.
124
125ctfconvert
126	Convert symbolic debugging information in an object file to the Compact
127	ANSI-C Type Format (CTF).
128
129ctfdump
130	Decode and display CTF data stored in a raw file or in an ELF file.
131
132ctfmerge
133	Merge the CTF data from one or more object files.
134
135depcheck
136	A tool to try an assess the dependencies of executables.  This tool
137	is not a definitive dependency check, but it does use "strings" and
138	"ldd" to gather as much information as it can.  The dependency check
139	tool can handle filenames and pkgnames.  Before using the dependency
140	checker you must build a database which reflects the properties and
141	files in your system.
142
143elfcmp
144	Compares two ELF modules (e.g. .o files, executables) section by
145	section.  Useful for determining whether "trivial" changes -
146	cstyle, lint, etc - actually changed the code.  The -S option
147	is used to test whether two binaries are the same except for
148	the elfsign signature.
149
150elfsign
151	Built from the same sources as the shipped elfsign(1), this
152	version is used in nightly -t builds to assure that the signing
153	process and format is the same as will be used on the target
154	system.
155
156elfsigncmp
157	This script can be used in lieu of elfsign during a build.
158	It uses elfsign to sign a copy of the object and elfcmp -S to
159	verify that the signing caused no damage before updating
160	the object to be signed.
161
162find_elf
163	Search a directory tree for ELF objects, and produce one line of
164	output per object. Used by check_rtime and interface_check to locate
165	the objects to examine.
166
167findunref
168	Finds all files in a source tree that have access times older than a
169	certain time and are not in a specified list of exceptions.  Since
170	'nightly' timestamps the start of the build, and findunref uses its
171	timestamp (by default), this can be used to find all files that were
172	unreferenced during a nightly build).  Since some files are only used
173	during a SPARC or Intel build, 'findunref' needs to be run on
174	workspaces from both architectures and the results need to be merged.
175	For instance, if $INTELSRC and $SPARCSRC are set to the usr/src
176	directories of your Intel and SPARC nightly workspaces, then you
177	can merge the results like so:
178
179	$ findunref $INTELSRC $INTELSRC/tools/findunref/exception_list | \
180	  sort > ~/unref-i386.out
181	$ findunref $SPARCSRC $SPARCSRC/tools/findunref/exception_list | \
182	  sort > ~/unref-sparc.out
183	$ comm -12 ~/unref-i386.out ~/unref-sparc.out > ~/unref.out
184
185hdrchk
186	checks headers for compliance with OS/Net standards (form, includes,
187	C++ guards).
188
189install.bin
190	binary version of /usr/sbin/install. Used to be vastly faster
191	(since /usr/sbin/install is a shell script), but may only be a bit
192	faster now. One speedup includes avoiding the name service for the
193	well-known, never-changing password entries like 'root' and 'sys.'
194
195interface_check
196	detects and reports invalid versioning in ELF objects.
197	Optionally generates an interface description file for
198	the workspace.
199
200interface_cmp
201	Compares two interface description files, as produced by
202	interface_check, and flags invalid deviations in ELF object
203	versioning between them. interface_cmp can be used between Solaris
204	gates to ensure that older releases remain compatible with the
205	development gate. It can also be used to validate new changes to
206	the development gate before they are integrated.
207
208lintdump
209	dumps the contents of one or more lint libraries; see lintdump(1)
210
211ndrgen
212	Network Data Language (NDL) RPC protocol compiler to support DCE
213	RPC/MSRPC and SMB/CIFS.  ndrgen takes an input protocol definition
214	file (say, proto.ndl) and generates an output C source file
215	(proto_ndr.c) containing the Network Data Representation (NDR)
216	marshalling routines to implement the RPC protocol.
217
218nightly
219	nightly build script. Takes an environment (or 'env') file describing
220	such things as the workspace, the parent, and what to build. See
221	env/developer and env/gatekeeper for sample, hopefully well-commented
222	env files.
223
224pmodes
225	enforces proper file ownership and permissions in pkgmap and package
226	prototype* files.  converts files if necessary
227
228protocmp
229	compares proto lists and the package definitions. Used by nightly
230	to determine if the proto area matches the packages, and to detect
231	differences between a childs proto area and a parents.
232
233protocmp.terse
234	transforms the output of protocmp into something a bit more friendly
235
236protolist
237	create a list of what's in the proto area, to feed to protocmp.
238
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
246tokenize
247	Used to build the sun4u boot block.
248
249webrev
250	Generates a set of HTML pages that show side-by-side diffs of
251	changes in your workspace, for easy communication of code
252	review materials.  Can automagically find edited files or use a
253	manually-generated list; knows how to use wx's active file for
254	lists of checked-out files and proposed SCCS comments.
255
256which_scm
257	Reports the current Source Code Management (SCM) system in use
258	and the top-level directory of the workspace.
259
260wsdiff
261	Detect object differences between two ON proto areas. Used by
262	nightly(1) to determine what changed between two builds. Handy
263	for identifying the set of built objects impacted by a given
264	source change. This information is needed for patch construction.
265
266
267How to do a full build
268----------------------
269
2701. Find an environment file that might do what you want to do. If you're just
271   a developer wanting to do a full build in a child of the gate, copy the
272   'developer' environment file to a new name (private to you and/or the
273   work being done in this workspace, to avoid collisions with others). Then
274   edit the file and tailor it to your workspace. Remember that this file
275   is a shell script, so it can do more than set environment variables.
276
2772. Login as 'gk' (or root, but your PATH and .make.machines for dmake will
278   not be right). Run 'nightly' and give it your environment file as an
279   option. 'nightly' will first look for your environment file in
280   /opt/onbld/env, and if it's not there then it will look for it as an
281   absolute or relative path. Some people put their environment files in
282   their workspace to keep them close.
283
2843. When 'nightly' is complete, it will send a summary of what happened to
285   $MAILTO. Usually, the less info in the mail the better. If you have failures,
286   you can go look at the full log of what happened, generally in
287   $CODEMGR_WS/log/log.<date>/nightly.log (the mail_msg it sent and the proto
288   list are there too). You can also find the individual build logs, like
289   'make clobber' and 'make install' output in $SRC, under names like
290   clobber-${MACH}.out and install-${MACH}.out (for a DEBUG build). These
291   will be smaller than nightly.log, and maybe more searchable.
292
293Files you have to update to add a tool
294--------------------------------------
295
2961.  Add the tool in its appropriate place.
2972.  Update the Makefile as required.
2983.  Update usr/src/pkg/manifests/developer-build-onbld.mf
2994.  Update usr/src/tools/README.tools (this file).
3005.  Repeat 1-4 for any man pages.
301