Sunday, September 27, 2020

Developer Creates DOS Subsystem For Linux (DSL)

A developer from Melbourne got so bored during the coronavirus lockdown, and he ended up creating a DOS Subsystem for Linux (DSL). It is a tool that DOS users have never had so far: an integrated Linux environment similar to what Windows 10 users enjoy via Windows Subsystem for Linux (WSL).

The developer behind this DSL is Charlie Somerville, a software engineer who enjoys system programming and is interested in retro computing, especially when it comes to the 1990s Microsoft DOS and Windows.

Somerville told Itnews that he was inspired by Microsoft’s Windows Subsystem for Linux (WSL), so he wrote DSL for fun.

At first, he just wanted to see if he could get the Linux to boot from the DOS command line. Once that happened, he thought of taking it a notch higher to see if he can continue executing DOS once Linux was running.

I’m mostly surprised by how smoothly the whole thing works given how *dodgy* it all is haha,” says Somerville.

How DOS Subsystem for Linux works?

DOS Subsystem for Linux is like a WSL alternative for users who prefer to work in an MS-DOS environment. DSL integrates a real Linux environment into MS-DOS systems, which lets users run DOS and Linux applications from the DOS command prompt.

via GIPHY

Shedding further light on how DSL works, Somerville explained on a Hacker News thread:

When DSL is first invoked at the command line it boots up the Linux kernel which takes over control of the computer from DOS.

Now here’s the trick: DSL uses a processor feature called VM8086, which allows for a 32-bit OS to run legacy 16-bit code mostly natively. This approach of running DOS under vm8086 is actually how early Windows, DOS extenders, etc., worked. The Linux kernel also supports VM86, although it is mostly undocumented and not really used these days.

DSL then returns to DOS, which has essentially been flipped inside out and is now unknowingly running inside a VM8086 task. Helpfully Linux does not appear to clobber DOS’s memory during its own boot process.

DSL barely manages to emulate hardware like the keyboard to make things work and thereby allowing DOS raw hardware access for everything else. But it is to be noted that running two operating systems simultaneously on the same hardware is extremely fragile and unsafe, of course. Nevertheless, it seems to work surprisingly well.

Building DSL

To run DSL, you must:

  • Have a cross toolchain targeting i386-linux-musl on PATH. This tool can build one for you without much hassle. Now set TARGET to i386-linux-musl
  • Build the prerequisites (Linux and Busybox) by running J=xxx script/build-prereq, replacing xxx with the desired build parallelism
  • Get a hard drive image hdd.base.img with an installed copy of MS-DOS on the first partition
  • Run make (This will create a new hard drive image hdd.img with DOS Subsystem for Linux installed)
  • Invoke C:\doslinux\dsl <command> to run Linux commands [you can also place C:\doslinux on your DOS PATH for more convenience]

You can check out DSL on Github which seems to be working on MS-DOS 6.22 and FreeDOS.

The post Developer Creates DOS Subsystem For Linux (DSL) appeared first on Fossbytes.


Developer Creates DOS Subsystem For Linux (DSL)
read more

No comments:

Post a Comment

Playing Grand Theft Auto Inside A Neural Network’s Hallucination? It’s Possible!

Ever imagined what a Neural Network's hallucination would look like? The post Playing Grand Theft Auto Inside A Neural Network’s Halluc...