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 
  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. If you like, 'make pkg' will build the SUNWonbld
  29 package in $(PKGARCHIVE). Installing that package will populate the
  30 /opt/onbld directory, and create a root account for building called 'gk',
  31 which uses csh and has a home directory of /opt/onbld/gk. You can
  32 use this account to do full builds with 'nightly'. You don't have to,
  33 but the 'gk' account has the path setup properly, has a .make.machines
  34 file for dmake, and has a .login that sets up for dmake.
  35 
  36 Layout 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 
  75 Tool Summary
  76 ------------
  77 
  78 bldenv
  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 
  87 build_cscope
  88         builds cscope databases in the uts, the platform subdirectories
  89         of uts, and in usr/src. Uses cscope-fast.
  90 
  91 cdm 
  92         A Mercurial extension providing various commands useful for ON
  93         development
  94 
  95 check_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 
 104 checkproto
 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 
 109 codereview
 110         Given two filenames, creates a postscript file with the file 
 111         differences highlighted.
 112 
 113 copyrightchk
 114         Checks that files have appropriate SMI copyright notices.
 115         Primarily used by wx
 116 
 117 cscope-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         
 122 cstyle
 123         checks C source for compliance with OS/Net guidelines.
 124 
 125 ctfconvert
 126         Convert symbolic debugging information in an object file to the Compact
 127         ANSI-C Type Format (CTF).
 128 
 129 ctfdump
 130         Decode and display CTF data stored in a raw file or in an ELF file.
 131 
 132 ctfmerge
 133         Merge the CTF data from one or more object files.
 134 
 135 depcheck
 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 
 143 elfcmp
 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 
 150 elfsign
 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 
 156 elfsigncmp
 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         
 162 find_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 
 167 findunref
 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 
 185 hdrchk
 186         checks headers for compliance with OS/Net standards (form, includes,
 187         C++ guards).
 188 
 189 hgsetup
 190         creates a basic Mercurial configuration for the user.
 191 
 192 hg-active
 193         helper used by webrev to generate file lists for Mercurial
 194         workspaces.
 195 
 196 install.bin
 197         binary version of /usr/sbin/install. Used to be vastly faster
 198         (since /usr/sbin/install is a shell script), but may only be a bit
 199         faster now. One speedup includes avoiding the name service for the
 200         well-known, never-changing password entries like 'root' and 'sys.'
 201 
 202 interface_check
 203         detects and reports invalid versioning in ELF objects.
 204         Optionally generates an interface description file for
 205         the workspace.
 206 
 207 interface_cmp
 208         Compares two interface description files, as produced by
 209         interface_check, and flags invalid deviations in ELF object
 210         versioning between them. interface_cmp can be used between Solaris
 211         gates to ensure that older releases remain compatible with the
 212         development gate. It can also be used to validate new changes to
 213         the development gate before they are integrated.
 214 
 215 lintdump
 216         dumps the contents of one or more lint libraries; see lintdump(1)
 217 
 218 ndrgen
 219         Network Data Language (NDL) RPC protocol compiler to support DCE
 220         RPC/MSRPC and SMB/CIFS.  ndrgen takes an input protocol definition
 221         file (say, proto.ndl) and generates an output C source file
 222         (proto_ndr.c) containing the Network Data Representation (NDR)
 223         marshalling routines to implement the RPC protocol.
 224 
 225 nightly
 226         nightly build script. Takes an environment (or 'env') file describing
 227         such things as the workspace, the parent, and what to build. See
 228         env/developer and env/gatekeeper for sample, hopefully well-commented
 229         env files.
 230 
 231 pmodes
 232         enforces proper file ownership and permissions in pkgmap and package
 233         prototype* files.  converts files if necessary
 234 
 235 protocmp
 236         compares proto lists and the package definitions. Used by nightly
 237         to determine if the proto area matches the packages, and to detect
 238         differences between a childs proto area and a parents.
 239 
 240 protocmp.terse
 241         transforms the output of protocmp into something a bit more friendly
 242 
 243 protolist
 244         create a list of what's in the proto area, to feed to protocmp.
 245 
 246 
 247 ws
 248         creates a shell with the environment set up to build in the given
 249         workspace. Used mostly for non-full-build workspaces, so it sets up
 250         to pull headers and libraries from the proto area of the parent if
 251         they aren't in the childs proto area.
 252 
 253 tokenize
 254         Used to build the sun4u boot block.
 255 
 256 webrev
 257         Generates a set of HTML pages that show side-by-side diffs of
 258         changes in your workspace, for easy communication of code
 259         review materials.  Can automagically find edited files or use a
 260         manually-generated list; knows how to use wx's active file for
 261         lists of checked-out files and proposed SCCS comments.
 262 
 263 which_scm
 264         Reports the current Source Code Management (SCM) system in use
 265         and the top-level directory of the workspace.
 266 
 267 wsdiff
 268         Detect object differences between two ON proto areas. Used by
 269         nightly(1) to determine what changed between two builds. Handy
 270         for identifying the set of built objects impacted by a given
 271         source change. This information is needed for patch construction.
 272 
 273 
 274 How to do a full build
 275 ----------------------
 276 
 277 1. Find an environment file that might do what you want to do. If you're just
 278    a developer wanting to do a full build in a child of the gate, copy the
 279    'developer' environment file to a new name (private to you and/or the
 280    work being done in this workspace, to avoid collisions with others). Then
 281    edit the file and tailor it to your workspace. Remember that this file
 282    is a shell script, so it can do more than set environment variables.
 283 
 284 2. Login as 'gk' (or root, but your PATH and .make.machines for dmake will
 285    not be right). Run 'nightly' and give it your environment file as an
 286    option. 'nightly' will first look for your environment file in
 287    /opt/onbld/env, and if it's not there then it will look for it as an
 288    absolute or relative path. Some people put their environment files in
 289    their workspace to keep them close.
 290 
 291 3. When 'nightly' is complete, it will send a summary of what happened to
 292    $MAILTO. Usually, the less info in the mail the better. If you have failures,
 293    you can go look at the full log of what happened, generally in
 294    $CODEMGR_WS/log/log.<date>/nightly.log (the mail_msg it sent and the proto
 295    list are there too). You can also find the individual build logs, like
 296    'make clobber' and 'make install' output in $SRC, under names like
 297    clobber-${MACH}.out and install-${MACH}.out (for a DEBUG build). These
 298    will be smaller than nightly.log, and maybe more searchable.
 299 
 300 Files you have to update to add a tool
 301 --------------------------------------
 302 
 303 1.  Add the tool in its appropriate place.
 304 2.  Update the Makefile as required.
 305 3.  Update usr/src/pkg/manifests/developer-build-onbld.mf
 306 4.  Update usr/src/tools/README.tools (this file).
 307 5.  Repeat 1-4 for any man pages.