X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=choosers%2Ftextmenu.c;h=ac282c0cc6f933427dc6f751d6b1bca60852c39f;hb=6b99cd9349f4ee5a5af604dfe86df032024e9792;hp=9379b0e2034e7691709a609b8dde2635c08a1359;hpb=054761502f884ae2cb147c75bd17a660fe63b071;p=debian%2Felilo diff --git a/choosers/textmenu.c b/choosers/textmenu.c index 9379b0e..ac282c0 100644 --- a/choosers/textmenu.c +++ b/choosers/textmenu.c @@ -1,6 +1,10 @@ /* * Copyright (C) 2001-2003 Hewlett-Packard Co. * Contributed by Richard Hirst + * Copyright (C) 2006-2009 Intel Corporation + * Contributed by Fenghua Yu + * Contributed by Bibo Mao + * Contributed by Chandramouli Narayanan * * This file is part of the ELILO, the EFI Linux boot loader. * @@ -27,8 +31,9 @@ #include #include "elilo.h" +#include "console.h" -#define MAX_LABELS 16 +#define MAX_LABELS 64 #define MSGBUFLEN 4096 static UINT8 msgbuf[MSGBUFLEN]; @@ -45,8 +50,8 @@ static CHAR16 PromptBuf[CMDLINE_MAXLEN]; #define DEF_ATTR EFI_TEXT_ATTR(EFI_LIGHTGRAY,EFI_BLACK) -#define ClearScreen() ST->ConOut->ClearScreen(ST->ConOut) -#define SetTextAttr(a) ST->ConOut->SetAttribute(ST->ConOut, a) +#define ClearScreen() uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut) +#define SetTextAttr(a) uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, a) static INTN tohex(INTN c) @@ -182,12 +187,12 @@ paint_menu(VOID) } static INTN -read_message_file(INTN msg, INT8 *buf, INTN max) +read_message_file(INTN msg, UINT8 *buf, UINTN max) { CHAR16 *filename; fops_fd_t message_fd; EFI_STATUS status; - INTN len = max; + UINTN len = max; if (msg > 10) return 0; @@ -249,7 +254,8 @@ reprint: SetTextAttr(CurrentAttr); for (;;) { - while ((status=ip->ReadKeyStroke(ip, &key)) == EFI_NOT_READY); + while ((status = uefi_call_wrapper(ip->ReadKeyStroke, 2, ip, &key)) + == EFI_NOT_READY); if (EFI_ERROR(status)) { SetTextAttr(EFI_TEXT_ATTR(EFI_LIGHTGRAY,EFI_BLACK)); ClearScreen(); @@ -295,7 +301,7 @@ reprint: if (i) { msgbuf[i] = 0; paint_msg(msgbuf); - while ((status=ip->ReadKeyStroke(ip, &key)) == EFI_NOT_READY); + while ((status= uefi_call_wrapper(ip->ReadKeyStroke, 2, ip, &key)) == EFI_NOT_READY); goto reprint; } } @@ -358,6 +364,7 @@ textmenu_choose(CHAR16 **argv, INTN argc, INTN index, CHAR16 *kname, CHAR16 *cmd # define BOOT_IMG_STR L"BOOT_IMAGE=" CHAR16 label[CMDLINE_MAXLEN]; CHAR16 initrd_name[CMDLINE_MAXLEN]; + CHAR16 vmcode_name[CMDLINE_MAXLEN]; CHAR16 args[CMDLINE_MAXLEN]; CHAR16 devname[CMDLINE_MAXLEN]; CHAR16 dpath[FILENAME_MAXLEN]; @@ -382,12 +389,13 @@ textmenu_choose(CHAR16 **argv, INTN argc, INTN index, CHAR16 *kname, CHAR16 *cmd nlabels++; } restart: - initrd_name[0] = kname[0] = cmdline[0] = args[0] = CHAR_NULL; + vmcode_name[0] = initrd_name[0] = kname[0] = cmdline[0] = args[0] = CHAR_NULL; /* reset per image loader options */ 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); @@ -400,7 +408,7 @@ restart: if (elilo_opt.alt_check && alternate_kernel(PromptBuf, sizeof(PromptBuf)) == 0) { argc = argify(PromptBuf,sizeof(PromptBuf), argv); index = 0; - label[0] = args[0] = initrd_name[0] = 0; + label[0] = args[0] = initrd_name[0] = vmcode_name[0] = 0; } /* @@ -412,16 +420,16 @@ restart: * still be modified by global options in the config file. */ if (label[0]) - ret = find_label(label, kname, args, initrd_name); + ret = find_label(label, kname, args, initrd_name, vmcode_name); else - ret = find_label(argv[index], kname, args, initrd_name); + ret = find_label((index < argc) ? argv[index] : NULL, kname, args, initrd_name, vmcode_name); /* * not found, so assume first argument is kernel name and * not label name */ if (ret == -1) { - if (argv[index]) + if ((index < argc) && argv[index]) StrCpy(kname, argv[index]); else StrCpy(kname, elilo_opt.default_kernel); @@ -448,17 +456,23 @@ restart: StrCpy(elilo_opt.initrd, initrd_name); } + if (elilo_opt.vmcode[0] == CHAR_NULL && vmcode_name[0] != CHAR_NULL) { + StrCpy(elilo_opt.vmcode, vmcode_name); + } + VERB_PRT(1, { Print(L"kernel is '%s'\n", kname); Print(L"arguments are '%s'\n", args); if (elilo_opt.initrd[0]) Print(L"initrd is '%s'\n", elilo_opt.initrd); + if (elilo_opt.vmcode[0]) Print(L"vmm is '%s'\n", elilo_opt.vmcode); }); if (elilo_opt.prompt == 0) { /* minimal printing */ - Print(L"ELILO\n"); + Print(L"ELILO v%s for EFI/%a\n", ELILO_VERSION, ELILO_ARCH); ret = wait_timeout(elilo_opt.delay); if (ret != 0) { elilo_opt.prompt = 1; + elilo_opt.initrd[0] = elilo_opt.vmcode[0] = CHAR_NULL; elilo_opt.timeout = ELILO_TIMEOUT_INFINITY; goto restart; } @@ -493,6 +507,7 @@ restart: len = StrLen(BOOT_IMG_STR) /* BOOT_IMAGE= */ +StrLen(devname) /* device name */ +StrLen(kname) /* kernel name */ + +elilo_opt.vmcode[0] ? StrLen(elilo_opt.vmcode) : StrLen(kname) +1 /* space */ +StrLen(args); /* args length */ @@ -504,7 +519,10 @@ restart: } StrCpy(cmdline, L"BOOT_IMAGE="); StrCat(cmdline, devname); - StrCat(cmdline, kname); + if (elilo_opt.vmcode[0]) + StrCat(cmdline, elilo_opt.vmcode); + else + StrCat(cmdline, kname); StrCat(cmdline, L" "); StrCat(cmdline, args);