Created: 2006-03-08 by PaulSladen
Packages affected: casper
This spec describes adding Qemu to the LiveCD to boot under Win32.
Users may find themselves unwilling to try a LiveCD or make the switch to Ubuntu; a virtualized LiveCD would give users a way to use Ubuntu easily until they feel comfortable enough to commit.
There are several.
- Alice worries that a LiveCD may destroy her existing OS; she runs it inside an emulated Qemu session instead.
- Bob wants to try Ubuntu without rebooting and closing all his running programs; he uses Ubuntu within a virtualized Qemu session.
- Eve uses Ubuntu within a Qemu virtualized session with her documents in a Samba share; she becomes comfortable enough to make the switch on her next computer upgrade.
The LiveCD should offer to run inside Qemu under Win32.
Use Qemu for emulation to execute the LiveCD directly.
Use Qvm86 for virtualization when ready, and only with the user's explicit consent.
The Qvm86 and Kqemu modules function as Windows drivers; in many cases, users may not wish to install these. Security flaws in the design or implementation of these modules may expose the end user to root kits; we should therefor target primarily unaccelerated Qemu environments.
The LiveCD runs fairly well under Qemu without Qvm86; operations may be slightly slow. Recent versions of Qemu (0.8.2) seem to be workable to a point; Kqemu seems to double emulation speed, Qvm86 should provide approximately the same gains when it's workable. We can probably claim Qemu runs Ubuntu at 1/5 to 1/2 your machine's full speed.
No Acceleration: Roughly 8 minutes to get to GDM; 10 total to reach the desktop. (Host: Ubuntu x86, Athlon 64 1.8GHz)
Kqemu Acceleration: 4(GDM)/5(Desktop) (Host: Ubuntu x86, Athlon 64 1.8GHz)
No Acceleration: 5(GDM)/7(Desktop) (Host: Windows XP x86, Athlon 64 1.8GHz)
No Acceleration: 7(GDM)/10(Desktop) (Host: Ubuntu x86, Athlon 64 1.8GHz)
Kqemu Acceleration: 2(GDM)/3(Desktop) (Host: Ubuntu x86, Athlon 64 1.8GHz)
- Feisty: Not tested yet.
See LiveCDQemuWin32/Benchmarks for more benchmarks.
Once loaded, both systems seem rather responsive; Edgy seems much more responsive than Dapper, especially in terms of screen drawing. Feisty has not been tested yet; but should supply some enhancements:
With the --hash-style=both support in binutils-220.127.116.11.x and in glibc in Feisty, boot and program load time should be minimized; this should halve the boot and load times over Edgy.
As of this writing, Feisty's toolchain and glibc supports the appropriate options; but they have not been activated on the buildd. readelf -e ''ELF_FILE'' | grep .gnu.hash will show the DT_GNU_HASH section once it's built into binaries.
- Other enhancements to GNOME and GTK+ especially should make Feisty faster due to lowered RAM usage and faster screen painting.
- Booting in Qemu without Qvm86 or KQemu will probably supply developers with a good testbed for performance regressions.
The CD should have a section in the Windows auto-run catalog about running the CD as a LiveCD. This section should mention the ability to run it in a slower, emulated environment:
You can try out Ubuntu by using this CD as a LiveCD. A LiveCD supplies a functional desktop without installation to the hard disk; the entire Ubuntu Linux operating system and all applications run from the CD. To use the LiveCD, reboot your computer with this CD in the drive. The boot menu will offer you the option to Start or Install Ubuntu; this option will take you to the Ubuntu Linux desktop. If you only wish to use Ubuntu as a LiveCD, then simply do not click the "Install" icon on the desktop. Alternately, you can try out the LiveCD from within your current operating system. This CD can launch an emulator which will run Ubuntu at 1/5 to 1/2 your computer's current speed. Some functions may not work in this mode, and the system may feel slightly sluggish. You can safely close the window Ubuntu is running in when finished.
It should be noted that Qvm86 functions as a Windows driver; users may not wish to install this driver even when it becomes an option.
The below code runs Qemu with the CD in Windows D:, booting from the CD:
C:\qemu> qemu -L . -cdrom //./d: -net user -net nic -m 384
Broken down, this command does the following:
qemu: The command.
-L .: Location of the BIOS file is the current directory.
-cdrom //./d:: Use the CD in D:.
-net user -net nic: Supply a NIC, emulate it with user space emulation.
-m 384: Supply the emulated environment with 384MiB of RAM.
- ISO image for Edgy boots under Windows fine.
- CD takes forever (i.e. over 15 minutes) to boot due to all the time spent reading the disk.
- If there's space, we may "copy the CD to a temporary file on the hard disk to greatly improve performance. You may later delete this file; or use the supplied tools to burn it to a blank CD and share Ubuntu with your friends."
- UPX seems able to reduce the size of the needed files from 1.8M to 884K.
make -fwin32/Makefile.gcc zlib1.dll sudo cp -a zlib.h zconf.h /usr/i586-mingw32msvc/include sudo cp -a libzdll.a /usr/i586-mingw32msvc/lib/libz.a paul@katu:~/src/upload/qemu-win32/qemu-0.8.0$ cp -a ../zlib-1.2.3/upstream/tarballs/zlib-1.2.3/zlib1.dll . paul@katu:~/src/upload/qemu-win32/qemu-0.8.0$ wine ./qemu-img.exe qemu-img version 0.8.0, Copyright (c) 2004-2005 Fabrice Bellard usage: qemu-img command [command options] $ cp -a ../../sdl-1.2.9-win32/bin/SDL.dll . paul@katu:~/src/upload/qemu-win32/qemu-0.8.0$ wine ./i386-softmmu/qemu.exe | head QEMU PC emulator version 0.8.0, Copyright (c) 2003-2005 Fabrice Bellard usage: qemu [options] [disk_image] Hzzzzah!
- Qvm86 appears to be the Open Source equivalent of Kqemu (the binary accelerator module).
Data preservation and migration
- Qemu needs GCC 3.3 to build reliably
- SDL 1.2
http://fabrice.bellard.free.fr/qemu/qemu-doc.html#TOC56 http://www.libsdl.org/release/SDL-devel-1.2.9-mingw32.tar.gz sudo apt-get install mingw32-binutils mingw32 mingw32-runtime cp -al qemu-0.8.0/ qemu-0.8.0-win32 export PATH=/home/paul/src/upload/sdl-1.2.9-win32/bin/:$PATH ./configure --enable-mingw32 --cross-prefix=i586-mingw32msvc- ERROR: "i586-mingw32msvcgcc" looks like gcc 4.x QEMU is known to have problems when compiled with gcc 4.x It is recommended that you use gcc 3.x to build QEMU To use this compiler anyway, configure with --disable-gcc-check make install *lots of errors*
BoF agenda and discussion
This spec needs attention if it's going to go anywhere. --JohnMoser
Ubuntu can't see Windows Samba shares from within Qemu; this should be addressed. --JohnMoser
- Windows can see Samba shares from Ubuntu though...
Qvm86 seems to work with Qemu 0.8.0, not latest 0.8.2. This will have to be addressed. --JohnMoser
- Although, loading a driver doesn't seem too appealing to the end user; especially not after the Sony BMG thing.