loader: use snprintf() with variable length error messages
[unleashed.git] / usr / src / tools / README.tools
blobd9342ab10ea4eb704ffee386e350a2b2cdc9934a
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
22 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 This directory contains the tools used to do a full build of the
26 OS/Net workspace.  They usually live in the /opt/onbld directory on build
27 machines. From here, 'make install' will build and install the tools
28 in $ROOT/opt/onbld. 
30 Layout of /opt/onbld
31 --------------------
33 /opt/onbld/etc/abi
34         contains Solaris ABI database (ABI_*.db) and exceptions
35         for ABI Auditing tool (interface_check, interface_cmp).
37 /opt/onbld/bin
38         basic bin directory - contains scripts.
40 /opt/onbld/bin/${MACH}
41         architecture-specific bin directory for binaries.
43 /opt/onbld/env
44         build environment files.
46 /opt/onbld/lib
47         libraries used by the build tools.
49 /opt/onbld/lib/python<version>/
50         python modules used by the build tools.
52 /opt/onbld/lib/python<version>/onbld/hgext
53         Mercurial extensions.
55 /opt/onbld/lib/python/ 
56         symlink to the modules directory of the currently preferred
57         python version.  This exists to retain compatibility both for
58         tools expecting only one supported version of python, and for
59         user .hgrc files that expect to find cdm.py in
60         /opt/onbld/lib/python/onbld/hgext.
62 /opt/onbld/man
63         rudimentary man pages for some of the tools.
66 Tool Summary
67 ------------
69 bldenv
70         companion to 'nightly.' Takes the same environment file you
71         used with 'nightly,' and starts a shell with the environment
72         set up the same way as 'nightly' set it up. This is useful
73         if you're trying to quickly rebuild portions of a workspace
74         built by 'nightly'. 'ws' should not be used for this since it
75         sets the environment up differently and may cause everything
76         to rebuild (because of different -I or -L paths).
78 build_cscope
79         builds cscope databases in the uts, the platform subdirectories
80         of uts, and in usr/src. Uses cscope-fast.
82 cdm 
83         A Mercurial extension providing various commands useful for ON
84         development
86 check_rtime
87         checks ELF attributes used by ELF dynamic objects in the proto area.
88         Used by 'nightly's -r option, to check a number of ELF runtime
89         attributes for consistency with common build rules.  nightly uses
90         the -o option to simplify the output for diffing with previous
91         build results.  It also uses the -i option to obtain NEEDED and RUNPATH
92         entries, which help detect changes in software dependencies and makes
93         sure objects don't have any strange runpaths like /opt/SUNWspro/lib.
95 checkproto
96         Runs protocmp and protolist on a workspace (or uses the environment
97         variable CODEMGR_WS to determine the workspace). Checks the proto area
98         against the packages.
100 codereview
101         Given two filenames, creates a postscript file with the file 
102         differences highlighted.
104 copyrightchk
105         Checks that files have appropriate SMI copyright notices.
106         Primarily used by wx
108 cscope-fast
109         The fast version of cscope that we use internally. Seems to work,
110         but may need more testing before it's placed in the gate. The source
111         just really needs to be here.
112         
113 cstyle
114         checks C source for compliance with OS/Net guidelines.
116 ctfconvert
117         Convert symbolic debugging information in an object file to the Compact
118         ANSI-C Type Format (CTF).
120 ctfdump
121         Decode and display CTF data stored in a raw file or in an ELF file.
123 ctfmerge
124         Merge the CTF data from one or more object files.
126 depcheck
127         A tool to try an assess the dependencies of executables.  This tool 
128         is not a definitive dependency check, but it does use "strings" and 
129         "ldd" to gather as much information as it can.  The dependency check
130         tool can handle filenames and pkgnames.  Before using the dependency
131         checker you must build a database which reflects the properties and
132         files in your system.
134 elfcmp
135         Compares two ELF modules (e.g. .o files, executables) section by
136         section.  Useful for determining whether "trivial" changes -
137         cstyle, lint, etc - actually changed the code.  The -S option
138         is used to test whether two binaries are the same except for
139         the elfsign signature.
141 find_elf
142         Search a directory tree for ELF objects, and produce one line of
143         output per object. Used by check_rtime and interface_check to locate
144         the objects to examine.
146 findunref
147         Finds all files in a source tree that have access times older than a
148         certain time and are not in a specified list of exceptions.  Since
149         'nightly' timestamps the start of the build, and findunref uses its
150         timestamp (by default), this can be used to find all files that were
151         unreferenced during a nightly build).  Since some files are only used
152         during a SPARC or Intel build, 'findunref' needs to be run on
153         workspaces from both architectures and the results need to be merged.
154         For instance, if $INTELSRC and $SPARCSRC are set to the usr/src
155         directories of your Intel and SPARC nightly workspaces, then you
156         can merge the results like so:
158         $ findunref $INTELSRC $INTELSRC/tools/findunref/exception_list | \
159           sort > ~/unref-i386.out
160         $ findunref $SPARCSRC $SPARCSRC/tools/findunref/exception_list | \
161           sort > ~/unref-sparc.out
162         $ comm -12 ~/unref-i386.out ~/unref-sparc.out > ~/unref.out
164 hdrchk
165         checks headers for compliance with OS/Net standards (form, includes,
166         C++ guards).
168 hgsetup
169         creates a basic Mercurial configuration for the user.
171 hg-active
172         helper used by webrev to generate file lists for Mercurial
173         workspaces.
175 install.bin
176         binary version of /usr/sbin/install. Used to be vastly faster
177         (since /usr/sbin/install is a shell script), but may only be a bit
178         faster now. One speedup includes avoiding the name service for the
179         well-known, never-changing password entries like 'root' and 'sys.'
181 interface_check
182         detects and reports invalid versioning in ELF objects.
183         Optionally generates an interface description file for
184         the workspace.
186 interface_cmp
187         Compares two interface description files, as produced by
188         interface_check, and flags invalid deviations in ELF object
189         versioning between them. interface_cmp can be used between Solaris
190         gates to ensure that older releases remain compatible with the
191         development gate. It can also be used to validate new changes to
192         the development gate before they are integrated.
194 ndrgen
195         Network Data Language (NDL) RPC protocol compiler to support DCE
196         RPC/MSRPC and SMB/CIFS.  ndrgen takes an input protocol definition
197         file (say, proto.ndl) and generates an output C source file
198         (proto_ndr.c) containing the Network Data Representation (NDR)
199         marshalling routines to implement the RPC protocol.
201 nightly
202         nightly build script. Takes an environment (or 'env') file describing
203         such things as the workspace, the parent, and what to build. See
204         env/developer and env/gatekeeper for sample, hopefully well-commented
205         env files.
207 pmodes
208         enforces proper file ownership and permissions in pkgmap and package
209         prototype* files.  converts files if necessary
211 protocmp
212         compares proto lists and the package definitions. Used by nightly
213         to determine if the proto area matches the packages, and to detect
214         differences between a childs proto area and a parents.
216 protocmp.terse
217         transforms the output of protocmp into something a bit more friendly
219 protolist
220         create a list of what's in the proto area, to feed to protocmp.
224         creates a shell with the environment set up to build in the given
225         workspace. Used mostly for non-full-build workspaces, so it sets up
226         to pull headers and libraries from the proto area of the parent if
227         they aren't in the childs proto area.
229 tokenize
230         Used to build the sun4u boot block.
232 webrev
233         Generates a set of HTML pages that show side-by-side diffs of
234         changes in your workspace, for easy communication of code
235         review materials.  Can automatically find edited files or use a
236         manually-generated list.
238 which_scm
239         Reports the current Source Code Management (SCM) system in use
240         and the top-level directory of the workspace.
242 wsdiff
243         Detect object differences between two ON proto areas. Used by
244         nightly(1) to determine what changed between two builds. Handy
245         for identifying the set of built objects impacted by a given
246         source change. This information is needed for patch construction.
249 How to do a full build
250 ----------------------
252 1. Find an environment file that might do what you want to do. If you're just
253    a developer wanting to do a full build in a child of the gate, copy the
254    'developer' environment file to a new name (private to you and/or the
255    work being done in this workspace, to avoid collisions with others). Then
256    edit the file and tailor it to your workspace. Remember that this file
257    is a shell script, so it can do more than set environment variables.
259 2. Run 'nightly' and give it your environment file as an
260    option. 'nightly' will first look for your environment file in
261    /opt/onbld/env, and if it's not there then it will look for it as an
262    absolute or relative path. Some people put their environment files in
263    their workspace to keep them close.
265 3. When 'nightly' is complete, it will send a summary of what happened to
266    $MAILTO. Usually, the less info in the mail the better. If you have failures,
267    you can go look at the full log of what happened, generally in
268    $CODEMGR_WS/log/log.<date>/nightly.log (the mail_msg it sent and the proto
269    list are there too). You can also find the individual build logs, like
270    'make clobber' and 'make install' output in $SRC, under names like
271    clobber-${MACH}.out and install-${MACH}.out (for a DEBUG build). These
272    will be smaller than nightly.log, and maybe more searchable.
274 Files you have to update to add a tool
275 --------------------------------------
277 1.  Add the tool in its appropriate place.
278 2.  Update the Makefile as required.
279 3.  Update usr/src/pkg/manifests/developer-build-onbld.mf
280 4.  Update usr/src/tools/README.tools (this file).
281 5.  Repeat 1-4 for any man pages.