diff --git a/xCAT-client/bin/genimage b/xCAT-client/bin/genimage index a3c48af57..2f210d811 100755 --- a/xCAT-client/bin/genimage +++ b/xCAT-client/bin/genimage @@ -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"; diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index f0bef4595..0e6db2e7f 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -174,6 +174,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; @@ -940,6 +941,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; @@ -1352,7 +1354,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); } } } @@ -2428,6 +2430,7 @@ sub insert_dd { my $driverupdatesrc = shift; my $drivers = shift; my $osupdirlist = shift; + my $ignorekernelchk = shift; my $install_dir = xCAT::TableUtils->getInstallDir(); @@ -2438,6 +2441,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; @@ -2467,8 +2471,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; } } } @@ -2497,6 +2503,7 @@ sub insert_dd { chomp(@dd_list); chomp(@rpm_list); + chomp(@vendor_rpm); unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) { return (); @@ -2605,24 +2612,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) @@ -2683,9 +2714,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$//; @@ -2902,9 +2951,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/"); @@ -3155,7 +3222,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."; } diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index a4936eb8c..1321ec900 100644 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -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; diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index e2e3bb08a..d43ec2a05 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -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"); diff --git a/xCAT-server/lib/xcat/plugins/geninitrd.pm b/xCAT-server/lib/xcat/plugins/geninitrd.pm index 18782cb99..5e499ba25 100644 --- a/xCAT-server/lib/xcat/plugins/geninitrd.pm +++ b/xCAT-server/lib/xcat/plugins/geninitrd.pm @@ -28,15 +28,20 @@ sub preprocess_request my $usage = sub { my $callback = shift; - xCAT::MsgUtils->message("I", {data=>["Usage: geninitrd [-h | --help]"]}, $callback); + xCAT::MsgUtils->message("I", {data=>["Usage: geninitrd [--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); } } diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 3392a63af..bb5faacb9 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -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; @@ -710,6 +711,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'); @@ -1038,20 +1040,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); } } } @@ -1948,6 +1950,7 @@ sub insert_dd () { my $driverupdatesrc = shift; my $drivers = shift; my $osupdirlist = shift; + my $ignorekernelchk = shift; my $install_dir = xCAT::TableUtils->getInstallDir(); @@ -1955,6 +1958,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; @@ -1985,8 +1989,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; } } } @@ -2015,6 +2021,7 @@ sub insert_dd () { chomp(@dd_list); chomp(@rpm_list); + chomp(@vendor_rpm); unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) { return (); @@ -2086,26 +2093,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") { @@ -2165,9 +2196,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) { diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 5769d2983..9bcb7d30c 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -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) { diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 3a87e43a8..f04aecaef 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -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) {