Mar 062015

F6 logoThis is a problem I’ve wanted to solve for quite some time now: How to install older Windows on systems with an AHCI SATA or maybe SCSI or SAS controller, when there is no floppy drive and Windows setup won’t recognize any hard drive? Usually, you’ll have to press F6 during the early setup sequence, and then provide the drivers with either a real floppy, or a USB floppy drive that’s on the hardware compatibility list (not all USB floppies work). While adding non-supported USB floppies to any installation disc is possible when using [nLite] (see farther below), sometimes you may not want to build your own image or maybe you don’t have any floppies available, USB included.

What I always wanted to do was to find a way to just use some USB pendrive for this, like it’s possible with newer Windows systems. And yesterday, I finally found the solution. My original attempts to modify the Windows CD itself were all unsuccessful, and today I believe that it is hardly possible to just talk setup into accepting USB pendrives as floppies, unless your systems BIOS can actively mask the pendrive as such. The solution is much more weird than any such modification actually.

But this time around, I won’t dive into the technical details up front, but simply give you the solution first. If you’re interested in how this really works, just read the lower part 3.)!

1.) How to use any USB drive as a F6 floppy medium for storage driver loading during legacy Windows setup

1.a.) Let’s go step by step. You’ll need to be on Microsoft Windows for this. First we need nu2’s bfi.exe[1] plus a few additional files. I have packaged them all together for you in this file: [buildf6]. Please unpack the archive, and enter the newly created folder buildf6\. In that folder you’ll see a subfolder f6\. Put the storage drivers you wish to use to support your target system in that folder. Please keep in mind, that it has to be F6 capable drivers. Usually these are small and consist of a txtsetup.oem file plus some *.inf and *.sys, maybe *.dll files. When you’ve placed all necessary drivers in there, run the floppy image builder script: buildf6.bat. This will create a 1.44MiB image file called f6.img.

In case you put too many drivers in the f6\ folder and it’s growing too large to build the image file, you can also alter the script to have it build a larger 2.88MiB floppy image instead of the 1.44MiB one. Just open buildf6.bat with your favorite text editor, it’ll show this:

  1. @echo off
  2. cls
  3. .\bfi\bfi.exe -v -t=144 -b=boot\boot_sector.bin -f=.\f6.img -o=BCDL.BIN -o=BCDL-IDE.SYS -o=VIDE-CDD.SYS .\boot\chainload_cd .\f6
  4. pause

Simply change the -t option to -t=288 to get a larger floppy image which can hold more drivers.

1.b.) Next thing we need is [Syslinux] to prepare ourselves a bootable and extremely minimalistic Linux system. Actually, it’s not even Linux at all, it’s just a bootloader. The latest version 6.xx can be obtained directly from [here] at Unpack it, launch cmd.exe and enter the following subdirectory of Syslinux on the shell: bios\win32\ or maybe bios\win64\ in case you’re on a 64-bit Windows machine. Plug your desired USB key into the machine. I’ll assume drive letter F: here. Run the following command to prepare your USB drive, and beware – all data stored on it will be lost:

syslinux.exe --mbr --active --install F:

Please copy your previously created image buildf6\f6.img over to F:\, and also copy Syslinux’ bios\memdisk\memdisk file directly to F:\. Don’t create any subfolders, all files belong in the root directory. Now, create a new text file F:\syslinux.cfg, open it with an editor and enter the following:

default 1
label 1
kernel memdisk
append initrd=f6.img floppy

Save the file. The contents of the USB drive should now look like this:

Our F6 USB sticks content

Our bootable F6 USB sticks’ content

2.) Run it

Now, you need to put the Windows 2000/XP/2003 CD into the target machines optical drive, plug the USB drive in, and set the systems BIOS to boot from USB. If you’re on a UEFI-based machine, make sure to boot in legacy/BIOS mode. The machine will boot from the USB drive, and then go on and continue booting from the CD, as usual. When the prompt for pressing F6 comes up, please do so. When Windows setup asks you to provide a floppy for the intended drivers, confirm that you’ve already put it in, and setup will magically pick it up. See the following screenshots:

XP x64 accessing the virtual F6 floppy

XP x64 accessing the virtual F6 floppy

XP x64 will now load the Areca SAS controller driver - no real floppies involved

XP x64 will now load the Areca SAS controller driver – no real floppies involved

As said, this even works with Windows 2000. Possibly even with Windows NT 4.0 and older systems capable of booting from a CD, but I haven’t tested systems that old. I tried it with Windows 2000 Professional though, and it just works:

Windows 2000 accessing the virtual floppy drive

Windows 2000 accessing the virtual floppy drive (German)

Windows 2000 will load a Mylex AcceleRAID 352 driver for installation

Windows 2000 will load a Mylex AcceleRAID 352 driver for installation (German)

Just keep booting from the USB stick until setup is complete, so that the virtual floppy drive is present throughout all stages of the installation process. As soon as Windows is completely installed, shut down the machine, remove USB drive and CD, and you’re good to go!

Now, for the addendum…

3.) What’s really going on here

