[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 2/2] Add [images-xen] block to .treeinfo (#559347).



Under RHEL-6, we do not have a separate xen kernel package nor do we
have a separate kernel-PAE package.  All installations use the 'kernel'
package.  Introduce a $xen variable to control whether or not we want
the [images-xen] block in the .treeinfo file, which fixes virt-install
runs on previous RHEL releases (those installs are looking for an
[images-xen] block).
---
 scripts/mk-images     |    6 ++-
 scripts/mk-images.efi |   83 ++++++++++++++++++++++++-------------------------
 scripts/mk-images.x86 |   28 +++++-----------
 3 files changed, 54 insertions(+), 63 deletions(-)

diff --git a/scripts/mk-images b/scripts/mk-images
index 4a74367..eb55fd1 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -1002,6 +1002,7 @@ fi
 
 # Find the kernel, unpack it, and verify it
 kerneltags="kernel"
+xen=no
 efiarch=""
 arches="$BUILDARCH"
 if [ "$BUILDARCH" = "ppc" ]; then
@@ -1009,10 +1010,11 @@ if [ "$BUILDARCH" = "ppc" ]; then
 elif [ "$BUILDARCH" = "i386" ]; then
     arches="i586"
     efiarch="ia32"
-    kerneltags="kernel kernel-PAE"
-    kernelxen="kernel-PAE"
+    kerneltags="kernel"
+    xen=yes
 elif [ "$BUILDARCH" = "x86_64" ]; then
     kerneltags="kernel"
+    xen=yes
     efiarch="x64"
 elif [ "$BUILDARCH" = "ia64" ]; then
     kerneltags="kernel"
diff --git a/scripts/mk-images.efi b/scripts/mk-images.efi
index 7b31ced..5425111 100644
--- a/scripts/mk-images.efi
+++ b/scripts/mk-images.efi
@@ -197,49 +197,48 @@ makeEfiImages() {
     echo "in makeEfiImages"
     yumconf="$1"
     echo "Making EFI images ($PWD)"
-    if [ "$kernelvers" != "$kernelxen" ]; then
-        local grubarch=${efiarch}
-        case ${efiarch} in
-            ia32) grubarch=i?86 ;;
-            x64) grubarch=x86_64 ;;
-        esac
-
-        grubpkg=$(repoquery --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}" -c $yumconf grub.$grubarch)
-
-        if [ -z "$grubpkg" ]; then
-            echo "cannot find package grub.$grubarch" >&2
-            return 1
-        fi
-        echo "Building efiboot.img for ${efiarch}/$KERNELARCH at $TOPDESTPATH/images/efiboot.img"
-	echo "grubpkg: ${grubpkg}"
-
-        makeefibootimage \
-            --imagename efiboot.img \
-            --kernel $TOPDESTPATH/images/pxeboot/vmlinuz \
-            --initrd $TOPDESTPATH/images/pxeboot/initrd.img \
-            --grubpkg ${grubpkg}
-        local ret=$?
-        if [ $ret -ne 0 ]; then
-            echo "makeefibootimage (1) failed" >&2
-            return $ret
-        fi
 
-        makeefibootdisk $TOPDESTPATH/images/efiboot.img $TOPDESTPATH/images/efidisk.img
-        local ret=$?
-        [ $ret -eq 0 ] || return $ret
-        rm -vf $TOPDESTPATH/images/efiboot.img
-
-        # make a boot image with just boot*.efi in it...
-        makeefibootimage \
-            --imagename efiboot.img \
-            --kernelpath /images/pxeboot/vmlinuz \
-            --initrdpath /images/pxeboot/initrd.img \
-            --grubpkg ${grubpkg}
-        local ret=$?
-        if [ $ret -ne 0 ]; then
-            echo "makeefibootimage (2) failed" >&2
-        fi
+    local grubarch=${efiarch}
+    case ${efiarch} in
+        ia32) grubarch=i?86 ;;
+        x64) grubarch=x86_64 ;;
+    esac
+
+    grubpkg=$(repoquery --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}" -c $yumconf grub.$grubarch)
+
+    if [ -z "$grubpkg" ]; then
+        echo "cannot find package grub.$grubarch" >&2
+        return 1
+    fi
+    echo "Building efiboot.img for ${efiarch}/$KERNELARCH at $TOPDESTPATH/images/efiboot.img"
+   e "grubpkg: ${grubpkg}"
+
+    makeefibootimage \
+        --imagename efiboot.img \
+        --kernel $TOPDESTPATH/images/pxeboot/vmlinuz \
+        --initrd $TOPDESTPATH/images/pxeboot/initrd.img \
+        --grubpkg ${grubpkg}
+    local ret=$?
+    if [ $ret -ne 0 ]; then
+        echo "makeefibootimage (1) failed" >&2
         return $ret
     fi
