diff options
author | Michael Janczyk | 2012-12-14 14:04:06 +0100 |
---|---|---|
committer | Michael Janczyk | 2012-12-14 14:04:06 +0100 |
commit | 2c45fdd73dc9b8152119b1dd03cfbb303bb705bc (patch) | |
tree | aa5de7a46e5d065d36c20558a151dca1a1337e4e | |
parent | Remove all files from /var and leave only the dir structure (diff) | |
download | core-2c45fdd73dc9b8152119b1dd03cfbb303bb705bc.tar.gz core-2c45fdd73dc9b8152119b1dd03cfbb303bb705bc.tar.xz core-2c45fdd73dc9b8152119b1dd03cfbb303bb705bc.zip |
FW is now automatically added to the initramfs. Checks are done with modinfo.
-rw-r--r-- | src/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm | 78 |
1 files changed, 46 insertions, 32 deletions
diff --git a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm index bf96daf6..1eb91e88 100644 --- a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm +++ b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm @@ -278,49 +278,63 @@ sub _copyKernelModules # build a list of required firmwares out of the list of modules - not # totally optimal my @firmwares; - $self->addCMD("mkdir -p $self->{'build-path'}/lib/firmware/$self->{'kernel-version'}"); - foreach my $moduleToBeCopied(%modulesToBeCopied) { + foreach my $moduleToBeCopied(sort keys %modulesToBeCopied) { $moduleToBeCopied =~ /.*\/(.*?)$/; - # implies usage of switch - vlog(1,$1); - switch ($1){ - case "bnx2.ko" {push @firmwares, split ' ', "bnx2/"} - case "bnx2x.ko" {push @firmwares, split ' ', "bnx2x/"} - case "e100.ko" {push @firmwares, split ' ', "e100"} - case "iwlwifi" { - push @firmwares, split ' ', - "iwlwifi-3945-1.ucode iwlwifi-3945-2.ucode iwlwifi-4965-1.ucode iwlwifi-4965-2.ucode iwlwifi-5000-1.ucode" - } - # modules required for graphic adaptors (bootsplash, Xorg) - case "radeon.ko" {push @firmwares, split ' ', "radeon/"} - case "mga.ko" {push @firmwares, split ' ', "matrox/"} - case "r128.ko" {push @firmwares, split ' ', "r128/"} - case "r8169.ko" {push @firmwares, split ' ', "rtl_nic/"} - case "tg3.ko" {push @firmwares, split ' ', "tigon/"} + # use modinfo to check if module depends on firmware, and add it + my @dependsFirmware = `modinfo -F firmware $self->{'root-path'}/$moduleToBeCopied`; + foreach my $firmware(@dependsFirmware) { + push @firmwares, split ' ', "$firmware"; } + # old static copy + ## implies usage of switch + #vlog(1,$1); + #switch ($1){ + # #case "bnx2.ko" {push @firmwares, split ' ', "bnx2/"} + # #case "bnx2x.ko" {push @firmwares, split ' ', "bnx2x/"} + # case "e100.ko" {push @firmwares, split ' ', "e100"} + # case "iwlwifi" { + # push @firmwares, split ' ', + # "iwlwifi-3945-1.ucode iwlwifi-3945-2.ucode iwlwifi-4965-1.ucode iwlwifi-4965-2.ucode iwlwifi-5000-1.ucode" + # } + # # modules required for graphic adaptors (bootsplash, Xorg) + # case "radeon.ko" {push @firmwares, split ' ', "radeon/"} + # case "mga.ko" {push @firmwares, split ' ', "matrox/"} + # case "r128.ko" {push @firmwares, split ' ', "r128/"} + # case "r8169.ko" {push @firmwares, split ' ', "rtl_nic/"} + # case "tg3.ko" {push @firmwares, split ' ', "tigon/"} + #} } + # copy all the firmwares that we think are required foreach my $firmwareToBeCopied (@firmwares) { - my $source = followLink( - "$self->{'root-path'}/lib/firmware/$self->{'kernel-version'}/$firmwareToBeCopied", $self->{'root-path'} + my $firmwareSource = followLink( + "$self->{'root-path'}/lib/firmware/$firmwareToBeCopied" , + $self->{'root-path'} ); - my $alternative_source = followLink( - "$self->{'root-path'}/lib/firmware/$firmwareToBeCopied", $self->{'root-path'} + my $kernelFWSource = followLink( + "$self->{'root-path'}/lib/firmware/$self->{'kernel-version'}/" . + "$firmwareToBeCopied", $self->{'root-path'} ); - if (-e $source){ - my $target = "$self->{'build-path'}/lib/firmware/$self->{'kernel-version'}/"; - - $self->addCMD("cp -pr --dereference $source $target"); + + if (-e $firmwareSource){ + my $targetDir = dirname("$self->{'build-path'}/lib/firmware/" . + "$firmwareToBeCopied"); + $self->addCMD("mkdir -p $targetDir; \ + cp -pr --dereference $firmwareSource $targetDir"); } else { - vlog(3,"unable to find $source for copying purposes"); + vlog(3,"unable to find $firmwareSource for copying purposes"); } - if (-e $alternative_source){ - my $target = "$self->{'build-path'}/lib/firmware/"; - - $self->addCMD("cp -pr --dereference $alternative_source $target"); + + if (-e $kernelFWSource){ + my $targetDir = dirname("$self->{'build-path'}/lib/firmware/" . + "$self->{'kernel-version'}/$firmwareToBeCopied"); + $self->addCMD("mkdir -p $targetDir; \ + cp -pr --dereference $kernelFWSource $targetDir"); + } else { + vlog(3,"unable to find $kernelFWSource for copying purposes"); } } - + # copy all the modules that we think are required foreach my $moduleToBeCopied (sort keys %modulesToBeCopied) { my $source = followLink( |