Hi, I'm attempting to netboot Linux on my Macs. I don't want to mess around with boot cds, so I have to maket his work with the Macs EFI firmware.
The first problem I encountered with iPXE is that I don't see any output on the screen. That's because Macs start in graphic mode. The attached hack(inspired by Refit's textmode.efi) puts the firmware into text mode, so I actually see something. The next problem(for debugging purposes), is that Ctrl-B does not work. I replaced the key with 'a', which allows me to bring up the iPXE shell. The next issue is that iPXE doesn't find my network card. This seems to be a regression, because it works fine with gPXE(I just filed to gPXE bugs before I noticed that iPXE exists now). I tried the following builds: make bin-i386-efi/ipxe.efi make bin-i386-efi/sky2.efi make bin-i386-efi/sky2.efi DEBUG=sky2 None of them works. If I don't open the console, I see "o more network devices" (with an o, not a 0). Currently I've netboot working by loading a grub2 .efi file with a memdisk image that contains a config file and kernel. I hope to replace this with a solution that allows me to separate the boot loader, kernel and configuration. Best regards, Stefan
>From 659f68e69eed653d5d4a4f92b875d9a029fadfe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <[email protected]> Date: Thu, 16 Feb 2012 13:41:57 +0100 Subject: [PATCH] Hack to load on Macs via EFI --- src/core/main.c | 2 +- src/include/ipxe/efi/Protocol/ConsoleControl.h | 121 ++++++++++++++++++++++++ src/interface/efi/efi_init.c | 10 ++ 3 files changed, 132 insertions(+), 1 deletions(-) create mode 100644 src/include/ipxe/efi/Protocol/ConsoleControl.h diff --git a/src/core/main.c b/src/core/main.c index 9fd4a76..be191a9 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -49,7 +49,7 @@ static int shell_banner ( void ) { return 0; return ( prompt ( "\nPress Ctrl-B for the iPXE command line...", - ( BANNER_TIMEOUT * 100 ), CTRL_B ) == 0 ); + ( BANNER_TIMEOUT * 100 ), 'a' ) == 0 ); } /** diff --git a/src/include/ipxe/efi/Protocol/ConsoleControl.h b/src/include/ipxe/efi/Protocol/ConsoleControl.h new file mode 100644 index 0000000..187f562 --- /dev/null +++ b/src/include/ipxe/efi/Protocol/ConsoleControl.h @@ -0,0 +1,121 @@ +/*++ + +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 } } + +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 diff --git a/src/interface/efi/efi_init.c b/src/interface/efi/efi_init.c index 6c7b495..a30f6e8 100644 --- a/src/interface/efi/efi_init.c +++ b/src/interface/efi/efi_init.c @@ -23,6 +23,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <ipxe/efi/Protocol/LoadedImage.h> #include <ipxe/uuid.h> #include <ipxe/init.h> +#include <ipxe/efi/Protocol/ConsoleControl.h> /** Image handle passed to entry point */ EFI_HANDLE efi_image_handle; @@ -40,6 +41,9 @@ static EFI_GUID efi_loaded_image_protocol_guid /** Event used to signal shutdown */ static EFI_EVENT efi_shutdown_event; +static EFI_CONSOLE_CONTROL_PROTOCOL *console_control; +EFI_REQUIRE_PROTOCOL ( EFI_CONSOLE_CONTROL_PROTOCOL, &console_control ); + /** * Shut down in preparation for booting an OS. * @@ -84,6 +88,7 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle, struct efi_config_table *tab; EFI_STATUS efirc; void *loaded_image; + EFI_CONSOLE_CONTROL_SCREEN_MODE currentMode; /* Store image handle and system table pointer for future use */ efi_image_handle = image_handle; @@ -158,5 +163,10 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle, return efirc; } + console_control->GetMode(console_control, ¤tMode, NULL, NULL); + if (currentMode == EfiConsoleControlScreenGraphics) { + console_control->SetMode(console_control, EfiConsoleControlScreenText); + } + return 0; } -- 1.7.3.4
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ ipxe-devel mailing list [email protected] https://lists.ipxe.org/mailman/listinfo/ipxe-devel

