ChorusOS 5.0 Source Delivery Guide

Example: The OS Component Build Files

For the OS component, the OS source files are merged into the component's build directory, build_dir/build-OS. In this directory, exports.1st is produced by the mkmerge command. This directory relies on the profile file to ensure that the NUCLEUS component is merged before the OS component.

To look in greater detail at the OS build directory, list the contents of build_dir/build-OS/src/sys. This directory contains the following:

Table 4-14 Files Generated in /build-OS/src/sys

File 

Description 

MakefileThe Makefile of the directory, produced by mkmk
C_OS The C_OS actor
all.dpDependency file, produced by make depend and getExport
sys_agglo.mkInternal Makefile, used when linking the configurable actor, to copy files from the src directory to the obj directory

sys.bf

The build file 

sys.df

The definition file 

sys_rule.xml

XML rules for the OS component

sys_action.xml

XML action rules for the OS component

The contents the sys.bf and sys.df files, the Makefile and the common.mf and all.dp files are given below:

sys.df

The sys.df file, defines the INCLUDES and DEFINES variables.


Example 4-2 A sys.df File

INCLUDES="                              \
 -I${OS_DIR}/src/sys                    \
 -I${OS_DIR}/src/sys/chorus/sys         \
 -I${OS_DIR}/src/sys/sys                \
 -I${OS_DIR}/src/sys/machine            \
 -I${NUCLEUS_DIR}/include               \
 -I${NUCLEUS_DIR}/include/chorus        \
 -I${OS_DIR}/include/chorus             \
 -I${OS_DIR}/include"

DEFINES="$DEFINES -DKERNEL -D_KERNEL -D__FreeBSD__ -DINET -DNO_CACHE"
DEFINES="$DEFINES -DMSDOSFS -DNFS"

FWARN=STRICT

sys.bf

In this example, S_LIBS contains the list of libraries used to link the OS component. The ConfigurableActor rule is also used to link the OS component to build the C_OS actor.


Example 4-3 A sys.bf File

S_LIBS = $(OS_DIR)/lib/sys/libufs.a \
         $(OS_DIR)/lib/sys/libdisk.a \
         $(OS_DIR)/lib/sys/libgen.a \
         $(OS_DIR)/lib/sys/libmem.a \
         $(OS_DIR)/lib/sys/libunresolved.a \
         $(OS_DIR)/lib/sys/libloader.s.a \
         $(NUCLEUS_DIR)/lib/zlib/zlib.a \
         $(OS_DIR)/lib/sys/libio.s.a \
         $(NUCLEUS_DIR)/lib/stdc/libstdc++.a \
         $(NUCLEUS_DIR)/lib/embedded/libebd.s.a \
         $(NUCLEUS_DIR)/lib/cpu/cpu.s.a \
         $(NUCLEUS_DIR)/lib/ddi/net.s.a \
         $(NUCLEUS_DIR)/lib/ddm/ddm.s.a \
         $(NUCLEUS_DIR)/lib/sysevent/sysevent.a \
         $(NUCLEUS_DIR)/lib/visu/visu.s.a \
         $(NUCLEUS_DIR)/lib/gauges/gauges.s.a \
         $(NUCLEUS_DIR)/lib/classix/libsys.s.a \
         $(DRV_DIR)/lib/drv_tools/drv_tools.s.a

ConfigurableActor(C_OS, $(S_LIBS))

Makefile

The Makefile generated by mkmk contains two parts. The first part has a list of the definitions of variables as defined in Table 4-8, Table 4-9, Table 4-7 and Table 4-10. The second part contains preprocessed copies of the .bf, .lf, and .mf files found in the work directory. In this example there is only a .bf file present in the work directory.


Example 4-4 A Makefile Generated by mkmk

BDIR = build_dir
FAMILY = usparc
COMPILER = gcc

include $(BDIR)/Paths
include $(DEVTOOLS_DIR)/tgt-make/host.conf
include $(DEVTOOLS_DIR)/tgt-make/variables.rf

