X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=choosers%2Fsimple.c;h=9d90fd6a8c9280285e2546c8c14c0a2782a7b013;hb=0218e27bab5789190314c636baeb32cb302c5ef7;hp=31bbe4ccc05911938e53884b24a0a22e81d61b17;hpb=176953673e992bd3812c32dc5d13eb8fa9b3c5b7;p=debian%2Felilo diff --git a/choosers/simple.c b/choosers/simple.c index 31bbe4c..9d90fd6 100644 --- a/choosers/simple.c +++ b/choosers/simple.c @@ -1,6 +1,10 @@ /* * Copyright (C) 2001-2003 Hewlett-Packard Co. * Contributed by Stephane Eranian + * 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. * @@ -37,6 +41,7 @@ display_label_info(CHAR16 *name) { CHAR16 *desc; CHAR16 initrd_name[CMDLINE_MAXLEN]; + CHAR16 vmcode_name[CMDLINE_MAXLEN]; CHAR16 options_tmp[CMDLINE_MAXLEN]; CHAR16 options[CMDLINE_MAXLEN]; CHAR16 kname[FILENAME_MAXLEN]; @@ -46,9 +51,9 @@ display_label_info(CHAR16 *name) Print(L"desc : %s\n", desc); } - initrd_name[0] = options_tmp[0] = kname[0] = CHAR_NULL; + initrd_name[0] = vmcode_name[0] = options_tmp[0] = kname[0] = CHAR_NULL; - if (find_label(name, kname, options_tmp, initrd_name) == -1) { + if (find_label(name, kname, options_tmp, initrd_name, vmcode_name) == -1) { StrCpy(kname, name); Print(L"\n"); } @@ -56,6 +61,7 @@ display_label_info(CHAR16 *name) Print(L"cmdline: %s %s\n", kname, options); if (initrd_name[0]) Print(L"initrd : %s\n", initrd_name); + if (vmcode_name[0]) Print(L"vmcode : %s\n", vmcode_name); } static VOID @@ -134,7 +140,8 @@ reprint: first_time = 0; 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)) { ERR_PRT((L"select_kernel readkey: %r", status)); return -1; @@ -213,7 +220,7 @@ display_message(VOID) { fops_fd_t fd; EFI_STATUS status; - INTN len, i; + UINTN len, i; CHAR16 *filename; CHAR8 buf[256]; @@ -247,6 +254,7 @@ simple_choose(CHAR16 **argv, INTN argc, INTN index, CHAR16 *kname, CHAR16 *cmdli CHAR16 buffer[CMDLINE_MAXLEN]; CHAR16 alt_buffer[CMDLINE_MAXLEN]; CHAR16 initrd_name[CMDLINE_MAXLEN]; + CHAR16 vmcode_name[CMDLINE_MAXLEN]; CHAR16 args[CMDLINE_MAXLEN]; CHAR16 devname[CMDLINE_MAXLEN]; CHAR16 dpath[FILENAME_MAXLEN]; @@ -259,7 +267,7 @@ simple_choose(CHAR16 **argv, INTN argc, INTN index, CHAR16 *kname, CHAR16 *cmdli display_message(); restart: - initrd_name[0] = kname[0] = cmdline[0] = args[0] = CHAR_NULL; + initrd_name[0] = vmcode_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)); @@ -271,7 +279,7 @@ restart: argc = argify(alt_buffer,sizeof(alt_buffer), argv); alt_argv = argv; index = 0; - args[0] = initrd_name[0] = 0; + args[0] = initrd_name[0] = vmcode_name[0] = 0; /* * don't check twice because the variable is deleted after * first access @@ -303,14 +311,14 @@ restart: * if no match is found, the args and initrd arguments may * still be modified by global options in the config file. */ - ret = find_label((index < argc) ? argv[index] : NULL, 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 ((index < argc) && argv[index]) + if ((index < argc) && argv[index]) StrCpy(kname, argv[index]); else StrCpy(kname, elilo_opt.default_kernel); @@ -335,9 +343,14 @@ 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) { @@ -346,8 +359,8 @@ restart: 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; - elilo_opt.initrd[0] = CHAR_NULL; goto restart; } } @@ -379,7 +392,8 @@ restart: */ len = StrLen(BOOT_IMG_STR) /* BOOT_IMAGE= */ +StrLen(devname) /* device name */ - +StrLen(kname) /* kernel name */ + /* kernel name */ + +elilo_opt.vmcode[0] ? StrLen(elilo_opt.vmcode) : StrLen(kname) +1 /* space */ +StrLen(args); /* args length */ @@ -389,7 +403,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);