A WSL alternative for users who prefer an MS-DOS environment. DOS Subsystem for Linux integrates a real Linux environment into MS-DOS systems, allowing users to make use of both DOS and Linux applications from the DOS command prompt.
- doslinux depends on several packages.
In Fedora 38, run
sudo dnf install wget git patch bzip2 gcc glibc glibc-static g++ libstdc++ libstdc++-static make binutils flex bison openssl-devel mtools nasm zip unzip bc
In Ubuntu 22.04, run
sudo apt install build-essential git gcc make nano flex bison libssl-dev mtools nasm zip unzip bc
In a VM configured for 16 CPUs, 16GB RAM, hosted on a dual Intel Xeon E5-2680 v4 2.4GHz hypervisor (a 9 year old server in 2023), full builds take about 10-15 miniutes and will consume about 4GB of disk space.
-
The included
Makefilewill downloadgcc,binutils,busybox(1.35.0), andhttps://github.com/richfelker/musl-cross-makefor you. -
The included
Makefilewill then build ai386-linux-muslcross-compiler and Linux 5.8.9 kernel for you. -
Adjust the variables at the top of
Makefileif you would like to use a higher/lower$(ARCH)or different kernel. (NOTE: this isn't quite working correctly yet) -
Running
makeis an alias formake distwhich will result in aDSLxxxB.ZIPfile containingdoslinux,init, a LinuxbzImagekernel, andbusybox. -
After the completion of building the cross-compiler,
sudo make -j$(CORES) installis executed to put the cross-compiler toolchain in your/usr/local/path. -
You can unzip a roughly 6.5MB
DSLxxxB.ZIPzipfile onto a DOS system, like MS-DOS or FreeDOS, and then start doslinux by running a command likeC:\DOSLINUX\dslorC:\DOSLINUX\dsl sh(giving you a shell into the loaded Linux). -
Also try running
make help,make showconfigif you run into configuration issues. -
Run
make cleanto clean up the local git repo. Runmake ultracleanto also get rid of the installation of the cross compiler toolchain in/usr/local.
-
You will need a cross toolchain targeting
i386-linux-muslonPATH.https://github.com/richfelker/musl-cross-make is a tool that can build one for you with minimal hassle. Set
TARGETtoi386-linux-musl. -
Build the prequisites (Linux and Busybox) by running
J=xxx script/build-prereq, replacingxxxwith the desired build parallelism. -
You will need a hard drive image
hdd.base.imgwith an installed copy of MS-DOS on the first partition. -
Run
makeThis will produce a new hard drive image
hdd.imgwith DOS Subsystem for Linux installed. InvokeC:\doslinux\dsl <command>to run Linux commands.C:\doslinuxcan also be placed on your DOSPATHfor greater convenience.
