This is the FreeDOS Patching mini How-to about how to contribute patches to the FreeDOS Project.

Tracking changes

Both the FreeDOS kernel and FreeCOM have a “HISTORY.TXT” file where people that contribute to either project should add comments about what changes they have implemented. There are no strict guidelines for these files now, but you can look at the file to see how everyone else does it. Most people just include what changes they made (and why if necessary) and sometimes specify what files they changed.

When you create the patch file (see below) it will contain the changes to the HISTORY.TXT file, as well as all the other changes you made. Then when I get it, I can read your entry in the HISTORY.TXT file and see what all you did.

Using diff

The “diff” program referred to within is available for Unix and DOS. Both versions are available on the internet in various places.

The patch files I refer to are really just the output that the diff program creates. I call them that because I use a program called “patch” to merge your patch file into my source code.

Here is a description of the diff program from the GNU website:

You can use the ’diff’ command to show differences between two files, or each corresponding file in two directories. ’diff’ outputs differences between files line by line in any of several formats, selectable by command line options. This set of differences is often called a ’diff’ or ’patch.’ For files that are identical, ’diff’ normally produces no output; for binary (non-text) files, ’diff’ normally reports only that they are different.

Running diff

These are the command line options I recommend for creating patch files for the FreeDOS project:

Command line options for diff
Short option Long option Meaning
-r --recursive When comparing directories, recursively compare any subdirectories found
-b --ignore-space-change Ignore changes in amount of white space
-U 5 --unified=5 Use the unified output format, showing 5 lines of context
-d --minimal Change the algorithm to perhaps find a smaller set of changes
-N --new-file In directory comparison, if a file is found in only one directory, treat it as present but empty in the other directory
-w --ignore-all-space Ignore white space when comparing lines
-B --ignore-blank-lines Ignore changes that just insert or delete blank lines

For example: If you have a version of the FreeDOS kernel in the directory “KERNEL\ORIG”, and a copy of the same source tree, but with your changes included, in a directory called “KERNEL\NEW”, and you want to create a patch file called “PATCH.TXT”, then you need to change to the directory “KERNEL”, and issue this command:

diff -bBdNrw -U5 original new > patch.txt

Always put the original directory name first, then the new directory name.

Submitting patches

You can upload your patches to the FreeDOS kernel maintainer or send an email to the email list.

Points to remember:

  • It is very important that you specify the name of the release (the version, such as com075a or build 2010) that your patches were generated from.
  • You should always get the latest source code available. Patches submitted that are changes to old source code are no good to the project. If they are only a revision or two behind, then we can work with them, but it’s usually a manual process.
  • You should make a copy of the latest source code, and then change that code so that you will end up with two directories: an original directory (with the original source) and a new directory (with the original source plus all your revolutionary changes).