Thursday, December 22, 2005
Linux screensaver for Windows
Construct and package a Linux® LiveCD so that it will install using the standard Microsoft® Windows® install process and will operate as a standard Windows screensaver. Answering the most common concern about open source software, this article shows that, yes, Linux will run under Windows.
So why should you read this article? Why, indeed, should I write it? My motive is to help remove two obstacles to the wider adoption of free and open source software. Those obstacles are:
- The perceived difficulty and disruptive effects of installing Linux
- The uncertainty of hardware support for Linux
Most computer users are familiar with a Microsoft Windows environment and with the variety of screensavers available to prevent unauthorized access to the data on the computer when unattended.
There is sufficient free and open source software available nowadays to enable Linux to install and run as a Windows screensaver. This article shows you how to construct an appropriate CD or DVD, and in doing so, demonstrates that the "free" and "non-free" sides of the software Grand Canyon are not so far apart after all.
The examples in this article correspond to three current IBM objectives:
- Concluding the OS/2 business
- Reinventing education
- Encouraging people to learn science
OS/2 is finally being withdrawn on December 23, 2005. According to the IBM Web site on OS/2 Warp migration (see Resources), there is no replacement product from IBM. IBM suggests that OS/2 customers consider Linux.
But which Linux? Without knowing what a client intends to do, it would be irresponsible to make a blanket recommendation. However, on December 25, 2005, the demand for GamesKnoppix St. Nicholas' Day will be large, and the delivery capability will be sufficient. And if you configure it as a screensaver, even the possibility of pressing the wrong key to start it is eliminated.
Figure 1. GamesKnoppix St. Nicholas' Day

The base ISO is GamesKnoppix 3.7-0.1 (see Resources).
![]() |
|
Reinventing education is a central focus for IBM's philanthropic efforts -- but even IBM is limited in what it can give. Organizations chartered with this task -- such as the United Nations Educational, Scientific, and Cultural Organization (UNESCO) -- use all their resources to that end. UNESCO has co-branded with the Organization for Free Software in Education and Teaching, a group of concerned French parents, resulting in a "UNESCO Linux" (look for the Freeduc-CD). The license model for it is clear -- they accept donations and they give it away for free.
Again, configuring the UNESCO Linux as a Windows screensaver eliminates fear, uncertainty, and doubt.
Figure 2. UNESCO Linux/Freeduc-CD

The base ISO is freeduc-cd 1.4.1 (see Resources).
![]() |
|
Enabling scientific research and progress is another pillar of IBM's philanthropic efforts -- without this particular effort, there might be no future IBMers (or future clients). But Big Blue cannot be everywhere. That's why there is Knosciences.
This Linux screensaver is from Nathalie Carrie and Arnaud Verhille, science teachers on Reunion Island, a French colony in the Indian Ocean. This screensaver comes equipped with 700MB of applications to help school children learn their math and physics. Verhille asks "Does anyone know where I can get a free Java," because he is concerned about encumbering his pupils with Sun®'s license conditions.
Figure 3. Knosciences

