Running Linux on the Sega Dreamcast
Looking for a low-cost way to get started with embedded Linux? Or a fun weekend project? In this detailed how-to article, Bill Gatliff explains everything you need to do to install Linux on a Sega Dreamscast gaming console. Even the necessary Linux kernel, bootloader, and utility kernel patches are included and available for download.
Introduction
One of the more challenging aspects of learning about embedded Linux is the scarcity of cheap, compatible hardware. Sure, Linux runs fine on a personal computer, but does being able to run Linux on your workstation mean you can call yourself an embedded Linux guru?
Hardly. You may not believe me now, but you will shortly.
What's needed to really explore Linux as an embedded operating system is a well-documented, inexpensive and readily available hardware platform that isn't based on an Intel x86-compatible microprocessor. By excluding PCs, the list of candidates becomes: PDAs, internet appliances, and gaming consoles.
Yes, gaming consoles: that's the ticket. To encourage consumers to buy the games, gaming consoles are often sold at or below cost. And one of the cheapest ones around at the moment is the Sega Dreamcast, by virtue of the fact that it has been recently discontinued by Sega as they make way for their new products.
But will the Dreamcast run Linux? Sure! In fact, it already does.
The rest of this article tells you how to get it running on your Dreamcast.
How Linux works on the Dreamcast
Before we can discuss how to run Linux on the Dreamcast, you have to know a little bit about how to get Linux inside the Dreamcast in the first place. As it turns out, the magic is in the format of the CD you insert into the Dreamcast before powering up. In other words: no tools required!
The Sega Dreamcast
The Dreamcast sports a Hitachi SH7750 CPU running at 200 MHz, with 16MB of memory. It can drive either a television (PAL or NTSC) display or, with an adapter, a VGA monitor. You can still find Dreamcasts at your local toy store, and for around $100 USD you can get one plus the optional keyboard and mouse peripherals. You can also find its discontinued ethernet adapter (Sega calls it a Broadband Adapter, or BBA) listed on your favorite internet auction site from time to time.
Getting Linux into the Dreamcast
On powerup, the Dreamcast's onboard bootloader firmware expects to see a CD-R (not a CD-RW) containing a minimum of two recording sessions. The first session is assumed to be an audio track, which the bootloader ignores. The second session must be a CD/XA data track (mode 2, form 1) containing a standard ISO9660 filesystem, and must include a bootstrap information structure commonly referred to as IP.BIN
in the first 16 sectors of that filesystem.
The IP.BIN
data structure contains the name of the file the bootloader is to launch at the end of the boot process. IP.BIN also includes metadata that identifies the hardware on which the CD's programs are designed to run (Dreamcast vs. other Sega products), area symbols that control geographic compatability of the program (NTSC vs. PAL video output, for example), the list of peripherals required by the program (which controller, game pack, etc.), and a CRC.
Once the Dreamcast's bootloader reads and validates the information in IP.BIN
, it loads the contents of the named file from the ISO9660 filesystem into memory and gives complete control of the system over to it. In our case, the program loaded will our Linux operating system and related programs and data; other possibilities would be a small monitor that knows how to download another application from the Dreamcast's serial or ethernet port; an RTOS like eCos; or -- work with me here -- a game of some kind. Or so I've heard. (The author has no games for his Dreamcast. Really. When it's playtime, he heads upstairs to his three self-propelled gaming units. They are loads more fun, but also considerably more expensive to feed and clothe. Which makes the price of the Dreamcast an even better value.)
The Dreamcast's system firmware also provides some BIOS-like functionality for system operations like reading from the GD-ROM drive (a modified CD-ROM drive that can hold 1GB of data), getting system information, and accessing onboard flash memory; code to utilize these features in the Dreamcast's Linux kernel is currently under development, and will probably be ready for use by the time you read this article.
--- Continued ---
Story navigation . . .