October 25, 2020

The developer created a DOS Subsystem for Linux

2 min read

A developer from Melbourne, Charlie Somerville, created a DOS Subsystem for Linux (DSL). This is a tool that DOS users have never had so far, similar to the integrated Linux environment that Windows 10 users enjoy through Windows Subsystem for Linux (WSL).

Somerville stated that he was inspired by Microsoft WSL and wrote DSL purely for fun. At first, he just wanted to see if he could start Linux from the DOS command line. After success, he wanted to take a closer look at whether Linux can continue to execute DOS after running. What he didn’t expect was that the whole thing progressed unexpectedly smoothly.

For users who like to work in an MS-DOS environment, DSL is like an alternative to WSL. DSL integrates the real Linux environment into the MS-DOS system, allowing users to run DOS and Linux applications at the DOS command prompt.

Somerville further revealed how DSL works in a Hacker News post. He pointed out that when the DSL is called on the command line for the first time, it will start the Linux kernel and take over the control of the computer from DOS.

DSL uses a processor feature called VM8086, which allows 32-bit operating systems to mostly natively run traditional 16-bit code. This method of running DOS under VM8086 is actually the working method of early Windows and DOS extenders. In addition, the Linux kernel also supports VM86, but it is not widely used.

To run DSL, you must:
  • You will need a cross toolchain targeting i386-linux-musl on PATH.

    https://github.com/richfelker/musl-cross-make is a tool that can build one for you with minimal hassle. Set TARGET to i386-linux-musl.

  • Build the prequisites (Linux and Busybox) by running J=xxx script/build-prereq, replacing xxx with the desired build parallelism.
  • You will need a hard drive image hdd.base.img with an installed copy of MS-DOS on the first partition.
  • Run make

    This will produce a new hard drive image hdd.img with DOS Subsystem for Linux installed. Invoke C:\doslinux\dsl <command> to run Linux commands. C:\doslinux can also be placed on your DOS PATH for greater convenience.

DSL is available on the Github open-source code repository.

Via: itnews