File grub2-s390x-09-improve-zipl-setup.patch of Package grub2

---
 util/s390x/zipl2grub.conf.in |    2 +-
 util/s390x/zipl2grub.pl.in   |   19 +++++++++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)

--- a/util/s390x/zipl2grub.conf.in
+++ b/util/s390x/zipl2grub.conf.in
@@ -8,7 +8,7 @@ defaultmenu = menu
     target = @zipldir@
     ramdisk = @zipldir@/initrd,0x2000000
     image = @zipldir@/image
-    parameters = "root=@GRUB_DEVICE@ @GRUB_EMU_CONMODE@ @GRUB_CMDLINE_LINUX@ @GRUB_CMDLINE_LINUX_DEFAULT@ initgrub quiet splash=silent plymouth.enable=0 "
+    parameters = "root=@GRUB_DEVICE@ @GRUB_EMU_CONMODE@ @GRUB_CMDLINE_LINUX@ @GRUB_CMDLINE_LINUX_DEFAULT@ initgrub quiet splash=silent plymouth.enable=0 mem=1G "
 
 [skip-grub2]
     target = @zipldir@
--- a/util/s390x/zipl2grub.pl.in
+++ b/util/s390x/zipl2grub.pl.in
@@ -44,12 +44,12 @@ sub System(@) {
   return 0 if ($debug);
   system( @C);
   if ($? == -1) {
-    Panic( $?, "$C[0]: Failed to execute: $!\n");
+    Panic( 1, "$C[0]: Failed to execute: $!\n");
   } elsif ($? & 127) {
-    Panic( $?, sprintf( "$C[0]: Died with signal %d with%s coredump\n",
+    Panic( 1, sprintf( "$C[0]: Died with signal %d with%s coredump\n",
            ($? & 127),  ($? & 128) ? '' : 'out'));
   } elsif ( $? >> 8 != 0 ) {
-    Panic( $?, "$C[0]: Failed\n");
+    Panic( $? >> 8, "$C[0]: Failed\n");
   }
   return( 0);
 }
@@ -166,7 +166,9 @@ sub Usage($) {
 	"zIPL directory missing.",
 	"Configuration template missing.",
 	"Configuration template unreadable.",
-	"zIPL directory not accesible.",
+	"zIPL directory not accessible.",
+	"kernel image parameter missing.",
+	"kernel image unreadable.",
 	""
   );
   my $msg = "";
@@ -190,7 +192,8 @@ while ( $#ARGV >= 0 ) {
   (/^--?help/ || /^-h/)       && (Usage(0));
   (/^--zipldir$/ || /^-z$/)   && ($zipldir = shift || Usage(2), next);
   (/^--template$/ || /^-T$/)  && ($in = shift || Usage(3), next);
-  (/^--image$/ || /^-i$/)     && ($Image = shift || Usage(5), $force = 1, next);
+  (/^--image$/ || /^-i$/)     && ($Image = shift || Usage(6),
+				  -r "$Image" || Usage(7), $force = 1, next);
   (/^-/)                      && (Usage(1));
   Usage(1);
 }
@@ -403,15 +406,15 @@ if ( -l $Image ) {
   $Image = readlink( $Image);
 }
 my ($image, $version) = ($Image =~ m{^(?:/boot/)?([^-]+-(.+))$});
-my $initrd = "initrd-$version";
-
 if ( !defined($image) || !defined($version) || ! -r "/boot/$image" ) {
   Panic( 1, "$C: weird $Image. This should never happen!\n");
 }
+my $initrd = "initrd-$version";
 
 if ( ! -r $ziplimage || ! -r $ziplinitrd || $refresh ) {
   BootCopy( $image, $zipldir, "image");
-  BootCopy( $initrd, $zipldir, "initrd") if (-r "/boot/$initrd");
+  BootCopy( $initrd, $zipldir, "initrd")
+    if (-r "/boot/$initrd" && ! exists( $fsdev{"/boot"}));
 }
 if ( $refresh || ChkInitrd( $zipldir, "initrd") <= 0 ) {
   MkInitrd( $initrd, $zipldir, $version);
openSUSE Build Service is sponsored by