Code drop for new requirement: Add a new flag --ignorekernelchk for nodeset, geninitrd and genimage commands to skip the kernel version checking when injecting drivers from osimage.driverupdatesrc
This commit is contained in:
parent
004d179474
commit
2b61564684
@ -42,6 +42,7 @@ my $mode;
|
||||
my $interactive;
|
||||
my $onlyinitrd;
|
||||
my $dryrun;
|
||||
my $ignorekernelchk;
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 print_usage - usage message
|
||||
@ -88,6 +89,7 @@ if (!GetOptions(
|
||||
'interactive' => \$interactive,
|
||||
'onlyinitrd' => \$onlyinitrd,
|
||||
'dryrun' => \$dryrun,
|
||||
'ignorekernelchk' => \$ignorekernelchk,
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$version,
|
||||
)) {
|
||||
@ -404,6 +406,10 @@ if ($dryrun) {
|
||||
push @arg, "--dryrun";
|
||||
}
|
||||
|
||||
if ($ignorekernelchk) {
|
||||
push @arg, "--ignorekernelchk";
|
||||
}
|
||||
|
||||
my $cmdref;
|
||||
push (@{$cmdref->{arg}}, @arg);
|
||||
$cmdref->{command}->[0] = "genimage";
|
||||
|
@ -175,6 +175,7 @@ sub mknetboot
|
||||
my @args = @{$req->{arg}} if(exists($req->{arg}));
|
||||
my @nodes = @{$req->{node}};
|
||||
my $noupdateinitrd = $req->{'noupdateinitrd'};
|
||||
my $ignorekernelchk = $req->{'ignorekernelchk'};
|
||||
my $ostab = xCAT::Table->new('nodetype');
|
||||
#my $sitetab = xCAT::Table->new('site');
|
||||
my $linuximagetab;
|
||||
@ -941,6 +942,7 @@ sub mkinstall
|
||||
my $doreq = shift;
|
||||
my @nodes = @{$request->{node}};
|
||||
my $noupdateinitrd = $request->{'noupdateinitrd'};
|
||||
my $ignorekernelchk = $request->{'ignorekernelchk'};
|
||||
#my $sitetab = xCAT::Table->new('site');
|
||||
my $linuximagetab;
|
||||
my $osimagetab;
|
||||
@ -1353,7 +1355,7 @@ sub mkinstall
|
||||
unless ($noupdateinitrd) {
|
||||
copy($kernpath,"$tftppath");
|
||||
copy($initrdpath,"$tftppath/initrd.img");
|
||||
&insert_dd($callback, $os, $arch, "$tftppath/initrd.img", "$tftppath/vmlinuz", $driverupdatesrc, $netdrivers, $osupdir);
|
||||
&insert_dd($callback, $os, $arch, "$tftppath/initrd.img", "$tftppath/vmlinuz", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2429,6 +2431,7 @@ sub insert_dd {
|
||||
my $driverupdatesrc = shift;
|
||||
my $drivers = shift;
|
||||
my $osupdirlist = shift;
|
||||
my $ignorekernelchk = shift;
|
||||
|
||||
my $install_dir = xCAT::TableUtils->getInstallDir();
|
||||
|
||||
@ -2439,6 +2442,7 @@ sub insert_dd {
|
||||
|
||||
my @dd_list;
|
||||
my @rpm_list;
|
||||
my @vendor_rpm; # the rpms from driverupdatesrc attribute
|
||||
my @driver_list;
|
||||
my $Injectalldriver;
|
||||
my $updatealldriver;
|
||||
@ -2468,8 +2472,10 @@ sub insert_dd {
|
||||
push @dd_list, $1;
|
||||
} elsif ($src =~ /rpm:(.*)/i) {
|
||||
push @rpm_list, $1;
|
||||
push @vendor_rpm, $1;
|
||||
} else {
|
||||
push @rpm_list, $src;
|
||||
push @vendor_rpm, $src;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2498,6 +2504,7 @@ sub insert_dd {
|
||||
|
||||
chomp(@dd_list);
|
||||
chomp(@rpm_list);
|
||||
chomp(@vendor_rpm);
|
||||
|
||||
unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
|
||||
return ();
|
||||
@ -2606,24 +2613,48 @@ sub insert_dd {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
|
||||
# Change it back to xxx.ko here
|
||||
$driver_name = "\*ko.new";
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/rpm/*>);
|
||||
foreach my $file (@all_real_path) {
|
||||
my $newname = $file;
|
||||
$newname =~ s/\.new$//;
|
||||
$cmd = "/bin/mv -f $file $newname";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
}
|
||||
|
||||
# Extract files from vendor rpm when $ignorekernelchk is specified
|
||||
if ($ignorekernelchk) {
|
||||
mkpath "$dd_dir/vendor_rpm";
|
||||
foreach my $rpm (@vendor_rpm) {
|
||||
if (-r $rpm) {
|
||||
$cmd = "cd $dd_dir/vendor_rpm; rpm2cpio $rpm | cpio -idum";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not extract files from the rpm $rpm.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
} else {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $file.";
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not read the rpm $rpm.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
|
||||
# Change it back to xxx.ko here
|
||||
$driver_name = "\*ko.new";
|
||||
@all_real_path = ();
|
||||
my @rpmfiles = <$dd_dir/rpm/*>;
|
||||
if ($ignorekernelchk) {
|
||||
push @rpmfiles, <$dd_dir/vendor_rpm/*>;
|
||||
}
|
||||
find(\&get_all_path, @rpmfiles);
|
||||
foreach my $file (@all_real_path) {
|
||||
my $newname = $file;
|
||||
$newname =~ s/\.new$//;
|
||||
$cmd = "/bin/mv -f $file $newname";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $file.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# The rh6 has different initrd format with old version (rh 5.x)
|
||||
@ -2684,9 +2715,27 @@ sub insert_dd {
|
||||
}
|
||||
|
||||
foreach my $kernelver (@kernelvers) {
|
||||
# if $ignorekernelchk is specified, copy all files from vendor_rpm dir to target kernel dir
|
||||
if ($ignorekernelchk) {
|
||||
my @kernelpath4vrpm = <$dd_dir/vendor_rpm/lib/modules/*>;
|
||||
foreach my $path (@kernelpath4vrpm) {
|
||||
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
|
||||
}
|
||||
$cmd = "/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy driver $path from vendor rpm.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
next;
|
||||
}
|
||||
|
||||
if (@driver_list) {
|
||||
foreach my $driver (@driver_list) {
|
||||
$driver =~ s/\.gz$//;
|
||||
@ -2903,9 +2952,27 @@ sub insert_dd {
|
||||
}
|
||||
|
||||
foreach my $kernelver (@kernelvers) {
|
||||
# if $ignorekernelchk is specified, copy all files from vendor_rpm dir to target kernel dir
|
||||
if ($ignorekernelchk) {
|
||||
my @kernelpath4vrpm = <$dd_dir/vendor_rpm/lib/modules/*>;
|
||||
foreach my $path (@kernelpath4vrpm) {
|
||||
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
|
||||
}
|
||||
$cmd = "/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy driver $path from vendor rpm.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
next;
|
||||
}
|
||||
|
||||
# create path for the new kernel in the modules package
|
||||
unless (-d "$dd_dir/modules/$kernelver") {
|
||||
mkpath ("$dd_dir/modules/$kernelver/$arch/");
|
||||
@ -3156,7 +3223,7 @@ sub insert_dd {
|
||||
if (@rpm_drivers) {
|
||||
push @{$rsp->{data}}, "The drivers:".join(',', sort(@rpm_drivers))." from ".join(',', sort(@rpm_list))." have been injected to initrd.";
|
||||
} elsif ($Injectalldriver) {
|
||||
push @{$rsp->{data}}, "All the drivers from :".join(',', sort(@rpm_list))." have been injected to initrd.";
|
||||
push @{$rsp->{data}}, "All the drivers from: ".join(',', sort(@rpm_list))." have been injected to initrd.";
|
||||
} else {
|
||||
push @{$rsp->{data}}, "No driver was injected to initrd.";
|
||||
}
|
||||
|
@ -93,7 +93,9 @@ sub setdestiny {
|
||||
|
||||
@ARGV = @{$req->{arg}};
|
||||
my $noupdateinitrd;
|
||||
GetOptions('noupdateinitrd' => \$noupdateinitrd,);
|
||||
my $ignorekernelchk;
|
||||
GetOptions('noupdateinitrd' => \$noupdateinitrd,
|
||||
'ignorekernelchk' => \$ignorekernelchk,);
|
||||
|
||||
my $state = $ARGV[0];
|
||||
my $reststates;
|
||||
@ -304,7 +306,8 @@ sub setdestiny {
|
||||
$errored=0;
|
||||
$subreq->({command=>["mk$tempstate"],
|
||||
node=>$samestatenodes,
|
||||
noupdateinitrd=>$noupdateinitrd}, \&relay_response);
|
||||
noupdateinitrd=>$noupdateinitrd,
|
||||
ignorekernelchk=>$ignorekernelchk,}, \&relay_response);
|
||||
if ($errored) {
|
||||
$callback->({error=>"Some nodes failed to set up $state resources, aborting"});
|
||||
return;
|
||||
|
@ -69,6 +69,7 @@ sub process_request {
|
||||
my $onlyinitrd;
|
||||
my $tempfile;
|
||||
my $dryrun;
|
||||
my $ignorekernelchk;
|
||||
|
||||
GetOptions(
|
||||
'a=s' => \$arch,
|
||||
@ -88,6 +89,7 @@ sub process_request {
|
||||
'onlyinitrd' => \$onlyinitrd,
|
||||
'tempfile=s' => \$tempfile,
|
||||
'dryrun' => \$dryrun,
|
||||
'ignorekernelchk' => \$ignorekernelchk,
|
||||
);
|
||||
|
||||
my $osimagetab;
|
||||
@ -298,6 +300,7 @@ sub process_request {
|
||||
if (!$dryrun) { $cmd .= " --tempfile $tempfile"; }
|
||||
}
|
||||
if ($driverupdatesrc) { $cmd .= " --driverupdatesrc $driverupdatesrc"; }
|
||||
if ($ignorekernelchk) { $cmd .= " --ignorekernelchk $ignorekernelchk"; }
|
||||
|
||||
if($osfamily eq "sles") {
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("timezone");
|
||||
|
@ -28,15 +28,20 @@ sub preprocess_request
|
||||
|
||||
my $usage = sub {
|
||||
my $callback = shift;
|
||||
xCAT::MsgUtils->message("I", {data=>["Usage: geninitrd <imagename> [-h | --help]"]}, $callback);
|
||||
xCAT::MsgUtils->message("I", {data=>["Usage: geninitrd <imagename> [--ignorekernelchk] [-h | --help]"]}, $callback);
|
||||
};
|
||||
|
||||
my $osimage;
|
||||
my $ignorekernelchk;
|
||||
if (defined ($req->{arg})) {
|
||||
foreach (@{$req->{arg}}) {
|
||||
if (/^-/) {
|
||||
$usage->($callback);
|
||||
return;
|
||||
if (/--ignorekernelchk/) {
|
||||
$ignorekernelchk = 1;
|
||||
} else {
|
||||
$usage->($callback);
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
$osimage = $_;
|
||||
}
|
||||
@ -51,11 +56,13 @@ sub preprocess_request
|
||||
return;
|
||||
}
|
||||
|
||||
$req->{'ignorekernelchk'} = [$ignorekernelchk];
|
||||
|
||||
#if tftpshared is not set, dispatch this command to all the service nodes
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
|
||||
my $t_entry = $entries[0];
|
||||
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
|
||||
$req->{'_disparatetftp'}=[1];
|
||||
$req->{'_disparatetftp'} = [1];
|
||||
return xCAT::Scope->get_broadcast_scope($req,@_);
|
||||
}
|
||||
return [$req];
|
||||
@ -81,6 +88,10 @@ sub geninitrd {
|
||||
my $doreq = shift;
|
||||
|
||||
my $osimage = $req->{arg}->[0];
|
||||
my $ignorekernelchk;
|
||||
if (defined ($req->{'ignorekernelchk'}) && $req->{'ignorekernelchk'}->[0]) {
|
||||
$ignorekernelchk = $req->{'ignorekernelchk'}->[0];
|
||||
}
|
||||
|
||||
my ($osvers, $arch, $pkgdir, $driverupdatesrc, $netdrivers, $osdisupdir);
|
||||
|
||||
@ -218,10 +229,10 @@ sub geninitrd {
|
||||
# 2. Inject the drivers to initrd in /tftpboot base on the new kernel ver
|
||||
if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)/) {
|
||||
require xCAT_plugin::anaconda;
|
||||
xCAT_plugin::anaconda->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir);
|
||||
xCAT_plugin::anaconda->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir, $ignorekernelchk);
|
||||
} elsif ($osvers =~ /(sles.*)|(suse.*)/) {
|
||||
require xCAT_plugin::sles;
|
||||
xCAT_plugin::sles->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir);
|
||||
xCAT_plugin::sles->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir, $ignorekernelchk);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ sub mknetboot
|
||||
my $nodes = @{$req->{node}};
|
||||
my @nodes = @{$req->{node}};
|
||||
my $noupdateinitrd = $req->{'noupdateinitrd'};
|
||||
my $ignorekernelchk = $req->{'ignorekernelchk'};
|
||||
my $ostab = xCAT::Table->new('nodetype');
|
||||
#my $sitetab = xCAT::Table->new('site');
|
||||
my $linuximagetab;
|
||||
@ -711,6 +712,7 @@ sub mkinstall
|
||||
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
|
||||
|
||||
my $noupdateinitrd = $request->{'noupdateinitrd'};
|
||||
my $ignorekernelchk = $request->{'ignorekernelchk'};
|
||||
my @nodes = @{$request->{node}};
|
||||
my $node;
|
||||
my $ostab = xCAT::Table->new('nodetype');
|
||||
@ -1039,20 +1041,20 @@ sub mkinstall
|
||||
unless ($noupdateinitrd) {
|
||||
copy("$pkgdir/1/boot/$arch/loader/linux", "$tftppath");
|
||||
copy("$pkgdir/1/boot/$arch/loader/initrd", "$tftppath");
|
||||
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir);
|
||||
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
|
||||
}
|
||||
} elsif ($arch =~ /x86/) {
|
||||
unless ($noupdateinitrd) {
|
||||
copy("$pkgdir/1/boot/i386/loader/linux", "$tftppath");
|
||||
copy("$pkgdir/1/boot/i386/loader/initrd", "$tftppath");
|
||||
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir);
|
||||
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
|
||||
}
|
||||
}
|
||||
elsif ($arch =~ /ppc/)
|
||||
{
|
||||
unless ($noupdateinitrd) {
|
||||
copy("$pkgdir/1/suseboot/inst64", "$tftppath");
|
||||
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/inst64", undef, $driverupdatesrc, $netdrivers, $osupdir);
|
||||
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/inst64", undef, $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1949,6 +1951,7 @@ sub insert_dd () {
|
||||
my $driverupdatesrc = shift;
|
||||
my $drivers = shift;
|
||||
my $osupdirlist = shift;
|
||||
my $ignorekernelchk = shift;
|
||||
|
||||
my $install_dir = xCAT::TableUtils->getInstallDir();
|
||||
|
||||
@ -1956,6 +1959,7 @@ sub insert_dd () {
|
||||
|
||||
my @dd_list;
|
||||
my @rpm_list;
|
||||
my @vendor_rpm; # the rpms from driverupdatesrc attribute
|
||||
my @driver_list;
|
||||
my $Injectalldriver;
|
||||
my $updatealldriver;
|
||||
@ -1986,8 +1990,10 @@ sub insert_dd () {
|
||||
push @dd_list, $1;
|
||||
} elsif ($src =~ /rpm:(.*)/i) {
|
||||
push @rpm_list, $1;
|
||||
push @vendor_rpm, $1;
|
||||
} else {
|
||||
push @rpm_list, $src;
|
||||
push @vendor_rpm, $src;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2016,6 +2022,7 @@ sub insert_dd () {
|
||||
|
||||
chomp(@dd_list);
|
||||
chomp(@rpm_list);
|
||||
chomp(@vendor_rpm);
|
||||
|
||||
unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
|
||||
return ();
|
||||
@ -2087,26 +2094,50 @@ sub insert_dd () {
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
|
||||
# Change it back to xxx.ko here
|
||||
$driver_name = "\*ko.new";
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/rpm/*>);
|
||||
foreach my $file (@all_real_path) {
|
||||
my $newname = $file;
|
||||
$newname =~ s/\.new$//;
|
||||
$cmd = "mv -f $file $newname";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
# Extract files from vendor rpm when $ignorekernelchk is specified
|
||||
if ($ignorekernelchk) {
|
||||
mkpath "$dd_dir/vendor_rpm";
|
||||
foreach my $rpm (@vendor_rpm) {
|
||||
if (-r $rpm) {
|
||||
$cmd = "cd $dd_dir/vendor_rpm; rpm2cpio $rpm | cpio -idum";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not extract files from the rpm $rpm.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
} else {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not rename $file.";
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not read the rpm $rpm.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
|
||||
# Change it back to xxx.ko here
|
||||
$driver_name = "\*ko.new";
|
||||
@all_real_path = ();
|
||||
my @rpmfiles = <$dd_dir/rpm/*>;
|
||||
if ($ignorekernelchk) {
|
||||
push @rpmfiles, <$dd_dir/vendor_rpm/*>;
|
||||
}
|
||||
find(\&get_all_path, @rpmfiles);
|
||||
foreach my $file (@all_real_path) {
|
||||
my $newname = $file;
|
||||
$newname =~ s/\.new$//;
|
||||
$cmd = "mv -f $file $newname";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not rename $file.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
# Copy the firmware to the rootimage
|
||||
if (-d "$dd_dir/rpm/lib/firmware") {
|
||||
if (! -d "$dd_dir/initrd_img/lib") {
|
||||
@ -2166,9 +2197,27 @@ sub insert_dd () {
|
||||
}
|
||||
|
||||
foreach my $kernelver (@kernelvers) {
|
||||
# if $ignorekernelchk is specified, copy all files from vendor_rpm dir to target kernel dir
|
||||
if ($ignorekernelchk) {
|
||||
my @kernelpath4vrpm = <$dd_dir/vendor_rpm/lib/modules/*>;
|
||||
foreach my $path (@kernelpath4vrpm) {
|
||||
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
|
||||
}
|
||||
$cmd = "/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy driver $path from vendor rpm.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
next;
|
||||
}
|
||||
|
||||
if (@driver_list) {
|
||||
# copy the specific drivers to initrd
|
||||
foreach my $driver (@driver_list) {
|
||||
|
@ -63,6 +63,7 @@ my $rootimg_dir;
|
||||
my $permission; # the permission works only for statelite mode currently
|
||||
my $tempfile;
|
||||
my $prompt;
|
||||
my $ignorekernelchk;
|
||||
|
||||
|
||||
sub xdie {
|
||||
@ -108,6 +109,7 @@ GetOptions(
|
||||
'driverupdatesrc=s' => \$driverupdatesrc, #internal flag
|
||||
'interactive' =>\$prompt,
|
||||
'onlyinitrd' =>\$onlyinitrd,
|
||||
'ignorekernelchk' => \$ignorekernelchk,
|
||||
);
|
||||
|
||||
if (@ARGV > 0) {
|
||||
@ -1925,6 +1927,22 @@ sub load_dd ()
|
||||
if (-d "$dd_dir/rpm/lib/firmware") {
|
||||
system ("cp -rf $dd_dir/rpm/lib/firmware $rootimg_dir/lib");
|
||||
}
|
||||
|
||||
# if $ignorekernelchk is specified, copy all driver files to target kernel dir
|
||||
if ($ignorekernelchk) {
|
||||
my @kernelpath4vrpm = <$dd_dir/rpm/lib/modules/*>;
|
||||
foreach my $path (@kernelpath4vrpm) {
|
||||
if ($path eq "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
next;
|
||||
}
|
||||
|
||||
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
|
||||
}
|
||||
system ("/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver");
|
||||
}
|
||||
}
|
||||
|
||||
# Copy the drivers to the rootimage
|
||||
if (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
if (@driver_list) {
|
||||
@ -1953,6 +1971,8 @@ sub load_dd ()
|
||||
}
|
||||
} elsif ($Injectalldriver) {
|
||||
# copy all the drviers to the rootimage
|
||||
$driver_name = "\*\.ko";
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
|
||||
my @all_drivers = @all_real_path;
|
||||
foreach my $new_driver (@all_drivers) {
|
||||
|
@ -60,6 +60,7 @@ my $krpmver;
|
||||
my $tempfile;
|
||||
my $prompt;
|
||||
my $timezone; #the TIMEZONE of the stateless and statelite node
|
||||
my $ignorekernelchk;
|
||||
|
||||
sub xdie {
|
||||
system("rm -rf /tmp/xcatinitrd.$$");
|
||||
@ -106,6 +107,7 @@ GetOptions(
|
||||
'driverupdatesrc=s' => \$driverupdatesrc, #internal flag
|
||||
'interactive' =>\$prompt,
|
||||
'onlyinitrd' =>\$onlyinitrd,
|
||||
'ignorekernelchk' => \$ignorekernelchk,
|
||||
);
|
||||
|
||||
if (@ARGV > 0) {
|
||||
@ -2003,6 +2005,22 @@ sub load_dd()
|
||||
if (-d "$dd_dir/rpm/lib/firmware") {
|
||||
system ("cp -rf $dd_dir/rpm/lib/firmware $rootimg_dir/lib");
|
||||
}
|
||||
|
||||
# if $ignorekernelchk is specified, copy all driver files to target kernel dir
|
||||
if ($ignorekernelchk) {
|
||||
my @kernelpath4vrpm = <$dd_dir/rpm/lib/modules/*>;
|
||||
foreach my $path (@kernelpath4vrpm) {
|
||||
if ($path eq "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
next;
|
||||
}
|
||||
|
||||
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
|
||||
}
|
||||
system ("/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver");
|
||||
}
|
||||
}
|
||||
|
||||
# Copy the drivers to the rootimage
|
||||
if (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
#mkpath "$rootimg_dir/lib/modules/$kernelver/updates/";
|
||||
@ -2032,6 +2050,8 @@ sub load_dd()
|
||||
}
|
||||
} elsif ($Injectalldriver) {
|
||||
# copy all the drviers to the rootimage
|
||||
$driver_name = "\*\.ko";
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
|
||||
my @all_drivers = @all_real_path;
|
||||
foreach my $new_driver (@all_drivers) {
|
||||
|
Loading…
Reference in New Issue
Block a user