From eeb91dbb63c9c3efceb4030ebcb514b92520550a Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 13 Feb 2008 20:20:12 +0000 Subject: * added support for letting plugins suggest additional kernel modules * used this new functionality in the theme and vmware plugins to suggest the kernel modules they need (this should fix showing the console in ubuntu) * added distro-specific kernel module filtering, such that there no longer are the spurious warnings about 'hid', 'unix' and/or 'af_packet' not being found git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1540 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/OpenSLX/MakeInitRamFS/Distro/Debian.pm | 6 ++- initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm | 45 +++++++++++++++++++++ initramfs/OpenSLX/MakeInitRamFS/Distro/Ubuntu.pm | 18 +++++++-- initramfs/OpenSLX/MakeInitRamFS/Engine.pm | 51 ++++++++++++++++++++---- 4 files changed, 107 insertions(+), 13 deletions(-) create mode 100644 initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm (limited to 'initramfs') diff --git a/initramfs/OpenSLX/MakeInitRamFS/Distro/Debian.pm b/initramfs/OpenSLX/MakeInitRamFS/Distro/Debian.pm index 4a652e69..0337b0b3 100644 --- a/initramfs/OpenSLX/MakeInitRamFS/Distro/Debian.pm +++ b/initramfs/OpenSLX/MakeInitRamFS/Distro/Debian.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# MakeInitRamFS::Debian.pm -# - provides Debian-specific overrides of the OpenSLX MakeInitRamFS API. +# MakeInitRamFS::Distro::Debian.pm +# - provides Debian-specific overrides of the MakeInitRamFS::Distro API. # ----------------------------------------------------------------------------- package OpenSLX::MakeInitRamFS::Distro::Debian; @@ -37,6 +37,8 @@ sub applyChanges my $self = shift; my $engine = shift; + $engine->_addFilteredKernelModules( qw( af_packet hid unix )); + $engine->_addRequiredLib('/lib/libnss_compat.so.2'); return; diff --git a/initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm b/initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm new file mode 100644 index 00000000..4e5963a9 --- /dev/null +++ b/initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm @@ -0,0 +1,45 @@ +# Copyright (c) 2006, 2007 - 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::SUSE.pm +# - provides SUSE-specific overrides of the MakeInitRamFS::Distro API. +# ----------------------------------------------------------------------------- +package OpenSLX::MakeInitRamFS::Distro::SUSE; + +use strict; +use warnings; + +use base qw(OpenSLX::MakeInitRamFS::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### implementation +################################################################################ +sub new +{ + my $class = shift; + my $self = { + 'base-name' => 'suse', + }; + return bless $self, $class; +} + +sub applyChanges +{ + my $self = shift; + my $engine = shift; + + $engine->_addFilteredKernelModules( qw( hid unix )); + + return; +} + +1; \ No newline at end of file diff --git a/initramfs/OpenSLX/MakeInitRamFS/Distro/Ubuntu.pm b/initramfs/OpenSLX/MakeInitRamFS/Distro/Ubuntu.pm index 25d0b6f7..121ad030 100644 --- a/initramfs/OpenSLX/MakeInitRamFS/Distro/Ubuntu.pm +++ b/initramfs/OpenSLX/MakeInitRamFS/Distro/Ubuntu.pm @@ -8,15 +8,15 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# MakeInitRamFS::Ubuntu.pm -# - provides Ubuntu-specific overrides of the OpenSLX MakeInitRamFS API. +# MakeInitRamFS::Distro::Ubuntu.pm +# - provides Ubuntu-specific overrides of the MakeInitRamFS::Distro API. # ----------------------------------------------------------------------------- package OpenSLX::MakeInitRamFS::Distro::Ubuntu; use strict; use warnings; -use base qw(OpenSLX::MakeInitRamFS::Distro::Debian); +use base qw(OpenSLX::MakeInitRamFS::Distro::Base); use OpenSLX::Basics; @@ -32,4 +32,16 @@ sub new return bless $self, $class; } +sub applyChanges +{ + my $self = shift; + my $engine = shift; + + $engine->_addFilteredKernelModules( qw( unix )); + + $engine->_addRequiredLib('/lib/libnss_compat.so.2'); + + return; +} + 1; \ No newline at end of file diff --git a/initramfs/OpenSLX/MakeInitRamFS/Engine.pm b/initramfs/OpenSLX/MakeInitRamFS/Engine.pm index cbd5ff5a..4624c7d7 100644 --- a/initramfs/OpenSLX/MakeInitRamFS/Engine.pm +++ b/initramfs/OpenSLX/MakeInitRamFS/Engine.pm @@ -63,6 +63,7 @@ sub new my %distroMap = ( 'debian' => 'Debian', + 'suse' => 'SUSE', 'ubuntu' => 'Ubuntu', ); my $distroModule = $distroMap{$self->{'distro-name'}} || 'Base'; @@ -73,7 +74,9 @@ sub new $self->{'lib-scanner'} = OpenSLX::LibScanner->new({ 'root-path' => $self->{'root-path'} }); - $self->{'required-libs'} = {}; + $self->{'required-libs'} = {}; + $self->{'suggested-kernel-modules'} = []; + $self->{'filtered-kernel-modules'} = []; return bless $self, $class; } @@ -119,8 +122,6 @@ sub _collectCMDs $self->_copyRequiredLayeredFSTools(); - $self->_copyKernelModules(); - $self->_copyPreAndPostinitFiles(); if ($self->{'debug-level'}) { @@ -131,6 +132,8 @@ sub _collectCMDs $self->{distro}->applyChanges($self); + $self->_copyKernelModules(); + $self->_copyRequiredLibs(); $self->_createInitRamFS(); @@ -505,6 +508,15 @@ sub _addRequiredLib return; } +sub _addFilteredKernelModules +{ + my $self = shift; + + push @{ $self->{'filtered-kernel-modules'} }, @_; + + return; +} + sub _copyKernelModules { my $self = shift; @@ -536,6 +548,8 @@ sub _copyKernelModules my @kernelModules = qw( af_packet unix hid usbhid uhci-hcd ohci-hcd ); + push @kernelModules, @{ $self->{'suggested-kernel-modules'} }; + push @kernelModules, split ' ', $self->{attrs}->{ramfs_fsmods}; push @kernelModules, split ' ', $self->{attrs}->{ramfs_miscmods}; push @kernelModules, split ' ', $self->{attrs}->{ramfs_nicmods}; @@ -555,9 +569,14 @@ sub _copyKernelModules # required modules foreach my $kernelModule (@kernelModules) { if (!$modulePath{$kernelModule}) { - warn _tr( - 'kernel module "%s" not found (in modules.dep)', $kernelModule - ); + if (! grep { $_ eq $kernelModule } + @{ $self->{'filtered-kernel-modules'} } + ) { + warn _tr( + 'kernel module "%s" not found (in modules.dep)', + $kernelModule + ); + } } foreach my $modulePath (@{$modulePath{$kernelModule}}) { next if $modulesToBeCopied{$modulePath}; @@ -687,13 +706,29 @@ sub _handlePlugins } my $plugin = OpenSLX::OSPlugin::Roster->getPlugin($pluginName); next if !$plugin; + my @suggestedKernelParams = $plugin->suggestAdditionalKernelParams($self->{'kernel-params'}); if (@suggestedKernelParams) { + my $paramsList = join ' ', @suggestedKernelParams; + vlog( + 2, + "plugin $pluginName suggests these kernel params: $paramsList" + ); $self->{'kernel-params'} - .= ($self->{'kernel-params'} ? ' ' : '') - . join ' ', @suggestedKernelParams; + .= ($self->{'kernel-params'} ? ' ' : '') . $paramsList; } + + my @suggestedModules = $plugin->suggestAdditionalKernelModules($self); + if (@suggestedModules) { + vlog( + 2, + "plugin $pluginName suggests these kernel modules: " + . join(',', @suggestedModules) + ); + push @{ $self->{'suggested-kernel-modules'} }, @suggestedModules; + } + $plugin->copyRequiredFilesIntoInitramfs( $self->{'build-path'}, $self->{attrs}, $self ); -- cgit v1.2.3-55-g7522