How are bundles compiled? 02sep98 There are three parts to this file. The first part describes the compilation flags used to compile the kernel bundles. The second part describes what each of these flags means. The third part describes what this means to your driver. ****************************************************************************** I. How are the bundles compiled? Standard build flags: -D_KERNEL -D_KERNEL_HEADERS -D_LOCKTEST -DMERGE386 -DV86MODE -DEVGA -DIAPX386 debug: Standard + -DDEBUG -DSTATIC= -D_KMEM_HIST -D_KMEM_STATS -D_MPSTATS -D_MEM_RESV_STATS -DDKTEST LEAKS: Standard + -DSTATIC= -U_LOCKTEST -D_KMEM_HIST -DKMA_PARANOID -DDEBUG_TOOLS -D_KMEM_STATS -D_KMEM_HIST -D_MEM_RESV_STATS -D_MPSTATS up.tools: Standard + -DSTATIC= -U_LOCKTEST -D_KMEM_HIST -DKMA_PARANOID -DDEBUG_TOOLS -DUNIPROC mp.tools: Standard + -DSTATIC= -U_LOCKTEST -D_KMEM_HIST -DKMA_PARANOID -DDEBUG_TOOLS up.nodbg: Standard + -DSTATIC=static -U_LOCKTEST -DUNIPROC mp.nodbg: Standard + -DSTATIC=static -U_LOCKTEST ***************************************************************************** II. But what do the above defines mean? The list of defines below is _NOT_ a complete list of manifest defines you'll encounter, only the more common ones used with kstuff above. DEBUG ----- General symbol used for driver debugging. Prints misc. debugging messages on console, enables assertion checks, adds many callable kdb functions compiled into kernel, etc. DEBUG_TOOLS ----------- subset of DEBUG, used for enabling callable kdb functions but without assertion checks or assorted debugging messages on console See Part III for a listing of these. DKTEST ------ not used EVGA ---- used by devadp, gvid, kd drivers only for EGA and VGA support IAPX386 ------- used by ODI shim KMA_PARANOID ------------ enable consistency checks in KMA routines, notably any code calling the DDI functions kmem_alloc_physreq, kmem_alloc, kmem_alloc_physreq, kmem_free, kmem_zalloc, or kmem_zalloc_physreq. This includes allocb(D3). NOTE: the above is not a complete list of functions affected by this define, just the common routines. MERGE386 -------- code which should be enabled for the Platinum Merge product. STATIC ------ used in function and variable definitions to limit scope. expands to word "static" or nothing. UNIPROC ------- used to denote code that is applicable to uniprocessor only. V86MODE ------- must be used with MERGE386 define, denoting v86 mode code. _KERNEL ------- Used in driver source in 2 ways: 1) prevent user level code from being compiled into driver 2) in following construct: #ifdef _KERNEL_HEADERS #include #elif defined(_KERNEL) #include #endif Common in header files for function prototypes, data structures, etc. along with _KERNEL_HEADERS and _KMEMUSER. Use MINI_KERNEL for ISL kernel. _KERNEL_HEADERS --------------- Used when compiling driver within kernel source tree. Typically used around #include lines so that they are pulled from right location instead of /usr/include/sys. Developers compiling their driver outside of kernel source tree should just use _KERNEL (and _KMEMUSER where needed) _KMEM_HIST ---------- Used with KMA routines to find undisciplined users of kmem_alloc/kmem_free. The last 10000 calls to kmem_alloc/kmem_zalloc, and kmem_free are recorded Enables kdb callable print_kma_hist() routine. _KMEM_STATS ----------- KMA statistical information is organized into two tables. The SIZES table holds the number of bytes owned (allocated but not freed) for each size. The "invocations" table holds the number of invocations of kma_alloc or kma_free for each size, for each invocation point, where an invocation point is a pair. Each entry in the "sizes" table is linked to the chain of corresponding invocations entries. Enables kdb callable print_kma_stats() function. Statistics can be enabled and disabled dynamically by writing 1 or 0 to kernel kmem_stats_enabled variable. _LOCKTEST --------- Enables a myriad of checks for events, spin locks, fast spin locks, read/write spin locks, and sleep locks. Should be used with DEBUG and without UNIPROC. _MEM_RESV_STATS --------------- enables memory reservation statistical information, organized into an open hash indexed by line, file, and reservation type. For each entry, the count of pages reserved is kept, as well as the number of calls. Can be dynamically enabled or disabled by setting the kernel mem_resv_stats_enabled to either 1 or 0. enables kdb callable function print_mem_resv_stats. Note there are *two* kdb callable functions named print_mem_resv_stats: The first is enabled if _MEM_RESV_STATS is defined. This gives detailed information (line and file) about reservations. The second is enabled if DEBUG is defined but _MEM_RESV_STATS is _not_ defined. This gives high level information only for each reservation type. If both DEBUG and _MEM_RESV_STATS are defined you get both types of information. _MPSTATS -------- Enable the collection of certain MP statistics pertaining to preemption and locks. Similar to the KS_MPSTATS argument used with locks. Enables the following kdb callable functions: print_dispmetrics - prints context switch metrics. print_lkstat - print a bunch of lock statistics for a lock ***************************************************************************** III. What does the above mean to you? Compile your source code with the above options to match the kstuff bundle you will be using. If your name on the source machine is "foo", you will idinstall the DSP files (Driver.o, Master, System, etc) with the -R option on the destination machine: /etc/conf/bin/idinstall -a -k -R /etc/conf.unix.foo mydrvr Instead of /etc/conf, kstuff creates a new link kit directory with the name /etc/conf.unix.. You must use idinstall with the -R argument to copy your DSP files to the kstuff link kit. ---cut paste glue---