-    return 0
+
+    makeefibootdisk $TOPDESTPATH/images/efiboot.img $TOPDESTPATH/images/efidisk.img
+    local ret=$?
+    [ $ret -eq 0 ] || return $ret
+    rm -vf $TOPDESTPATH/images/efiboot.img
+
+    # make a boot image with just boot*.efi in it...
+    makeefibootimage \
+        --imagename efiboot.img \
+        --kernelpath /images/pxeboot/vmlinuz \
+        --initrdpath /images/pxeboot/initrd.img \
+        --grubpkg ${grubpkg}
+    local ret=$?
+    if [ $ret -ne 0 ]; then
+        echo "makeefibootimage (2) failed" >&2
+    fi
+
+    return $ret
 }
diff --git a/scripts/mk-images.x86 b/scripts/mk-images.x86
index 7495ad4..721e4fd 100644
--- a/scripts/mk-images.x86
+++ b/scripts/mk-images.x86
@@ -87,14 +87,6 @@ makeBootImages() {
   local initrd="initrd.img"
   local kernelimage="vmlinuz"
 
-  if [ "$kernelvers" = "$kernelxen" ] ; then
-    local tag="${kernelvers#kernel}"
-    if [ -n "$tag" -a "$tag" != "$kernelvers" ] ; then
-      initrd="initrd${tag}.img"
-      kernelimage="vmlinuz${tag}"
-    fi
-  fi
-
   echo "Building $initrd"
   makeinitrd --initrdto $TOPDESTPATH/images/pxeboot/$initrd \
 	--initrdsize 8192 \
@@ -102,8 +94,7 @@ makeBootImages() {
 	--modules "$INITRDMODS"
   [ $? = 0 ] || exit 1
 
-  if [ "$kernelvers" != "$kernelxen" ] ; then
-    if [ -f $IMGPATH/usr/share/syslinux/isolinux.bin ]; then
+  if [ -f $IMGPATH/usr/share/syslinux/isolinux.bin ]; then
 	echo "Building isolinux directory"
 	MBD_BOOTTREE=$TOPDESTPATH/isolinux
 	MBD_FSIMAGE=$TOPDESTPATH/images/pxeboot/initrd.img
@@ -123,14 +114,14 @@ makeBootImages() {
            cp $IMGPATH/usr/lib/anaconda-runtime/boot/memtest* $MBD_BOOTTREE/memtest
            echo -e "label memtest86\n  menu label ^Memory test\n  kernel memtest\n  append -\n" >> $MBD_BOOTTREE/isolinux.cfg
 	fi
-    else
+  else
 	echo "No isolinux binaries.  Skipping isolinux creation"
-    fi
+  fi
 
-    # symlink the kernel for pxe dir
-    ln $TOPDESTPATH/isolinux/vmlinuz $TOPDESTPATH/images/pxeboot/vmlinuz
+  # symlink the kernel for pxe dir
+  ln $TOPDESTPATH/isolinux/vmlinuz $TOPDESTPATH/images/pxeboot/vmlinuz
 
-    cat > $TOPDESTPATH/images/pxeboot/README <<EOF
+  cat > $TOPDESTPATH/images/pxeboot/README <<EOF
 The files in this directory are useful for booting a machine via PXE.  
 
 The following files are available:
@@ -138,16 +129,15 @@ vmlinuz - the kernel used for the installer
 initrd.img - an initrd with support for all install methods and
     drivers supported for installation of $PRODUCT
 EOF
-    cat << __EOT__ >> $TOPDESTPATH/.treeinfo
+  cat << __EOT__ >> $TOPDESTPATH/.treeinfo
 [images-$BASEARCH]
 kernel = images/pxeboot/vmlinuz
 initrd = images/pxeboot/initrd.img
 __EOT__
-    if [ -n "$BOOTISO" ]; then echo "boot.iso = images/$BOOTISO" >> $TOPDESTPATH/.treeinfo ; fi    
-  fi
+  if [ -n "$BOOTISO" ]; then echo "boot.iso = images/$BOOTISO" >> $TOPDESTPATH/.treeinfo ; fi    
 
   # set up the boot stuff for the xen guest kernel
-  if [ -z "$kernelxen" -o "$kernelvers" = "$kernelxen" ] ; then
+  if [ "$xen" = "yes" ] ; then
     cp $KERNELROOT/boot/vmlinuz-$version $TOPDESTPATH/images/pxeboot/$kernelimage
     cat << __EOT__ >> $TOPDESTPATH/.treeinfo
 [images-xen]
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]