Incorporating SATA controller drivers into unattended setups

Introduction
Chances are that if you work for a company that has more than ten users, you’re familiar with Windows OS deployment technologies such as SysPrep and WinPE.  Both save considerable time and effort, but if there’s one area that seems to trip people up time and again it’s the issue of adding custom hard disk controller drivers to your image.   Most of the time when people run into this it’s because the target systems use some sort of SATA controller not supported by the OS being deployed, so with that in mind I decided to post a quick blog on how to use these custom drivers with whichever deployment technology you decide is best for you.

Background on SATA Controllers
SATA controllers have 3 modes.  Vendors often use varying terminology but they can basically be classified as the following:

•    Compatibility mode
•    AHCI mode
•    Raid mode

Each mode exposes a different PNPID, and which mode the controller is in is controlled by a setting in the BIOS.  Generally in compatibility mode, Windows detects the controller as a standard  IDE controller.  In AHCI or raid mode a 3rd party driver is used to talk to the controller (e.g. you have to hit F6 and supply driver to get setup to see the hard drive).  Intel storage matrix drivers are the most common SATA drivers. 

Hardware used for our example:
In our example below, a Dell Precision 380 system with SATA controller is used.  This particular controller happens to use the Intel storage matrix drivers which are also the most common.  This example should not be considered as something that would work for all SATA controllers as each controller and version of the driver may require slightly different PNPID'S  and driver versions. 

Step #1: Identifying the type of controller
On the target system, do a clean install of the operating system and get the setupapi.log. For example on the Dell 380 if you run setup with the controller in compatibility mode the setupapi.log looks something like this:

#-019 Searching for hardware ID(s):  pci\ven_8086&dev_27df&subsys_01a81028&rev_01,pci\ven_8086&dev_27df&subsys_01a81028,pci\ven_8086&dev_27df&cc_01018a,pci\ven_8086&dev_27df&cc_0101
#-018 Searching for compatible ID(s):  pci\ven_8086&dev_27df&rev_01,pci\ven_8086&dev_27df,pci\ven_8086&cc_01018a,pci\ven_8086&cc_0101,pci\ven_8086,pci\cc_01018a,pci\cc_0101
#-199 Executing "C:\WINDOWS\system32\setup.exe" with command line: setup -newsetup
#I022 Found "PCI\CC_0101" in C:\WINDOWS\inf\mshdc.inf; Device: "Standard Dual Channel PCI IDE

pci\ven_8086&dev_27df&rev_01 is the PNPID but it also exposes a compatible PNPID of pci\cc_0101 which is found in mshdc.inf so setup runs without having to  use F6 to supply the driver. 

If you run setup with the controller in Raid mode setup you must press F6 to supply the driver.  Here is what was listed

Intel (R) 82801GR/GH Sata Raid Controller(Desktop ICH7r/DH). 
Intel (R) 82801GR/GH AHCI Controller(Desktop ICH7r/DH)
Intel (R) 82801FR Sata Raid Controller(Desktop ICH6r)
Intel (R) 82801FR AHCI COntroller(Desktop ICH6r)

Intel (R) 82801GR/GH Sata Raid Controller(Desktop ICH7r/DH) is the selection that worked, and after setup completed the setupapi.log looked like this:

#-019 Searching for hardware ID(s):  pci\ven_8086&dev_27c3&subsys_01a81028&rev_01,pci\ven_8086&dev_27c3&subsys_01a81028,pci\ven_8086&dev_27c3&cc_010400,pci\ven_8086&dev_27c3&cc_0104
#-018 Searching for compatible ID(s):  pci\ven_8086&dev_27c3&rev_01,pci\ven_8086&dev_27c3,pci\ven_8086&cc_010400,pci\ven_8086&cc_0104,pci\ven_8086,pci\cc_010400,pci\cc_0104
#-199 Executing "C:\WINDOWS\system32\setup.exe" with command line: setup -newsetup
#I022 Found "PCI\VEN_8086&DEV_27C3&CC_0104" in C:\WINDOWS\inf\oem0.inf; Device: "Intel(R) 82801GR/GH SATA RAID Controller"; Driver: "Intel(R) 82801GR/GH SATA  RAID Controller"; Provider: "Intel"; Mfg: "Intel"; Section name: "iaStor_Inst_RAID".

This tells us that PCI\VEN_8086&DEV_27C3&CC_0104 is found in oem0.inf.  In this install oem0.inf is a copy of iastor.inf which got created when the driver was installed

