From 061e8b657c339b32aeae9787b781f8b4ed838ca0 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 30 Mar 2010 15:18:31 +0000 Subject: [PATCH] -Preserve vmlinuz in root image on genimage -Improve kernel version autoselection to tolerate modules compiled against different kernels git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5611 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/netboot/rh/genimage | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index be3754c19..550bde5c8 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -350,9 +350,15 @@ unless ($onlyinitrd) { #If specified, that takes precedence. #if image has one, that is used #if all else fails, resort to uname -r like this script did before -my @KVERS= <$rootimg_dir/lib/modules/*>; +my @KVERS= <$rootimg_dir/boot/vmlinuz-*>; +foreach (@KVERS) { + s/vmlinuz-//; +} +unless (scalar(@KVERS)) { + @KVERS= <$rootimg_dir/lib/modules/*>; +} if (scalar(@KVERS)) { - $basekernelver = basename($KVERS[0]); + $basekernelver = basename(pop @KVERS); } unless ($basekernelver) { $basekernelver = `uname -r`; @@ -433,11 +439,11 @@ sub getlibs { sub mkinitrd { mkpath("/tmp/xcatinitrd.$$/bin"); if($basekernelver eq $kernelver) { - rename(<$rootimg_dir/boot/vmlinuz*>,"$destdir/kernel"); + copy(<$rootimg_dir/boot/vmlinuz*>,"$destdir/kernel"); } else { if(-r "$rootimg_dir/boot/vmlinuz-$kernelver") { - rename("$rootimg_dir/boot/vmlinuz-$kernelver","$destdir/kernel"); + copy("$rootimg_dir/boot/vmlinuz-$kernelver","$destdir/kernel"); } elsif(-r "/boot/vmlinuz-$kernelver") { copy("/boot/vmlinuz-$kernelver","$destdir/kernel"); } @@ -1091,7 +1097,7 @@ sub generic_post { #This function is meant to leave the image in a state approxi } close($cfgfile); - rename(<$rootimg_dir/boot/vmlinuz*>,"$destdir/kernel"); } + copy(<$rootimg_dir/boot/vmlinuz*>,"$destdir/kernel"); } sub get_package_names { my $plist_file_name=shift;