Hello list,

Please find attached an updated version of the Windows drivers scan system
for the Unattended project and some related informations about it.

This obsoletes all previous published code versions of this scanner.
Files and patches are based on the CVS version of the Unattended source code 
as of 2009-04-20 13:50 UTC .

Regards,

Pierre Bourgin

[below: copy of the README-search-win-drivers.txt file]


Changelog:
* 20090420 - Added cache support for Windows drivers collection (any sub-level).
* 20090420 - Added support of multiple Windows drivers root paths.
* 20090420 - code rewrite for better parsing of .INF files of Windows drivers.
* 20090420 - Added USB devices support via use of lsub.
* 20090420 - use "-m" option of lspci (output more "portable" accross linux 
distributions)
* 20090420 - Added HDAUDIO sound bus support 
             (via ALSA sound system kernel support)
* 20090420 - partial code rewrite: less 'pci' strings everywhere.
* 20090213 - Updated instructions related to site/config.pl content
             (reported by Steven Blackery)
* 20090213 - Added search-win-drivers.pl example output.
* 20090213 - Updated instructions related to site/config.pl content
             (reported by Juan Jose Pablo and Steven Blackery)
* 20081112 - case insensitive search on pattern PCI\\VEN 
             (reported by Jye Meier)
* 20081006 - deal with .INF encoded in UTF-16le format
* 20081003 - initial (public) revision

All Files and patches are based on 2009-04-20 CVS version of Unattended project.

-----------------------------------------------------------------------
Introduction
-----------------------------------------------------------------------

Implement an automated retrieval of Windows drivers for the current harwdare
platform to install with the Unattended Project by parsing a Windows
collection of drivers.
It is designed to work along with other functionalities related to drivers in
Unattended, ie manual choose of drivers and TXTSETUP stuff (adding driver for
text setup part of Windows installation).

Basically, it's a perl script that HINTS which Windows drivers COULD match
for the current platform hardware devices to install under Windows. 

The script (search-win-drivers.pl) retrieves informations from present hardware
devices and try to figure out which Windows drivers could apply to these
devices.

The matching drivers are then copied onto the hard drive (from which Windows
is installing) and unattend.txt file is updated in order that Windows Setup
uses them (update of its OemPnPDriversPath entry).

That way, the Plug-and-Play Windows mechanism will be able to choose among
these "hinted" drivers which one feets nicely (from its point of view).

The benefit is that you don't have to choose manually which Windows drivers to
install for hardware support with Unattended.

In case of a missing driver, you "just" have to add it into your Windows
drivers collection for the next time.

PCI, HDAUDIO and USB devices are supported.

-----------------------------------------------------------------------
Installation & configuration (basic)
-----------------------------------------------------------------------

As much as possible, try to install file(s) below folder
<unattended>/install/site/, it will help you for unattended maintenance.

  ** These instructions do not provide HDAUDIO and USB support: **
  ** see dedicated section below.                               **

1. Retrieve a collection of Windows drivers into the Windows drivers "root"
   directory. Default path for this root directory is 
   <unattended>/install/site/win_drivers/ .

   see example below with DriverPacks.net collection of Windows drivers.

2. From the attached archive, retrieve nt5x-install script as file
   <unattended>/install/site/nt5x-install .
   It's not usefull to update <unattended>/linuxboot/nt5x-install !

3. patch file <unattended>/install/dosbin/install.pl with the provided
   patch. 
   NOTE: this patch is generated against the CVS version install.pl file:

   $ cd <unattended>
   $ patch install/dosbin/install.pl 
<search-win-drivers-archive>/dosbin/install.pl.patch

4. Add script <unattended>/install/dosbin/search-win-drivers.pl with the one
   from the archive.

5. Update your <unattended>/install/site/config.pl file with the following
   elements:
   
    ## Windows drivers scanning: uncomment to DISABLE its usage
    #$u->{'_temp'}->{'scan_windrivers'} = '';
    
    ## Windows drivers scanning: drivers collection root path:
    ## default is "/z/site/win_drivers"  (in search-win-drivers.pl):
    #$u->{'_temp'}->{'scan_windrivers_path'} = "/z/site/win_drivers" ;
    
    ## Windows drivers scanning: use our patched version of ntx5-install
    $u->{'_meta'}->{'ntinstall_cmd'} = '/z/site/nt5x-install' ;
    
    ## Windows drivers scanning:
    ##   howto exclude PCI_CLASSID Ethernet Controller (0x0200)
    ##   from search of Windows Drivers scanning
    #$u->{'_temp'}->{'scan_windrivers_options'} = '-c 0200' ;
    
    ## Windows drivers scanning: where to store matching driver(s)
    ##   (relative to %systemdrive% once Windows is installed):
    ## default is 'drv-scan' (in dosbin/install.pl)
    #$u->{'_temp'}->{'scan_windrivers_dest'} = 'drv-scan' ;

