Getting ready for Windows 7 and how to integrate your own drivers in an image to perform clean installs.
As the Windows 7 release is getting closer, I would like to share how to integrate your own drivers in a Windows image in order that users with specific hardware such as raid card can automate the install.
This sample tutorial is intended only for advanced users that want to test on how to perform a clean Windows 7 installs with their custom 3rd party drivers (for example from booting from a CD/DVD Rom).
The first step to plan your upgrade is to use the Windows Upgrade Advisor: http://www.microsoft.com/windows/windows-7/upgrade-advisor.aspx and test the compatibility of your system. You may also want to check from your OEM vendor if the system has been tested.
Your next step is indeed to backup all your individual data on a separate media / disks and remove / unplug it.
One of the most important steps in an install process is to make sure that all your devices will be recognized after the upgrade. Most OEMs and hardware manufactures provides a download site with their latest drivers.
Some systems that are using specific raid cards may require specific drivers in order for the Windows setup to recognize your disks. So this is for you one of the key element in order to get the setup working and getting this process automated.
There are a number of tools on the market that allow you to extract drivers from an existing Vista system and export them in a very simple manner. Beforehand create a report of your existing configuration by running Cmd->Msinfo32 and by exporting the results of it to a file (File->Export and add it to your backup set).
After running such driver export tools for each device on your existing system you may want to obtain individual package that will contain an OEM*.inf file plus a few more files depending on the hardware that you use. As explained previously you may want to make sure you get all the key drivers for your system such as raid/Sata subsystems. If the Windows 7 setup can’t detect your hardware subsystem you will get a message that disks can’t be found or in the worst case a bluescreen such as 0x00000007F in order to protect your system.
It might be as well a good time to upgrade to the latest drivers for your machine and after a period of time export these packages again.
Then download and install the Windows AIK for Windows 7, at this time of writing the latest version is available at: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=60a07e71-0acb-453a-8035-d30ead27ef72 the tools will be installed by default in C:\Program Files\Windows AIK.
Extract the Windows 7 bootable .iso file in c:\temp\Win7flat for example.
Then create the following directory: C:\temp\mount for DISM.
The main concept to understand is that the setup version of Windows that is used for clean installs is a small version of Windows called WinPE (in short it's Windows installing Windows). This small core of Windows comes with a very small number of drivers in order to make it as tiny as possible. The idea is to add your disk drivers to it in order that when it starts it can find your system drives and complete the install.
DISM allows you to manipulate any .wim image that represents these setup files and list, add, remove drivers, packages to theses. This allows system administrators to completely tune their Windows installs.
Open and CMD shell and cd in “C:\Program Files\Windows AIK\Tools\x86\Servicing”
Here are is list of the sample commands that can be performed:
· Read/list the boot.wim winpe image details:
DISM.exe /Get-WimInfo /WimFile:C:\temp\Win7flat\sources\boot.wim
· Read/list the install.wim image details:
DISM.exe /Get-WimInfo /WimFile:C:\temp\Win7flat\sources\install.wim
Note that when you open or mount an image there can be multiple image indexes please find bellow a sample from Win7rc1:
|
C:\temp\ Win7flat \sources\boot.wim |
|
Index : 1
Nom : Microsoft Windows PE (x86)
Description : Microsoft Windows PE (x86)
Taille : 805 452 925 octets
Index : 2
Nom : Microsoft Windows Setup (x86)
Description : Microsoft Windows Setup (x86)
Taille : 877 520 318 octets |
So you may want to apply the drivers to both in order to make sure that all images will have your drivers built-in.
· Mounting the first image of the boot.wim file:
DISM.exe /Mount-Wim /WimFile:C:\temp\Win7flat\sources\boot.wim /index:1 /MountDir:C:\temp\mount
· List the drivers for one of the mounted image above:
DISM.exe /Image:C:\temp\mount /Get-Drivers
· Add a driver to an image (oem01.inf from the above extraction)
DISM.exe /Image:C:\temp\mount /Add-Driver:C:\temp\Drivers\MyRaidControler\oem01.inf
· Unmount the image
DISM.exe /Unmount-Wim /MountDir:C:\temp\mount /commit
or
DISM.exe /Unmount-Wim /MountDir:C:\temp\mount /discard
If you want to save the changes you performed use the /commit switch or /discard to cancel and revert back to the previous configuration.
· Rebuilding an new .iso image
To make a new bootable .iso file use the oscdimg tool that also comes with the Windows AIK as follow by specifying the built in boot etfs boot loader:
"C:\Program Files\Windows AIK\Tools\x86\oscdimg.exe" -n -m -bE:\temp\Win7flat\boot\etfsboot.com "E:\temp\Win7flat " "c:\win7-customized.iso"
Note: If you get an ”Error 5” such as “can’t delete files”, logoff your session and logon again to release opened handles.
Burn your customized ISO on a DVD, backup your data and boot on it!
I have provided a sample script bellow that will add two drivers to each image:
|
rem image1
DISM.exe /Mount-Wim /WimFile:C:\temp\Win7flat\sources\boot.wim /index:1 /MountDir:C:\temp\mount
DISM.exe /Image:C:\temp\mount /Add-Driver:C:\temp\Drivers\1\oem1.inf
DISM.exe /Image:C:\temp\mount /Add-Driver:C:\temp\Drivers\2\oem2.inf
DISM.exe /Image:C:\temp\mount /Get-Drivers
DISM.exe /Image:C:\temp\mount /Get-Drivers > C:\temp\image1-drivers.txt
DISM.exe /Unmount-Wim /MountDir:C:\temp\mount /commit
rem image2
DISM.exe /Mount-Wim /WimFile:C:\temp\Win7flat\sources\boot.wim /index:2 /MountDir:C:\temp\mount
DISM.exe /Image:C:\temp\mount /Add-Driver:C:\temp\Drivers\1\oem1.inf
DISM.exe /Image:C:\temp\mount /Add-Driver:C:\temp\Drivers\2\oem2.inf
DISM.exe /Image:C:\temp\mount /Get-Drivers
DISM.exe /Image:C:\temp\mount /Get-Drivers > C:\temp\image2-drivers.txt
DISM.exe /Unmount-Wim /MountDir:C:\temp\mount /commit
rem Add the drivers the Ultimate build (Index 5 of the install.wim)
DISM.exe /Mount-Wim /WimFile:C:\temp\Win7flat\sources\install.wim /index:5 /MountDir:C:\temp\mount
DISM.exe /Image:C:\temp\mount /Add-Driver:C:\temp\Drivers\1\oem1.inf
DISM.exe /Image:C:\temp\mount /Add-Driver:C:\temp\Drivers\2\oem2.inf
Rem … Add more drivers here if needed…
DISM.exe /Image:C:\temp\mount /Get-Drivers
DISM.exe /Image:C:\temp\mount /Get-Drivers > C:\temp\image3-drivers.txt
DISM.exe /Unmount-Wim /MountDir:C:\temp\mount /commit |
|
@echo logoff (if required) and create the ISO (c:\win7-customized.iso)
C:\Program Files\Windows AIK\Tools\x86\oscdimg.exe" -n -m -bE:\temp\Win7flat\boot\etfsboot.com "E:\temp\Win7flat" "c:\win7-customized.iso" |
Hope this helps,
Julien