Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Linux screensaver for Windows

LiveCDs demonstrate that, yes, Linux can run under Windows

Chris Ward (tjcw@uk.ibm.com), Advisory Software Engineer, IBM 
Chris Ward
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.

Summary:  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.

Date:  20 Dec 2005
Level:  Introductory
Also available in:   Japanese

Activity:  28706 views
Comments:  

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

Successor to OS/2

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
GamesKnoppix St. Nicholas' Day

The base ISO is GamesKnoppix 3.7-0.1 (see Resources).


Reinventing education

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
UNESCO Linux/Freeduc-CD

The base ISO is freeduc-cd 1.4.1 (see Resources).


Enabling science

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
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.

Rebuilding QEMU

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
                
    for(;;) {
        if (optind >= argc)
            break;
        r = argv[optind];
        if (r[0] != '-') {
            if ( 0 == strcmp(r,"/s") ) {
              /* Going to run as a Windows screen saver */
              full_screen = 1 ;
              bios_dir = "." ;
              ram_size=512*1024*1024 ;
              boot_device='d' ;
              hd_filename[cdrom_index] = "knosciences-0.95.iso" ;
              rtc_utc = 0;
              net_if_type = NET_IF_DUMMY;
              optind += 1 ;
            } else {
               hd_filename[0] = argv[optind++];
            }
        } else {
  ...
    }
    if ( full_screen == 1 )
    {
       putenv("SDL_VIDEODRIVER=windib") ;
    }

After building QEMU, rename the i386-softmmu version of the qemu.exe file to Knosciences.scr.

Inno Setup

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
                
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
;

[Setup]
AppName=Knosciences Screen Saver
AppVerName=Knosciences Screen Saver
AppPublisher=OFSET
AppPublisherURL=http://www.ofset.org/
AppSupportURL=http://www.ofset.org/
AppUpdatesURL=http://www.ofset.org/
DefaultDirName={pf}\Knosciences
DefaultGroupName=Knosciences
Compression=lzma
SolidCompression=yes

[Files]
Source: "{src}\qemusaver\Knosciences.scr"; DestDir: "{sys}"; Flags: external
Source: "{src}\qemusaver\knosciences-0.95.iso"; DestDir: "{sys}"; Flags: external
Source: "{src}\qemu\SDL.dll"; DestDir: "{sys}"; Flags: external
Source: "{src}\qemu\bios.bin"; DestDir: "{sys}"; Flags: external
Source: "{src}\qemu\vgabios.bin"; DestDir: "{sys}"; Flags: external
Source: "{src}\qemu\vgabios-cirrus.bin"; DestDir: "{sys}"; Flags: external
Source: "{src}\qemu\qemu-doc.html"; DestDir: "{app}"; Flags: external
Source: "{src}\qemu\vl.c"; DestDir: "{app}"; Flags: external
Source: "{src}\qemu\LICENSE\LICENSE"; DestDir: "{app}\LICENSE\LICENSE";
                                                       Flags: external
Source: "{src}\qemu\LICENSE\README-SDL.txt"; DestDir: "{app}\LICENSE\README-SDL.txt";
                                                       Flags: external
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\Knosciences Screen Saver"; Filename: "{sys}\Knosciences.scr"
Name: "{group}\{cm:UninstallProgram,Knosciences Screen Saver}"; Filename: "{uninstallexe}"

File structure for the CD

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
                
.
./autorun.bat
./autorun.inf
./autorun.pif
./qemu
./qemu/bios.bin
./qemu/linux_boot.bin
./qemu/qemu-doc.html
./qemu/qemu.exe
./qemu/qemu-img.exe
./qemu/qemu-knoppix.bat
./qemu/vl.c
./qemu/qemu-tech.html
./qemu/qemu-win.bat
./qemu/README-en.txt
./qemu/README-ja.txt
./qemu/SDL.dll
./qemu/vgabios.bin
./qemu/vgabios-cirrus.bin
./qemu/LICENSE
./qemu/LICENSE/LICENSE
./qemu/LICENSE/README-SDL.txt
./qemusaver
./qemusaver/qemusaver.iss
./qemusaver/Knosciences.scr
./qemusaver/knosciences-0.95.iso
./cdrom.ico
./SetupQemuSaver.exe
./Knosciences
./Knosciences/index.html
./Knosciences/knosciences-0.95.css
./Knosciences/knosciences-0.95.html
./Knosciences/labels.pl
./Knosciences/node1.html
./Knosciences/node10.html
./Knosciences/node100.html
./Knosciences/node101.html
   ..
./Knosciences/node97.html
./Knosciences/node98.html
./Knosciences/node99.html
./Knosciences/WARNINGS
./index.html

The autorun.bat file

The autorun.bat file (which is started when the CD is put in the reader/player) looks like this:


Listing 4. autorun.bat
                
@start SetupQemuSaver.exe
@start index.html
@cd qemu
@start /MIN qemu-knoppix
@exit

The qemu-knoppix.bat file

The qemu-knoppix.bat file (which starts the Knosciences demo as part of the autorun sequence) looks like this:


Listing 5. qemu-knoppix.bat
                
@echo off
REM KNOPPIX on Windows File System
REM Written by Japanese KNOPPIX TEAM 2004.08.17
REM Contact: knoppix@m.aist.go.jp
REM License GPL

REM If you get iso image of KNOPPIX, please use the following options.
REM Join the following two lines before running this bat file; it was split for space purposes.
qemu.exe -L . -m 128 -boot d -cdrom ../qemusaver/knosciences-0.95.iso -user-net -enable-audio
 -localtime
REM                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
exit

Shell to create the ISO image

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
                
function remaster_mkisofs
{
mkdir -p ${wrkdir}/new_iso
mkisofs -pad -l -r -J -v -V "Knosciences" \
-hide-rr-moved \
-publisher "OFSET http://www.ofset.org/" \
-p "http://www.ofset.org/" \
-volset "Knosciences 0.95 for Windows (knosciences 0.95 with QEMU 0.7.2)" \
-o ${wrkdir}/new_iso/freeduc.iso ${wrkdir}/files

}

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!


Resources

Learn

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 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

About the author

Chris Ward

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.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Linux, Open source
ArticleID=100958
ArticleTitle=Linux screensaver for Windows
publish-date=12202005
author1-email=tjcw@uk.ibm.com
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers