How to compile FreeDOS-32
Last update: 2005-06-22
Copyright © 2005-2006 Salvatore Isaja
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included by reference.
This document describes how to build FreeDOS-32 from source code. Some knowledge of the operating system usage and C programming is assumed. You can get the source code of FreeDOS-32 either downloading a source package or checking out the latest development code from Subversion.
If you are compiling a release between 0.0.2 and 0.0.5 (included), you should follow the old instructions. This document assumes the code structure as currently found in the Subversion repository and after release 0.0.5.
If you are in a hurry
If you are in a hurry to try the latest development source code, in How to get the source code from SVN you find the scratch listing of what you need to type at the command line to checkout and compile the FreeDOS-32 kernel and modules.
Conventions
You can compile FreeDOS-32 either under GNU/Linux, DOS or Windows. In the
following text, Linux-style file names are used, that is forward slashes '/'
are used to separate directory components. Replace them with backslashes '\'
if you use a DOS or Windows system.
The source code tree
At the top level of the source code tree of FreeDOS-32, you find at least the following directories:
fd32 |
containing source files of the FD32 kernel and modules |
oslib |
containing the source code of the OSLib low level library |
You can obtain the above directories from a source code release, or checking them out from SVN. OSLib is a low level free library, to develop MultiBoot compliant operating systems. For the needs of FreeDOS-32 we have created our own fork of the OSLib code.
Please refer to How to get the source code from SVN for instructions about how to obtain the directories said above. Create a directory for the source code of FreeDOS-32 and put those directories inside it. Before you continue, please make sure you have them in the same parent directory.
Hereinafter the placeholder SRC will be used to identify your local directory containing the above directories. Feel free to replace it with the one you prefer, but be sure to be consistent with what is showed in the following examples.
Configure the compilation
Now that you have the sources of FreeDOS-32, you can compile them. This is done using GNU Make, a program which builds whole projects looking at the instructions given in scripts called Makefiles.
First, you have to specify a configuration file for the platform you are compiling on. This is easy to do, all you need is to copy one file. The selected configuration file will be included in the Makefiles to customize the for your platform.
The following configuration files are available in the SRC/fd32/mk
subdirectory:
| name | description |
|---|---|
| linux.mk | GNU/Linux platform, using the Linux gcc (generates ELF) |
| linux_djgpp.mk | GNU/Linux platform, using a DJGPP cross-compiler (generates COFF) |
| linux_mingw.mk | GNU/Linux platform, using a MinGW cross-compiler (generates COFF) |
| djgpp.mk | DOS platform, using DJGPP (generates COFF) |
| mingw.mk | Windows platform, using MinGW (and maybe Cygwin) (generates COFF) |
You have to copy the appropriate file in the SRC/fd32
directory, renaming it as config.mk, like in the following examples.
DOS example: cd SRC\fd32 copy mk\djgpp.mk config.mk
GNU/Linux example: cd SRC/fd32 cp mk/linux.mk config.mk
In this way, when you compile FreeDOS-32, the custom options for your platform are
included in the Makefiles from config.mk. Please note that if you do not
do this, you will not be able to compile FreeDOS-32.
Start GNU Make
Once you have selected the configuration file for your operating system, you
can compile FreeDOS-32. While in the SRC/fd32 directory, type make
from the command prompt (assuming that GNU Make is in your path):
cd SRC/fd32 make
This will compile OSLib first, then the FreeDOS-32 kernel and finally the modules.
This can take several minutes. When finished, if everything worked fine, you should
find fd32.bin inside the SRC/fd32 directory, that is the
binary image of the kernel, and, in each subdirectory of the SRC/fd32/modules
directory, a <module name>.o file that you can load at boot time
as module to add functionality to the kernel. Please note that some directories (such as
winb) are exluded from this default compilation procedure.