I mentioned that I believe that Windows can’t be tricked into accepting any arbitrary USB drive as a F6 floppy. If possible at all, it’d require a low-level binary hack, as Windows setup is calling the hardware interrupt 13hex to access the floppy drive, which is about as low-level as it gets. And that’s hardcoded… somewhere. For the USB floppy part, well, you can widen the field of supported drives (see even [further below]), but according to my attempts you can’t tell Windows to treat a USB device of class 08, subclass 06 and interface 80 – like a USB pendrive – just like a class 08, subclass 04 and interface 00 device – like a real USB floppy. For more information please refer to the [USB mass storage specifications].

So what we’re doing instead is something much more freakish. The exact process that this solution goes through looks like this:

  1. The system BIOS executes the boot code within the boot sector of the USB drive.
  2. The boot code boots Syslinux’ ldlinux.sys loader.
  3. Syslinux continues to higher stages by loading the Syslinux core module, ldlinux.c32.
  4. Syslinux now pulls our floppy image f6.img into a ramdisk, and executes it as if it was an operating system kernel as specified in syslinux.cfg, effectively chainloading it (It also redirects INT13hex to the virtual floppy, so when any code calls the interrupt, it’ll get to the Ramdisk instead of any real floppy!).
  5. This works, because the floppy image itself has a boot sector that the x86 host processor can execute directly as it’s x86 machine code!
  6. Instead of a real operating system, the virtual floppies’ boot sector now executes BCDL.BIN, a pure machine code executable, which was embedded into the image by buildf6.bat from buildf6\boot\chainload_cd\ together with its CD drivers BCDL-IDE.SYS and VIDE-CDD.SYS which support real IDE as well as SATA optical drives.
  7. BCDL.BIN loads its drivers and chainloads the CD by employing standard El Torito optical drive booting.
  8. The Ramdisk stays where it is, posing as a real A: INT13hex floppy drive until reboot.
  9. Windows setup boots from CD.
  10. Besides BCDL, we also have our required storage drivers on that floppy image. Windows 2000/XP/2003 may now load them by locating and reading txtsetup.oem just as it always did.

It may sound complicated, but once you know what to do and how, it’s a pretty easy and fast process. With nothing but your USB key, the drivers and the installation CD you can set up ancient Windows pretty much anywhere, as long as you still have an optical drive at least. I’d imagine this to be specifically useful for notebooks.

4.) The USB floppy thing – How to add non-supported drives

This is just for completeness’ sake. Should you wish to just keep using a USB floppy, but unfortunately have a newer unsupported one, you can add it to your setup CDs HCL. This requires copying the entire CD off to another Windows machine, modifying a small file and rebuilding a new ISO using [nLite] though.

You can find the file on your installation CD in \I386\ for 32-bit Windows (2000/XP/2003) and in \AMD64\ for 64-bit Windows (XP x64/2003 x64), it’s called TXTSETUP.SIF. Open it with your favorite text editor and locate the following part in the Section [HardwareIdsDatabase]:

txtsetup.sif, USB part of the [HardwareIdsDatabase] section

TXTSETUP.SIF, USB part of the [HardwareIdsDatabase] section

Depending on your operating system, this may be found on totally different line numbers. Now you need to determine the USB vendor ID and device ID of your USB floppy drive. I usually do this on Linux or BSD UNIX by running lsusb (FreeBSD needs the usbutils package for that, # pkg install usbutils). Here is an example with some USB device, not a floppy, but just so you know what to look for, it’s the two 4-letter hexadecimal codes separated by a colon, the first is the vendor ID, the second the device ID:

lsusb showing USB devices on FreeBSD

lsusb showing USB devices on FreeBSD (click to enlarge)

You can also get it on Windows though, just go to “Start\Settings\Control Panel”, and then “System\Hardware\Device Manager”. Locate your USB drive by exploding the USB part of the device tree on the very bottom, right click the correct device and choose “Properties”, then “Details”. Et voilà:

Getting a USB devices vendor ID (VID) and device ID (PID) on Windows

Getting a USB devices vendor ID (VID_****) and device ID (PID_****) on Windows

Patching it in is a simple process of adding an according line to TXTSETUP.SIF, like this:

Adding an unsupported USB floppy device in TXTSETUP.SIF (shown with an invalid non-floppy device here, but it works like that with any unsupported real USB floppy drive).

Adding an unsupported USB floppy device in TXTSETUP.SIF (shown with an invalid non-floppy device here, but it works exactly like that with any unsupported real USB floppy drive).

As said, you’ll have to build yourself a new ISO from that using nLite and burn it to CD. But with that, you can now use any previously unsupported USB floppy drive for F6 driver installations.

5.) Profit

So that’s how it can be achieved after all, and I always thought it to be impossible. It’s quite the obscure method, and its gain in usefulness over nLite driver embedding is maybe debatable, but I believe this can be faster and more flexible. That may be especially true if you have to deal with lots of different machines with different SATA AHCI driver requirements or other storage controllers. Building new ISOs using nLite over and over again can be time consuming after all.

[1] Lagerweij, B. BFI is © 2000-2015 Nu2 productions. All rights reserved.