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