diff options
Diffstat (limited to 'src/boot-env/OpenSLX/MakeInitRamFS')
4 files changed, 64 insertions, 97 deletions
diff --git a/src/boot-env/OpenSLX/MakeInitRamFS/Distro/Scilin.pm b/src/boot-env/OpenSLX/MakeInitRamFS/Distro/Scilin.pm deleted file mode 100644 index f2372f8f..00000000 --- a/src/boot-env/OpenSLX/MakeInitRamFS/Distro/Scilin.pm +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2009..2010 - OpenSLX GmbH -# -# This program is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your suggestions, praise, or complaints to feedback@openslx.org -# -# General information about OpenSLX can be found at http://openslx.org/ -# ----------------------------------------------------------------------------- -# MakeInitRamFS::Distro::Scilin.pm -# - provides Scientific Linux specific overrides of the -# MakeInitRamFS::Distro API. -# ----------------------------------------------------------------------------- -package OpenSLX::MakeInitRamFS::Distro::Scilin; - -use strict; -use warnings; - -use base qw(OpenSLX::MakeInitRamFS::Distro::Base); - -use OpenSLX::Basics; - -################################################################################ -### implementation -################################################################################ -sub new -{ - my $class = shift; - my $self = { - 'base-name' => 'scilin', - }; - return bless $self, $class; -} - -sub applyChanges -{ - my $self = shift; - my $engine = shift; - # filter modules which are part of the main kernel already - $engine->_addFilteredKernelModules( qw( af_packet hid hid-bright usbhid unix vesafb fbcon )); - - return; -} - -sub determineMatchingHwinfoVersion -{ - my $self = shift; - my $distroVersion = shift; - - my %versionMap = ( - '4.7' => '13.11', - '5.3' => '15.3', - '5.4' => '15.21', - '5.5' => '16.0', - ); - return $versionMap{$distroVersion} - || $self->SUPER::determineMatchingHwinfoVersion($distroVersion); -} - -1; diff --git a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm index 9fd2c8bc..1eb91e88 100644 --- a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm +++ b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm @@ -278,50 +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->addCMD("ln -s . $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){ - # nic modules fw - case "bnx2.ko" {push @firmwares, split ' ', "bnx2/"} - case "bnx2x.ko" {push @firmwares, split ' ', "bnx2x/"} - case "e100.ko" {push @firmwares, split ' ', "e100"} - case "r8169.ko" {push @firmwares, split ' ', "rtl_nic/"} - case "tg3.ko" {push @firmwares, split ' ', "tigon/"} - # wifi fw - 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/"} + # 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'} ); - my $target = "$self->{'build-path'}/lib/firmware/"; - if (-e $source){ - $self->addCMD("cp -pr --dereference $source $target"); - } - elsif (-e $alternative_source){ - $self->addCMD("cp -pr --dereference $alternative_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 $firmwareSource for copying purposes"); } - else { - vlog(3,"unable to find $source for copying purposes"); + + 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( @@ -337,6 +350,17 @@ sub _copyKernelModules return; } +sub _copyModprobeD +{ + my $self = shift; + + my $source = "$self->{'root-path'}/etc/modprobe.d"; + my $target = "$self->{'build-path'}/etc"; + $self->addCMD("cp -pr --dereference $source $target"); + + return; +} + sub _platformSpecificFileFor { my $self = shift; diff --git a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm index 319ff65e..e0123aa7 100644 --- a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm +++ b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm @@ -43,6 +43,8 @@ sub _collectCMDs $self->_copyKernelModules(); + $self->_copyModprobeD(); + $self->_createInitRamFS(); return; diff --git a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm index a0c24edb..23448998 100644 --- a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm +++ b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm @@ -52,6 +52,8 @@ sub _collectCMDs $self->{distro}->applyChanges($self); $self->_copyKernelModules(); + + $self->_copyModprobeD(); $self->_createInitRamFS(); @@ -235,9 +237,9 @@ sub _copyPreAndPostinitFiles foreach my $cfg ( 'default/initramfs/preinit.local', - "$self->{'system-name'}/initramfs/preinit.local", + "$self->{'system-name'}/default/initramfs/preinit.local", 'default/initramfs/postinit.local', - "$self->{'system-name'}/initramfs/postinit.local" + "$self->{'system-name'}/default/initramfs/postinit.local" ) { my $cfgPath = "$openslxConfig{'private-path'}/config/stage3/$cfg"; next if !-f $cfgPath; |