3 Quick Start ------------------------------------------------------------------ 3.1 Setting Environment Microkernel tarball should contain following: 1. mk.tgz: contains microkernel sources 2. md.man: manpage for tool md 3. .bashrc: stuff that should go into your .bashrc (bash should be your login shell) 4. .sandboxrc: sample sandbox configuration that should go into your $HOME/.sandboxrc 5. README 6. YAMIT.status 7. dma_compile: this will be removed in future; contains special instructions for compilation related to DMA Untar the mk.tgz into /usr/src/. ( This does not really have to go to /usr/src. Symlink is quite enough.) Get ODE (OSF Development Environment) tools. Make sure that the directory where you have installed the binaries of ODE tools is in the PATH. Edit the accompanying .bashrc suitably. Check if your USER environment variable is set. It should be set to your LOGNAME. Check if you can execute 'workon -sb osfmk'. This should start up a new bash shell, echo the following: cd'ing to sandbox source directory: /usr/src/osfmk/src project: osc starting new shell: /bin/bash then drop you into /usr/src/osfmk/src directory. Beware! The ODE tools include make tool which is different from the usual GNU make. It might clash with your other compilation jobs. You want to have separate USER account. 3.2 Building header files If you have not executed 'workon -sb osfmk', do so now. This will start a ODE sandbox. Build the header files needed for compilation using the following: $ build MAKEFILE_PASS=FIRST This may stop at attempt to export profile-md.h. For time being, apply this hack: $ cp ../export/at386/include/profile/i386/profile-md.h ../export/at386/include/profile/ $ cd ../export/at386/include/mach/; ln -s i386 machine; cd - and try again. $ build MAKEFILE_PASS=FIRST 3.3 Building core libraries The following hack should make the process easier: $ cd ../export/at386/include; rmdir machine; ln -s i386 machine; cd - $ cd ../export/at386/include/sa_mach; rmdir machine; ln -s i386 machine; cd - Build the cthreads library using: $ build -here mach_services/lib/libcthreads Build the sa_mach library using: $ build -here mach_services/lib/libsa_mach Build the mach library using: $ build -here mach_services/lib/libmach Build the mach_maxonstack library using: $ build -here mach_services/lib/libmach_maxonstack You've now built the libraries in the Microkernel tree that are needed for building the single server, which is a task run "on top of" the microkernel. If you want, you may stop building microkernel pieces at this point and simply move on to building the server. 3.4 Building other stuff Build filesystem support using: $ build -here file_systems Currently, ext2fs, minixfs and ufs are supported. Build bootstrap using: $ build -here bootstrap Here you might run into plenty of undefined references. All of these functions, have been defined in OSF MK libraries. The naming convention followed in the .o files name the memcpy function as _memcpy and so on. Some way around this is still to be worked out. As of now, one will have to resort to objcopy tool to rename the symbols. A bunch of scripts are provided which ease the process. scripts are located in osfmk/src/scripts name of script file pretty much tells what it should be used for. ( some scripts work with object files, so if you are building library, rerun build to relink your library with new object files.) To build default pager: $ build -here default_pager To build name server and it's libraries: $ build -here mach_services/lib/libservice $ build -here mach_services/lib/libnetname $ build -here mach_services/servers/netname To build the mpts (Microkernel Performance Test Suite): $ build -here mach_services/cmds/mach_perf This might stop when trying to find stdarg.h. This stdarg.h is not the usual stdarg.h provided by libc. It's located in ../export/include/sa_mach/i386. You may have to edit osc/Buildconf to add that path to pass to gcc. $ vi osc/Buildconf add necessary directory to INCDIRS variable. Try building again: $ build -here mach_services/cmds/mach_perf This might fail again for undefined references. The following should suffice: $ cd ../obj/at386/mach_services/cmds/mach_perf/lib; sh /usr/src/osfmk/src/scripts/libperf.symbols ; cd - 3.5 Building microkernel A few hints to help building the microkernel: 1. If the compilation cribs about include files with names such as machine/setjmp.h, then most probably, the build process has failed to create a link machine to the machine dependent include file directory. The machine directory there (../export/at386/mach_kernel) should have been link to i386 directory in the same directory. Remove the machine directory and link it. $ cd ../export/at386/mach_kernel; rm -rf machine; ln -s i386 machine 2. If the compilation cribs about undefined symbols, try to find the .o file, in which the symbol would have been defined. If the crib is about, say for example, symbol memcpy, then very likely, the symbol has been defined but it might be defined as _memcpy in the .o file. Rename the symbol in the .o file to memcpy or whatever the name of the symbol is. You will have to recompile/relink the library, which includes the .o file, to re-include it.