Step #2: Familiarizing yourself with the driver
The txtsetup.oem for our driver is listed below.  This is for the Intel storage matrix driver I downloaded from Intel.com, but depending on your particular card you may have to visit the vendor’s site to find the latest drivers.
iaStor_ICH7DH = "Intel(R) 82801GR/GH SATA RAID Controller (Desktop ICH7R/DH)"
iaAHCI_ICH7R = "Intel(R) 82801GR/GH SATA AHCI Controller (Desktop ICH7R/DH)"
iaStor_ICH6R = "Intel(R) 82801FR SATA RAID Controller (Desktop ICH6R)"
iaAHCI_ICH6R = "Intel(R) 82801FR SATA AHCI Controller (Desktop ICH6R)"

HardwareIds.scsi.iaStor_ICH7DH]
id = "PCI\VEN_8086&DEV_27C3&CC_0104","iaStor"

[HardwareIds.scsi.iaAHCI_ICH7R]
id = "PCI\VEN_8086&DEV_27C1&CC_0106","iaStor"

[HardwareIds.scsi.iaStor_ICH6R]
id = "PCI\VEN_8086&DEV_2652&CC_0104","iaStor"

[HardwareIds.scsi.iaAHCI_ICH6R]
id = "PCI\VEN_8086&DEV_2652&CC_0106","iaStor"

When the controller is in AHCI or Raid mode the same driver is used, iastor.sys.  Different inf’s are used though.  Iastor.inf for raid mode and iaahci.inf for AHCI mode. 

Step #3: Adding the driver to the specific deployment method

1. WINPE 2004 or WINPE 2005

a.  Copy the Intel Storage Driver Matrix drivers to I386\system32\sata folder
b.  Edit WINPEOEM.SIF to look like this

[OemDriverParams]
OemDriverRoot=""
OemDriverDirs=sata

Note with WinPE we only load the driver that is listed in the [Defaults] section so it might need to be edited to load the correct driver depending on which driver your card requires.  For example:

[Defaults]
scsi = iaStor_ICH7DH

In my case this line did not need editing.

2. Unattended Setup

a. In your distribution share create the following directory structure:

I386\$oem$\textmode
I386\$oem$\$1\drivers\sata

b. Copy the Intel Storage Matrix drivers to both folders.
c. Edit the unattend.txt to look like this:

[Unattended]
OemPreinstall=yes
oempnpdriverspath=drivers\sata

[MassStorageDrivers]
"Intel(R) 82801GR/GH SATA RAID Controller (Desktop ICH7R/DH)" = "OEM"
"IDE CD-ROM (ATAPI 1.2)/PCI IDE Controller" = "RETAIL"
[OEMBootFiles]
iaStor.inf
iaachi.inf
iaStor.sys
iaStor.cat
Txtsetup.oem

Note that the name in [MassStorageDrivers] must match the name in the txtsetup.oem [scsi] section.  These names may also change across different versions of the inf.

3. RISETUP Image

This setup is same as an unattended setup except that $oem$ should be created at same level as I386, not under it.

4. RIPREP Image

RIPREP images require that the RISETUP image has the drivers integrated into it otherwise you may get the error message:

"Setup did not find any hard disk drives installed on your computer."

To avoid this, locate the RISETUP image and configure it in the same manner as RISETUP above. 

5. SysPrep

To add these drivers to a SysPrep image do the following:

a. Create the C:\drivers\sata folder.
b. Copy the drivers to the C:\drivers\sata folder.
c. In your sysprep.inf include the following:

Note:  The first entry is the only required entry for the example listed above where the controller is in RAID mode.

[SysprepMassStorage]
PCI\VEN_8086&DEV_27C3&CC_0104= "c:\drivers\sata\iastor.inf", "c:\drivers\sata\","Intel Matrix Storage Manager driver","c:\drivers\sata\iastor.sys"
PCI\VEN_8086&DEV_2652&CC_0104= "c:\drivers\sata\iastor.inf", "c:\drivers\sata\","Intel Matrix Storage Manager driver","c:\drivers\sata\iastor.sys"
PCI\VEN_8086&DEV_2652&CC_0106= "c:\drivers\sata\iastor.inf", "c:\drivers\sata\","Intel Matrix Storage Manager driver","c:\drivers\sata\iastor.sys"
PCI\VEN_8086&DEV_2653&CC_0106= "c:\drivers\sata\iaahci.inf", "c:\drivers\sata\","Intel Matrix Storage Manager driver","c:\drivers\sata\iastor.sys"
PCI\VEN_8086&DEV_27C1&CC_0106= "c:\drivers\sata\iaahci.inf", "c:\drivers\sata\","Intel Matrix Storage Manager driver","c:\drivers\sata\iastor.sys"

Note that the entries that go here depend on the version of the INF being used.  This was done in Step #1 above.  Also note that some of these entries point to iaahci.inf and not iastor.inf.

So as you can see, with a little bit of investigative work and a modified file here and there, adding custom controller drivers can be pretty easy and painless.  Hopefully this will save you some time the next time you find yourself needing to roll out a brand new OS in your environment.

Scott McArthur | Support Escalation Engineer