I use Knosciences 0.95 in this article (see Resources).
![]() |
|
Making it work: Nuts, bolts, and screws
Getting the ISO to run under another operating system requires an open source PC emulator, which includes an open source BIOS and an open source virtual graphics adapter (such as QEMU version 0.7.2). The emulator enables you to set up a virtual PC within a real one. To construct a screensaver, the best way is to configure it with a virtual CD-ROM drive, keyboard, screen, and mouse, but without any virtual disks or network adapter.
Remember, running in emulation is slow (or "slooooooooowwww," like running interpreted Java code). But since we're doing this under the auspices of a screensaver, modern PC hardware is sufficiently fast for the task.
Here are the steps to make this work.
You need to rebuild QEMU -- I learned how by following instructions in a QEMU forum (see Resources). Get these packages:
- The Minimalist GNU for Windows components:
- MinGW. This collection of freely available and freely distributable Windows-specific header files and import libraries combined with GNU toolsets allows you to produce native Windows programs that do not rely on any third-party C runtime DLLs.
- MSYS, a Minimal SYStem. This allows POSIX/Bourne configuration scripts to execute and create a makefile used by
make
. - msysDTK. These add-ons for MSYS include telnet and rlogin.
- SDL, Simple DirectMedia Layer. This cross-platform multimedia library is designed to provide low-level access to audio, keyboard, mouse, joystick, and 3D hardware via OpenGL and 2D video framebuffer.
- zlib. This lossless data-compression library can be used on virtually any computer hardware and operating system, required by SDL.
- directx. This is required when SDL runs under Windows.
- Inno Setup. This is a free installer for Windows programs.
Inno Setup can help you package things in a way that is familiar to Windows users. I used version 5.1.5.
For a program to run as a Windows screensaver, it needs a name like "Knosciences.scr" and it needs to be in directory C:\WINDOWS\SYSTEM32\. It will start from the command line with a command like Knosciences.scr /s
and its "current directory" will be C:\WINDOWS\SYSTEM32\.
With the following alterations to file vl.c in QEMU, it responds appropriately to the /s
switch and runs in full-screen mode. This implementation removes the virtual network card; if you take out the line specifying the net_if_type
, you will have a screensaver that treats Windows as a NAT-router-firewall.
Listing 1. Modifications to QEMU to enable it to run as screensaver
|
After building QEMU, rename the i386-softmmu version of the qemu.exe file to Knosciences.scr.
The following script for Inno Setup puts the screensaver and the ISO file into the C:\WINDOWS\SYSTEM32\ directory:
Listing 2. Script for the installer
|
The following file structure is needed for the CD:
autorun
starts the screen saver installer, the "live" Knosciences, and the documentation viewer.- Files in /qemu are related to the "live" Knosciences.
- The SetupQemuSaver.exe file is the screensaver installer generated by Inno Setup.
- Files in /qemusaver are the screensaver and the original ISO.
- Files in /Knosciences are documentation from the original CD.
Listing 3. Bill-of-materials for the resulting CD
|
The autorun.bat file (which is started when the CD is put in the reader/player) looks like this:
Listing 4. autorun.bat
|
The qemu-knoppix.bat file (which starts the Knosciences demo as part of the autorun sequence) looks like this:
Listing 5. qemu-knoppix.bat
|
The following shell function will create the ISO image. You can also create the CD under Windows; there is no requirement for the CD to be bootable.
Listing 6. Constructing the ISO image
|
That's really all it takes to install Linux from a LiveCD to run as a screensaver on a Windows machine. Have fun with it!
![]() |
|
Learn
- Learn more about LiveCD technology and Linux in these articles:
- "Spin up a Linux LiveCD" (developerWorks, July 2004) gives background on how to use LiveCD.
- "Assess system security using a Linux LiveCD" (developerWorks, July 2005) helps you size up vulnerabilities without lengthy installation and configuration.
- In "Open source licensing, Part 1: The intent" (developerWorks, October 2005), Martin Streicher describes copyrights and open source licenses.
- In Open source licensing, Part 2: Academic v. reciprocal (developerWorks, November 2005), Streicher continues by exploring the two most popular forms of open source licenses: the academic license and the reciprocal license.
- Follow the "Windows-to-Linux roadmap" (developerWorks, November 2003) to migrate your skills from a Windows environment to a Linux one.
- "Write emulator-friendly Linux code" (developerWorks, December 2004) examines what emulators do and looks at hardware and software emulation issues in detail.
- "OS/2 Warp migration information" provides vital information on where to go from OS/2, soon to take its place in the operating system history book.
- Innovation Opens Up describes IBM's strategic view of the future.
- In the developerWorks Linux zone, find more resources for Linux developers.
- Stay current with developerWorks technical events and Webcasts.
Get products and technologies
- GamesKnoppix 3.7-0.1, a Live Linux ISO built by students at the University of Kaiserslautern, Germany, includes support for various 3D graphics adapters, gamepads, and the xsnow animated wallpaper.
- freeduc-cd 1.4.1 is a Live Linux ISO built by the Organization for Free Software in Education and Teaching, and sponsored by the United Nations Educational, Scientific, and Cultural Organization.
- Knosciences is a Live Linux CD built by Nathalie Carrie and Arnaud Verhille, science teachers on Reunion Island, a French colony in the Indian Ocean.
- Harmony is an attempt to create a compatible, independent implementation of J2SE 5 under the Apache License 2.0. Register for the Apache Harmony developer kit.
- QEMU is an open source PC emulator written by Fabrice Ballard.
- Minimalist GNU for Windows packages include MSYS, msysDTK, and MinGW.
- The Simple Direct Layer is used by QEMU to access screen, keyboard, and mouse. The author uses the SDL 1.2.8 package, zlib 1.2.2 (compression library), and directx (for use under Windows).
- Inno Setup is an open source application that constructs installation packages for use under Windows.
- The source code for UNESCO Linux is hosted at National Taiwan University.
- LinuxTracker is one of many "watering holes" for people who wish to exchange free open source software (it uses the BitTorrent method of distribution). Software here is "as is" -- use at your own risk!
- Order the no-charge SEK for Linux, a two-DVD set containing the latest IBM trial software for Linux from DB2®, Lotus®, Rational®, Tivoli®, and WebSphere®.
- With IBM trial software, available for download directly from developerWorks, build your next development project on Linux.
Discuss
- Discuss QEMU, the open-source PC emulator, at the QEMU Forum.
- Participate in developerWorks blogs and get involved in the developerWorks community.
![]() |
|
![]() | |
Chris Ward joined IBM from Cambridge University, England, in 1982. He has watched hard disks come and go. He has watched OS/2 come and go. He has seen both Windows and Linux come, and neither has gone yet. He has written about BlueGene/L for the IBM Journal of Research and Development. And he will invent and create anything for any commercial client of IBM or any charity or school supported by IBM's On Demand Community. Contact Chris at tjcw@uk.ibm.com. source:http://www-128.ibm.com/developerworks/linux/library/l-scrnsave/ |