We ❤️ Open Source

A community education resource

5 min read

Explore the five steps of the FreeDOS boot sequence

Use FreeDOS to understand what happens when a computer starts up.

One thing I appreciate from growing up in the early days of personal computing was I learned so much about how the computer works under the hood. Those early home computers didn’t have much memory so they had very simple operating systems like DOS, and that made it easy to see how things worked. There just weren’t a lot of “moving parts” to confuse things.

FreeDOS makes it easy to see how computers work

The FreeDOS Project is an open source implementation of the classic DOS operating system. While FreeDOS is more modern than classic DOS, and includes many more applications and tools than DOS provided in the 1980’s and 1990’s, it is still just “DOS.” FreeDOS wouldn’t mean much if it didn’t run DOS applications, or if it operated in a completely different way than classic DOS. So just like the original DOS, FreeDOS makes it easy to see how your computer works.

Let’s use FreeDOS to understand the basics about how computers work. With this simple model, you can start to learn more complex operating systems like Linux.

Initial boot strap

When you turn on your computer, the system loads some built-in software called firmware which performs several self-checks on the hardware, such as verifying the memory and checking which disks are connected to the system. This is called the Power On Self Test or “POST.”

After the POST, the firmware uses a hard-coded instruction that tells it where to find the next part of the operating system. This is called the “boot loader” and is usually installed on the Master Boot Record (“MBR”) on the first hard drive. The MBR then loads the primary operating system kernel, such as FreeDOS.

This process of loading small parts of information to find the next piece of the operating system is called “bootstrapping,” from the old-timey expression of “to pick yourself up by your bootstraps.” It’s from this “boot strapping” term that we use “boot” to mean “starting the computer.”

The kernel

When the computer runs the FreeDOS kernel, one of the first things the kernel does is identify any parameters the user has provided. For classic DOS, this configuration information is stored in a file called CONFIG.SYS in the root directory where the kernel is located. FreeDOS uses a slightly different name, called FDCONFIG.SYS, to support anyone who wants to dual-boot their computer with FreeDOS and classic DOS.

If FreeDOS cannot find FDCONFIG.SYS, it also looks for CONFIG.SYS. If neither file exists, then the FreeDOS kernel will assume certain defaults.

You may already be familiar with CONFIG.SYS if you used DOS in the 1980’s or 1990’s. This file can contain any number of configuration parameters, as key=value items. One of these settings is SHELL= which tells the kernel what program to run as the user “shell,” usually a command line interpreter called COMMAND.COM.

In the simplest case, you can get by with just this one-line CONFIG.SYS file, which tells the kernel to load COMMAND.COM as the shell. The /P option indicates that this is a “permanent” shell that the user cannot exit unless they shut down the computer.

SHELL=C:\COMMAND.COM /P

Without the SHELL= line, DOS will try to run COMMAND.COM from the root directory where you booted the kernel. If the shell program cannot be found, you will see the dreaded “Bad or missing command interpreter” message and have to type in the location of a new shell program. For example, FreeDOS has a second copy of COMMAND.COM in the C:\FREEDOS\BIN directory; you can use that if things go wrong.

The shell

When COMMAND.COM starts up, it looks for a file called a “batch file” that contains commands to set the initial environment. Classic DOS always used AUTOEXEC.BAT in the root directory, but you can tell FreeDOS to use a different startup file, such as FDAUTO.BAT. Using the different name means DOS power users can use the same hard drive to boot both classic DOS and FreeDOS, and have a different configuration for classic DOS (CONFIG.SYS and AUTOEXEC.BAT) than for FreeDOS (FDCONFIG.SYS and FDAUTO.BAT).

A very simple AUTOEXEC.BAT file might only set the PATH variable, which tells the shell where to look for programs that it can run:

PATH C:\FREEDOS\BIN

Without a startup file like AUTOEXEC.BAT, the shell will simply prompt the user for the date and time.

Simple startup

And that’s it! There’s just not much going on under the hood with FreeDOS, which makes it easier for new computer users to understand what’s happening when the computer starts up. With FreeDOS, it’s just a few steps:

  1. Power On Self Test
  2. MBR loads the kernel
  3. The kernel loads FDCONFIG.SYS or CONFIG.SYS
  4. The SHELL= line tells the kernel how to run COMMAND.COM
  5. COMMAND.COM loads AUTOEXEC.BAT or FDAUTO.BAT to set the environment

Once FreeDOS has loaded the kernel, and the kernel has loaded the shell, FreeDOS is ready for the user to type commands.

Screenshot of the FreeDOS boot sequence.
Booting FreeDOS with the bare minimum CONFIG.SYS and AUTOEXEC.BAT.

About the Author

Jim Hall is an open source software advocate and developer, best known for usability testing in GNOME and as the founder + project coordinator of FreeDOS. At work, Jim is CEO of Hallmentum, an IT executive consulting company that provides hands-on IT Leadership training, workshops, and coaching.

Read Jim's Full Bio

The opinions expressed on this website are those of each author, not of the author's employer or All Things Open/We Love Open Source.

Save the Date for All Things Open 2024

Join thousands of open source friends October 27-29 in downtown Raleigh for ATO 2024!

Upcoming Events

We do more than just All Things Open and Open Source 101. See all upcoming events here.

Open Source Meetups

We host some of the most active open source meetups in the U.S. Get more info and RSVP to an upcoming event.