* Detect the networking.enableIntel2200BGFirmware option.

svn path=/nixos/trunk/; revision=10406
This commit is contained in:
Eelco Dolstra 2008-01-30 14:32:02 +00:00
parent 7363895f6d
commit 92fffa1ee8

View File

@ -50,6 +50,8 @@ push @kernelModules, "kvm-amd" if hasCPUFeature "svm";
# modules are auto-detected so we don't need to list them here. # modules are auto-detected so we don't need to list them here.
# However, some are needed in the initrd to boot the system. # However, some are needed in the initrd to boot the system.
my $enableIntel2200BGFirmware = "false";
sub pciCheck { sub pciCheck {
my $path = shift; my $path = shift;
my $vendor = readFile "$path/vendor"; my $vendor = readFile "$path/vendor";
@ -62,9 +64,9 @@ sub pciCheck {
chomp $module; chomp $module;
} }
print "$path: $vendor $device $class"; print STDERR "$path: $vendor $device $class";
print " $module" if defined $module; print STDERR " $module" if defined $module;
print "\n"; print STDERR "\n";
if (defined $module) { if (defined $module) {
# See the bottom of http://pciids.sourceforge.net/pci.ids for # See the bottom of http://pciids.sourceforge.net/pci.ids for
@ -82,7 +84,14 @@ sub pciCheck {
{ {
push @initrdKernelModules, $module; push @initrdKernelModules, $module;
} }
} }
# Can't rely on $module here, since the module may not be loaded
# due to missing firmware. Ideally we would check modules.pcimap
# here.
$enableIntel2200BGFirmware = "true" if $vendor eq "0x8086" &&
($device eq "0x1043" || $device eq "0x104f" || $device eq "0x4220" ||
$device eq "0x4221" || $device eq "0x4223" || $device eq "0x4224");
} }
foreach my $path (glob "/sys/bus/pci/devices/*") { foreach my $path (glob "/sys/bus/pci/devices/*") {
@ -104,9 +113,9 @@ sub usbCheck {
chomp $module; chomp $module;
} }
print "$path: $class $subclass $protocol"; print STDERR "$path: $class $subclass $protocol";
print " $module" if defined $module; print STDERR " $module" if defined $module;
print "\n"; print STDERR "\n";
if (defined $module) { if (defined $module) {
if (# Mass-storage controller. Definitely important. if (# Mass-storage controller. Definitely important.
@ -129,7 +138,6 @@ foreach my $path (glob "/sys/bus/usb/devices/*") {
} }
# Generate the configuration file. # Generate the configuration file.
sub removeDups { sub removeDups {
@ -170,5 +178,11 @@ print <<EOF ;
nix = { nix = {
maxJobs = $cpus; maxJobs = $cpus;
}; };
networking = {
# Warning: setting this option to `true' requires acceptance of the
# firmware license, see http://ipw2200.sourceforge.net/firmware.php?fid=7.
enableIntel2200BGFirmware = $enableIntel2200BGFirmware;
};
} }
EOF EOF