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