Blob Blame History Raw
From 487c264cb590c42b6122fd7d02d14c1d762214e5 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Thu, 11 Dec 2014 14:41:21 -0500
Subject: [PATCH 26/41] Fix ppc kernelName when invoked by installkernel.

During the installation of a new kernel on an existing system the
invocation of "make install" called installkernel and that provided
new-kernel-pkg with the incorrect kernelName on ppc systems. Added
new option --kernel-name to new-kernel-pkg and invoked it from
installkernel with the appropriate kernel name.

Resolves: rhbz#979852

Signed-off-by: Robert Marshall <rmarshall@redhat.com>
---
 installkernel  |  6 +++---
 new-kernel-pkg | 22 +++++++++++++++-------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/installkernel b/installkernel
index 86fe2c3..b887929 100755
--- a/installkernel
+++ b/installkernel
@@ -79,9 +79,9 @@ ln -fs ${RELATIVE_PATH}$INSTALL_PATH/System.map-$KERNEL_VERSION $LINK_PATH/Syste
 
 if [ -n "$cfgLoader" ] && [ -x /sbin/new-kernel-pkg ]; then
 	if [ -n "$(which dracut 2>/dev/null)" ]; then
-		new-kernel-pkg --mkinitrd --dracut --host-only --depmod --install $KERNEL_VERSION
+		new-kernel-pkg --mkinitrd --dracut --host-only --depmod --install --kernel-name $KERNEL_NAME $KERNEL_VERSION
 	else
-		new-kernel-pkg --mkinitrd --depmod --install $KERNEL_VERSION
+		new-kernel-pkg --mkinitrd --depmod --install --kernel-name $KERNEL_NAME $KERNEL_VERSION
 	fi
-	new-kernel-pkg --rpmposttrans $KERNEL_VERSION
+	new-kernel-pkg --rpmposttrans --kernel-name $KERNEL_NAME $KERNEL_VERSION
 fi
diff --git a/new-kernel-pkg b/new-kernel-pkg
index 70f6118..527f8fb 100755
--- a/new-kernel-pkg
+++ b/new-kernel-pkg
@@ -588,6 +588,12 @@ doRmmoddep() {
     fi
 }
 
+# kernel image for 2.4 is vmlinux
+if [ $ARCH = 'ppc64' -o $ARCH = 'ppc' ]; then
+  if [ "$kernelmajor" == "2.4" ]; then
+      kernelName=vmlinux
+  fi
+fi
 
 while [ $# -gt 0 ]; do
     case $1 in
@@ -714,6 +720,15 @@ while [ $# -gt 0 ]; do
             fi
             ;;
 
+        --kernel-name*)
+            if [[ $1 == --kernel-name\=* ]]; then
+                kernelName=${1#--kernel-name=}
+            else
+                kernelName="$2"
+                shift
+            fi
+            ;;
+
 	-v)
 	    verbose=-v
 	    ;;
@@ -747,13 +762,6 @@ fi
 
 kernelmajor=`echo $kernel | cut -d . -f 1,2`
 
-# kernel image for 2.4 is vmlinux
-if [ $ARCH = 'ppc64' -o $ARCH = 'ppc' ]; then
-  if [ "$kernelmajor" == "2.4" ]; then
-      kernelName=vmlinux
-  fi
-fi
-
 [[ $kernelImage ]] || kernelImage="$bootPrefix/$kernelName-$version"
 
 # set the initrd file based on arch; ia64 is the only currently known oddball
-- 
2.4.3