From 252535d478f27f05153edc13d1afae91abb7a374 Mon Sep 17 00:00:00 2001 From: Alexander Hoppe Date: Wed, 26 Aug 2009 13:37:49 +0000 Subject: function for firmwares to be copied to /lib/firmware and attribute ramfs_firmmods git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@3133 95ad53e4-c205-0410-b2fa-d234c58c8868 --- boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm | 31 ++++++++++++++++++++++++ boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm | 3 +++ boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm | 2 ++ config-db/OpenSLX/AttributeRoster.pm | 10 ++++++++ config-db/OpenSLX/DBSchema.pm | 1 + 5 files changed, 47 insertions(+) diff --git a/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm b/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm index ec80f6a6..30ad500a 100644 --- a/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm +++ b/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm @@ -187,6 +187,36 @@ sub _addFilteredKernelModules return; } +sub _copyFirmware +{ + my $self = shift; + + my $sourcePath = "$self->{'root-path'}/lib/firmware/$self->{'kernel-version'}"; + vlog(3,"sourcePath: $sourcePath"); + + my $targetPath + = "$self->{'build-path'}/lib/firmware"; + vlog(3,"targetPath: $targetPath"); + $self->addCMD("mkdir -p $targetPath"); + + # add a couple of kernel modules that we expect to be used in stage3 + # (some of these modules do not exist on all distros, so they will be + # filtered out again by the respective distro object): + my @firmwareModules; + vlog(3,"ramfs_firmmods: $self->{attrs}->{ramfs_firmmods}"); + push @firmwareModules, split ' ', $self->{attrs}->{ramfs_firmmods}; + # copy all the modules that we think are required + foreach my $moduleToBeCopied (@firmwareModules) { + my $source = followLink( + "$self->{'root-path'}/lib/firmware/$self->{'kernel-version'}/$moduleToBeCopied", $self->{'root-path'} + ); + my $target = "$targetPath/$moduleToBeCopied"; + $self->addCMD("cp -pa --dereference $source $target"); + + } + return; +} + sub _copyKernelModules { my $self = shift; @@ -306,6 +336,7 @@ sub _writeInitramfsSetup 'ramfs_fsmods' => $self->{attrs}->{ramfs_fsmods} || '', 'ramfs_miscmods' => $self->{attrs}->{ramfs_miscmods} || '', 'ramfs_nicmods' => $self->{attrs}->{ramfs_nicmods} || '', + 'ramfs_firmmods' => $self->{attrs}->{ramfs_firmmods} || '', 'rootfs' => $self->{'export-uri'} || '', 'hw_local_disk' => $self->{attrs}->{hw_local_disk} || '', }; diff --git a/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm b/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm index 3c012ce2..5605df62 100644 --- a/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm +++ b/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm @@ -43,6 +43,8 @@ sub _collectCMDs $self->_copyKernelModules(); + $self->_copyFirmware(); + $self->_createInitRamFS(); return; @@ -91,6 +93,7 @@ sub _writeInitramfsSetup 'host_name' => 'slx-client', # just to have something at all 'ramfs_miscmods' => $self->{attrs}->{ramfs_miscmods} || '', 'ramfs_nicmods' => $self->{attrs}->{ramfs_nicmods} || '', + 'ramfs_firmmods' => $self->{attrs}->{ramfs_firmmods} || '', 'preboot_id' => $self->{'preboot-id'} || '', 'boot_uri' => $self->{'boot-uri'} || '', }; diff --git a/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm b/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm index f4e2708c..e67b1fc4 100644 --- a/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm +++ b/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm @@ -53,6 +53,8 @@ sub _collectCMDs $self->_copyKernelModules(); + $self->_copyFirmware(); + $self->_createInitRamFS(); return; diff --git a/config-db/OpenSLX/AttributeRoster.pm b/config-db/OpenSLX/AttributeRoster.pm index f039d20e..8e810306 100644 --- a/config-db/OpenSLX/AttributeRoster.pm +++ b/config-db/OpenSLX/AttributeRoster.pm @@ -171,6 +171,16 @@ sub _init content_descr => 'a space-separated list of NIC modules', default => 'forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32', }, + 'ramfs_firmmods' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + list of wifi network card modules to load + End-of-Here + content_regex => qr{^\s*([-\w]+\s*)*$}, + content_descr => 'a space-separated list of firmware modules', + default => 'tigon e100', + }, 'hw_local_disk' => { applies_to_systems => 1, applies_to_clients => 1, diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm index d3e7573b..f913b3ba 100644 --- a/config-db/OpenSLX/DBSchema.pm +++ b/config-db/OpenSLX/DBSchema.pm @@ -380,6 +380,7 @@ sub _schemaUpgradeDBFrom 'attr_ramfs_fsmods', 'attr_ramfs_miscmods', 'attr_ramfs_nicmods', + 'attr_ramfs_firmmods', 'attr_ramfs_screen', 'attr_sane_scanner', 'attr_scratch', -- cgit v1.2.3-55-g7522