diff --git a/README.ibm3215 b/README.ibm3215 new file mode 100644 index 0000000..d691738 --- /dev/null +++ b/README.ibm3215 @@ -0,0 +1,59 @@ +[Disclaimer: I do not know enough (by far) about the inner workings +and secrets of these printer-consoles, so please correct me/send advice, +if there are better solutions!] + +On 3215/327x things are dramatically different from everywhere else. +You'll have to live with some severe limitations: + +0. Interactivity is quite limited. You'll need to "blindly" type, + most of the time, to see the effect only on "submission" ([Enter]). + In edit and shell mode it's sometimes useful to insert underlines + just to see, where the curser (AKA "point") is. (BTW, 3270 is _much_ + better at displaying/refreshing grub2 screens than 3215.) +1. No cursor-movement-, alt-, meta-, and control-keys (like [ESC]). +2. To work around the lack of control-keys, the "[^][C]-sends-interrupt"- + trick is extended to translate sequences of caret followed by character + to the respective control-character. In the following this sequence + of two keystrokes is referred to as '^c' instead of that somewhat balky + [^][C]. Thus an [ESC] keypress can be generated with '^[' ("caret" + followed by "opening square bracket"). +3. If a caret itself is needed, send one on it's own (i.e. a solitary [^] + followed by [Enter] -- or use '^^'. +4. No '[Enter]', because it can't be avoided on *any* input. +5. If you still need one to arrive at the application, you may either + press '[Enter]' *twice* (one empty line, sort of) or add '^j' to your + input. In menu mode '^f' works as well (see below). But using "empty + lines" does now work very reliably, so explicit control sequences + are to be preferred. This has the additional advantage, that combined + sequences can be sent, e.g. to exit from 'grub2-emu' without doing + anything, you can simply type 'cexit^j' and submit that with [Enter]. + +Common Substitutes: + '^j'` => [Enter] "engage" + '^[' => [ESC] "abort" / return to previous "state" + '^i' => [TAB] try completion (in edit & shell mode) + +Available Keys in Menu Mode: + '^a' first entry '^e' last entry + '^p' previous entry '^n' next entry + '^g' previous page '^c' next page + '^f' boot selected entry/enter sub-menu (same as '^j') + 'e' edit selected entry 'c' enter grub-shell + +Available Keys in Edit Mode: + '^p' previous line '^n' next line + '^b' backward char '^f' forward char + '^a' beginning of line '^e' end of line + '^h' backspace '^d' delete + '^k' kill (to end of) line '^y' yank + '^o' open line '^l' refresh screen + '^x' boot entry '^c' enter grub-shell + +Availble Keys on Command Line Mode: + '^p' previous command '^n' next command (from history) + '^a' beginning of line '^e' end of line + '^b' backward char '^f' forward char + '^h' backspace '^d' delete + '^k' kill (to end of) line '^u' discard line + '^y' yank + diff --git a/grub2-s390x-02-kexec-module-added-to-emu.patch b/grub2-s390x-02-kexec-module-added-to-emu.patch index 196555b..7fc6ce4 100644 --- a/grub2-s390x-02-kexec-module-added-to-emu.patch +++ b/grub2-s390x-02-kexec-module-added-to-emu.patch @@ -7,7 +7,7 @@ include/grub/emu/exec.h | 4 include/grub/emu/hostfile.h | 3 include/grub/emu/misc.h | 3 - 8 files changed, 205 insertions(+), 3 deletions(-) + 8 files changed, 204 insertions(+), 4 deletions(-) --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -93,7 +93,7 @@ + return rc; + } + if (kexecute < 1) -+ grub_fatal (N_("Use '--kexec' if you really want to load&restart from here.")); ++ grub_fatal (N_("Use '"PACKAGE"-emu --kexec' to force a system restart.")); + + grub_printf("Performing 'systemctl kexec' (%s) ", + (kexecute==1) ? "do-or-die" : "just-in-case"); @@ -277,15 +277,30 @@ void grub_util_warn (const char *fmt, ...) -@@ -81,9 +82,23 @@ grub_util_error (const char *fmt, ...) +@@ -81,7 +82,7 @@ grub_util_error (const char *fmt, ...) vfprintf (stderr, fmt, ap); va_end (ap); fprintf (stderr, ".\n"); +- exit (1); + grub_exit (); -+ /* NOTREACHED but needed to get small diff... */ + } + + void * +@@ -138,6 +139,9 @@ xasprintf (const char *fmt, ...) + void + grub_exit (void) + { ++#if defined (GRUB_KERNEL) ++ grub_reboot(); ++#endif exit (1); } +@@ -150,3 +154,15 @@ grub_get_time_ms (void) + + return (tv.tv_sec * 1000 + tv.tv_usec / 1000); + } ++ +void +grub_util_set_kexecute(void) +{ @@ -297,20 +312,6 @@ +{ + return kexecute; +} -+ - void * - xmalloc (grub_size_t size) - { -@@ -138,6 +153,9 @@ xasprintf (const char *fmt, ...) - void - grub_exit (void) - { -+#if defined (GRUB_KERNEL) -+ grub_reboot(); -+#endif - exit (1); - } - --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -59,6 +59,9 @@ void EXPORT_FUNC(grub_util_warn) (const diff --git a/grub2-s390x-03-output-7-bit-ascii.patch b/grub2-s390x-03-output-7-bit-ascii.patch index bca1649..dbe4cda 100644 --- a/grub2-s390x-03-output-7-bit-ascii.patch +++ b/grub2-s390x-03-output-7-bit-ascii.patch @@ -1,8 +1,10 @@ --- - grub-core/normal/menu_text.c | 43 ++++++- + grub-core/kern/emu/main.c | 8 + + grub-core/normal/menu_text.c | 54 ++++++++ grub-core/normal/term.c | 2 - grub-core/osdep/unix/emuconsole.c | 224 ++++++++++++++++++++++++++++++++++++-- - 3 files changed, 257 insertions(+), 12 deletions(-) + grub-core/osdep/unix/emuconsole.c | 231 +++++++++++++++++++++++++++++++++++++- + include/grub/term.h | 4 + 5 files changed, 287 insertions(+), 12 deletions(-) --- a/grub-core/osdep/unix/emuconsole.c +++ b/grub-core/osdep/unix/emuconsole.c @@ -69,7 +71,7 @@ actual = write (STDOUT_FILENO, &chr, 1); if (actual < 1) -@@ -60,20 +104,145 @@ put (struct grub_term_output *term __att +@@ -60,17 +104,147 @@ put (struct grub_term_output *term __att } static int @@ -86,17 +88,18 @@ + timeout.tv_sec = 0; + timeout.tv_usec = 500000; + if ((sel=select (1, &readfds, (fd_set *)0, (fd_set *)0, &timeout)) <= 0) -+ return -1; ++ { ++ if (sel < 0 && errno == EINTR) ++ return 0x03; /* '^C' */ ++ return -1; ++ } + actual = read (STDIN_FILENO, &c, 1); -- if (actual > 0) -- return c; -- return -1; -+ if (actual <= 0) -+ return -1; -+ return c; -+} -+ + if (actual > 0) + return c; + return -1; + } + +static int +readkey_dumb (struct grub_term_input *term) +{ @@ -106,6 +109,12 @@ + c = readkey (term); + if (c == (grub_uint8_t)-1) + return -1; ++ if (p == '^' && c == '\n') /* solitary '^': use it! */ ++ { ++ grub_uint8_t t = p; ++ p = c; ++ return t; ++ } + if ((c == '\n' || c == '^') && p != c) + { + p = c; @@ -206,20 +215,12 @@ + + dprintf ("\n"); + data->pos = pos; - } - ++} ++ static grub_err_t grub_console_init_input (struct grub_term_input *term) { -+ if (console_mode > 3200) -+ { -+ new_tty = orig_tty; -+ return GRUB_ERR_NONE; -+ } - if (!saved_orig) - { - original_fl = fcntl (STDIN_FILENO, F_GETFL); -@@ -105,7 +274,8 @@ static grub_err_t +@@ -105,7 +279,8 @@ static grub_err_t grub_console_init_output (struct grub_term_output *term) { struct winsize size; @@ -229,7 +230,7 @@ { grub_console_terminfo_output.size.x = size.ws_col; grub_console_terminfo_output.size.y = size.ws_row; -@@ -115,6 +285,8 @@ grub_console_init_output (struct grub_te +@@ -115,6 +290,8 @@ grub_console_init_output (struct grub_te grub_console_terminfo_output.size.x = 80; grub_console_terminfo_output.size.y = 24; } @@ -238,7 +239,7 @@ grub_terminfo_output_init (term); -@@ -161,15 +333,53 @@ static struct grub_term_output grub_cons +@@ -161,24 +338,70 @@ static struct grub_term_output grub_cons void grub_console_init (void) { @@ -267,6 +268,8 @@ + grub_console_term_output.flags |= GRUB_TERM_DUMB; + /* FALLTHROUGH */ + case 3270: ++ grub_console_term_output.flags |= GRUB_TERM_LINE; ++ grub_console_term_output.flags |= GRUB_TERM_NO_ECHO; + grub_console_terminfo_input.readkey = readkey_dumb; + break; + default: @@ -289,10 +292,25 @@ grub_terminfo_init (); - grub_terminfo_output_register (&grub_console_term_output, "vt100-color"); + grub_terminfo_output_register (&grub_console_term_output, -+ (grub_console_term_output.flags & GRUB_TERM_DUMB)?"dumb":"vt100-color"); ++ (grub_console_term_output.flags & GRUB_TERM_DUMB) ? "dumb":"vt100-color"); } void + grub_console_fini (void) + { ++ dprintf( "grub_console_fini: %d\n", grub_console_term_output.flags & GRUB_TERM_DUMB); + if (saved_orig) + { + fcntl (STDIN_FILENO, F_SETFL, original_fl); + tcsetattr(STDIN_FILENO, TCSANOW, &orig_tty); + } ++ if (!(grub_console_term_output.flags & GRUB_TERM_DUMB)) ++ { ++ const char clear[] = { 0x1b, 'c', 0 }; ++ write (STDOUT_FILENO, clear, 2); ++ } + saved_orig = 0; + } --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -113,6 +113,7 @@ draw_border (struct grub_term_output *te @@ -312,19 +330,40 @@ grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1, (geo->first_entry_y - 1 + geo->num_entries -@@ -165,6 +166,11 @@ command-line or ESC to discard edits and +@@ -155,6 +156,15 @@ print_message (int nested, int edit, str + int ret = 0; + grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); + ++ if (edit && (term->flags & GRUB_TERM_LINE)) ++ { ++ ret += grub_print_message_indented_real ++ (_("Minimum Emacs-like screen editing is supported. '^i' lists " ++ "completions. Type '^x' to boot, '^c' for a command-line " ++ "or '^[' to discard edits and return to the GRUB menu."), ++ STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); ++ } ++ else + if (edit) + { + ret += grub_print_message_indented_real (_("Minimum Emacs-like screen editing is \ +@@ -165,10 +175,15 @@ command-line or ESC to discard edits and } else { +#if defined(__s390x__hotkey) + ret += grub_print_message_indented_real -+ (_("Select a menu option by pressing the hotkey specified."), ++ (_("Select a menu option by pressing the hotkey specified. "), + STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); +#else char *msg_translated; msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which " -@@ -177,6 +183,7 @@ command-line or ESC to discard edits and +- "entry is highlighted."), ++ "entry is highlighted. "), + GRUB_UNICODE_UPARROW, + GRUB_UNICODE_DOWNARROW); + if (!msg_translated) +@@ -177,6 +192,7 @@ command-line or ESC to discard edits and STANDARD_MARGIN, term, dry_run); grub_free (msg_translated); @@ -332,7 +371,7 @@ if (nested) { -@@ -211,6 +218,10 @@ print_entry (int y, int highlight, grub_ +@@ -211,6 +227,10 @@ print_entry (int y, int highlight, grub_ title = entry ? entry->title : ""; title_len = grub_strlen (title); @@ -343,7 +382,7 @@ unicode_title = grub_malloc (title_len * sizeof (*unicode_title)); if (! unicode_title) /* XXX How to show this error? */ -@@ -244,6 +255,14 @@ print_entry (int y, int highlight, grub_ +@@ -244,6 +264,14 @@ print_entry (int y, int highlight, grub_ if (data->geo.num_entries > 1) grub_putcode (highlight ? '*' : ' ', data->term); @@ -358,7 +397,7 @@ grub_print_ucs4_menu (unicode_title, unicode_title + len, 0, -@@ -413,6 +432,8 @@ grub_menu_init_page (int nested, int edi +@@ -413,6 +441,8 @@ grub_menu_init_page (int nested, int edi grub_term_highlight_color = old_color_highlight; geo->timeout_y = geo->first_entry_y + geo->num_entries + geo->border + empty_lines; @@ -367,7 +406,7 @@ if (bottom_message) { grub_term_gotoxy (term, -@@ -422,6 +443,8 @@ grub_menu_init_page (int nested, int edi +@@ -422,6 +452,8 @@ grub_menu_init_page (int nested, int edi print_message (nested, edit, term, 0); geo->timeout_y += msg_num_lines; } @@ -376,7 +415,7 @@ geo->right_margin = grub_term_width (term) - geo->first_entry_x - geo->entry_width - 1; -@@ -433,12 +456,19 @@ menu_text_print_timeout (int timeout, vo +@@ -433,12 +465,19 @@ menu_text_print_timeout (int timeout, vo struct menu_viewer_data *data = dataptr; char *msg_translated = 0; @@ -398,7 +437,7 @@ else msg_translated = grub_xasprintf (_("The highlighted entry will be executed automatically in %ds."), timeout); if (!msg_translated) -@@ -468,6 +498,8 @@ menu_text_print_timeout (int timeout, vo +@@ -468,6 +507,8 @@ menu_text_print_timeout (int timeout, vo data->term); grub_free (msg_translated); @@ -407,7 +446,7 @@ grub_term_gotoxy (data->term, (struct grub_term_coordinate) { grub_term_cursor_x (&data->geo), -@@ -495,7 +527,7 @@ menu_text_set_chosen_entry (int entry, v +@@ -495,7 +536,7 @@ menu_text_set_chosen_entry (int entry, v data->first = entry; complete_redraw = 1; } @@ -416,7 +455,7 @@ print_entries (data->menu, data); else { -@@ -525,6 +557,9 @@ menu_text_clear_timeout (void *dataptr) +@@ -525,6 +566,9 @@ menu_text_clear_timeout (void *dataptr) struct menu_viewer_data *data = dataptr; int i; @@ -437,3 +476,41 @@ } void +--- a/grub-core/kern/emu/main.c ++++ b/grub-core/kern/emu/main.c +@@ -174,6 +174,12 @@ static struct argp argp = { + NULL, help_filter, NULL + }; + ++void ++ignore (int num __attribute__ ((unused))) ++{ ++ return; ++} ++ + + + #pragma GCC diagnostic ignored "-Wmissing-prototypes" +@@ -212,7 +218,7 @@ main (int argc, char *argv[]) + sleep (1); + } + +- signal (SIGINT, SIG_IGN); ++ signal (SIGINT, (sighandler_t) &ignore); + grub_console_init (); + grub_host_init (); + +--- a/include/grub/term.h ++++ b/include/grub/term.h +@@ -99,8 +99,10 @@ grub_term_color_state; + #define GRUB_TERM_NO_EDIT (1 << 1) + /* Set when the terminal cannot do fancy things. */ + #define GRUB_TERM_DUMB (1 << 2) ++/* Set when the terminal is line oriented. */ ++#define GRUB_TERM_LINE (1 << 3) + /* Which encoding does terminal expect stream to be. */ +-#define GRUB_TERM_CODE_TYPE_SHIFT 3 ++#define GRUB_TERM_CODE_TYPE_SHIFT 4 + #define GRUB_TERM_CODE_TYPE_MASK (7 << GRUB_TERM_CODE_TYPE_SHIFT) + /* Only ASCII characters accepted. */ + #define GRUB_TERM_CODE_TYPE_ASCII (0 << GRUB_TERM_CODE_TYPE_SHIFT) diff --git a/grub2-s390x-04-grub2-install.patch b/grub2-s390x-04-grub2-install.patch index 40a4c65..7d54b9a 100644 --- a/grub2-s390x-04-grub2-install.patch +++ b/grub2-s390x-04-grub2-install.patch @@ -1,23 +1,37 @@ From: Raymund Will Subject: Allow s390x-emu to be "installed" -References: fate#314213 +References: fate#314213, bnc#866867, bnc#868909 Patch-Mainline: no +V2: + * try harder to find root filesystem (incl. subvol-handling). + * read /etc/sysconfig/bootloader as final fallback. +V3: + * refresh initrd by default, prefer running kernel and + re-zipl despite minor issues. [bnc#866867, fate#314213] +V4: + * append 'quiet splash=silent' for 'initgrub'-boot. + * properly check for dracut script during 'grub2-install'. + * move 'zipl2grub.pl' to '/usr/sbin/grub2-zipl-setup'. +V5: + * actually call 'grub2-zipl-setup' from 'grub2-install'. + * handle 'GRUB{,_EMU}_CONMODE'. [bnc#868909] + --- Makefile.util.def | 39 +++ configure.ac | 9 grub-core/Makefile.core.def | 7 grub-core/osdep/basic/no_platform.c | 7 - grub-core/osdep/unix/platform.c | 13 + + grub-core/osdep/unix/platform.c | 11 + grub-core/osdep/windows/platform.c | 6 include/grub/util/install.h | 4 util/grub-install-common.c | 1 - util/grub-install.c | 51 +++++ + util/grub-install.c | 43 +++ util/s390x/dracut-grub2.sh.in | 69 ++++++ util/s390x/dracut-module-setup.sh.in | 17 + util/s390x/zipl2grub.conf.in | 26 ++ - util/s390x/zipl2grub.pl.in | 346 +++++++++++++++++++++++++++++++++++ - 13 files changed, 591 insertions(+), 4 deletions(-) + util/s390x/zipl2grub.pl.in | 379 +++++++++++++++++++++++++++++++++++ + 13 files changed, 614 insertions(+), 4 deletions(-) --- a/Makefile.util.def +++ b/Makefile.util.def @@ -66,11 +80,11 @@ Patch-Mainline: no }; script = { -+ name = zipl2grub.pl; ++ name = grub-zipl-setup; ++ installdir = sbin; + common = util/s390x/zipl2grub.pl.in; + enable = emu; + emu_condition = COND_s390x; -+ installdir = platform; +}; + +data = { @@ -198,29 +212,27 @@ Patch-Mainline: no } + +void -+grub_install_zipl (const char *D, const char *s, const char *d, int i, int f) ++grub_install_zipl (const char *d, int i, int f) +{ + grub_util_error ("%s", _("no zIPL routines are available for your platform")); +} + --- a/grub-core/osdep/unix/platform.c +++ b/grub-core/osdep/unix/platform.c -@@ -233,3 +233,16 @@ grub_install_sgi_setup (const char *inst +@@ -233,3 +233,14 @@ grub_install_sgi_setup (const char *inst imgfile, destname, NULL }); grub_util_warn ("%s", _("You will have to set `SystemPartition' and `OSLoader' manually.")); } + +void -+grub_install_zipl (const char *scriptdir, const char *script, -+ const char *dest, int install, int force) ++grub_install_zipl (const char *dest, int install, int force) +{ -+ char *path = grub_util_path_concat (2, scriptdir, script); -+ if (grub_util_exec ((const char * []){ path, ++ if (grub_util_exec ((const char * []){ PACKAGE"-zipl-setup", ++ verbosity ? "-v" : "", + install ? "" : "--debug", -+ verbosity ? "-v" : "", -+ force ? "--force" : "", ++ !force ? "" : "--force", + "-z", dest, NULL })) -+ grub_util_error (_("`%s' failed.\n"), script); ++ grub_util_error (_("`%s' failed.\n"), PACKAGE"-zipl-setup"); +} --- a/grub-core/osdep/windows/platform.c +++ b/grub-core/osdep/windows/platform.c @@ -230,7 +242,7 @@ Patch-Mainline: no } + +void -+grub_install_zipl (const char *D, const char *s, const char *d, int i, int f) ++grub_install_zipl (const char *d, int i, int f) +{ + grub_util_error ("%s", _("no zIPL routines are available for your platform")); +} @@ -249,7 +261,7 @@ Patch-Mainline: no const char *imgfile, const char *destname); +void -+grub_install_zipl (const char *D, const char *s, const char *d, int i, int f); ++grub_install_zipl (const char *d, int i, int f); + int grub_install_compress_gzip (const char *src, const char *dest); @@ -385,31 +397,23 @@ Patch-Mainline: no grub_install_make_image_wrap (/* source dir */ grub_install_source_directory, /*prefix */ prefix, /* output */ imgfile, -@@ -1610,6 +1645,17 @@ main (int argc, char *argv[]) +@@ -1610,6 +1645,10 @@ main (int argc, char *argv[]) /* image target */ mkimage_target, 0); } break; + + case GRUB_INSTALL_PLATFORM_S390X_EMU: -+#if 0 -+ { -+ char *dst = grub_util_path_concat (2, platdir, "grub2-emu"); -+ grub_install_copy_file ("/usr/bin/grub2-emu", dst, 1); -+ free (dst); -+ } -+#endif + break; + case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: -@@ -1871,6 +1917,11 @@ main (int argc, char *argv[]) +@@ -1871,6 +1910,10 @@ main (int argc, char *argv[]) } break; + case GRUB_INSTALL_PLATFORM_S390X_EMU: -+ grub_install_zipl (grub_install_source_directory, "zipl2grub.pl", -+ zipldir, install_bootsector, force); ++ grub_install_zipl (zipldir, install_bootsector, force); + break; + case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: @@ -423,7 +427,7 @@ Patch-Mainline: no +# ex: ts=8 sw=4 sts=4 et filetype=sh +#getargbool() { true; } + -+if getargbool 0 initgrub && [ ! -e /grub2b0rken ] || [ -e /grub2force ]; then ++if getargbool 0 initgrub && [ ! -e /grub2skip ] || [ -e /grub2force ]; then + #type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + checkro() { + local dev mp fs opts dc @@ -520,13 +524,13 @@ Patch-Mainline: no + target = @zipldir@ + ramdisk = @zipldir@/initrd,0x2000000 + image = @zipldir@/image -+ parameters = "root=@GRUB_DEVICE@ @GRUB_CMDLINE_LINUX@ @GRUB_CMDLINE_LINUX_DEFAULT@ initgrub quiet splash=silent " ++ parameters = "root=@GRUB_DEVICE@ @GRUB_EMU_CONMODE@ @GRUB_CMDLINE_LINUX@ @GRUB_CMDLINE_LINUX_DEFAULT@ initgrub quiet splash=silent " + +[skip-grub2] + target = @zipldir@ + ramdisk = @zipldir@/initrd,0x2000000 + image = @zipldir@/image -+ parameters = "root=@GRUB_DEVICE@ @GRUB_CMDLINE_LINUX@ @GRUB_CMDLINE_LINUX_DEFAULT@ " ++ parameters = "root=@GRUB_DEVICE@ @GRUB_CONMODE@ @GRUB_CMDLINE_LINUX@ @GRUB_CMDLINE_LINUX_DEFAULT@ " + +:menu + target = @zipldir@ @@ -538,7 +542,7 @@ Patch-Mainline: no + --- /dev/null +++ b/util/s390x/zipl2grub.pl.in -@@ -0,0 +1,346 @@ +@@ -0,0 +1,379 @@ +#!/usr/bin/perl +use strict; + @@ -558,7 +562,10 @@ Patch-Mainline: no +my $cfg = ""; +my %C; + -+$C{GRUB_CMDLINE_LINUX} = ""; # force existence! ++my %Mandatory = ( ++ GRUB_CMDLINE_LINUX_DEFAULT => 1, ++ GRUB_DEVICE => 1, ++); + +sub Panic($$) { + printf( STDERR "%s", $_[1]); @@ -794,9 +801,37 @@ Patch-Mainline: no + close( IN); +} + -+ if ( ! exists( $C{GRUB_DEVICE})) { -+ Panic( 0, "$C: Default not ready and no fallback. Please retry later!\n"); ++if ( ! exists( $C{GRUB_DEVICE})) { ++ Panic( 0, "$C: Default not ready and no fallback. Please retry later!\n"); ++} ++ ++if ( ! exists( $C{GRUB_EMU_CONMODE}) && exists( $C{GRUB_CONMODE}) ) { ++ # GRUB_CONMODE is used for 'grub2-emu' as well ++ $C{GRUB_EMU_CONMODE} = $C{GRUB_CONMODE}; ++} ++if ( exists( $C{GRUB_EMU_CONMODE}) && !exists( $C{GRUB_CONMODE}) ) { ++ # pick up 'conmode=' from CMDLINE ++ my $found = ""; ++ foreach ( "GRUB_CMDLINE_LINUX", "GRUB_CMDLINE_LINUX_DEFAULT" ) { ++ next unless ($C{$_} =~ m{ ?conmode=(\S+) ?}); ++ $C{GRUB_CONMODE} = $1; ++ last; + } ++ if ( !exists( $C{GRUB_CONMODE}) && $C{GRUB_EMU_CONMODE} eq "3270" ) { ++ # force GRUB_CONMODE to 3215 for least surprise ++ $C{GRUB_CONMODE}="3215"; ++ } ++} ++if ( exists( $C{GRUB_EMU_CONMODE}) && exists( $C{GRUB_CONMODE})) { ++ # strip "conmode=" from GRUB_CMDLINE{,_LINUX}_DEFAULT ++ foreach ( "GRUB_CMDLINE_LINUX", "GRUB_CMDLINE_LINUX_DEFAULT" ) { ++ $C{$_} =~ s{( ?)conmode=\S+ ?}{$1}g; ++ } ++} ++foreach ("GRUB_EMU_CONMODE", "GRUB_CONMODE") { ++ next unless( exists( $C{$_}) ); ++ $C{$_} = "conmode=" . $C{$_}; ++} + +if ( $debug && $verbose > 2 ) { + foreach ( sort( keys( %C)) ) { @@ -820,9 +855,11 @@ Patch-Mainline: no + my $v; + if ( exists( $C{$k}) ) { + $v = $C{$k}; -+ } else { -+ $v = $k; ++ } elsif ( exists( $Mandatory{$k}) ) { ++ $v = "$k"; + $miss++; ++ } else { ++ $v = ""; + } + s{\@$k\@}{$v}g; + } diff --git a/grub2-s390x-05-grub2-mkconfig.patch b/grub2-s390x-05-grub2-mkconfig.patch index 3bee017..fcac48c 100644 --- a/grub2-s390x-05-grub2-mkconfig.patch +++ b/grub2-s390x-05-grub2-mkconfig.patch @@ -1,15 +1,31 @@ From: Raymund Will Subject: Enable grub2-mkconfig for s390x-emu -References: fate#314213 +References: fate#314213, bnc#868909 Patch-Mainline: no +V2: + * omit subvolume-prefix for platform "emu" +V3: + * add 'conmode=' to command-line if GRUB_CONMODE exists. [bnc#868909] + --- - util/grub.d/10_linux.in | 59 ++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 47 insertions(+), 12 deletions(-) + util/grub.d/10_linux.in | 63 ++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 51 insertions(+), 12 deletions(-) --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -67,6 +67,21 @@ esac +@@ -51,6 +51,10 @@ else + LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} + fi + ++if [ "x$GRUB_CONMODE" != "x" ]; then ++ GRUB_CMDLINE_LINUX="conmode=${GRUB_CONMODE} ${GRUB_CMDLINE_LINUX}" ++fi ++ + case x"$GRUB_FS" in + xbtrfs) + rootsubvol="`make_system_path_relative_to_its_root /`" +@@ -67,6 +71,21 @@ esac title_correction_code= @@ -31,7 +47,7 @@ Patch-Mainline: no linux_entry () { os="$1" -@@ -90,9 +105,11 @@ linux_entry () +@@ -90,9 +109,11 @@ linux_entry () title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" fi @@ -45,7 +61,7 @@ Patch-Mainline: no fi if [ x$type != xrecovery ] ; then save_default_entry | grub_add_tab -@@ -115,6 +132,7 @@ linux_entry () +@@ -115,6 +136,7 @@ linux_entry () echo " insmod gzio" | sed "s/^/$submenu_indentation/" @@ -53,7 +69,7 @@ Patch-Mainline: no if [ x$dirname = x/ ]; then if [ -z "${prepare_root_cache}" ]; then prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)" -@@ -126,6 +144,7 @@ linux_entry () +@@ -126,6 +148,7 @@ linux_entry () fi printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" fi @@ -61,7 +77,7 @@ Patch-Mainline: no message="$(gettext_printf "Loading Linux %s ..." ${version})" if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then sed "s/^/$submenu_indentation/" << EOF -@@ -159,16 +178,17 @@ EOF +@@ -159,16 +182,17 @@ EOF } machine=`uname -m` @@ -88,7 +104,7 @@ Patch-Mainline: no case "$machine" in i?86) GENKERNEL_ARCH="x86" ;; -@@ -178,6 +198,15 @@ case "$machine" in +@@ -178,6 +202,15 @@ case "$machine" in *) GENKERNEL_ARCH="$machine" ;; esac @@ -104,7 +120,7 @@ Patch-Mainline: no prepare_boot_cache= prepare_root_cache= boot_device_id= -@@ -194,6 +223,11 @@ while [ "x$list" != "x" ] ; do +@@ -194,6 +227,11 @@ while [ "x$list" != "x" ] ; do basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` @@ -116,7 +132,7 @@ Patch-Mainline: no version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` alt_version=`echo $version | sed -e "s,\.old$,,g"` linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" -@@ -278,7 +312,8 @@ while [ "x$list" != "x" ] ; do +@@ -278,7 +316,8 @@ while [ "x$list" != "x" ] ; do boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi # TRANSLATORS: %s is replaced with an OS name diff --git a/grub2.changes b/grub2.changes index 5479322..de678e6 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,23 @@ +------------------------------------------------------------------- +Tue Apr 1 04:52:53 UTC 2014 - mchang@suse.com + +- add Recommends to libburnia-tools (bnc#812681) + +------------------------------------------------------------------- +Mon Mar 31 12:42:00 UTC 2014 - rw@suse.de + +- Document peculiarities of s390 terminals in 'README.ibm3215'. +- grub2-s390x-02-kexec-module-added-to-emu.patch: + * Improve exit message for dry-run (and cleanup). +- grub2-s390x-03-output-7-bit-ascii.patch: + * Fix handling of '^C' and solitary '^'. (bnc#867258) + * Exit properly with mode-reset. +- grub2-s390x-04-grub2-install.patch: + * Install helper script as '/usr/sbin/grub2-zipl-setup'. + * Console mode may be controlled from config file. (bnc#868909) +- grub2-s390x-05-grub2-mkconfig.patch: + * Add 'conmode=' to command-line, if configured. (bnc#868909) + ------------------------------------------------------------------- Mon Mar 31 10:48:39 UTC 2014 - mchang@suse.com @@ -5,6 +25,7 @@ Mon Mar 31 10:48:39 UTC 2014 - mchang@suse.com * add btrfs_follow_default.patch * add suse_btrfs_grub2_install.sh * add 80_suse_btrfs_snapshot + * add SUSE_BTRFS_SNAPSHOT_BOOTING.patch * refresh grub2-snapper-plugin.sh ------------------------------------------------------------------- @@ -90,18 +111,18 @@ Wed Mar 26 11:51:42 UTC 2014 - dvaleev@suse.com Tue Mar 18 21:10:59 UTC 2014 - rw@suse.de - grub2-s390x-03-output-7-bit-ascii.patch: - * first usable interface on 3215 from initrd. [bnc#867258] + * first usable interface on 3215 from initrd. (bnc#867258) ------------------------------------------------------------------- Tue Mar 18 06:01:46 UTC 2014 - rw@suse.de -- reflect s390x-specifics in '/etc/default/grub'. [fate#314213] +- reflect s390x-specifics in '/etc/default/grub'. (fate#314213) - grub2-s390x-02-kexec-module-added-to-emu.patch: * boot-attempts are final, except if 'kexec -l' fails. * try to restore terminal on exit (via grub_reboot()). - grub2-s390x-03-output-7-bit-ascii.patch: - * use less CPU cycles waiting for user. [bnc#868650] - * first usable interface on 3215. [bnc#867258] + * use less CPU cycles waiting for user. (bnc#868650) + * first usable interface on 3215. (bnc#867258) * strip newlines on input for 3270 and 3215. - grub2-s390x-04-grub2-install.patch: * append 'quiet splash=silent' for 'initgrub'-boot. @@ -112,7 +133,7 @@ Wed Mar 5 20:44:56 UTC 2014 - rw@suse.com - grub2-s390x-04-grub2-install.patch: * refresh initrd by default, prefer running kernel and - re-zipl despite minor issues. [bnc#866867, fate#314213] + re-zipl despite minor issues. (bnc#866867, fate#314213) ------------------------------------------------------------------- Tue Mar 4 22:35:25 UTC 2014 - rw@suse.com @@ -131,7 +152,7 @@ Mon Mar 3 11:41:56 UTC 2014 - rw@suse.com - build grub2-emu for s390 non-static, with device-mapper support, but without grub2-mount and start to move arch-specific parts - to appropriate sub-packages. [fate#314213] + to appropriate sub-packages. (fate#314213) - grub2-s390x-02-kexec-module-added-to-emu.patch: * introduce '--kexec/-X' to grub2-emu command-line to prevent inadvertent system interruption. diff --git a/grub2.spec b/grub2.spec index 407e168..8ce6fda 100644 --- a/grub2.spec +++ b/grub2.spec @@ -109,6 +109,7 @@ Source4: grub2.rpmlintrc Source5: translations-20130626.tar.xz Source6: grub2-once Source7: 20_memtest86+ +Source8: README.ibm3215 Source10: openSUSE-UEFI-CA-Certificate.crt Source11: SLES-UEFI-CA-Certificate.crt Source12: grub2-snapper-plugin.sh @@ -181,6 +182,7 @@ Requires: gettext-runtime %ifnarch s390x Requires: os-prober %endif +Recommends: libburnia-tools %endif Requires(post): /sbin/install-info Requires(preun):/sbin/install-info @@ -346,8 +348,8 @@ mv po/grub.pot po/%{name}.pot %patch103 -p1 %patch104 -p1 %patch105 -p1 -#%patch110 -p1 -#%patch111 -p1 +#patch110 -p1 +#patch111 -p1 %patch201 -p1 %patch202 -p1 %patch203 -p1 @@ -381,6 +383,7 @@ rm -f po/stamp-po # README.openSUSE cp %{SOURCE3} . +cp %{SOURCE8} . mkdir build %ifarch %{efi} mkdir build-efi @@ -612,7 +615,6 @@ rm -f $R%{_sysconfdir}/grub.d/20_ppc_terminfo %ifarch s390x mv $R%{_sysconfdir}/{grub.d,default}/zipl2grub.conf.in chmod 600 $R%{_sysconfdir}/default/zipl2grub.conf.in -mv $R%{_libdir}/%{name}/%{grubarch}/zipl2grub{2,}.pl %define dracutlibdir %{_prefix}/lib/dracut %define dracutgrubmoddir %{dracutlibdir}/modules.d/99grub2 @@ -696,10 +698,6 @@ elif [ "x${LOADER_TYPE}" = "xgrub2" ]; then /sbin/update-bootloader --reinit 2>&1 | grep -q 'Unknown option: reinit' && /sbin/update-bootloader --refresh || true fi -%ifarch s390x -# until dracut is finally fixed... -rm -rf /usr/lib/dracut/modules.d/95grub2 -%endif %endif %ifarch %{efi} @@ -783,6 +781,9 @@ fi %doc THANKS TODO ChangeLog %doc README.openSUSE %doc docs/autoiso.cfg docs/osdetect.cfg +%ifarch s390x +%doc README.ibm3215 +%endif %dir /boot/%{name} %ghost /boot/%{name}/grub.cfg %{_sysconfdir}/bash_completion.d/grub @@ -794,7 +795,6 @@ fi %config %{_sysconfdir}/grub.d/20_linux_xen %config %{_sysconfdir}/grub.d/40_custom %config %{_sysconfdir}/grub.d/41_custom -#%config %{_sysconfdir}/grub.d/80_btrfs_snapshot %config %{_sysconfdir}/grub.d/90_persistent %{_sbindir}/%{name}-install %{_sbindir}/%{name}-mkconfig @@ -902,8 +902,8 @@ fi %{_libdir}/%{name}/%{grubarch}/modinfo.sh %endif %ifarch s390x +%{_sbindir}/%{name}-zipl-setup %config(noreplace) %{_sysconfdir}/default/zipl2grub.conf.in -%{_libdir}/%{name}/%{grubarch}/zipl2grub.pl %{dracutlibdir} %endif