OBJECTIVE: Using QEMU on a Linux Box (Tiny Core of course), to boot an ISO (or image - wasn't sure when I started) that contained the same files as a Windows 2000 Professional Setup CD and could work with other Windows OS (XP, Vista etc.) and save the QEMU hard disk that has a full "Windows Installation" on it so I can test an installation process (Tiny Core of course) of a Live Linux distro (bootable USB with Linux on it) in a Windows environment without having to turn on a slow, infected, power-hungry W2K laptop (I live off the grid and power consumption is a key)
SITUATION - SOLVED after 24 hours of non-stop hades trying every combination of mkisofs, grub, bart, floppy boot disk image downloads - third-party utilities - name it - been there...
Starting with a Trashed/Scratched Bootleg Backup Windows 2000 CD (made from my own authentic master that was also scratched)
and a half dozen missing/corrupt files like the 50MB DRIVER.CAB (crucial) which I managed to go fish off a working W2K laptop.
Note in most cases below CAPS are used strictly to highlight a command, but actually lower case was the rule unless specified in (parenthesis)
1. With Linux, built the folder structure /mnt/sda3/w2k/rawcd
2. TCE loaded WINE to give me a Windows 32 bit environment. Tried DOS BOX but it wasn't quite enough.
3. Went to my folder above with a terminal and using the command WINE CMD gave me a Z: drive (real space) and C: drive (virtual space in the ~/.wine area
4. On the C: (DOS/Windows) drive I also built a C:\rawcd folder. You'll need a bit of ram to do that - I have 3Gig
5. Popped in my Windows Setup CD and went to that folder with Linux - /mnt/sr0 - and then ran WINE CMD again
So now I had 2 WINE DOS/Windows open - the Z: drive (sda3) and another Z: drive (sr0) in a different linux terminal. My objective was to be able to easily shuttle data off the CD to the dos C: RAWCD folder, then to the Linux SDA3 drive for permanence.
So far I had less than 60 seconds into this and the xcopy's below took barely 3 minutes
6. In Wine, after xcopy Z:\mnt\sr0\* C:\rawcd\* /E /C /H to get all contents off CD to virtual C: drive I went to the other WINE terminal and typed
xcopy C:\rawcd\* Z:\mnt\sda3\w2k\rawcd\* /E /C /H
I had to use the /C option because the CD was so scratched. I was going to try the Linux dd command (simpler) but didn't know how to continue after it encountered errors.
7. Then I fished a good copy of driver.cab from a working W2K machine since the CD version was corrupt and put it in the folder Z:\mnt\sda3\w2k\rawcd\i386 with the rest of the Linux files. I actually had to do this copy in Linux since wine (DOS/Windows) had that folder's permissions locked up - as usual, linux rocks
NOTE: I have read you can stuff other files in the i386 and surrounding folders and will explore that later.
NOTE: I was also able to manipulate ~/.wine/drive_c and a few other folders in that area - awesome
After I had it all built, the root folder of my "Building It Myself CD" - Z:\mnt\sda3\w2k\rawcd looked like this:
autorun.inf (file)
bootdisk/ (folder)
cdrom_ip.5 (file)
cdrom_nt.5 (file)
discover/ (folder)
i386/ (main folder of setup/install files)
readme.doc (file)
setup.exe (file)
setuptxt/ (folder)
support/ (folder)
valueadd/ (folder - with a few missing files due to scratched CD - missing files didn't present a problem)
w2kboot.bin (a 2048 byte file I had to hunt for - required to get CD to do an authentic Windows 2000 Setup boot)
and
w2kcd.img (this file doesn't belong here - QEMU error in script - should be one level up the tree)
8. Wrote/Ran this lil script - slightly modified mkisofs line from a tutorial I found online at
http://www.g-loaded.eu/2007/04/25/how-to-create-a-windows-bootable-cd-with-mkisofs/#comment-19376after looking at 10 - 20 - ?50? of them
cd /mnt/sda3/w2k/rawcd
# make it fresh
tfile=../w2kbin.iso
if [ -f $tfile ]; then
rm $tfile
fi
mkisofs \
-b w2kboot.bin -no-emul-boot -boot-load-seg 1984 -boot-load-size 4 \
-iso-level 2 -J -l -D -N -joliet-long -relaxed-filenames \
-V "W2PFPP_EN" \
-o $tfile .
# that made the w2kbin.iso - basically a copy of the CD
qemu-img create -f qcow w2kcd.img 4000M
# that made the QEMU hard drive that Windows Setup will format and install to
# should have done this sooner in script before CD to rawcd folder
qemu -localtime -cdrom /mnt/sda3/w2k/w2kbin.iso -m 512 -boot d w2kcd.img
# that launches the Windows setup CD iso I built with the mkisofs command that is just a file on my hard drive - never burned it to a CD
Note: that -m 512 caused a fairly SLOW setup and later W2K environment
I bumped that up to 1024 (a gig of ram) and things ran much faster
10. Finally got W2K setup to fly and kewl - it even "reboots" smoothly within QEMU - all in the same terminal frame - and goes into setup step 2 (set clock, system etc.) and asks all the old W2K questions - time zone etc.
Its a little scary when W2K setup says hey - lets partition and format the 4GB drive and I am thinking QEMU - if you zap my sda3 I will kill ya - but nope - it just worked on/partition/format of - the QEMU IMAGE of a hard drive w2kcd.img - perfect
...next test is to learn to slip stream in SP4, then incorporate other "packages"
so I can create a W2K "locked" environment, including networking so its all part of setup
and the W2K Environment is LOCKED IN and fresh and consistent
WHY have a W2K XP or Vista QEMU environment when Linux does it all (so far - so much better than Windows ever did)?
First, some users have a hard time letting go of 1001 books or videos or other aps they may have paid for that are in WINDOWS - I have a few such clients. You might think - well let em run a regular Windows box - but frankly, they're so darn slow - if you have enough ram, doing it in QEMU isn't that much slower and I saw a few tools to speed up QEMUs performance, though doubling the ram - memory space - really helped.
Next, Windows is a patently corrupt, virus infected environment - clean and fresh today - guaranteed crash and burn tomorrow - but with a new FRESH though EMULATED QEMU hard drive version viruses aren't really a problem - they're zapped each time you restart the qemu W2K hard drive image - quite similar to the way Tiny Core is a fresh install with each boot.
As for my purpose - I need to debug / develop a LINUX INSTALLER (a C program compiled to exe) and I hated having to boot my Windows laptop - not just for power problems - but I cringe every time I have to work in, turn on or fix a Windows box now.
Tiny Core changed my view - absolutely - and I ain't going back. Why would I when I am booting in 12 - 20 seconds and ka-click - poof - running - got aps up in a blink?