top of page

FreeDOS Development Environment

Updated: May 6

In this post, I will share a bit about the development environment I am using to build FreeDOS (and possibly other DOS applications). I will update this post as I continue to improve the development environment.


I have installed VirtualBox 7.0.6 and created a new virtual machine. In that virtual machine, I have installed FreeDOS from the 1.3 LiveCD. I added a secondary virtual disk (VHD format) so that I can shut down the virtual machine, mount the VHD in my Windows host, and copy files for use in the virtual machine. In the running virtual machine, I used fdimples to add NASM. I downloaded WATCOMC 1.9 separately and installed it in FreeDOS; I could have also just used the WATCOMC option in fdimples. To build FreeDOS, I started with the source code at GitHub - FDOS/kernel: FreeDOS kernel. See the following video for additional details.



Network Access

To simplify my workflow and allow easier moving of data in and out of the FreeDOS virtual machine, I have setup an Ubuntu virtual machine running Samba. I configured FreeDOS to map a drive to a share on the Ubuntu VM. My primary development machine also has access to the Samba shared location. With this, I can easily copy files in and out of the FreeDOS virtual machine while it is running.


Getting network access running from FreeDOS to Samba was a little bit of a pain. Here are the general steps I took:

  1. Downloaded Disk 1 and Disk 2 of the MS Client 3.0 and extracted each into a separate folder.

  2. Downloaded AMD's NDIS2 DOS network drivers for the virtual NIC used in Virtual Box from here and extracted the files by running the executable.

  3. With my FreeDOS VM turned off, I mounted the secondary disk VHD to my Windows host and copied the three folders from steps 1 and 2 above to the VHD. I then dismounted the VHD from Windows and started the FreeDOS VM.

  4. In the FreeDOS VM, I changed to the D: drive (VHD) and into the directory for disk 1 of the MS Client 3.0. Ran setup.exe, selected "*Network adapter not shown..." and entered the folder of the extracted driver from step 2 above. For MS Client 3.0 install options, added TCP/IP and NetBEUI, removed NWLink IPX..., chose Full redirector, and Run Network Client on startup. When prompted for the driver disk, entered the folder for Disk 2 from step 1 above.

  5. The installer populated config.sys and autoexec.bat. I moved these entries over to fdconfig.sys and fdauto.bat, respectively.

  6. In c:\net in FreeDOS, I added entries in HOSTS and LMHOSTS to resolve the name of the Ubuntu VM.

  7. To get a Samba share to work for the DOS client, I had to reduce the security to pretty much nothing -- hence, why I have a dedicated Ubuntu VM for this. To configure Samba:

  8. Created a folder to share (e.g., /home/user/shared)

  9. Modified /etc/samba/smb.conf, in section [global]

  10. server min protocol = NT1

  11. ntlm auth = yes

  12. lanman auth = yes

  13. server min protocol = CORE

  14. server signing = disabled

  15. client plaintext auth = yes

  16. client ntlmv2 auth = no

  17. Modified /etc/samba/smb.conf, in section [shared] (or whatever shared name you want to use, probably no longer than eight characters)

  18. path = /home/user/shared

  19. read only = no

  20. browsable = yes

  21. writeable = yes

  22. create mask = 0755

  23. directory mask = 0755

  24. Restarted Samba

  25. Kept user name and password to maximum length of eight characters

  26. After a reboot of the FreeDOS VM, I mapped a drive with "net use s: \\server\share".

  27. Tested and verified drive mapping, reads, and writes all work.

  28. Backed up my FreeDOS VM at this point. :)


Mounting a CF Card in VirtualBox

To use a CF card, I will need to format the CF card, make sure the first sector contains the appropriate boot loader, drive geometry information, and FAT information. To do this, I will mount a CF card from my Windows host as a raw drive in VirtualBox. For my setup, my CF card is physical disk #4 in Windows (viewed in Disk Manager). Making sure that VirtualBox is not running, you can use a command like the following (my specific command). I ran this from an administrative command prompt, from the installation folder of VirtualBox.

VBoxManage.exe createmedium disk --filename "D:\VirtualBox\FreeDOS\cf2.vmdk" --format=VMDK --variant RawDisk --property RawDrive=\\.\PhysicalDrive4

You will need to run VirtualBox as an administrator (e.g., right click, "Run as administrator").

