When you're preparing for a customized Windows (silent, unattended) Setup, you'll find that you want to add to or modify the installation medium (typically : the Windows Setup CD). You can work around this by creating network installation points, or create a (not bootable) CD with modified installation files - but that still means you need to boot into Windows - eg with boot disks. It would be more elegant to create a custom setup CD : a (bootable) Windows Setup CD that already contains your answer file, any scripts you want to execute before, during or after setup, or additional files you want copied to the system you're setting up.
What you want, in fact, is the possibility to take a Windows Setup CD, modify it by adding or replacing files, then burn it back to a CD, but so that it is still bootable, allowing you to boot from it and execute your own, customized, silent installation. Here's how to go about that.
To my knowledge, Windows does not have any native tools that would let you play with iso images the way we want too here. There are, however, programs available that look like they could do the trick, such as MagicISO. MagicISO has a free trial version that lets you make images / CD's no larger than 300 MB. Another useful tool, specific for setup CD's, is nLite.
Instructions to create a custom bootcd for Windows Setup with nLite :
nLite does a little bit more than just burning files to a disk : it has its own tools to slipstream service packs and patches to your installation files, its own wizard to create an answer file, and so on, so this takes some getting used to if you're used to the microsoft deployment tools. TODO : see if its possible to put a different winnt.sif in i386 before creating the image file.
Well, that should be possible, I think, but I haven't succeeded. The idea is that you
So, pretty much like the process of using a bootable floppy to create a 'floppy emulation' boot disk, but replacing the floppy image with the 'no-emulation' boot image of a CD.
CD's are read-only. Not just because of the medium, but also because of the filesystem they use : iso9660. Therefore, whether you start from a physical CD or an iso image, you need to extract or copy the files from the CD/iso image to a working directory (eg $HOME/remaster/winxpsetup) where you can modify them and save changes.
From a cd, just copy the contents. Likewise if you've already made a distribution point with Windows XP setup files. From an iso image : mount the image, then copy the contents:
# mount iso image cd /mnt mkdir -p /mnt/iso mount -t iso9660 -o loop some_cd_image.iso /mnt/iso # copy contents (winxp setup dir will be created automatically) cp -a /mnt/iso ~/remaster/winxpsetup
Modify the contents of ~/cdremaster/winxpsetup as suits your needs : add or delete files and directories, modify files, ... You could, for instance, create an answer file, call it winnt.sif, and add it to the cd files. Refer to this discussion of unattended Windows setup. Don't exceed the size of a CD (650-700 MB).
Next step is to turn the contents of ~/cdremaster/winxpsetup into a bootable windows setup cd. In order to do so, we first create a CD image (an .iso file), which we will later burn to a CD.
The essential component to make the CD bootable, is a Boot Record. You can extract a boot sectorfrom either a hard drive, a (bootable) floppy disk, or a bootable cd. Linux (Unix) has the 'dd' command to accomplish this (instructions). Not all MBR's are alike, so it's best to pick a MBR that matches the operating system and medium that your building. In this case, I'd suggest you extract the MBR from the original Windows setup CD (or CD iso image). You may even find that some OEM's (like HP) add boot sector files to the CD's so you can use these for a custom CD. Save the boot sector files in (a subdirectory of) your remastering working directory so you can easily provide a relative path to them. To extract the boot sector from a CD and add it to the files in the remastering directory, do :
## if= can also take a path to a iso image dd if=/dev/cdrom of=~/remaster/winXP/boot.img bs=512 count=4
The Microsoft El Torito boot sector is 4 sectors of 512 bytes. Unfortunately, this doesn't work. Maybe because the boot sectors don't necessarily reside at the beginning of the disk. You can get information about the boot sectors with the geteltoritotool, a perl script. Or use Microsoft's documentation : creating a bootable CD by hex-editing a boot sector; Microsoft Knowledge Base
Maybe I'm missing something, but so far I haven't been successful in extracting a usable boot sector / boot image from a Windows CD. The problem may have to do with either the size and location of the boot sectors on the CD, or with the fact that you need to load some sort of operating system (ntldr, setupldr, ... that is capable of executing setup.exe. This needs to be called from the boot records. The BIOS may also be a factor, in that it has to be able to follow the instructions in the boot sector to locate and load the executable code on the CD.
To create an iso image, use 'mkisofs' ("make iso filesystem"). Refer to the man pages for the (many) options. Note that CD's can also be made bootable by emulating a (bootable) hard or floppy disk. For some applications, this may be appropriate, but for e.g. a Windows XP Setup CD, you want an El-Torito No Emulation CD-ROM (re Microsoft Knowledge Base). El Torito is a CD specification for bootable CD's that don't emulate a HDD of FDD boot. Emulation allows older operating systems to be booted off a CD, by making it appear to them as if they were booted off a hard or floppy disk or by loading eg a DOS environment in with the applications on the CD can run. Newer operating systems do not require emulation to boot; all that is needed is an appropriate boot loader (which you've extracted from the original boot medium). See also wikipedia : El Torito. In fact, it would be inadvisable to run eg an XP setup from a DOS environment, unless you particularly need DOS to execute a batch file or so. The reason we avoid DOS is that DOS doesn't know NTFS filesystem so the setup will start on FAT partitions (withs size limits !) that will later be converted to NTFS. Avoid this step if possible.
The mkisofs command syntax looks simple (mkisofs [ options ] [ -o filename ] pathspec [pathspec ...]), but the options are plenty and require some knowledge about CD specifications and file systems. The most interesting ones for our project are:
cd ~/remaster mkisofs -o winxp_custom.iso -r -l -J -b boot.img -c boot.catalog -no-emul-boot ./winXP
Use your preferred CD burning application to burn the image to a CD. You'll find that some (eg MagicIso, Nero Burning ROM (Windows)) offer the possibility to include a boot sector during the configuration of the burn process - this is similar to our Step 3 : create a boot image from or extract boot sectors of other bootable media. Because we've made the iso image itself bootable, you don't really need this. Any CD burning tool that offers a 'burn iso image' feature should do just fine.
To do it with CLI, try
cdrecord -v -eject dev=0,0 ./winxp_custom.iso
That would involve running DOS to to execute a batch file, and a DOS CD driver to get access to the setup files on the CD. You can accomplish this by starting the setup from a CD with DOS boot floppy emulation. Downside : it's a "DOS initiated" setup, and your hard drive must be FAT / FAT32 for DOS to do see it and be able to copy the installation files to it. However, it can be converted to NTFS later in the setup process, although your C: drive would be limited to a partition size that DOS / FAT32 can handle. See DAS BOOT : creating bootable media.
For a windows unattended setup, you could create an answerfile, and add a batch file that calls the setup. Windows XP setup.exe and winnt32.exe won't run under DOS, but you can use ...\i386\winnt.exe.
REM assuming X:\is drive letter for CD X: X:\i386\winnt /s:X:\i386 /u:unattended.txt