BNAME = sys
MPATH = src/sys
DEFINES = -DKERNEL -D_KERNEL -D__FreeBSD__ -DINET -DNO_CACHE -DMSDOSFS -DNFS
INCLUDES = -I/build_dir/build-OS/src/sys -Ibuild_dir
/build-OS/src/sys/chorus/sys
-I/build_dir/build-OS/src/sys/sys
-I/build_dir/build-OS/src/sys/machine
-I/build_dir/build-NUCLEUS/include
-I/build_dir/build-NUCLEUS/include/chorus
-I/build_dir/build-OS/include/chorus
-I/build_dir/build-OS/include
FEXCEPTION = OFF
FFPU = ON
FOPTIM = OFF
FPROF = OFF
FREMOTEDEB = ON
FVERBOSE = OFF
FASSERT = ON
FWARN = STRICT
FGCOV = OFF
FPIC = OFF
FLARGEGOT = OFF
FVEC = OFF
VARIABLES = OS_DIR NUCLEUS_DIR DRV_DIR OS_USER_LIBS OS_SUP_LIBS
SUB_DIRS = cam chorus crypto dev isofs kern libkern machine miscfs 
msdosfs net netinet
netinet6 netkey netns nfs nfs_noserver solaris sys ufs vm
EXTRA_DIRS = 
BFILES = sys.bf
MFILES = 
DFILES = debug.df sys.df
MODULES = 
OS_DIR = build_dir/build-OS
NUCLEUS_DIR = build_dir/build-NUCLEUS
DRV_DIR = build_dir/build-DRV
OS_USER_LIBS = build_dir/build-OS/lib/libc.a build_dir/build-OS/lib/sys/
libsystrap.u.a
/net/abdias/export/build/orivat/chorus/dev-r50/sparc/dev-int2709/
build-OS/lib/libc.a
OS_SUP_LIBS = build_dir/build-OS/lib/libc.a build_dir/build-OS/lib/sys/
libsyscall.a
/build_dir/build-OS/lib/libc.a

include $(BDIR)/Paths
include $(DEVTOOLS_DIR)/tgt-make/shared.rf

# produced from sys.bf -- begin

S_LIBS = $(OS_DIR)/lib/sys/libufs.a \
         $(OS_DIR)/lib/sys/libdisk.a \
         $(OS_DIR)/lib/sys/libgen.a \
         $(OS_DIR)/lib/sys/libmem.a \
         $(OS_DIR)/lib/sys/libunresolved.a \
         $(OS_DIR)/lib/sys/libloader.s.a \
         $(NUCLEUS_DIR)/lib/zlib/zlib.a \
         $(OS_DIR)/lib/sys/libio.s.a \
         $(NUCLEUS_DIR)/lib/stdc/libstdc++.a \
         $(NUCLEUS_DIR)/lib/embedded/libebd.s.a \
         $(NUCLEUS_DIR)/lib/cpu/cpu.s.a \
         $(NUCLEUS_DIR)/lib/ddi/net.s.a \
         $(NUCLEUS_DIR)/lib/ddm/ddm.s.a \
         $(NUCLEUS_DIR)/lib/sysevent/sysevent.a \
         $(NUCLEUS_DIR)/lib/visu/visu.s.a \
         $(NUCLEUS_DIR)/lib/gauges/gauges.s.a \
         $(NUCLEUS_DIR)/lib/classix/libsys.s.a \
         $(DRV_DIR)/lib/drv_tools/drv_tools.s.a

BINARY += C_OS

C_OS: $(S_LIBS)
        $(MKLINK) -r -c -e _start -o C_OS -B $(S_LIBS)

# produced from sys.bf -- end

include all.dp
include $(DEVTOOLS_DIR)/tgt-make/tgtdevsys.rf
DTL=${DEVTOOLS_DIR}/host/bin/

common.mf

The common.mf file is found in the build_dir/build-OS/src/sys/chorus/lib/gen directory.


Example 4-5 A common.mf File

....
C__SRCS = \
        insremque.c ovbcopy.c memstat.c util.c sysInitFuncs.c 

The .mf files contain the definition of variables and nothing else. These variables are listed in Table 4-10.

all.dp

The Makefile listed above for the OS component, located at build_dir/build-OS/src/sys, includes a dependency file, all.dp. This dependency file is located in the same directory as the Makefile. In the OS component, the all.dp file contains the list of files upon which the linked binary files, such as actors or libraries, are dependent. The -export lines at the top of the file are used by getExport during the link phase. In this example, as the directory contains no object file, these lines are empty.


Example 4-6 An all.dp File

host% head all.dp
#       automatically generated file
# -export ALL :      
# -export SUP :                                        
# -export USR :                                        
# built from a complex makefile

C_OS: cam/scsi/all.dp
C_OS: cam/scsi/scsi_da.o
C_OS: cam/scsi/scsi_all.o
....
C_OS: all.dp