retitle 376002 [PATCH] elilo needs to switch control to text mode before 
prompting
tags 376002 + patch
thanks

Hi,

On Macs, anything coming up after the Apple graphical chooser needs to
switch the EFI console to text mode to be visible.

The attached patch adds that switching ability to elilo 3.8.

This is a reduced version of Christoph Pfisterer's patches on the
SF.net patch tracker; there's only the text mode switching in this
patch and not the graphical boot logo stuff (which is useless).

There are also some general fixes for elilo 3.8 in the SF.net patch
tracker that you may want to apply.

Thanks,

JB.

-- 
 Julien BLACHE <[EMAIL PROTECTED]>  |  Debian, because code matters more 
 Debian & GNU/Linux Developer        |       <http://www.debian.org>
 Public key available on <http://www.jblache.org> - KeyID: F5D6 5169 
 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 

diff -ruN orig/elilo-3.8/Make.defaults elilo-3.8/Make.defaults
--- orig/elilo-3.8/Make.defaults	2007-07-20 21:47:25.000000000 +0200
+++ elilo-3.8/Make.defaults	2008-06-02 10:26:09.165016460 +0200
@@ -63,7 +63,7 @@
 TOPDIR  =
 
 ARCH	   = $(shell uname -m | sed s,i[3456789]86,ia32,)
-INCDIR	   = -I. -I$(TOPDIR) -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol
+INCDIR	   = -I. -I$(TOPDIR) -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol -I$(TOPDIR)/efi110
 CPPFLAGS   = -DCONFIG_$(ARCH) 
 
 OPTIMFLAGS = -O2 
diff -ruN orig/elilo-3.8/Makefile elilo-3.8/Makefile
--- orig/elilo-3.8/Makefile	2007-07-20 21:47:25.000000000 +0200
+++ elilo-3.8/Makefile	2008-06-02 10:26:09.181866450 +0200
@@ -67,7 +67,7 @@
 FILES = elilo.o getopt.o strops.o loader.o \
         fileops.o util.o vars.o alloc.o chooser.o  \
 	config.o initrd.o alternate.o bootparams.o \
-	gunzip.o fs/fs.o \
+	gunzip.o console.o fs/fs.o \
 	choosers/choosers.o \
 	devschemes/devschemes.o \
 	$(ARCH)/sysdeps.o \
diff -ruN orig/elilo-3.8/choosers/simple.c elilo-3.8/choosers/simple.c
--- orig/elilo-3.8/choosers/simple.c	2007-07-20 21:47:26.000000000 +0200
+++ elilo-3.8/choosers/simple.c	2008-06-02 10:26:09.089608402 +0200
@@ -32,6 +32,7 @@
 
 #include "elilo.h"
 #include "vars.h"
+#include "console.h"
 
 /* static is ugly but does the job here! */
 static CHAR16 **alt_argv;
