Hi,
A bit ago, there was a post on the list about the search-win-drivers tool.
Seems to work well for PCI devices for me. So,
I made a patch that is intended to integrate this tool directly in unattended.
There are a couple of tiny changes to what
was posted on the list before. 1) the default driver files path was changed to
/z/win_drivers to match the pattern of
/z/os, etc. 2) The example config.pl file bits now work the same as the other
bits in config.pl that read the properties
from the config file. 3) the old lines from nt5x-install that copied the
driver files the old way are not removed. This
should work out so that the driver files can be done either way since
search-win-drivers currently only works for those
items that are shown by lspci. Also, it might be desirable to force a certain
set of drivers to be copied to the installed
machine since some hardware is not present during the installation.
This patch is missing out the documenation file. It really should be there,
but I wasn't sure where to put it.
Allan.
diff --git a/install/dosbin/install.pl b/install/dosbin/install.pl
index db792dd..246f372 100644
--- a/install/dosbin/install.pl
+++ b/install/dosbin/install.pl
@@ -788,6 +788,70 @@ sub ask_os () {
return $choice->path ();
}
+# retrieve the Windows Collection drivers Automated scan engine
+sub windrivers_scan() {
+
+ if (! $is_linux) {
+ print "Automated choose in Windows driver(s) collection unavailable.\n";
+ return undef;
+ }
+
+ ## Path to Windows driver(s) collection
+ my $drvroot = dos_to_host ($u->{'_temp'}->{'scan_windrivers_path'});
+ opendir DRVROOT, $drvroot
+ or return undef;
+ closedir DRVROOT;
+
+ print "...Search for Windows drivers in collection below $drvroot ...\n";
+ print "(this may take up to 20 seconds)\n";
+ my $eng = "search-win-drivers.pl";
+ my $cmd_scan = "$eng $u->{'_temp'}->{'scan_windrivers_options'} -d $drvroot" ;
+ my $raw = `$cmd_scan`;
+
+ # just compute how many driver(s) found
+ my $out = $raw;
+ $out =~ s/#.*\n//mg ; # strip comment outputs
+ my @dlist = ();
+ if ( $out ne '' ) {
+ @dlist = split /\n/, $out;
+ }
+ print "...found ", scalar @dlist, " Windows driver(s) to use.\n";
+
+ return $raw;
+}
+
+
+sub windrivers_scan_dest_map() {
+
+ # generate a string of '<drv>:<dest>@<drv>:<dest> ...'
+ # (use '@' as seperator since parse_ini_file() of unatt-functions.sh treats ';' as comments)
+ my $raw = $u->{'_temp'}->{'scan_windrivers'};
+ ( my $out = $raw ) =~ s/#.*\n//mg ; # strip comment outputs
+ if ( $out eq '' ) {
+ return '';
+ }
+ my %dlist = map { $_ => "" } split /\n/, $out;
+
+ # Generate destination directory names for these path of drivers.
+ # To ensure that dest. dir names are unique, use the hash 'index'
+ # as names.
+ # Files copies of these folders are done by windows installation files
+ # on hard-methods (dosemu | nt5x-install)
+
+ my $index = 0;
+ my $ret = "";
+ foreach my $drv (keys %dlist) {
+ $index += 1;
+ $dlist{$drv} = $file_spec->catdir(
+ $u->{'_temp'}->{'scan_windrivers_dest'},
+ $index);
+ $ret .= "@" . $drv . ":" . $dlist{$drv} ;
+ }
+ $ret =~ s/^@//;
+ return $ret;
+}
+
+
# Which directories to include in OemPnPDriversPath
sub ask_oem_pnp_drivers_path () {
my $media_obj = Unattend::WinMedia->new ($u->{'_meta'}->{'OS_media'});
@@ -1372,6 +1436,29 @@ $u->{'Identification'}->{'DomainAdminPassword'} =
("Enter DomainAdminPassword for $admin account: ");
};
+$u->comments ('_temp', 'scan_windrivers_path') =
+ ['Directory holding Windows drivers collection'];
+$u->{'_temp'}->{'scan_windrivers_path'} =
+ sub { return $file_spec->catdir ( $u->{'_meta'}->{'dos_zdrv'}, "site", "win_drivers"); };
+
+$u->comments ('_temp', 'scan_windrivers_options') =
+ ['Option(s) to scan engine of Windows driver(s) (search-win-drivers.pl)'];
+$u->{'_temp'}->{'scan_windrivers_options'} = '' ;
+
+$u->comments ('_temp', 'scan_windrivers_dest') =
+ ['Directory holding found Windows drivers on hard-drvive (below $oem$\$1)'];
+$u->{'_temp'}->{'scan_windrivers_dest'} = 'drv-scan' ;
+
+# use '_meta' section since used by DOSEMU|nt5x-install script
+$u->comments ('_meta', 'scan_windrivers_dest_map') =
+ ['Maps between found Windows drivers paths',
+ 'and their destination path on hard-drive (below $oem$\$1)'];
+$u->{'_meta'}->{'scan_windrivers_dest_map'} = \&windrivers_scan_dest_map;
+
+$u->comments ('_temp', 'scan_windrivers') =
+ ['Retrieve automated scan output of Windows drivers (lspci based)'];
+$u->{'_temp'}->{'scan_windrivers'} = \&windrivers_scan;
+
$u->{'Unattended'}->{'OemPnPDriversPath'} = \&ask_oem_pnp_drivers_path;
my $product_key_q =
@@ -1696,6 +1783,29 @@ defined $postinst
push @edit_choices, ("Edit $doit (will run when you select Continue)"
=> $doit);
+# Scan of Windows drivers:
+# - write output log : only once c:\netinst exists.
+# - Update OemPnPDriversPath if needed
+if ( $u->{'_temp'}->{'scan_windrivers'} ne '' ) {
+
+ my $raw_file = $file_spec->catfile ($u->{'_meta'}->{'netinst'},
+ 'logs', 'search-win-drivers.log');
+ print "Write Windows drivers scan raw output into $raw_file...";
+ write_file( $raw_file, split /\n/, $u->{'_temp'}->{'scan_windrivers'});
+ print "done.\n";
+
+ if ( $u->{'_meta'}->{'scan_windrivers_dest_map'} eq '' ) {
+ print "(Scan of Windows driver(s): no driver path(s) to add to OemPnPDriversPath )\n";
+ }
+ else {
+ print "Update 'OemPnPDriversPath' with new windows driver path(s)...\n";
+ for my $e (split /@/, $u->{'_meta'}->{'scan_windrivers_dest_map'}) {
+ (my $i, my $d) = split /:/, $e ;
+ $u->{'Unattended'}->{'OemPnPDriversPath'} .= ";" . $d ;
+ }
+ }
+}
+
# Create unattend.txt file.
print "Creating $unattend_txt...";
diff --git a/install/site/sample-config.pl b/install/site/sample-config.pl
index 2b92c1f..86a2be8 100644
--- a/install/site/sample-config.pl
+++ b/install/site/sample-config.pl
@@ -243,5 +243,26 @@ foreach my $lookup ("$os_name",
and $u->read ($unattended_txt);
}
+## Windows drivers scanning: uncomment (define as empty string) to DISABLE its usage
+#$u->{'_temp'}->{'scan_windrivers'} = '';
+
+## Windows drivers scanning: drivers collection root path:
+## default is "/z/win_drivers" (in search-win-drivers.pl):
+$u->push_value ('_temp', 'scan_windrivers_path', sub { lookup_property('scan_windrivers_path'); });
+
+## Windows drivers scanning:
+## howto exclude PCI_CLASSID Ethernet Controller (0x0200)
+## from search of Windows Drivers scanning
+#$u->{'_temp'}->{'scan_windrivers_options'} = '-c 0200' ;
+$u->push_value ('_temp', 'scan_windrivers_options', sub { lookup_property('scan_windrivers_options'); });
+
+## 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' ;
+$u->push_value ('_temp', 'scan_windrivers_dest', sub { lookup_property('scan_windrivers_dest'); });
+
+#end
+
# Make this file evaluate to "true".
1;
diff --git a/linuxboot/Makefile b/linuxboot/Makefile
index febb445..084d4c0 100644
--- a/linuxboot/Makefile
+++ b/linuxboot/Makefile
@@ -36,7 +36,7 @@ pmtools=pmtools-20071116
samba=samba-3.0.32
slang=slang-2.0.7
syslinux=syslinux-3.73
-wireless_tools=wireless_tools.28
+wireless_tools=wireless_tools.29
zlib=zlib-1.2.3
keep-archives=1
@@ -730,9 +730,8 @@ stage1 += stage1/sbin/mount.cifs
## wireless_tools
$(wireless_tools)/iwconfig: fakeinclude/stdio.h $(linux)/arch/x86/boot/bzImage
- cd $(wireless_tools) \
- && $(MAKE) clean \
- && $(MAKE) KERNEL_SRC=$(cwd)/$(linux) \
+ $(MAKE) -C $(wireless_tools) clean
+ $(MAKE) -C $(wireless_tools) KERNEL_SRC=$(cwd)/$(linux)
CFLAGS="$(fakelib_cflags) -O2 -Wall"
[ -e $@ ]
@@ -813,6 +812,8 @@ $(call copy_file,misc/ntldrbin/ntldr_boot_code_sektor12,stage1/usr/lib/ntldrbin/
$(call copy_file,misc/nt5x-install,stage1/usr/bin/nt5x-install)
+$(call copy_file,misc/search-win-drivers.pl,stage1/usr/bin/search-win-drivers.pl)
+
$(call copy_file,misc/unatt-functions.sh,stage1/usr/lib/unatt-functions.sh)
# Some apps (namely dosemu) need getpwnam() etc. to work
@@ -829,6 +830,7 @@ stage1 += stage1/init stage1/usr/bin/find-boot-device \
stage1/usr/lib/ntldrbin/ntldr_boot_code_sektor0 \
stage1/usr/lib/ntldrbin/ntldr_boot_code_sektor12 \
stage1/usr/lib/unatt-functions.sh \
+ stage1/usr/bin/search-win-drivers.pl \
stage1/usr/bin/nt5x-install
# /etc/version
@@ -1007,7 +1009,7 @@ $(call download_rule, $(slang), tar.bz2, \
$(call download_rule, $(syslinux), tar.gz, \
http://ftp.all.kernel.org/pub/linux/utils/boot/syslinux/)
$(call download_rule, $(wireless_tools), tar.gz, \
- http://pcmcia-cs.sourceforge.net/ftp/contrib/)
+ http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/)
$(call download_rule, $(zlib), tar.gz, http://www.zlib.net/)
symlink_targets=$(addprefix symlink-,$(packages)) \
diff --git a/linuxboot/misc/nt5x-install b/linuxboot/misc/nt5x-install
index 39d383e..659c1ad 100755
--- a/linuxboot/misc/nt5x-install
+++ b/linuxboot/misc/nt5x-install
@@ -201,6 +201,27 @@ then
cp /c/\$/[Tt][Ee][Xx][Tt][Mm][Oo][Dd][Ee]/* /c/\$win_nt\$.~bt/\$oem\$/
fi
+#add files/drivers from windows drivers scan...
+#NOTE: we directly copy files into /c/\$\$1 (shortcut) since code
+# just above is moving other drivers into this target directory.
+message "Copy drivers from scan of windows drivers"
+dir_map_drv_scan=`parse_ini_file /c/netinst/unattend.txt _meta scan_windrivers_dest_map`
+if [ "$dir_map_drv_scan" = "" ]; then
+ echo "(no driver to copy)."
+else
+ # NOTE: provide UNIX paths to copy_files
+ echo $dir_map_drv_scan | sed -e 's,\\,/,g' -e 's/@/\n/g'| while read map
+ do
+ drv_src=`echo $map | awk -F: '{print $1}'`
+ drv_dst="/c/\$/\$1/`echo $map | awk -F: '{print $2}'`"
+ # workaround: do not use copy_files():
+ # command 'copy_files dir1 1 dir2' copies <dir1> as <dir2>/<dir1> !
+ # so perform copy directly
+ mkdir -p `dirname "$drv_dst"` || die "failed to create dir. `dirname $drv_dst`"
+ cp -Lr "$drv_src" "$drv_dst" || die "recursive directory copy failed"
+ done
+fi
+
message "Syncing disk -aiaparanoia :-)"
sync
diff --git a/linuxboot/misc/search-win-drivers.pl b/linuxboot/misc/search-win-drivers.pl
new file mode 100755
index 0000000..584c154
--- /dev/null
+++ b/linuxboot/misc/search-win-drivers.pl
@@ -0,0 +1,546 @@
+#! /usr/bin/env perl
+#
+# TODO - several drivers collection (ie multiple '-d' options allowed)
+# TODO - OS flavor(s) to check in order to decide (un)matching drivers (XP, 2k, 2003, etc).
+# TODO - extend -c option to '<class>:<vendor>:<dev>' to exclude
+# (with usage like '*:8086:*' for excluding a particular vendor).
+# TODO - option to exclude a particular PCI device.
+# TODO - scan other bus devices like USB (lsusb) or SCSI (lsscsi) ?
+# what about other devices like mouse for instance ?
+# (example: VMware mouse pointer driver)
+#
+# Changelog:
+# 20881112 - case insensitive search on pattern PCI\\VEN (reported by Jye Meier)
+# 20081006 - deal with .INF encoded in UTF-16le format
+# 20081003 - initial (public) revision
+#
+# INF file specification: Windows Driver Kit : Creating an inf file:
+# http://msdn.microsoft.com/en-us/library/ms790220.aspx
+# INF file are case insensitive: http://msdn.microsoft.com/en-us/library/ms790225.aspx
+
+use warnings;
+use strict;
+use Getopt::Long;
+use Pod::Usage;
+use File::Spec;
+
+our %opts ; # declared here for out() function.
+
+################################################################################
+## out()
+################################################################################
+sub out($) {
+
+ my ($m) = @_;
+ print "# $m\n";
+} # out()
+
+
+################################################################################
+## display_hash()
+################################################################################
+sub display_hash {
+ my %h = @_;
+ for my $i (keys %h) {
+ out(" $i => $h{$i}");
+ }
+} # display_hash()
+
+################################################################################
+## display_pci_device()
+################################################################################
+sub display_pci_device($) {
+ my ($d) = @_;
+ out(sprintf("- desc=%s", $d->{"desc"}));
+ out(sprintf(" busid=%s vendor=%s device=%s class=%s",
+ $d->{"busid"}
+ , $d->{"vendor"}
+ , $d->{"device"}
+ , $d->{"class"}
+ ));
+ out(sprintf(" infstr=%s", $d->{"infstr"}));
+} # display_pci_device()
+
+################################################################################
+## display_pci_devices()
+################################################################################
+sub display_pci_devices($) {
+ my (@t) = @_;
+ foreach my $d (@t) {
+ display_pci_device($d);
+ }
+} # display_pci_devices()
+
+################################################################################
+## search_pcistrings_in_inf()
+## Return 1 if file $1 match one of the PCI string in hash of strings $2 (comment excluded).
+## usage: search_pcistrings_in_inf("file/name", \%ref_to_hash).
+################################################################################
+sub search_pcistrings_in_inf($$) {
+ my ($f, $strh) = @_;
+ my $r = 0;
+ open FILE, $f or die("unable to open file '$f': $^E.");
+
+ # check if encoding is UTF-16le: 0xFF 0xFE as 2 first char.
+ ( sysread(FILE,my $s2,2) eq 2 )
+ or die "Unable to read 2 first bytes from file $f: $^E" ;
+ if ( $s2 eq chr(0xff) . chr(0xfe)) {
+ close FILE;
+ open(FILE,"<:encoding(UTF-16LE)", $f) or die "unable to open file $f: $^E" ;
+ }
+ else {
+ # rewind to start of file
+ sysseek(FILE,0,0);
+ }
+ while ( my $line = <FILE>) {
+ last if $r ; # current file already matched (with one of the strings).
+ chomp $line;
+ next if ( $line =~ /^([;\#])/ ); # skip comment
+ next if ( $line !~ /PCI\\VEN/i ); # skip obviously non-matching line(s)
+ for my $s (keys %$strh) {
+ ( my $token = $s ) =~ s/\\/\\\\/g;
+ if ( $line =~ /$token/i ) {
+ out("- file $f\tmatch '$s'");
+ $r = 1;
+ last;
+ }
+ }
+ }
+ close FILE;
+ return $r;
+} # search_pcistrings_in_inf()
+
+################################################################################
+## search_pcistring_in_inf()
+## Return 1 if file $1 match the PCI string $2 (comment excluded).
+## usage: search_pcistring_in_inf("file/name", "string")
+################################################################################
+sub search_pcistring_in_inf($$) {
+ my ($f, $str) = @_;
+ my %h = ( $str => 1 );
+ my $r = search_pcistrings_in_inf($f,\%h);
+ return $r;
+} # search_pcistring_in_inf()
+
+
+################################################################################
+## main loop
+################################################################################
+
+# parse command-line args.
+%opts = ( "d" => "/z/win_drivers"
+ , "e" => ""
+ );
+
+my @opt_excludes_tmp = ();
+GetOptions (\%opts, 'help|h|?', 'd=s', 'c=s' => \...@opt_excludes_tmp )
+ or pod2usage (1);
+
+(exists $opts{'help'})
+ and pod2usage ('-exitstatus' => 0, '-verbose' => 2);
+
+# exclusions: check hexa on 4 digits and store them in hash
+my %opt_excludes = ();
+foreach my $e (@opt_excludes_tmp) {
+ if ( $e !~ /[\da-f]{4}/i ) {
+ die "Excluded classID '$e' is not a 4 digit hexadecimal number";
+ }
+ $opt_excludes{"$e"} = 1;
+}
+undef @opt_excludes_tmp;
+
+# use lspci
+my @pcidevices = ();
+out("request lspci about PCI device(s) ...");
+( -x "/sbin/lspci" ) or die "/sbin/lspci is missing";
+my $lspci_n_out = `/sbin/lspci -n`;
+my $lspci_out = `/sbin/lspci`;
+foreach my $l (split /\n/, $lspci_n_out) {
+ chomp $l;
+
+ ## retrieve BusID, PCI_CLASS, PCI_VENDOR, PCI_DEVICE
+ ## generate the corresponding string for search in .INF file(s)
+ ## retrieve the human device description
+
+ ## WARNING: 'lspci -n' does not ouput 'Class' on some platform(s) between busid and classid
+ #$l =~ /^([\da-f]{2}:[\da-f]{2}\.[\da-f]) Class ([\da-f]{4}): ([\da-f]{4}):([\da-f]{4})/i;
+ $l =~ s/ Class//i;
+ $l =~ /^([\da-f]{2}:[\da-f]{2}\.[\da-f]) ([\da-f]{4}): ([\da-f]{4}):([\da-f]{4})/i;
+ my $bustype = "pci" ; # future: parse other buses like USB ?
+ my $busid = $1;
+ my $class = $2;
+ my $vendor = $3;
+ my $device = $4;
+ my $infstr = "PCI\\VEN_$vendor&DEV_$device";
+ $lspci_out =~ /^$busid .+: (.+)/mi;
+ my $desc = $1;
+ push @pcidevices, { "busytpe" => $bustype
+ , "busid" => $busid
+ , "class" => $class
+ , "vendor" => $vendor
+ , "device" => $device
+ , "infstr" => $infstr
+ , "desc" => $desc
+ };
+}
+out(sprintf("found %d PCI device(s) on current hardware platform.", scalar @pcidevices));
+
+### INTERNAL DEBUG: add a known matching value:
+
+## match (only) win_drivers/DriverPacks-20080530/D/G/N1/nv4_go.inf
+#undef @pcidevices;
+...@pcidevices = ();
+#push @pcidevices, { "busytpe" => "pci"
+# , "busid" => "n/a"
+# , "class" => "0300"
+# , "vendor" => "n/a"
+# , "device" => "n/a"
+# , "infstr" => "PCI\\VEN_10DE&DEV_00F0"
+# , "desc" => "INTERNAL TEST: NVIDIA Device ID 0x00F0"
+# };
+
+## match (only) win_drivers/DriverPacks-20080530/D/L/B1/b57win32.inf
+#undef @pcidevices;
+...@pcidevices = ();
+#push @pcidevices, { "busytpe" => "pci"
+# , "busid" => "n/a"
+# , "class" => "0200"
+# , "vendor" => "n/a"
+# , "device" => "n/a"
+# , "infstr" => "PCI\\VEN_14e4&DEV_1677"
+# , "desc" => "INTERNAL TEST: Broadcom Corp... NetXtreme BCM5751 Gigabit Ethernet PCI Express (rev 01)"
+# };
+
+## match (only) win_drivers/DriverPacks-20080530/D/L/M/yk50x86.inf
+## ... file in UTF-16le character encoding ....
+#undef @pcidevices;
+...@pcidevices = ();
+#push @pcidevices, { "busytpe" => "pci"
+# , "busid" => "n/a"
+# , "class" => "n/a"
+# , "vendor" => "n/a"
+# , "device" => "n/a"
+# , "infstr" => "PCI\\VEN_1148&DEV_4320"
+# , "desc" => "UTF-16le TEST: Allied Telesis AT-2916T"
+# };
+
+## perform exclusions based on classID
+my @pcidev_checked = ();
+foreach my $d (@pcidevices) {
+ display_pci_device($d);
+ if (exists $opt_excludes{$d->{"class"}}) {
+ out(" ==> device EXCLUDED from search because of its classID.");
+ }
+ else {
+ push @pcidev_checked, $d ;
+ }
+}
+...@pcidevices = @pcidev_checked;
+undef @pcidev_checked;
+out(sprintf("%d PCI device(s) to consider.", scalar @pcidevices));
+
+## Walk on device(s): list unique infstr string
+my %infstrlist = ();
+foreach my $d (@pcidevices) {
+ $infstrlist{ $d->{"infstr"}} = 0;
+}
+out(sprintf("found %d distinct inf string(s) for PCI devices.", scalar keys %infstrlist));
+
+
+## Look for .INF support of device(s)
+out("Parsing drivers .inf file(s) below folder $opts{'d'} ...");
+my @foldertocheck = ( File::Spec->rel2abs($opts{'d'} ));
+my %infmatchdirlist = () ;
+my $infcheckcounter=0 ;
+while (defined(my $d = pop(@foldertocheck)) ) {
+ opendir DIR, $d
+ or die "Unable to open $d: $^E";
+ my @e = readdir DIR;
+ closedir DIR;
+ foreach my $i (@e) {
+ next if (exists $infmatchdirlist{$d});
+ next if $i eq '.' ;
+ next if $i eq '..' ;
+
+ my $f = File::Spec->catfile("$d","$i");
+ if ( -d $f ) {
+ push @foldertocheck, $f;
+ next;
+ }
+ if ( $f !~ /\.inf$/i ) {
+ # not .inf file
+ next;
+ }
+ ## this .INF file: check if match
+ $infcheckcounter++;
+ if (search_pcistrings_in_inf($f, \%infstrlist)) {
+ ## found a matching line: stop searching in current file,
+ ## and also in current directory, keep current folder name.
+ $infmatchdirlist{$d} = 1;
+ next;
+ }
+ }
+}
+out(sprintf("Checked %d .inf file(s).", $infcheckcounter));
+
+out(sprintf("Matching .inf file(s): %d distinct folder(s):", scalar keys %infmatchdirlist));
+for my $e (sort keys %infmatchdirlist) {
+ print "$e\n";
+}
+
+
+##
+## List unmatched device(s)
+##
+
+my %inf_str_no_match = %infstrlist;
+foreach my $d (keys %infmatchdirlist) {
+ opendir DIR, $d;
+ my @e = readdir DIR;
+ closedir DIR;
+ foreach my $i (@e) {
+ next if $i eq '.' ;
+ next if $i eq '..' ;
+ my $f = File::Spec->catfile("$d","$i");
+ if ( $f !~ /\.inf$/i ) {
+ # not an .INF file
+ next;
+ }
+ for my $s (keys %inf_str_no_match) {
+ if (search_pcistring_in_inf($f, $s)) {
+ delete $inf_str_no_match{$s};
+ last;
+ }
+ }
+ }
+}
+
+out(sprintf("Enumerate unmatched device(s): %d device(s)", scalar (keys %inf_str_no_match)));
+for my $s (keys %inf_str_no_match) {
+ foreach my $d (@pcidevices) {
+ if ( $d->{"infstr"} eq $s ) {
+ out("- unmatch device: $s (desc: '$d->{'desc'}')");
+ last;
+ }
+ }
+}
+
+
+exit 0;
+
+__END__
+
+==head1 NAME
+search-win-drivers.pl - Find Windows drivers that match PCI devices.
+
+=head1 SYNOPSIS
+
+search-win-drivers.pl <options>
+
+=head1 OPTIONS
+
+=over 12
+
+=item --help
+
+Display this help and exit
+
+=item -d <dir>
+
+Windows driver collection root path. Default is F</z/site/win_drivers/>.
+
+=item -c <cid>[,<cid>]
+
+exclude device(s) of class ID <cid> (several are possible)
+
+=back
+
+=head1 DESCRIPTION
+
+Find the Windows(TM) hardware driver(s) that match the current platform
+PCI devices.
+
+In default mode, this script output a list of (parent) folder(s) that contains
+matching *.INF files.
+
+Primarily designed to take advantage of the DriverPacks.net collection of
+Windows driver(s) , without the need of complicated maintenance steps to use
+them.
+
+Platform PCI devices identifiers are retrieved by parsing entries of
+F</sbin/lspci> command output (C<PCI_VENDOR>, C<PCI_DEVICE>, C<PCI_CLASS>).
+
+Search is then performed recursively onto the content of *.INF file(s) of
+Windows driver(s) collection, via the magic string
+"B<PCI\VEN_>[PCI_VENDOR]B<&DEV_>[PCI_DEVICE]".
+
+Each time a particular .INF file matches any of the PCI devices, the search
+stops for its parent directory. This imply the following assumptions:
+
+=over 2
+
+=item -
+
+a matching device may make appears several drivers; in this case, all these
+drivers will be provided to Windows, that will use its own rules to decide
+which driver to use.
+
+=item -
+
+as soon as a PCI entry match a driver, no more search is performed for that
+driver; so some devices may not have any match, but the general case is to have
+several devices depdending on the same driver (think about Intel ICH* chipset:
+have one driver for several PCI dev.).
+
+=back
+
+=head1 HOWTO Setup a Windows drivers collection
+
+Simply put all the drivers you need to be used in its own folder below
+the root directory of the driver collection F<unattended/install/site/win_drivers/>.
+
+You can also use the DriverPacks.net collection of Windows drivers: retrieve
+all the I<.7z> files from their web site L<http://driverPacks.net/> then
+uncompress all these archive file(s) into the default driver root path
+F<unattended/install/site/win_drivers/>. As of writing, their full drivers
+collection take about 1.3GB of hard drive space:
+
+ $ mkdir -p unattended/install/site/win_drivers/DriverPacks-20080530
+ $ cd unattended/install/site/win_drivers/DriverPacks-20080530
+ $ ls ..../download/DriverPacks/*.7z | xargs -n 1 /usr/bin/7za x
+
+=head1 LIMITATIONS AND KNOWN BUGS
+
+=over 2
+
+=item -
+
+works only with linux boot of Unattended project.
+
+=item -
+
+Don't know what happens if Mass Storage devices are present; no interaction
+with TXTSETUP.OEM is done. Perharps should we filter PCI devices to only
+non-storage devices ?
+
+=item -
+
+no check of different flavours of Windows (2k,XP,2k3,etc): should we parse the
+content of .inf files to see on which system the check driver is applying to ?
+
+=item -
+
+rely only on PCI_VENDOR and PCI_DEVICE, no use of
+PCI_SUBSYS,PCI_SUBDEV,PCI_CLASS (need to use F</sys/bus/pci>).
+
+=item -
+
+check only PCI devices; /sys/bus/{usb,scsi,pci_express} have different
+semantics.
+
+=item -
+
+probably have to allow unsigned drivers to be used.
+
+=back
+
+=head1 EXAMPLES
+
+=over 2
+
+=item -
+
+To check how devices of your current platform match with your Windows drivers
+collection, boot it with your unattended installation and go onto shell prompt
+([Clt]-[Alt]-[F2]):
+
+ $ search-win-drivers.pl
+ # request lspci about PCI device(s) ...
+ # found 18 PCI device(s) on current hardware platform.
+ # - desc=Intel Corporation 82915G/P/GV/GL/PL/910GL Memory Controller Hub (rev 04)
+ # 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)
+ # 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)
+ # busid=00:1c.0 vendor=8086 device=2660 class=0604
+ # infstr=PCI\VEN_8086&DEV_2660
+ <snip>
+ # - desc=ATI Technologies Inc RV516 [Radeon X1300/X1550 Series] (Secondary)
+ # 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)
+ # busid=40:00.0 vendor=14e4 device=1677 class=0200
+ # infstr=PCI\VEN_14e4&DEV_1677
+ # 18 PCI device(s) to consider.
+ # found 18 distinct inf string(s) for PCI devices.
+ # Parsing drivers .inf file(s) below folder win_drivers ...
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/S/zC/stac97.inf match 'PCI\VEN_8086&DEV_266e'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/S/CxG/ari0215a.inf match 'PCI\VEN_8086&DEV_266e'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/S/C/CMICHX.INF match 'PCI\VEN_8086&DEV_266e'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/L/B1/b57win32.inf match 'PCI\VEN_14e4&DEV_1677'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/G/A1/A_Hotfix.inf match 'PCI\VEN_1002&DEV_7187'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/xp/915.inf match 'PCI\VEN_8086&DEV_2580'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k3/915.inf match 'PCI\VEN_8086&DEV_2580'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k/915.inf match 'PCI\VEN_8086&DEV_2580'
+ # Checked 551 .inf file(s).
+ # Matching .inf file(s): 8 distinct folder(s):
+ /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k
+ /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k3
+ /z/site/win_drivers/DriverPacks-20080530/D/C/I/xp
+ /z/site/win_drivers/DriverPacks-20080530/D/G/A1
+ /z/site/win_drivers/DriverPacks-20080530/D/L/B1
+ /z/site/win_drivers/DriverPacks-20080530/D/S/C
+ /z/site/win_drivers/DriverPacks-20080530/D/S/CxG
+ /z/site/win_drivers/DriverPacks-20080530/D/S/zC
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/S/C/CMICHX.INF match 'PCI\VEN_8086&DEV_266e'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k/915.inf match 'PCI\VEN_8086&DEV_2580'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k/dmi_pci.inf match 'PCI\VEN_8086&DEV_244e'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k/ich6core.inf match 'PCI\VEN_8086&DEV_266a'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k/ich6id2.inf match 'PCI\VEN_8086&DEV_266f'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k/ich6ide.inf match 'PCI\VEN_8086&DEV_2651'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k/ich6usb.inf match 'PCI\VEN_8086&DEV_2659'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k3/915.inf match 'PCI\VEN_8086&DEV_2581'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k3/ich6core.inf match 'PCI\VEN_8086&DEV_2662'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/2k3/ich6usb.inf match 'PCI\VEN_8086&DEV_265b'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/G/A1/A_Hotfix.inf match 'PCI\VEN_1002&DEV_71a7'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/G/A1/CX_59746.inf match 'PCI\VEN_1002&DEV_7187'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/xp/ich6core.inf match 'PCI\VEN_8086&DEV_2640'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/C/I/xp/ich6usb.inf match 'PCI\VEN_8086&DEV_2658'
+ # - file /z/site/win_drivers/DriverPacks-20080530/D/L/B1/b57win32.inf match 'PCI\VEN_14e4&DEV_1677'
+ # Enumerate unmatched device(s): 3 device(s)
+ # - unmatch device: PCI\VEN_8086&DEV_265a (desc: 'Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #3 (rev 03)')
+ # - unmatch device: PCI\VEN_8086&DEV_265c (desc: 'Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller (rev 03)')
+ # - unmatch device: PCI\VEN_8086&DEV_2660 (desc: 'Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI Express Port 1 (rev 03)')
+
+=back
+
+=head1 SEE ALSO
+
+=over 2
+
+=item -
+
+PCI classID : see file F</usr/share/hwdata/pci.ids>.
+ Some well known values:
+ C 01 Mass storage controller
+ 00 SCSI storage controller
+ 01 IDE interface
+ 02 Floppy disk controller
+ 03 IPI bus controller
+ 04 RAID bus controller
+ 05 ATA controller
+ 20 ADMA single stepping
+ 40 ADMA continuous operation
+ 06 SATA controller
+ 00 Vendor specific
+ 01 AHCI 1.0
+ 07 Serial Attached SCSI controller
+ 80 Mass storage controller
+
+=item -
+
+wipe out Windows and migrate to GNU/Linux ;-)
+
+=back
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
unattended-devel mailing list
unattended-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unattended-devel