You can then attach the VMDK using VirtualBox. Select the VM, Settings, Storage, select controller (e.g., I used SATA for this disk, IDE didn't seem to work), add Hard Disk button, and then select the VMDK file in the "Not Attached" list. Finally, you should be able to start the VM and access the CF card directly from FreeDOS in the VM.


I have testing to do with this. I am finding that VirtualBox is a bit flaky and does not handle this well. (Generally, I am not liking VirtualBox, as I can consistently reproduce crashes of VirtualBox). I might need to switch to a different virtualization tool.


Update... After some further testing with the setup above, I am finding that the CF Card does not get setup correctly when using FreeDOS and the CF Card in VirtualBox. This could be due to how I have it connected. I am using a USB CF card reader connected to Windows 11, running FreeDOS in VirtualBox. Even with the raw drive attachment, format and sys both fail to write the disk information as I understood it should be written. Referencing Operating System Development: Boot Sector Structure, I am not seeing this type of structure. Instead of a VM, I setup an old PC with a PCIe to IDE card and an IDE to CF Card adapter. I boot with a FreeDOS USB drive and install to the CF Card.


Switching from VirtualBox to Hyper-V

I have switched my FreeDOS development setup from VirtualBox to Microsoft Hyper-V (Windows 11). I found VirtualBox to be consistently unstable, especially when switching between remote desktop connections to the host PC and interactive logins on the host PC. Hyper-V has been a nice improvement. Some important notes about getting FreeDOS with network support running in Hyper-V:


I ended up with this for my fdconfig.sys:

SET DOSDIR=C:\FreeDOS

!COUNTRY=001,858,C:\FreeDOS\BIN\COUNTRY.SYS
!LASTDRIVE=Z
!BUFFERS=20
!FILES=60
!MENUCOLOR=7,0

MENUDEFAULT=1,5
MENU 1 - Load FreeDOS with HIMEM and EMM386
MENU 3 - Load FreeDOS low with some drivers (Safe Mode)
MENU 4 - Load FreeDOS without drivers (Emergency Mode)

1?DOS=HIGH
1?DOS=UMB
1?DOSDATA=UMB
3?DEVICE=C:\FreeDOS\BIN\HIMEMX2.EXE

1?DEVICE=C:\FREEDOS\BIN\HIMEM.EXE
1?DEVICE=C:\FREEDOS\BIN\EMM386.EXE NOEMS X=E000-EFFF
34?SHELL=C:\FreeDOS\BIN\COMMAND.COM C:\FreeDOS\BIN /E:1024 /P=C:\FDAUTO.BAT
1?DEVICE=C:\NET\IFSHLP.SYS
SHELL=C:\FreeDOS\BIN\COMMAND.COM C:\FreeDOS\BIN /E:1024 /P=C:\FDAUTO.BAT



I ended up with this for my fdauto.bat:

@ECHO OFF
REM Standard AutoExec Batch File

set DOSDRV=C:
set DOSDIR=C:\FreeDOS
set LANG=EN
set TZ=UTC
set PATH=%dosdir%\BIN;C:\NET
if exist %dosdir%\LINKS\NUL set PATH=%path%;%dosdir%\LINKS
set NLSPATH=%dosdir%\NLS
set HELPPATH=%dosdir%\HELP
set TEMP=%dosdir%\TEMP
set TMP=%TEMP%
set BLASTER=A220 I5 D1 H5 P330
REM set DIRCMD=/P /OGN /Y
set DIRCMD=/OGN /Y
set COPYCMD=/-Y
set OS_NAME=FreeDOS
set OS_VERSION=1.3
set autofile=C:\FDAUTO.BAT
set cfgfile=C:\FDCONFIG.SYS
alias cfg=edit %cfgfile%
alias auto=edit %autofile%
alias reboot=fdapm warmboot
alias reset=fdisk /reboot
alias halt=fdapm poweroff
alias shutdown=fdapm poweroff
alias edit=setedit

if "%config%"=="4" goto END

:Support286
LH FDAPM APMDOS
MEM /C /N
echo.

C:\NET\NET.EXE INITIALIZE
C:\NET\NETBIND.COM
C:\NET\UMB.COM
C:\NET\TCPTSR.EXE
C:\NET\TINYRFC.EXE
C:\NET\NMTSR.EXE
C:\NET\EMSBFR.EXE
net start
REM net use s: \\ub\shared

:NoNetwork

if exist %dosdir%\bin\fdassist.bat call %dosdir%\bin\fdassist.bat
if exist %dosdir%\bin\cdrom.bat call %dosdir%\bin\cdrom.bat display
if exist %dosdir%\bin\welcome.bat call %dosdir%\bin\welcome.bat

:END



More to come...



Additional Resources

45 views2 comments
bottom of page