6. (optional) generate a cache file for each Windows drivers collections in
   order to speedup the parsing time of Windows drivers collection.
   See details in section below.

7. Start a Windows installation via Unattended to use it. 
   The effect of this code happens before you choose (manually) which
   driver(s) to add to the installation. 
   You can check the scan result in the file
     /c/netinst/logs/search-win-drivers.log

You can also run search-win-drivers.pl script directly from the shell to see
what happens: it's a standalone script that just produce output like this one:

  $ /z/dosbin/search-win-drivers.pl -d /z/site/win_drivers
  # Check root paths of Windows drivers...
  # Windows drivers collections to use: /z/site/win_drivers
  # - Check PCI devices (via lspci output command)...
  #   found 18 PCI device(s) on current hardware platform.
  # - Check HDAUDIO devices...
  #   found 0 HDaudio codec (on 1 sound card).
  # - Check USB devices...
  #   found 6 USB usable devices on current hardware platform.
  # Hardware device list:
  # - desc=Intel Corporation 82915G/P/GV/GL/PL/910GL Memory Controller Hub (rev 
04)
  #   bustype=PCI busid=00:00.0 vendor=8086 device=2580 class=0600
  #   infstr=PCI\VEN_8086&DEV_2580
  # - desc=Intel Corporation 82915G/P/GV/GL/PL/910GL PCI Express Root Port (rev 
04)
  #   bustype=PCI busid=00:01.0 vendor=8086 device=2581 class=0604
  #   infstr=PCI\VEN_8086&DEV_2581
  # - desc=Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI Express 
Port 1 (rev 03)
  #   bustype=PCI busid=00:1c.0 vendor=8086 device=2660 class=0604
  #   infstr=PCI\VEN_8086&DEV_2660
  <snip output>
  # - desc=Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio 
Controller (rev 03)
  #   bustype=PCI busid=00:1e.2 vendor=8086 device=266e class=0401
  #   infstr=PCI\VEN_8086&DEV_266e
  # - desc=Intel Corporation 82801FB/FW (ICH6/ICH6W) SATA Controller (rev 03)
  #   bustype=PCI busid=00:1f.2 vendor=8086 device=2651 class=0101
  #   infstr=PCI\VEN_8086&DEV_2651
  # - desc=ATI Technologies Inc RV516 [Radeon X1300/X1550 Series]
  #   bustype=PCI busid=01:00.0 vendor=1002 device=7187 class=0300
  #   infstr=PCI\VEN_1002&DEV_7187
  # - desc=ATI Technologies Inc RV516 [Radeon X1300/X1550 Series] (Secondary)
  #   bustype=PCI busid=01:00.1 vendor=1002 device=71a7 class=0380
  #   infstr=PCI\VEN_1002&DEV_71a7
  # - desc=Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express 
(rev 01)
  #   bustype=PCI busid=40:00.0 vendor=14e4 device=1677 class=0200
  #   infstr=PCI\VEN_14e4&DEV_1677
  # - desc=Primax Electronics, Ltd
  #   bustype=USB busid=003:003 vendor=0461 device=4d15 class=n/a
  #   infstr=USB\VID_0461&PID_4d15
  # 24 hardware device(s) to consider.
  # 20 distinct INF string(s) for hardware devices.
  #
  # loading INF strings from Windows drivers collection...
  # - path: /z/site/win_drivers
  # Parse .INF files below folder /z/site/win_drivers ...
  # - load cache file 
'/z/site/win_drivers/DriverPacks/search-win-drivers.cache' ...
  # - added 33365 INF strings
  # - load cache file '/z/site/win_drivers/dell/search-win-drivers.cache' ...
  # - added 1132 INF strings
  # - parsed 11 .INF files, added 9 INF strings.
  # Search matching drivers for current hardware platform
  # 34 driver folders to use:
  /z/site/win_drivers/DriverPacks/D/C/I/2k
  /z/site/win_drivers/DriverPacks/D/C/I/2k3
  /z/site/win_drivers/DriverPacks/D/C/I/xp
  /z/site/win_drivers/DriverPacks/D/G/A1
  <snip output>
  /z/site/win_drivers/DriverPacks/D/S/SMS
  /z/site/win_drivers/DriverPacks/D/S/V2
  /z/site/win_drivers/DriverPacks/D/S/zC
  /z/site/win_drivers/DriverPacks/D/S/zD2
  /z/site/win_drivers/dell/chipset-intel-M-45series/files/All
  # Enumerate unmatched devices: 1 devices
  #    (might be handled directly by Windows or indirectly by matching drivers 
