README revision 2063d9c01c4a721994a3cb528444d7f328135869
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson#
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# CDDL HEADER START
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# The contents of this file are subject to the terms of the
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# Common Development and Distribution License (the "License").
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# You may not use this file except in compliance with the License.
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# or http://www.opensolaris.org/os/licensing.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# See the License for the specific language governing permissions
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# and limitations under the License.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# When distributing Covered Code, include this CDDL HEADER in each
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# If applicable, add the following below this CDDL HEADER, with the
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# fields enclosed by brackets "[]" replaced with your own identifying
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# information: Portions Copyright [yyyy] [name of copyright owner]
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# CDDL HEADER END
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Use is subject to license terms.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinKERNEL MAKEFILE STRUCTURE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein-------------------------
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinThe advent of dynamic loading of kernel modules has obsoleted the
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User4.x kernel configuration scheme which was centered around a derived
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinMakefile and a collection of derived header files generated by the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinconfig(8) program. This file describes the structure of the replacement
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein"static" set of Makefiles.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinSome additional secondary goals were associated with the generation
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinof these Makefiles. It should be noted that the ability to properly
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeindeal with derived Makefiles is an explicit non-goal of the ongoing
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserNSE enhancements, so this project is a necessary consequence of that
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeindecision.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserAll project goals are enumerated below:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein1] To provide a set of static Makefiles to support kernel build
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein and installation.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User2] To provide a set of static Makefiles which conform to the
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews "Makefiles Guidelines". (This document is currently available
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User on-line as "terminator:/usr/integration/doc/make.std")
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein3] To completely eliminate the config(8) program.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein4] To provide a framework for linting the kernel (so that "lint free"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein can be made an integration criterion, in addition to being general
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User good hygiene).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein5] To eliminate the need for the small headers generated by config(8).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein In the ddi/dki world this need is completely eliminated as drivers
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User will be expected to dynamically configure themselves. Interim support
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein for existing drivers will be provided.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User6] To be able to "acquire" only the files needed to build a specific
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User module, if that is all that is needed.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein7] To provide a framework suitable for the production of "implementation
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein architecture" independent modules.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User8] To restructure the assembly language files to support the generation
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein of "lint-libraries" from them.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein9] To provide support for the incidental Makefile targets many developers
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User are accustomed to (such as cscope and tags). These can be added to the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Makefiles asd required. (cscope is currently supported.)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox UserGENERAL STRUCTURE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein-----------------
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinThe source code layout is not generally effected by the Makefiles. However,
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Userthe location of the generated files has changed dramatically.
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User"Implementation architecture" independent modules are produced in
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userindividual directories (one per module) under the "instruction-set
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinarchitecture" directory (i.e.: sparc). Similarly, "implementation
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinarchitecture" dependent modules are produced in individual directories
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinunder the "implementation architecture" directory (i.e.: sun4, sun4c).
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserIt should be noted that currently (4/14/91) no implementation architecture
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrewsmodules exist. This situation is expected to change shortly.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox UserThe driving Makefile for any module is located in the leaf directory
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinwhere the module (and associated objects) are built. After a 'make
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclobber' operation, the Makefile is the only file remaining in that
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeindirectory. Common definitions and rules are contained in suffixed
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinMakefiles in non-leaf directories which are included in the leaf
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserMakefiles. Non-suffixed Makefiles in non-leaf directories generally
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeininvoke lower level Makefiles to perform the actual tasks.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/Makefile
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Useruts/sparc/Makefile
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/sun4c/Makefile
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/sun4c/svvs/Makefile
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User These Makefiles generally are cognizant of the components
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User made in subdirectories and invoke Makefiles in those sub-
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein directories to perform the actual build. Some targets (or
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein pseudo-targets) may be directly built at this level (such
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein as the cscope databases).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Useruts/Makefile.uts
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Contains common definitions for all possible architectures.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/Makefile.targ
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User Contains common targets for all possible architectures.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/common/Makefile.files
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Useruts/sun/Makefile.files
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Useruts/sparc/Makefile.files
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/sun4c/Makefile.files
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/sun4/Makefile.files
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein These Makefiles are divided into two sections. The first
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User section can be viewed as the equivalent of the "files" (sparc
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews and sun4c) and "files.cmn" (common and sun) files. These
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User define the object lists which define each module. The second
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User section defines the appropriate header search paths and other
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein machine specific global build parameters.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/common/Makefile.rules
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/sun/Makefile.rules
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Useruts/sparc/Makefile.rules
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/sun4c/Makefile.rules
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/sun4/Makefile.rules
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein The files provide build rules (targets) which allow make to function
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User in a multiple directory environment. Each source tree below the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein directory containing the Makefile has a build rule in the file.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Useruts/sun4c/Makefile.sun4c
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Useruts/sun4/Makefile.sun4
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein These Makefile contains the definitions specific (defaults) to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein the obvious "implementation architecture". These rules can be
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein overridden in specific leaf node Makefiles if necessary.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrewsuts/sun4c/unix/Makefile
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User Main driving Makefile for building /unix.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/sun4c/MODULE/Makefile (for MODULE in arp, aoutexec, ...)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Main driving Makefile for building MODULE.kmod.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/sun4c/unix.static/Makefile
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User Main driving Makefile for building a static unix (for development
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein work only). This Makefile is known to NSE, but its targets are
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein not. This makefile may be copied to additional parallel directories
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein to build multiple configurations. This configuration is roughly
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User equivalent to the GENERIC kernel of SunOS 4.x.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinThe Makefiles are verbosely commented. It is desired that they should
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Userstay this way.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinUSE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein---
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark AndrewsIssuing the command 'make' in the uts directory will cause all supported,
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Usermodularized kernels and modules to be built.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinIssuing the command 'make' in a uts/ARCHITECTURE directory (i.e.: uts/sparc)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinwill cause all supported, "implementation architecture" independent modules
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinfor ARCHITECTURE to be built.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserIssuing the command 'make' in a uts/MACHINE directory (i.e.: uts/sun4c)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinwill cause that kernel and all supported, "implementation architecture"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeindependent modules for MACHINE to be built.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserIssuing the command 'make' in the uts/MACHINE/unix directory will cause the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinkernel for MACHINE to be built (and unix.o).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserIssuing the command 'make' in a uts/MACHINE/MODULE or a uts/ARCHITECTURE/MODULE
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userdirectory will cause MODULE.kmod to be built.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinLINT
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein----
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinLinting is fairly similar to the builds, but it has an additional complication.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinIn order to get meaningful output from lint pass2, all the modules must be
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinlinted together. This is accomplished by each module being responsible to
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Userproduce its own pass1 output (file.ln, one per .c/.s file). It is also
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinresponsible for placing the a lint-library (llib-lMODULE) in the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinuts/MACHINE/lint-libs directory. The final full lint is accomplished by the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinMakefile in the uts/MACHINE directory by linting all the lint-libraries
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Useragainst each other.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinNote that there is no equivalent to Locore.c in the current source base.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserThe C prototypes are in the .s files. As example:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein #if defined(lint)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein int
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein blort(int, int)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein { return 0 }
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User #else /* lint */
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ENTRY(blort)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ld [%i0],....
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User ....
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein SET_SIZE(blort)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein #endif /* lint */
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinCOMPONENT HIERARCHY
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User------------------
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox UserThe component hierarchy has been restructured to allow the acquisition of
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Usermore finely grained objects; specificly a kernel module. The basic component
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userstructure is:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein :src:uts.all --+--> :sparc --+--> :MODULES... (none currently)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein |
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein +--> :sun4c --+--> :unix
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein | |
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein | +--> :MODULES...
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein | |
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User | +--> :unix.static
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein |
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein +--> :sun4 ---+--> :unix
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein | |
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein | +--> :MODULES...
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein | |
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein | +--> :unix.static
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ...
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinThe above diagram does not reflect the full component tree. The full component
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeintree may be displayed with the "nsecomp list -r :src:uts.all" command.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinCOMMON OPERATIONS
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User-----------------
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinAdding a New Kernel Module
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein--------------------------
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 0] Create the source files (and directories) as usual.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 1] Edit uts/*/Makefile.files to define the set of objects. By convention
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein the symbolic name of this set is of the form MODULE_OBJS, where
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein MODULE is the module name (i.e.: namefs). The files in each subtree
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein should be defined in the Makefile.files in the root directory of that
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein subtree. Note that they are defined using the += operator, so that
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein the set can be built across multiple files. As example:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein NAMEFS_OBJS += namevfs.o namevno.o
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Each source file needs a build rule in the corresponding Makefile.rules
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein file (compilation and lint). A typical pair of entries would be:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(OBJS_DIR)/mem.o: $(UTSBASE)/sun4c/io/mem.c
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(COMPILE.c) -o $@ $(UTSBASE)/sun4c/io/mem.c
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(LINTS_DIR)/mem.ln: $(UTSBASE)/sun4c/io/mem.c
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User @($(LHEAD) $(LINT.c) $(UTSBASE)/sun4c/io/mem.c $(LTAIL))
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson 2] Create build directories in the appropriate places. If the module
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson can be built in a machine independent way, this would be in the
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson "instruction set architecture" directory (i.e.: sparc). If not, these
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson directories would be created for all appropriate "implementation
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson architecture" dependent directories (i.e.: sun4, sun4c).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 3] In each build directory, create a Makefile. This can usually be
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein accomplished by copying a Makefile from a parallel directory and
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User editing the following lines (in addition to comments).
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson MODULE = namefs
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson - replace with module name
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson OBJECTS = $(NAMEFS_OBJS:%=$(OBJS_DIR)/%)
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson LINTS = $(NAMEFS_OBJS:%.o=$(LINTS_DIR)/%.ln)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein - replace with MODULE_OBJS
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ROOTMODULE = $(ROOT_FS_DIR)/$(MODULE).kmod
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein - replace directory part with the appropriate
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User installation directory name (see Makefile.uts)
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson If a custom version of modstubs.o is needed to check the undefines
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson for this routine, the following lines need to appear in the
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson Makefile (after the inclusion of Makefile.mach (i.e.: Makefile.sun4c)).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein MODSTUBS_DIR = $(OBJS_DIR)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(MODSTUBS_O) := AS_CPPFLAGS += -DNAMEFS_MODULE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein - replace "-DNAMEFS_MODULE" with the appropriate flag
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User for the modstubs.o assembly.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein CLEANFILES += $(MODSTUBS_O)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 4] Edit the parent Makefile.mach (i.e.: Makefile.sun4c) to know about
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein the new module:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein FS_KMODS += fd fifo namefs nfs proc spec ufs
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ------
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinAny additional questions can be easily answered by looking at the many
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userexisting examples.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinMoving a Module to the "Implementation Architecture" Independent Build
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein----------------------------------------------------------------------
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 1] Create the build directory under the appropriate "instruction
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein set architecture" build directory (i.e.: sparc/MODULE).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 2] Move the Makefile from the "implementation architecture" build
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein directory (i.e.: sun4c/MODULE) to the directory created above.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Edit this Makefile to reflect the change of parent (trivial:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein comments, paths and includes).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 3] Edit the "implementation architecture" directory Makefile (i.e.:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Makefile.sun4c) to *not* know about this module and edit the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein "instruction set architecture" directory Makefile (i.e.:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Makefile.sparc) to know about it.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein