xref: /illumos-gate/usr/src/tools/README.tools (revision 25b05a3ecbac136f5e1192d4d9e79dc14f895785)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
534c98957Smeem# Common Development and Distribution License (the "License").
634c98957Smeem# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2287ab3622SRichard Lowe# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
23d8e4595bSJohn Levon#
24d8e4595bSJohn Levon# Copyright 2019 Joyent, Inc.
25d8e4595bSJohn Levon#
2675ce41a5SAli Bahrami
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gateThis directory contains the tools used to do a full build of the
297c478bd9Sstevel@tonic-gateOS/Net workspace.  They usually live in the /opt/onbld directory on build
307c478bd9Sstevel@tonic-gatemachines. From here, 'make install' will build and install the tools
315c60adfbSRichard Lowein $ROOT/opt/onbld.
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gateLayout of /opt/onbld
347c478bd9Sstevel@tonic-gate--------------------
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate/opt/onbld/etc/abi
377c478bd9Sstevel@tonic-gate	contains Solaris ABI database (ABI_*.db) and exceptions
3875ce41a5SAli Bahrami	for ABI Auditing tool (interface_check, interface_cmp).
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate/opt/onbld/bin
417c478bd9Sstevel@tonic-gate	basic bin directory - contains scripts.
427c478bd9Sstevel@tonic-gate
437c478bd9Sstevel@tonic-gate/opt/onbld/bin/${MACH}
447c478bd9Sstevel@tonic-gate	architecture-specific bin directory for binaries.
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate/opt/onbld/env
477c478bd9Sstevel@tonic-gate	build environment files.
487c478bd9Sstevel@tonic-gate
49cdf0c1d5Smjnelson/opt/onbld/lib
50cdf0c1d5Smjnelson	libraries used by the build tools.
51cdf0c1d5Smjnelson
5287ab3622SRichard Lowe/opt/onbld/lib/python<version>/
53cdf0c1d5Smjnelson	python modules used by the build tools.
54cdf0c1d5Smjnelson
5587ab3622SRichard Lowe/opt/onbld/lib/python/
5687ab3622SRichard Lowe        symlink to the modules directory of the currently preferred
570f554fe5SRichard Lowe        python version.
5887ab3622SRichard Lowe
597c478bd9Sstevel@tonic-gate/opt/onbld/man
607c478bd9Sstevel@tonic-gate	rudimentary man pages for some of the tools.
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gateTool Summary
647c478bd9Sstevel@tonic-gate------------
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gatebldenv
677c478bd9Sstevel@tonic-gate	companion to 'nightly.' Takes the same environment file you
687c478bd9Sstevel@tonic-gate	used with 'nightly,' and starts a shell with the environment
697c478bd9Sstevel@tonic-gate	set up the same way as 'nightly' set it up. This is useful
707c478bd9Sstevel@tonic-gate	if you're trying to quickly rebuild portions of a workspace
717c478bd9Sstevel@tonic-gate	built by 'nightly'. 'ws' should not be used for this since it
727c478bd9Sstevel@tonic-gate	sets the environment up differently and may cause everything
737c478bd9Sstevel@tonic-gate	to rebuild (because of different -I or -L paths).
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gatebuild_cscope
767c478bd9Sstevel@tonic-gate	builds cscope databases in the uts, the platform subdirectories
777c478bd9Sstevel@tonic-gate	of uts, and in usr/src. Uses cscope-fast.
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gatecheck_rtime
807c478bd9Sstevel@tonic-gate	checks ELF attributes used by ELF dynamic objects in the proto area.
817c478bd9Sstevel@tonic-gate	Used by 'nightly's -r option, to check a number of ELF runtime
827c478bd9Sstevel@tonic-gate	attributes for consistency with common build rules.  nightly uses
837c478bd9Sstevel@tonic-gate	the -o option to simplify the output for diffing with previous
847c478bd9Sstevel@tonic-gate	build results.  It also uses the -i option to obtain NEEDED and RUNPATH
857c478bd9Sstevel@tonic-gate	entries, which help detect changes in software dependencies and makes
867c478bd9Sstevel@tonic-gate	sure objects don't have any strange runpaths like /opt/SUNWspro/lib.
877c478bd9Sstevel@tonic-gate
8823259b79Srotondocodesign
8923259b79Srotondo	Tools for signing cryptographic modules using the official
9023259b79Srotondo	Sun release keys stored on a remote signing server. This
9123259b79Srotondo	directory contains signit, a client program for signing
9223259b79Srotondo	files with the signing server; signproto, a shell script
9323259b79Srotondo	that finds crypto modules in $ROOT and signs them using
9423259b79Srotondo	signit; and codesign_server.pl, the code that runs on the
9523259b79Srotondo	server. The codesign_server code is not used on an ON
9623259b79Srotondo	build machine but is kept here for source control purposes.
9723259b79Srotondo
98cdf0c1d5Smjnelsoncopyrightchk
99cdf0c1d5Smjnelson	Checks that files have appropriate SMI copyright notices.
100cdf0c1d5Smjnelson	Primarily used by wx
101cdf0c1d5Smjnelson
1027c478bd9Sstevel@tonic-gatecscope-fast
1037c478bd9Sstevel@tonic-gate	The fast version of cscope that we use internally. Seems to work,
1047c478bd9Sstevel@tonic-gate	but may need more testing before it's placed in the gate. The source
1057c478bd9Sstevel@tonic-gate	just really needs to be here.
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gatecstyle
1087c478bd9Sstevel@tonic-gate	checks C source for compliance with OS/Net guidelines.
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gatectfconvert
1117c478bd9Sstevel@tonic-gate	Convert symbolic debugging information in an object file to the Compact
1127c478bd9Sstevel@tonic-gate	ANSI-C Type Format (CTF).
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gatectfdump
1157c478bd9Sstevel@tonic-gate	Decode and display CTF data stored in a raw file or in an ELF file.
1167c478bd9Sstevel@tonic-gate
1177c478bd9Sstevel@tonic-gatectfmerge
1187c478bd9Sstevel@tonic-gate	Merge the CTF data from one or more object files.
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gateelfcmp
1217c478bd9Sstevel@tonic-gate	Compares two ELF modules (e.g. .o files, executables) section by
1227c478bd9Sstevel@tonic-gate	section.  Useful for determining whether "trivial" changes -
1237c478bd9Sstevel@tonic-gate	cstyle, lint, etc - actually changed the code.  The -S option
1247c478bd9Sstevel@tonic-gate	is used to test whether two binaries are the same except for
1257c478bd9Sstevel@tonic-gate	the elfsign signature.
1267c478bd9Sstevel@tonic-gate
12775ce41a5SAli Bahramifind_elf
12875ce41a5SAli Bahrami	Search a directory tree for ELF objects, and produce one line of
12975ce41a5SAli Bahrami	output per object. Used by check_rtime and interface_check to locate
13075ce41a5SAli Bahrami	the objects to examine.
13175ce41a5SAli Bahrami
1327c478bd9Sstevel@tonic-gatefindunref
1337c478bd9Sstevel@tonic-gate	Finds all files in a source tree that have access times older than a
1347c478bd9Sstevel@tonic-gate	certain time and are not in a specified list of exceptions.  Since
1357c478bd9Sstevel@tonic-gate	'nightly' timestamps the start of the build, and findunref uses its
1367c478bd9Sstevel@tonic-gate	timestamp (by default), this can be used to find all files that were
1377c478bd9Sstevel@tonic-gate	unreferenced during a nightly build).  Since some files are only used
1387c478bd9Sstevel@tonic-gate	during a SPARC or Intel build, 'findunref' needs to be run on
1397c478bd9Sstevel@tonic-gate	workspaces from both architectures and the results need to be merged.
1407c478bd9Sstevel@tonic-gate	For instance, if $INTELSRC and $SPARCSRC are set to the usr/src
1417c478bd9Sstevel@tonic-gate	directories of your Intel and SPARC nightly workspaces, then you
1427c478bd9Sstevel@tonic-gate	can merge the results like so:
1437c478bd9Sstevel@tonic-gate
1447c478bd9Sstevel@tonic-gate	$ findunref $INTELSRC $INTELSRC/tools/findunref/exception_list | \
1457c478bd9Sstevel@tonic-gate	  sort > ~/unref-i386.out
1467c478bd9Sstevel@tonic-gate	$ findunref $SPARCSRC $SPARCSRC/tools/findunref/exception_list | \
1477c478bd9Sstevel@tonic-gate	  sort > ~/unref-sparc.out
1487c478bd9Sstevel@tonic-gate	$ comm -12 ~/unref-i386.out ~/unref-sparc.out > ~/unref.out
1497c478bd9Sstevel@tonic-gate
1507c478bd9Sstevel@tonic-gatehdrchk
1517c478bd9Sstevel@tonic-gate	checks headers for compliance with OS/Net standards (form, includes,
1527c478bd9Sstevel@tonic-gate	C++ guards).
1537c478bd9Sstevel@tonic-gate
1547c478bd9Sstevel@tonic-gateinstall.bin
1557c478bd9Sstevel@tonic-gate	binary version of /usr/sbin/install. Used to be vastly faster
1567c478bd9Sstevel@tonic-gate	(since /usr/sbin/install is a shell script), but may only be a bit
1577c478bd9Sstevel@tonic-gate	faster now. One speedup includes avoiding the name service for the
1587c478bd9Sstevel@tonic-gate	well-known, never-changing password entries like 'root' and 'sys.'
1597c478bd9Sstevel@tonic-gate
16075ce41a5SAli Bahramiinterface_check
16175ce41a5SAli Bahrami	detects and reports invalid versioning in ELF objects.
16275ce41a5SAli Bahrami	Optionally generates an interface description file for
16375ce41a5SAli Bahrami	the workspace.
16475ce41a5SAli Bahrami
16575ce41a5SAli Bahramiinterface_cmp
16675ce41a5SAli Bahrami	Compares two interface description files, as produced by
16775ce41a5SAli Bahrami	interface_check, and flags invalid deviations in ELF object
16875ce41a5SAli Bahrami	versioning between them. interface_cmp can be used between Solaris
16975ce41a5SAli Bahrami	gates to ensure that older releases remain compatible with the
17075ce41a5SAli Bahrami	development gate. It can also be used to validate new changes to
17175ce41a5SAli Bahrami	the development gate before they are integrated.
1727c478bd9Sstevel@tonic-gate
17334c98957Smeemlintdump
17434c98957Smeem	dumps the contents of one or more lint libraries; see lintdump(1)
17534c98957Smeem
176d0e51869Samwndrgen
177d0e51869Samw	Network Data Language (NDL) RPC protocol compiler to support DCE
178d0e51869Samw	RPC/MSRPC and SMB/CIFS.  ndrgen takes an input protocol definition
179d0e51869Samw	file (say, proto.ndl) and generates an output C source file
180d0e51869Samw	(proto_ndr.c) containing the Network Data Representation (NDR)
181d0e51869Samw	marshalling routines to implement the RPC protocol.
182d0e51869Samw
1837c478bd9Sstevel@tonic-gatenightly
1847c478bd9Sstevel@tonic-gate	nightly build script. Takes an environment (or 'env') file describing
1857c478bd9Sstevel@tonic-gate	such things as the workspace, the parent, and what to build. See
1867c478bd9Sstevel@tonic-gate	env/developer and env/gatekeeper for sample, hopefully well-commented
1877c478bd9Sstevel@tonic-gate	env files.
1887c478bd9Sstevel@tonic-gate
1897c478bd9Sstevel@tonic-gateprotocmp
1907c478bd9Sstevel@tonic-gate	compares proto lists and the package definitions. Used by nightly
1917c478bd9Sstevel@tonic-gate	to determine if the proto area matches the packages, and to detect
1927c478bd9Sstevel@tonic-gate	differences between a childs proto area and a parents.
1937c478bd9Sstevel@tonic-gate
1947c478bd9Sstevel@tonic-gateprotocmp.terse
1957c478bd9Sstevel@tonic-gate	transforms the output of protocmp into something a bit more friendly
1967c478bd9Sstevel@tonic-gate
1977c478bd9Sstevel@tonic-gateprotolist
1987c478bd9Sstevel@tonic-gate	create a list of what's in the proto area, to feed to protocmp.
1997c478bd9Sstevel@tonic-gate
2007c478bd9Sstevel@tonic-gate
2017c478bd9Sstevel@tonic-gatews
2027c478bd9Sstevel@tonic-gate	creates a shell with the environment set up to build in the given
2037c478bd9Sstevel@tonic-gate	workspace. Used mostly for non-full-build workspaces, so it sets up
2047c478bd9Sstevel@tonic-gate	to pull headers and libraries from the proto area of the parent if
2057c478bd9Sstevel@tonic-gate	they aren't in the childs proto area.
2067c478bd9Sstevel@tonic-gate
2077c478bd9Sstevel@tonic-gatetokenize
2087c478bd9Sstevel@tonic-gate	Used to build the sun4u boot block.
2097c478bd9Sstevel@tonic-gate
2107c478bd9Sstevel@tonic-gatewebrev
2117c478bd9Sstevel@tonic-gate	Generates a set of HTML pages that show side-by-side diffs of
2127c478bd9Sstevel@tonic-gate	changes in your workspace, for easy communication of code
2137c478bd9Sstevel@tonic-gate	review materials.  Can automagically find edited files or use a
2147c478bd9Sstevel@tonic-gate	manually-generated list; knows how to use wx's active file for
2157c478bd9Sstevel@tonic-gate	lists of checked-out files and proposed SCCS comments.
2167c478bd9Sstevel@tonic-gate
217cdf0c1d5Smjnelsonwhich_scm
218cdf0c1d5Smjnelson	Reports the current Source Code Management (SCM) system in use
219cdf0c1d5Smjnelson	and the top-level directory of the workspace.
220cdf0c1d5Smjnelson
22196ccc8cbSesaxewsdiff
22296ccc8cbSesaxe	Detect object differences between two ON proto areas. Used by
22396ccc8cbSesaxe	nightly(1) to determine what changed between two builds. Handy
22496ccc8cbSesaxe	for identifying the set of built objects impacted by a given
22596ccc8cbSesaxe	source change. This information is needed for patch construction.
22696ccc8cbSesaxe
22796ccc8cbSesaxe
2287c478bd9Sstevel@tonic-gateHow to do a full build
2297c478bd9Sstevel@tonic-gate----------------------
2307c478bd9Sstevel@tonic-gate
2317c478bd9Sstevel@tonic-gate1. Find an environment file that might do what you want to do. If you're just
2327c478bd9Sstevel@tonic-gate   a developer wanting to do a full build in a child of the gate, copy the
2337c478bd9Sstevel@tonic-gate   'developer' environment file to a new name (private to you and/or the
2347c478bd9Sstevel@tonic-gate   work being done in this workspace, to avoid collisions with others). Then
2357c478bd9Sstevel@tonic-gate   edit the file and tailor it to your workspace. Remember that this file
2367c478bd9Sstevel@tonic-gate   is a shell script, so it can do more than set environment variables.
2377c478bd9Sstevel@tonic-gate
2385c60adfbSRichard Lowe2. Run 'nightly' and give it your environment file as an
2397c478bd9Sstevel@tonic-gate   option. 'nightly' will first look for your environment file in
2407c478bd9Sstevel@tonic-gate   /opt/onbld/env, and if it's not there then it will look for it as an
2417c478bd9Sstevel@tonic-gate   absolute or relative path. Some people put their environment files in
2427c478bd9Sstevel@tonic-gate   their workspace to keep them close.
2437c478bd9Sstevel@tonic-gate
2447c478bd9Sstevel@tonic-gate3. When 'nightly' is complete, it will send a summary of what happened to
2457c478bd9Sstevel@tonic-gate   $MAILTO. Usually, the less info in the mail the better. If you have failures,
2467c478bd9Sstevel@tonic-gate   you can go look at the full log of what happened, generally in
2477c478bd9Sstevel@tonic-gate   $CODEMGR_WS/log/log.<date>/nightly.log (the mail_msg it sent and the proto
2487c478bd9Sstevel@tonic-gate   list are there too). You can also find the individual build logs, like
2497c478bd9Sstevel@tonic-gate   'make clobber' and 'make install' output in $SRC, under names like
2507c478bd9Sstevel@tonic-gate   clobber-${MACH}.out and install-${MACH}.out (for a DEBUG build). These
2517c478bd9Sstevel@tonic-gate   will be smaller than nightly.log, and maybe more searchable.
2527c478bd9Sstevel@tonic-gate
2537c478bd9Sstevel@tonic-gateFiles you have to update to add a tool
2547c478bd9Sstevel@tonic-gate--------------------------------------
2557c478bd9Sstevel@tonic-gate
2567c478bd9Sstevel@tonic-gate1.  Add the tool in its appropriate place.
2577c478bd9Sstevel@tonic-gate2.  Update the Makefile as required.
258*25b05a3eSAndy Fiddaman3.  Update usr/src/pkg/manifests/developer-build-onbld.p5m
25934c98957Smeem4.  Update usr/src/tools/README.tools (this file).
26034c98957Smeem5.  Repeat 1-4 for any man pages.
261