above).
  # - unmatch device: USB\VID_0461&PID_4d15 (desc: 'Primax Electronics, Ltd ')

-----------------------------------------------------------------------
Add HDAUDIO and USB support
-----------------------------------------------------------------------

In order to add support of HDAUDIO and USB hardware devices support, more
steps are required: 

  - build a linux kernel with ALSA sound system support (for HDAUDIO devices)

  - patch /etc/master file in order to load ALSA kernel modules and use USB FS

  - rebuild/repackage the Unattended Solution including this kernel with ALSA
    support and USB tools (lsusb).

You will need to be familiar with Unattended building task.

1. Patch files with the provided patches:

   $ cd <unattended>
   $ patch linuxboot/Makefile          
<search-win-drivers-archive>/linuxboot/linuxboot.Makefile.patch
   $ patch linuxboot/misc/linux-config 
<search-win-drivers-archive>/linuxboot/linuxboot.misc.linux-config.patch
   $ patch linuxboot/misc/master       
<search-win-drivers-archive>/linuxboot/linuxboot.misc.master.patch

2. Rebuild Unattended from sources:

     $ cd <unattended>/linuxboot
     $ make clean
     $ make 

3. Install your new Unattended Solution as usual (PXE boot or CDROM boot).

4. test: start a spare hardware with this patch unattended and check that
   "lsub" command is running fine.
   Also check that ALSA kernel module are loaded if you have a supported sound
   card:
   $ lsmod | grep snd


-----------------------------------------------------------------------
Technical details
-----------------------------------------------------------------------

Script install/dosbin/search-win-drivers.pl, called by dosbin/install.pl,
enumerates PCI, HDAUDIO and USB devices on the current hardware platform by
parsing outputs of lspci and lsusb commands and by parsing content of
/proc/asound/ (ALSA sound support).

These informations provide Vendor Id, Product Id, etc. related to
each device.

Then for each device, It looks recursively in all *.INF file(s) below the
Windows driver collection ( pointed by
$u->{'_temp'}->{'scan_windrivers_path'}) to search for the INF string related
to this device. 
The INF string is how Windows driver INF file encodes its matching device(s).
Example: PCI device match string "PCI\VEN_[PCI_VENDOR]&DEV_[PCI_DEVICE]" .

Once finished, install/dosbin/search-win-drivers.pl returns a list of
folder(s) that contains matching Windows drivers to copy onto the hard drive.
Its output is written into file /c/netinst/log/search-win-drivers.log .
It also lists the hardware device(s) that no Windows driver matched.

install.pl then continues its usual operations and update the content
of string OemPnPDriversPath with the supplementary folder(s) provided by
search-win-drivers.pl output.

Script nt5x-install will take care of copying these directories onto the
hard-drive.

Please note that in order to limit the lengh of string "OemPnPDriversPath",
install.pl makes a map between the real path(s) of drivers and their
corresponding paths on hard drive. It also help to avoid collisions among
(manually choosed) driver folder(s).

So all drivers folders will be copied with the following names onto the
hard-drive : /c/drv-scan/1/, /c/drv-scan/2/, /c/drv-scan/3/, ....
The maps between full drivers paths and their copied destination is
available in unattend.txt as [_meta]/'scan_windrivers_dest_map' string.


-----------------------------------------------------------------------
FAQ, Knowm limitations, Examples
-----------------------------------------------------------------------

- This mechanism shoud fit nice to small/medium organizations, espacially if
  having a lot of heterogeneous hardware platforms.
  For big companies or people that want/need a complete control of what is
  used during installation, it can be a usefull debug tool in order to check
  which drivers are missing to fully support a given hardware platform.

