summaryrefslogtreecommitdiff
path: root/com32/menu
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-07-27 10:41:30 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-07-30 09:51:36 +0100
commit0d6f330878173c7ba45b884f3e41ce40b917c73c (patch)
tree0a887066d35d8b01914330d6ab6818fe015a5a9d /com32/menu
parent0fcd9a48603497dcc2727570a50a4401bb0fd085 (diff)
parentf0bbf9dd40f37f8c4870a33784996efd56955a75 (diff)
downloadsyslinux-0d6f330878173c7ba45b884f3e41ce40b917c73c.tar.gz
Merge remote-tracking branch 'mfleming/elflink' into for-hpa/elflink/firmware
Conflicts: Makefile com32/elflink/ldlinux/adv.c com32/elflink/ldlinux/kernel.c com32/elflink/ldlinux/ldlinux.c com32/include/bitsize/stddef.h com32/include/bitsize/stdint.h com32/include/stdint.h com32/include/sys/module.h com32/include/sys/x86_64/bitops.h com32/include/syslinux/linux.h com32/lib/Makefile com32/lib/sys/ansicon_write.c com32/lib/sys/module/elfutils.h com32/lib/sys/vesa/efi/fill.h com32/lib/syslinux/load_linux.c com32/lib/syslinux/serial.c com32/lib/syslinux/shuffle.c core/conio.c core/elflink/config.c core/elflink/load_env32.c core/graphics.c core/include/graphics.h core/init.c core/pxelinux.asm mk/elf.mk mk/lib.mk
Diffstat (limited to 'com32/menu')
-rw-r--r--com32/menu/Makefile6
-rw-r--r--com32/menu/execute.c69
-rw-r--r--com32/menu/menumain.c22
-rw-r--r--com32/menu/readconfig.c6
4 files changed, 23 insertions, 80 deletions
diff --git a/com32/menu/Makefile b/com32/menu/Makefile
index d1e85ad0..2096b4c4 100644
--- a/com32/menu/Makefile
+++ b/com32/menu/Makefile
@@ -24,14 +24,14 @@ MODULES = menu.c32 vesamenu.c32
TESTFILES =
COMMONOBJS = menumain.o readconfig.o passwd.o drain.o printmsg.o colors.o \
- background.o refstr.o execute.o
+ background.o refstr.o
all: $(MODULES) $(TESTFILES)
-menu.elf : menu.o $(COMMONOBJS) $(C_LIBS)
+menu.c32 : menu.o $(COMMONOBJS) $(C_LIBS)
$(LD) $(LDFLAGS) -o $@ $^
-vesamenu.elf : vesamenu.o $(COMMONOBJS) $(C_LIBS)
+vesamenu.c32 : vesamenu.o $(COMMONOBJS) $(C_LIBS)
$(LD) $(LDFLAGS) -o $@ $^
vesamenu.c32: vesamenu.o $(COMMONOBJS) $(C_LIBS)
diff --git a/com32/menu/execute.c b/com32/menu/execute.c
deleted file mode 100644
index c2de7353..00000000
--- a/com32/menu/execute.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* ----------------------------------------------------------------------- *
- *
- * Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
- *
- * This program 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, Inc., 51 Franklin St, Fifth Floor,
- * Boston MA 02110-1301, USA; either version 2 of the License, or
- * (at your option) any later version; incorporated herein by reference.
- *
- * ----------------------------------------------------------------------- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <com32.h>
-#include "menu.h"
-
-void execute(const char *cmdline, enum kernel_type type)
-{
- com32sys_t ireg;
- const char *p, *const *pp;
- char *q = __com32.cs_bounce;
- const char *kernel, *args;
-
- memset(&ireg, 0, sizeof ireg);
-
- kernel = q;
- p = cmdline;
- while (*p && !my_isspace(*p)) {
- *q++ = *p++;
- }
- *q++ = '\0';
-
- args = q;
- while (*p && my_isspace(*p))
- p++;
-
- strcpy(q, p);
-
- if (kernel[0] == '.' && type == KT_NONE) {
- /* It might be a type specifier */
- enum kernel_type type = KT_NONE;
- for (pp = kernel_types; *pp; pp++, type++) {
- if (!strcmp(kernel + 1, *pp)) {
- execute(p, type); /* Strip the type specifier and retry */
- }
- }
- }
-
- if (type == KT_LOCALBOOT) {
- ireg.eax.w[0] = 0x0014; /* Local boot */
- ireg.edx.w[0] = strtoul(kernel, NULL, 0);
- } else {
- if (type < KT_KERNEL)
- type = KT_KERNEL;
-
- ireg.eax.w[0] = 0x0016; /* Run kernel image */
- ireg.esi.w[0] = OFFS(kernel);
- ireg.ds = SEG(kernel);
- ireg.ebx.w[0] = OFFS(args);
- ireg.es = SEG(args);
- ireg.edx.l = type - KT_KERNEL;
- /* ireg.ecx.l = 0; *//* We do ipappend "manually" */
- }
-
- __intcall(0x22, &ireg, NULL);
-
- /* If this returns, something went bad; return to menu */
-}
diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index 5b3f6bd1..c9762b27 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -28,7 +28,9 @@
#include <setjmp.h>
#include <limits.h>
#include <com32.h>
+#include <core.h>
#include <syslinux/adv.h>
+#include <syslinux/boot.h>
#include "menu.h"
@@ -1108,7 +1110,7 @@ int main(int argc, char *argv[])
{
const char *cmdline;
struct menu *m;
- int rows, cols;
+ int rows, cols, cursorrow;
int i;
(void)argc;
@@ -1150,16 +1152,24 @@ int main(int argc, char *argv[])
local_cursor_enable(true);
cmdline = run_menu();
- if (clearmenu)
+ if (clearmenu) {
clear_screen();
+ cursorrow = 1;
+ } else {
+ cursorrow = END_ROW;
+ }
local_cursor_enable(false);
- printf("\033[?25h\033[%d;1H\033[0m", END_ROW);
+ printf("\033[?25h\033[%d;1H\033[0m", cursorrow);
if (cmdline) {
- execute(cmdline, KT_NONE);
- if (cm->onerror)
- execute(cm->onerror, KT_NONE);
+ uint32_t type = parse_image_type(cmdline);
+
+ execute(cmdline, type);
+ if (cm->onerror) {
+ type = parse_image_type(cm->onerror);
+ execute(cm->onerror, type);
+ }
} else {
return 0; /* Exit */
}
diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c
index 0ac2564a..69f524c4 100644
--- a/com32/menu/readconfig.c
+++ b/com32/menu/readconfig.c
@@ -35,7 +35,7 @@ struct menu *root_menu, *start_menu, *hide_menu, *menu_list;
/* These are global parameters regardless of which menu we're displaying */
int shiftkey = 0; /* Only display menu if shift key pressed */
int hiddenmenu = 0;
-int clearmenu = 0;
+int clearmenu = 1;
long long totaltimeout = 0;
const char *hide_key[KEY_MAX];
@@ -62,7 +62,7 @@ static const struct messages messages[MSG_COUNT] = {
__p; })
/* Must match enum kernel_type */
-const char *const kernel_types[] = {
+static const char *const kernel_types[] = {
"none",
"localboot",
"kernel",
@@ -744,6 +744,8 @@ static void parse_config_file(FILE * f)
refstr_put(command);
} else if ((ep = looking_at(p, "clear"))) {
clearmenu = 1;
+ } else if ((ep = looking_at(p, "noclear"))) {
+ clearmenu = 0;
} else if ((ep = is_message_name(p, &msgnr))) {
refstr_put(m->messages[msgnr]);
m->messages[msgnr] = refstrdup(skipspace(ep));