Linux DevCenter    
 Published on Linux DevCenter (http://www.linuxdevcenter.com/)
 See this if you're having trouble printing code examples


Opening Up the PlayStation 2 with Linux

by Howard Wen
03/21/2002

The bout between Sony, Nintendo, and Microsoft with their video game consoles could become even more heated when Linux enters the fray this spring. Sony will sell online the "Linux (for PlayStation 2)" Release 1.0 in the U.S. in May 2002. (A European version will come out that month, too, and the Japanese version earlier in April.)

This kit will include a Linux distribution on DVD that runs on the PS2 hardware, additional software, documentation, a 40GB hard drive, an Ethernet adapter, a USB mouse, a USB keyboard, and a computer monitor cable. The package will cost $200. (The PlayStation 2 is sold separately, though.)

While Linux has been brought to other consoles (such as the SEGA Dreamcast) by hobbyist programmers in the Linux community, this is the first distribution officially released, sold, and supported by a major hardware manufacturer for its game console. Since the demonstration of the kit in January this year at LinuxWorld, over four thousand people have registered at the Linux for PlayStation 2 Community Web site. The site offers discussion forums and file space to help Linux PS2 developers coordinate with one another on projects.

Besides the sheer geek thrill of being able to do it, there's a practical reason for running Linux on a PlayStation 2. A lot of people expressing interest in this kit are hobbyists looking to gain experience in developing for a major game console. The Linux PS2 distribution makes home-brew game programming and experimentation on the PS2 platform affordable for such individuals. The only other alternative is to become a professional, licensed developer and lease a PS2 development kit from Sony--and the professional license and development kit cost many thousands of dollars.

Items in the Release 1.0 kit.
The items that come with the "Linux (for PlayStation 2)" Release 1.0 kit.

(Almost) Full access to the PS2's capabilities

The PlayStation 2-specific libraries will be released under the LGPL; there are no proprietary licenses involved. Sony's distribution of Linux is based on Kondara Linux, which in turn is based on Red Hat Linux. The documentation with this kit will give all the same information about the PS2 hardware that Sony provides its licensed game developers (but it won't give access to the system's anti-piracy mechanisms). This will include full details on the PS2's proprietary Emotion Engine core instruction set, the Graphic Synthesizer, and the Vector Processing Units. "The idea was to simply provide a functional and complete distribution of Linux on the PlayStation 2, while also giving access to the PlayStation 2's unique hardware," says Sarah Ewen, who works for Sony as one of its Linux engineers responsible for supporting the kit.

Related Reading

Physics for Game Developers
By David M. Bourg

Those interested in buying and playing around with the PS2 Linux kit should be aware of some things before getting it: Access to the PS2's DVD drive is restricted so that only official PlayStation discs can be read; and CD-Rs and DVD-R discs won't work in the drive. However, the USB ports on the PS2 are standard, so some USB external CD and DVD drive models that are supported under Linux could be used with this kit.

In terms of programming, the following graphics libraries are provided: libSDL (a fast, 2D graphics library), mesa, and ps2gl (a simplified GL clone, which makes use of the PlayStation 2's hardware). Ewen says, with these tools and enough effort on a programmer's part, it is possible to create games with graphics that are comparable to those of commercial PS2 games: "So the limitations really are few. You have almost unfettered access to the [graphics] hardware. There is nothing stopping programmers from coding 'right to the metal' using the Linux kit."

As for the portability of code from Linux on a PC system to the PS2, most applications written on a PC will compile on the PlayStation 2 with little or no modification. The significant difference is having to pass the --host option to the configure script. The kit supports languages typical to a Linux distribution, like C, C++, Perl, Python, Ruby, and Tcl. The only one missing is Java, although Kaffe has been ported by others in the Linux PS2 community.

"Porting between Linux on the PC and Linux on the PS2 is very easy. Both the PC and PS2 use the same endianness, the same word sizes, et cetera," says Sam Lantinga, a software engineer at Blizzard Entertainment (makers of the Diablo and Warcraft game franchises). With the kit, he ported to the PS2 his Simple DirectMedia Layer, a cross-platform library he created for handling access to graphics and sound, that is mainly used for helping to develop Linux games. "The only kind of code that I can think of that wouldn't run on the PS2, if it ran on a PC, would be either very memory-intensive applications or applications like WINE that require an x86 CPU core."

Screen shot...click for full-size view.
X Windows running on the PlayStation 2 with the "Linux (for PlayStation 2)" kit. (Click for full-size view.)

Open source, open possibilities over the competition?

For Sony, there is no plan to make this kit a significant revenue source. The company won't be advertising it through the usual methods since it doesn't want to confuse consumers who have no interest in Linux or programming. "We're definitely not trying to enter the desktop PC market [with the Linux PS2 kit]," says Ewen, who points out that Sony already sells its own brand of PCs.

Regardless, there could be benefits for the company if the PS2 is seen as more than just a game console. Lantinga predicts that this kit, with its inclusion of an Ethernet adapter and hard drive, could spur the development of online applications and services, things that could give the PS2 platform an edge over Microsoft's Xbox. "Linux is the natural choice for Sony to leverage the vast amount of non-Microsoft expertise available around the world," says Lantinga.

Then there's the advantage for Sony that more games will inevitably appear for the PS2, thanks to this kit. Lantinga easily ported Maelstrom to the PlayStation 2 and played it with the console's game controllers on a television set. "That was very cool. Any other 2D game [made with Simple DirectMedia Layer] that uses 640x480 or lower video resolution should run just fine on the PS2," he says. "So I expect that when the Linux kit ships in the U.S., there will be a number of games almost immediately available for it. It should be fun."

Howard Wen is a freelance writer who has contributed frequently to O'Reilly Network and written for Salon.com, Playboy.com, and Wired, among others.


Return to the Linux DevCenter.

Copyright © 2009 O'Reilly Media, Inc.