File elilo-text-mode.diff of Package elilo

---
 x86_64/config.c  |   19 ++++++++++++++++---
 x86_64/sysdeps.h |    4 +++-
 x86_64/system.c  |    4 ++++
 3 files changed, 23 insertions(+), 4 deletions(-)

--- a/x86_64/config.c
+++ b/x86_64/config.c
@@ -33,15 +33,23 @@
 
 typedef struct {
 	UINTN legacy_free_boot;
+	UINTN text_mode;
 } x86_64_global_config_t;
 
 
+#define x86_64_opt_offsetof(option)    (&((sys_img_options_t *)(0x0))->option)
+
 static x86_64_global_config_t x86_64_gconf;
 
 static config_option_t sysdeps_global_options[]={
 	{OPT_BOOL,	OPT_GLOBAL, L"legacy-free",	NULL,	NULL,	&x86_64_gconf.legacy_free_boot}
 };
 
+static config_option_t sysdeps_image_options[]={
+	{OPT_BOOL,	OPT_IMAGE_SYS, L"text-mode",	NULL,	NULL,	x86_64_opt_offsetof(text_mode)}
+};
+
+
 /*
  * X86_64 operations that need to be done only once and just before 
  * entering the main loop of the loader
@@ -81,6 +89,14 @@ x86_64_use_legacy_free_boot(VOID)
 	return x86_64_gconf.legacy_free_boot ? 1 : 0;
 }
 
+
+INTN
+x86_64_text_mode(VOID)
+{
+	return (elilo_opt.sys_img_opts &&
+		elilo_opt.sys_img_opts->text_mode == TRUE) ? 1 : 0;
+}
+
 INTN
 sysdeps_register_options(VOID)
 {
@@ -89,14 +105,11 @@ sysdeps_register_options(VOID)
 	ret = register_config_options(sysdeps_global_options, 
 				      sizeof(sysdeps_global_options)/sizeof(config_option_t),
 				      OPTIONS_GROUP_GLOBAL);
-#if 0
-	/* no per image options yet */
 	if (ret == -1 ) return ret;
 
 	ret = register_config_options(sysdeps_image_options, 
 				      sizeof(sysdeps_image_options)/sizeof(config_option_t),
 				      OPTIONS_GROUP_IMAGE);
-#endif
 
 	return ret;
 }
--- a/x86_64/sysdeps.h
+++ b/x86_64/sysdeps.h
@@ -364,6 +364,7 @@ extern UINT8 rmswitch_image[];
 extern UINTN rmswitch_size;
 
 extern INTN x86_64_use_legacy_free_boot();
+extern INTN x86_64_text_mode();
 
 /*
  * How to jump to kernel code
@@ -457,7 +458,8 @@ start_kernel(VOID *kentry, boot_params_t
 }
 
 typedef struct sys_img_options {
-	UINT8 nothing_yet;
+	UINT8 dummy;	 /* forces non-zero offset for first field */
+	UINT8 text_mode; /* do not try to initialize Graphics Output Protocol */
 } sys_img_options_t;
 
 #endif /* __ELILO_SYSDEPS_X86_64_H__ */
--- a/x86_64/system.c
+++ b/x86_64/system.c
@@ -251,6 +251,10 @@ static INTN get_video_info(boot_params_t
         UINTN size1;
         UINT8 i;
 
+	if (x86_64_text_mode() == 1) {
+		Print((L"Skip GOP init, force text-mode.\n"));
+		return -1;
+	}
 	efi_status = uefi_call_wrapper(
 			BS->LocateHandle,
 			5,
openSUSE Build Service is sponsored by