Notes on Compact Flash CF-IDE Booting, Windows XP (Embedded)

BIOS Boot Menu

I had experienced a bunch of issues in my various attempts at getting Windows XP (and other operating systems as well) to boot from a Compact Flash card installed as a hard drive replacement utilizing a CF-IDE Adapter.  I’ve read that CF-IDE adapters, and Compact Flash cards themselves can be very tempermental when utilized in this fashion.  Apparently there are a high number of Compact Flash cards that do not perform well in a UDMA mode.  While I still suspect that some of the hardware I tried was the culprit of the frustration, I was able to make a large portion of my prior attempts work properly (for use as Windows boot devices) by following some of the procedures outlined below.  I found a number of good tutorials, most of which are linked in the following post.  What I didn’t find was something that tied it all together in a concise fashion.  I will attempt to do just that in the following post.

This will destroy all data on the Compact Flash card.  Some of these steps, if misused can be seriously detremental to the health of your computer, or longevity of the data on your computer.  Proceed with caution, don’t come crying to me if something is wrong or if you lose your entire collection of Rick Astley MP3s, weird videos about squirrels that you’ve collected while scouring the web, or that really disturbing picture of you with the lampshade on your head at the company party.  Really, I don’t want to hear it.  Especially the MP3s.  For the purposes of this article, I am assuming the Compact Flash card is BLANK, or that you don’t care if it BECOMES BLANK.  Also, missteps CAN destroy data on your primary hard drive.  To be absolutely safe, I will typically make sure that ONLY the Compact Flash card itself is connected to the computer I’m using when running these procedures.  (Sometimes I’ll have a USB drive plugged in too, to boot from or whatever.)

Strap in, here we go:

Boot from a USB Drive formatted for DOS.  Pre-load with DelPart.exe, FDisk.exe, Format.com, Sys.com, and BootPrep.exe.  FDisk.exe, Format.com, and Sys.com are available from the Windows 98 SE OEM boot disks.  While you are prepping your DOS USB drive, also prepare a Puppy Linux USB Drive.  Alternatively, you can use Puppy Linux Bootable CD versions.  (You can also use any one of the many recovery CDs or other Linux Distributions that contain the GParted utility.)  In my case, I wanted a solution that will work on machines that are not configured with a CD drive.

Run DelPart.exe and remove all partitions from the Compact Flash card.

Reboot.  (Be sure to boot to the DOS USB Drive again.)

FDisk

Run FDisk.exe

FDisk LBA Question

Enable LBA when it asks, Change Fixed Disk to Compact Flash card, Create DOS partition or Logical DOS Drive, Create Primary Partition, Use all available space.

Reboot.  (Be sure to boot to the DOS USB Drive again.)

Format D: /s /u (assuming that the Compact Flash has drive letter D assigned to it, otherwise, substitute the appropriate drive letter).

Unfortunately, FDisk will not allow you to set anything but the current primary drive as bootable/the active partition.  I have yet to find a DOS program (from Microsoft or ANY third-party) that has this capability.  It seems like they are extremely floppy-centric, they assume you will be booting from a floppy.  If anything takes the place of the primary drive (i.e. the USB stick we booted with), you can’t set any active partitions on the Compact Flash card.  You also can’t use the Windows XP Recovery Console as Microsoft in all of their infinite wisdom does not allow setting of active partitions from the Recovery Console version of DISKPART.  Don’t believe me?  Try it.  Because of this, we will now reboot to our Puppy Linux CD or USB Stick in order to set the active partition on our Compact Flash card.

Puppy Linux - Launch GParted

Once booted to Puppy Linux, go to the Puppy Menu (same place the Start Menu usually is in Microshaft products).  Then select System, followed by GParted Partition Manager.

GParted - Selecting Partition

I usually Left-click on the partition I’ll be working with, to select it and double-check everything prior to making any changes.

GParted - Right Click Menu

Right-Click on Compact Flash FAT32 partition, select Manage Flags.

GParted Boot Flags

Check the box for Boot, and wait while the partition is activated.  Close the Manage Flags window, close partition manager, and reboot the computer (be sure to boot to the DOS USB Drive again).

Once back in DOS, run the following command:

Bootprep /dD

(Replace the last D with whatever your drive letter is, mine happens to be D.)  Answer Yes to both of the verification prompts.  This prepares the card for booting directly to Windows XP.

At this point, if you boot to the Compact Flash card, you will get an NTLDR not found error.  This is a good sign.

For my purposes, I’m installing the Compact Flash card in another machine (via USB multi-card reader) and copying the pre-configured Windows XP installation over to it. Once the bootprep has been completed, it seems that you can just do a flat-file copy to get Windows over to the Compact Flash card.  I’ve done this a few times, and it seems to work just fine.

I’m using an NLited version of XP Pro.  I’m using the “safe” setting.ini from IntellaWorks over in the MP3Car.com forum. I also enabled MinLogon.exe and the EWF flash write filtering tools from the XP Embedded Toolkit.  I used the excellent tutorials available at Silvio Florito’s GranTuring blog for these steps.  The whole install winds up being a little less than 600 MB once you disable Paging, delete the Paging File (if necessary), remove the DLLCache directory from Windows, and a few other tweaks that I can’t remember off-hand.  Here’s a tip… Once you have the OS up and running, use Soft-Central’s excellent SC-DiskInfo utility (one of my FAVORITE utilities, I use it all the time) to see where the largest file hogs are in your Windows installation and delete them.  I assume I could get the install even thinner, but I’m fairly pleased with how things are working right now, so I’ll probably stick with where it’s at.

For some reason, once Windows XP is up and running from a newly copied Compact Flash card, I have to re-enable the EWF filter.  To do this, I’ve used the registry edits recommended by Silvio Florito.  I created an EWF.REG file in my Windows\System32 directory in the NLited Windows installation for future use.

After re-installing the registry tweaks, you must also run the following command from the command prompt of the booted Compact Flash Windows:

ewfmgr c: /enable

After running this command, reboot the computer to enable the EWF filter.  This should get you up and running. Even with a relatively slow (10 MB/s read speed) Compact Flash card, I am still able to boot windows in about 24 seconds.  This is most likely due to the extremely low seek times associated with Compact Flash media.

2 Responses to “Notes on Compact Flash CF-IDE Booting, Windows XP (Embedded)” »»