Sat, 15 Dec 2012 by Bolshevik in os | Comments

As a person who does know something about computers and the computer science I am often asked to help resolving computer related problems. It may be cleaning windows machine after virus attack or just setting up a newly bought PC hardware, operating system and applications. Thus it is very cool to have a live CD or USB pen drive capable to boot some environment helping to detect problems and resolve them. Here I want to go through my experience and the solution I currently used.

History

Installing basic DOS was quite easy and didn't require special equipment to have. The only you needed is a bootable floppy disk and utilities like fdisk, format, sys and that's all.

Later Windows arrived and things got a bit complicated. I am skipping operating system versions before Windows 95, as they were just environments, not separate operating systems. Windows 95 needed about 40 floppy disks to put installation files on as I remember. One had to check that all the floppy disks are valid and readable or fail installing the system due to I/O error. Later Windows 98 appeared requiring more space on the installation media. Fortunately, by that time El Torito Bootable CD Specification had been announced and implemented and it was possible to create a bootable CD containing installation files.

At school I liked to install Windows operating system again and again to keep it clean and fast. Most of us know, that Windows becomes unstable and trashy after installing and uninstalling a lot of software, drivers etc. So one day I decided to create my own live CD. The CD contained FreeDOS, MS DOS from Windows 98 and MS DOS from Windows ME. It was possible to boot one of them and then launch a lot of useful utilities from the CD itself. Floppy emulation had been used for the bootable CD therefore it was not very hard to modify boot options and configure DOS drivers. Later I noticed that not all BIOS was capable to boot El Torrito and had a separate floppy drive to boot from, while my CD was in the CD drive to provide all the features. After getting the first DVD drive the live CD grown into a live DVD containing several operating systems on it to be installed.

Up to Windows XP I was booting DOS to install Windows. Now mostly all computer configurations are capable to boot live CD and many people just boot the distribution media and install Windows or Linux, additionally all modern operative systems include a lot of drivers into setup programs. Most of computers can boot USB stick which allows to create flexible and functional configurations occupying a lot of space. There are a lot of articles on the Internet explaining how to boot WindowsPE from USB and there are a lot of WindowsPE distributives which include a lot of useful software. For a long time I was using Alkid live CD on my USB stick. It provides WindowsPE environment based on Windows XP and includes a lot of useful applications.

Windows 7 installation from ISO

Yes, it's possible and the implementation is really great it allows to put an ISO image on the USB stick, boot it and install Windows 7 or later just from the ISO. It would be very useful to read limitations and caveats of the method described.

Some linux distributions like Ubuntu also support booting installation CD from the ISO image. Please refer to distribution documentation on how to pass loop device configuration to the OS kernel on the installation media.

SystemRescueCD

For some time I have been mostly using Ubuntu at home and got acquainted with it quite well. There is a great live CD distribution called SystemRescueCD, it contains a lot of useful applications, support 64-bit processors and looks like Alkid live CD alternative for me.

Universal boot stick

I wanted to join all the features mentioned above. It seemed to be very useful having a USB drive capable to boot both Linux and Windows PE and additionally install Windows 7 from ISO images. The problem is that SystemRescueCD has its own boot configuration and is booted using syslinux or grub2 optionally, Windows PE uses windows boot loader to boot and RMPrepUSB uses grub4dos.

The obvious solution is to chain boot loaders somehow to switch from one to another. The easiest would be to boot syslinux first, then chainload grub4dos to install Windows 7 or boot Windows XP based PE environment. Follow instructions here and created bootable SystemRescueCD USB stick. Extract Alkid CD contents to the drive saving directories structure. Copy FiraISO as specified here and create ISO folder containing dummy file Choose_an_iso, do not install grub4dos.

Contents of the flash drive must be the following:

-rw-r--r--   1 bolshevik bolshevik      7998 июля   2 15:07 AutoUnattend.xml
drwx------   2 bolshevik bolshevik      4096 дек.  11 02:01 bootdisk
drwx------   2 bolshevik bolshevik      4096 окт.   9 12:23 bootprog
drwx------   9 bolshevik bolshevik      4096 окт.  10 10:46 FiraDisk
drwx------   2 bolshevik bolshevik      4096 окт.   9 12:30 ISO
-r--r--r--   1 bolshevik bolshevik     32256 окт.   9 20:55 ldlinux.sys
drwx------  13 bolshevik bolshevik      4096 окт.   9 12:37 minint
-rwxr-xr-x   1 bolshevik bolshevik     47596 авг.   7  2009 NTDETECT.COM
drwx------   2 bolshevik bolshevik      4096 окт.   9 12:42 ntpasswd
drwx------  74 bolshevik bolshevik      4096 окт.   9 12:42 PROGRAMS
drwx------   5 bolshevik bolshevik      4096 дек.  11 01:23 syslinux
-rw-r--r--   1 bolshevik bolshevik 270471168 нояб.  5 22:27 sysrcd.dat
-rw-r--r--   1 bolshevik bolshevik        45 нояб.  5 22:27 sysrcd.md5
drwx------   2 bolshevik bolshevik      4096 окт.  25 01:52 usb_inst
-rw-r--r--   1 bolshevik bolshevik     15799 июля  24 21:11 usb_inst.sh
-rw-r--r--   1 bolshevik bolshevik       877 сент. 26  2010 usbstick.htm
-rw-r--r--   1 bolshevik bolshevik         6 нояб.  5 22:27 version

Next let's copy grub configuration file menu.lst from FiraISO to /syslinux/grub/, copy grub.exe to /syslinux/ and modify syslinux.cfg. I changed default boot option, boot timeout and added a new entry to chainload grub4dos.

LABEL load_grub
  MENU LABEL 0) Load GRUB to boot XP or install Windows 7-8
  KERNEL grub.exe
  APPEND --config-file="root (hd0,0);configfile /syslinux/grub/menu.lst; find --set-root /syslinux/grub/menu.lst; configfile /syslinux/grub/menu.lst"
  TEXT HELP
  Boot GRUB to boot WinXP or install windows 7-8.
  ENDTEXT

At this point the USB stick can boot SystemRescueCD, switch to grub4dos and install Windows 7 from ISO image. Next these lines must be added to menu.lst

title 1 Alkid Live CD
find --set-root /minint/setupldr.bin
chainloader /minint/setupldr.bin
savedefault

title 2 Alkid Live CD (without SCSI/RAID)
find --set-root /minint/setuplns.bin
chainloader /minint/setuplns.bin

All /menu.lst references must be replaced with /syslinux/grub/menu.lst, moreover some useful entries can be added:

title find and load NTLDR of Windows NT/2K/XP
find --set-root --ignore-floppies --ignore-cd /ntldr
map () (hd0)
map (hd0) ()
map --rehook
find --set-root --ignore-floppies --ignore-cd /ntldr
chainloader /ntldr

title find and load BOOTMGR of Windows VISTA-8
find --set-root --ignore-floppies --ignore-cd /bootmgr
map () (hd0)
map (hd0) ()
map --rehook
find --set-root --ignore-floppies --ignore-cd /bootmgr
chainloader /bootmgr

title Reboot
reboot

title Shutdown
halt

title Back
chainloader (hd0)+1

Finally, it must be possible to boot all three options mentioned at the beginning.

Issues

UEFI boot is still the issue. It's possible to add grub2 EFI loader to the drive and boot linux, but it is not possible to boot Windows XP or install Windows 7 from ISO image.

Links

  1. SytemRescueCD
  2. FiraISO
  3. Syslinux
  4. Grub4dos
  5. El Torito Bootable CD Specification

Comments

comments powered by Disqus

About

PHP web developer, python developer