Here is how I set up an environment to be able to recompile the FreeDOS kernel, on Windows 7 x64, using the VMWare player.
- Download the "FreeDOS Base CD" from here. Yes, I am well aware that there is also a "FreeDOS Base CD with source code" available, but we are going to recompile the latest kernel from SVN and in case I decide to upload my VMWare image to help y'all, I want the disk to be as little bloated as possible
- Create a new VMWare image in Player and select "I will install the OS later" when prompted. A 512MB (0.5 GB) disk is all you need in size, and I'm probably being generous. On the other hand since we are going to compile, setting at least 512 MB RAM for the VM (rather than VMWare's default 16 MB) is probably a good idea. You can also remove virtual floppy and sound card as we don't need them
- Set the VM to boot from the ISO you just downloaded in step 1, and start it. When prompted by FreeDOS, select "
1) Continue to boot from FreeDOS from the CD-ROM" or press Enter, then select "
1. Install to harddisk using FreeDOS SETUP (default)" and go through the installation steps. You may have to enter the VMWare BIOS (by pressing the F2 key) to make the CD-ROM first bootable device after partitioning in order to conplete the installation.
- One installed, FreeDOS should boot from the hard drive and the first bad surprise you'll get is that the default of "
2 - Load FreeDOS with EMM386+EMS and SHARE" results in "
CONFIG.SYS error in line 24 - Illegal Instruction occured". You should select instead "
1- Load FreeDOS with EMM386, no EMS (most UMBs), max RAM free" or "
3 - Load FreeDOS including HIMEM XMS-memory driver"
- Actually, let us start by fixing this inconvenience by issuing "
edit fdconfig.sys" and changing the "
MENUDEFAULT=2, 5" to "
MENUDEFAULT=3, 5". Now that's better.
- Power off the Virtual Machine and mount its virtual disk for transfer as highlighted in my previous post (or find another way that is convenient to you to transfer files to the disk)
- Download the latest DOS 32 bit nasm from https://sourceforge.net/projects/nasm/files/DOS%2032-bit%20binaries/ and extract
nasm.exeas well as
cwsdpmi.exefrom the archive to a
\BINdirectory on the FreeDOS hard drive
- Download the latest DOS/i386 version of UPX from http://upx.sourceforge.net and extract
- Download the latest
open-watcom-c-dos-x.y.exefrom http://ftp.openwatcom.org/ftp/ and copy it to your virtual FreeDOS hard drive (where is irrelevant)
- Fetch the latest FreeDOS kernel using svn (eg. using TortoiseSVN on Windows) from https://freedos.svn.sourceforge.net/svnroot/freedos/kernel/trunk and copy the whole
\src\kernelon your FreeDOS disk
- Boot the FreeDOS VM again, and now run the
open-watcom-c-dos-x.y.exefrom wherever you copied it (which may now be listed as
open-w~1.exe). Install Open Watcom as "
Selective installation" and in "
Toolkits and other components" remove "
Sample programs". Also in that section, select the "
Helpfiles" sub-menu and remove the "
DOS Hosted Help Files". The installation will take a little while, but at least it's unattended. At the end, tell Open Watcom NOT to modify the
AUTOEXEC.BATand edit the
PATHline to have the following:
set PATH %dosdir%\bin;C:\BIN;C:\WATCOM\BINW
- Also in
AUTOEXEC.BAT, after the line
lh doslfn, add:
- Reboot the VM
- Go to
C:\src\kerneland issue "
copy config.b config.bat"
- Edit config.bat and update the following:
Uncomment all the relevant WATCOM options in the file
It is also recommended to modify
- Issue the command:
- If you followed everything properly, you should end up with a successful build of
KERNEL.SYSand other files in
Note that you can clean up a previous build by issuing