- Managing your Windows drivers collection:

  The DriverPacks.net project provides a huge collection of the most common
  Windows drivers (2.2GB uncompressed size as of 200901). It can be a good
  starting point to create your Windows collection of drivers.

  Retrieve all the .7z files from the DriverPacks.net project web site
  (http://driverPacks.net) and uncompress these archive files into
  <unattended>/install/site/win_drivers/ :

  $ mkdir -p <unattended>/install/site/win_drivers/DriverPacks
  $ cd <unattended>/install/site/win_drivers/DriverPacks
  $ ls ..../download/DriverPacks/*.7z | xargs -n 1 /usr/bin/7za x

  Depending on your needs, you will probably have to add some specific
  drivers: for instance, I have: 

  $ ls -d <unattended>/install/site/win_drivers/*/*
  dell/cardbus-ctlr-ti-7510
  dell/modem-conextant-d480
  dell/wlan-intel-bg2200
  DriverPacks/D
  DriverPacks/L
  [...]
  VMware-server-1.0.7-32bit/video
  [...]

- If using this scanner, you probably don't need anymore to do the full
  uncompress DriverPacks.net and PnP mechanism on GUI Windows installation
  part as described in the links below:

  http://ubertechnique.com/unattended/BTS_Driver_Packs
  (thread) 
http://www.mail-archive.com/unattended-i...@lists.sourceforge.net/msg05535.html

- You should also move your devices drivers from i386/$oem$/$1/ folder
  into the Windows drivers collection (below site/win_drivers/).

- this scanner may provides several drivers for each hardware device.
  If fact, this collection provide drivers for both  Windows 2000/XP/2003,
  so a given driver may imply 2 or 3 folders.
  The scanner can't distinguish between Windows flavors, since this
  information is not available in .INF files.
  This is not a problem since this is the Windows PnP's job.
    example: On a DELL Latitude D620 laptop, I have 57 folders ! 
             ... but it works (of course).
  ... Anyway, this is the expected behaviour: provides drivers that SHOULD
  match, NOT TRYING TO SUBSITUTE TO the Plug-and-Play mechanism of Windows.

  That is, you'll then have less control over which drivers are effectively in
  use: you have to trust the PnP mechanism of Windows in such a case.

- Windows drivers must provide an .INF file in order to be usable by this
  scan system. If they do not provide, try to unpack the provided files
  (un-cab, extract for .exe, etc.).

- works only with linux boot and nt5x-install : DOSEMU is not supported.

- Other driver mechanism from Unattended like TXTSETUP.OEM support (think mass
  storage driver support on text setup step of Windows installation) of manual
  choose of drivers are working fine along this solution.

- PCI devices exclusion of search-win-drivers.pl is only based on
  PCI_CLASSID; in the future, we should use a more generic form for
  exclusion, like '<class>:<vendor>:<device>'

- an "unmatched" hardware device does not means unsupported: it may be
  supported via buildin drivers collection of windows for instance,

- USB, HDAUDIO and PCI devices are supported. 

  Other hardware buses (SCSI, ...) are currently NOT supported.

  Bluetooth is unsupported ? Yes since most of time, hardware vendors do not
  provide only a driver but a complete installer: blootooth stack is not
  integrated into Windows, so this stack has to be installed first.

- " virtual " bus(es) that Windows use won't probably be never supported:
  the goal is to help installing, not replace the PnP Windows mechanism.

- This scanner does not support to be runned from Windows. It could be
  achieved by writing a devices scanner from Windows API that return Vendor
  ID, Product ID, etc. for each hardware device or an INF string that combines
  all these informations.

- search-win-drivers.pl support multiple Windows drivers collections (paths):
  several "-d" comand-line are possible.
  Each of these collection may have or not a cache file.
  Some checks are perfomed on these paths: they may not overlap between them,
  they must exist, remove duplicated entries.

- About cache file(s): purpose is to reduce the parsing time of Windows
  drivers. It takes about 30 to 40 seconds to parse a 2GB Windows drivers
  collection (1200 .INF files) each time you use Unattended, but 1 second if
  using cache file(s).
  Since your Windows drivers collection may have quick update cycles (testing
  drivers for a new hardware platform for instance), it can be a good idea to
  add cache file only to stable sub-part of your collection, and thus avoiding
  the regenerate a unique cache file for the whole collection each time you
  update its content.
  Cache file can be generated from any host, not other requirement than perl
  and writable access to write the cache file.

  Example: one folder for DriverPacks.net (since it does not change often), 
           one folder for additional drivers, 
           one folder for testing drivers without cache file if not too many 
drivers.

  In such a case, have to generate cache files 
  and DO NOT FORGET to remove your old cache file ! : 

  $ cd <unattended>/install
  $ ls -dF site/win_drivers/*
  site/win_drivers/DriverPacks/
  site/win_drivers/Addtional/
  site/win_drivers/tests/

  $ rm site/win_drivers/search-win-drivers.cache
  $ cd site/win_drivers/DriverPacks \
       && .../dosbin/search-win-drivers.pl -g . > search-win-drivers.cache
  $ cd site/win_drivers/Additional  \
       && .../dosbin/search-win-drivers.pl -g . > search-win-drivers.cache

- HDAUDIO and USB hardware devices support are OPTIONAL, you're not obliged to
  enable them.  But if you need them, then you have to patch linuxboot/ files
  then rebuild Unattended solution from source (as explained above) ... or
  wait that the Unattended Project integrate these updates and provide a new
  build with these features included.

#end

Attachment: search-win-drivers-20090420.tar.gz
Description: GNU Zip compressed data

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
unattended-devel mailing list
unattended-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unattended-devel

Reply via email to