@@ -288,6 +289,7 @@
 	}
 
 	if (elilo_opt.prompt) {
+		console_textmode();
 		ret = select_kernel(buffer, sizeof(buffer));
 		if (ret == -1) return -1;
 		argc    = argify(buffer,sizeof(buffer), argv); 
diff -ruN orig/elilo-3.8/choosers/textmenu.c elilo-3.8/choosers/textmenu.c
--- orig/elilo-3.8/choosers/textmenu.c	2007-07-20 21:47:26.000000000 +0200
+++ elilo-3.8/choosers/textmenu.c	2008-06-02 10:26:09.091607487 +0200
@@ -31,6 +31,7 @@
 #include <efilib.h>
 
 #include "elilo.h"
+#include "console.h"
 
 #define MAX_LABELS	64
 #define MSGBUFLEN	4096
@@ -394,6 +395,7 @@
 	Memset(&elilo_opt.img_opt, 0, sizeof(elilo_opt.img_opt));
 
 	if (elilo_opt.prompt) {
+		console_textmode();
 		ret = select_kernel(label, sizeof(label));
 		if (ret == -1) return -1;
 		argc    = argify(PromptBuf,sizeof(PromptBuf), argv); 
diff -ruN orig/elilo-3.8/console.c elilo-3.8/console.c
--- orig/elilo-3.8/console.c	1970-01-01 01:00:00.000000000 +0100
+++ elilo-3.8/console.c	2008-06-02 10:32:30.566696163 +0200
@@ -0,0 +1,71 @@
+/* 
+ * console.c - Console screen handling functions
+ *
+ *  Copyright (C) 2006 Christoph Pfisterer
+ *
+ * This file is part of the ELILO, the EFI Linux boot loader.
+ *
+ *  ELILO is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  ELILO is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with ELILO; see the file COPYING.  If not, write to the Free
+ *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ *  02111-1307, USA.
+ *
+ * Please check out the elilo.txt for complete documentation on how
+ * to use this program.
+ */
+
+#include <efi.h>
+#include <efilib.h>
+
+#include "elilo.h"
+
+#include <efiConsoleControl.h>
+
+static EFI_GUID console_guid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
+
+static BOOLEAN console_inited = FALSE;
+
+static EFI_CONSOLE_CONTROL_PROTOCOL *console_control;
+
+/*
+ * Initialize console functions
+ */
+static VOID console_init(VOID)
+{
+	EFI_STATUS status;
+
+	if (!console_inited) {
+		console_inited = TRUE;
+
+		status = LibLocateProtocol(&console_guid, (VOID **) &console_control);
+		if (EFI_ERROR(status))
+			console_control = NULL;
+	}
+}
+
+/*
+ * Switch the console to text mode
+ */
+
+VOID console_textmode(VOID)
+{
+	EFI_CONSOLE_CONTROL_SCREEN_MODE console_mode;
+
+	console_init();
+
+	if (console_control != NULL) {
+		uefi_call_wrapper(console_control->GetMode, 4, console_control, &console_mode, NULL, NULL);
+		if (console_mode == EfiConsoleControlScreenGraphics)
+			uefi_call_wrapper(console_control->SetMode, 2, console_control, EfiConsoleControlScreenText);
+	}
+}
diff -ruN orig/elilo-3.8/console.h elilo-3.8/console.h
--- orig/elilo-3.8/console.h	1970-01-01 01:00:00.000000000 +0100
+++ elilo-3.8/console.h	2008-06-02 10:28:00.589607539 +0200
@@ -0,0 +1,32 @@
+/*
+ * console.h - Console screen handling functions
+ *
+ *  Copyright (C) 2006 Christoph Pfisterer
+ *
+ * This file is part of the ELILO, the EFI Linux boot loader.
+ *
+ *  ELILO is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  ELILO is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with ELILO; see the file COPYING.  If not, write to the Free
+ *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ *  02111-1307, USA.
+ *
+ * Please check out the elilo.txt for complete documentation on how
+ * to use this program.
+ */
+
+#ifndef __ELILO_CONSOLE_H__
+#define __ELILO_CONSOLE_H__
+
+extern VOID console_textmode(VOID);
+
+#endif /* __ELILO_CONSOLE_H__ */
diff -ruN orig/elilo-3.8/efi110/efiConsoleControl.h elilo-3.8/efi110/efiConsoleControl.h
--- orig/elilo-3.8/efi110/efiConsoleControl.h	1970-01-01 01:00:00.000000000 +0100
+++ elilo-3.8/efi110/efiConsoleControl.h	2008-06-02 10:26:09.148168053 +0200
@@ -0,0 +1,122 @@
+/*++ 
+
+Copyright (c) 2004, Intel Corporation                                                         
+All rights reserved. This program and the accompanying materials                          
+are licensed and made available under the terms and conditions of the BSD License         
+which accompanies this distribution.  The full text of the license may be found at        
+http://opensource.org/licenses/bsd-license.php                                            
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+Module Name:
+
+ConsoleControl.h
+
+Abstract:
+
+Abstraction of a Text mode or UGA screen
+
+--*/
+
+#ifndef __CONSOLE_CONTROL_H__
+#define __CONSOLE_CONTROL_H__
+
+#define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \
+{ 0xf42f7782, 0x12e, 0x4c12, { 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21 } }
+
+/* typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL   EFI_CONSOLE_CONTROL_PROTOCOL; */
+struct _EFI_CONSOLE_CONTROL_PROTOCOL;
+
+
+typedef enum {
+    EfiConsoleControlScreenText,
+    EfiConsoleControlScreenGraphics,
+    EfiConsoleControlScreenMaxValue
+} EFI_CONSOLE_CONTROL_SCREEN_MODE;
+
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) (
+                                                 IN  struct _EFI_CONSOLE_CONTROL_PROTOCOL *This,
+                                                 OUT EFI_CONSOLE_CONTROL_SCREEN_MODE   *Mode,
+                                                 OUT BOOLEAN                           *UgaExists,   OPTIONAL  
+                                                 OUT BOOLEAN                           *StdInLocked  OPTIONAL
+                                                 )
+/*++
+
+Routine Description:
+Return the current video mode information. Also returns info about existence
+of UGA Draw devices in system, and if the Std In device is locked. All the
+arguments are optional and only returned if a non NULL pointer is passed in.
+
+Arguments:
+This - Protocol instance pointer.
+Mode        - Are we in text of grahics mode.
+UgaExists   - TRUE if UGA Spliter has found a UGA device
+StdInLocked - TRUE if StdIn device is keyboard locked
+
+Returns:
+EFI_SUCCESS     - Mode information returned.
+
+--*/
+;
+
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE) (
+                                                 IN  struct _EFI_CONSOLE_CONTROL_PROTOCOL *This,
+                                                 OUT EFI_CONSOLE_CONTROL_SCREEN_MODE   Mode
+                                                 )
+/*++
+
+Routine Description:
+Set the current mode to either text or graphics. Graphics is
+for Quiet Boot.
+
+Arguments:
+This  - Protocol instance pointer.
+Mode  - Mode to set the 
+
+Returns:
+EFI_SUCCESS     - Mode information returned.
+
+--*/
+;
+
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN) (
+                                                    IN  struct _EFI_CONSOLE_CONTROL_PROTOCOL *This,
+                                                    IN CHAR16                             *Password
+                                                    )
+/*++
+
+Routine Description:
+Lock Std In devices until Password is typed.
+
+Arguments:
+This     - Protocol instance pointer.
+Password - Password needed to unlock screen. NULL means unlock keyboard
+
+Returns:
+EFI_SUCCESS      - Mode information returned.
+EFI_DEVICE_ERROR - Std In not locked
+
+--*/
+;
+
+
+
+typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL {
+    EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE           GetMode;
+    EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE           SetMode;
+    EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN        LockStdIn;
+} EFI_CONSOLE_CONTROL_PROTOCOL;
+
+extern EFI_GUID gEfiConsoleControlProtocolGuid;
+
+#endif

Reply via email to