Steffen Winterfeldt
2010-Apr-09 16:08 UTC
[syslinux] [PATCH] gfxboot: support MENU LABEL statement
The config file parser now accepts MENU LABEL. Also, make config statements case-insensitive. Signed-off-by: Steffen Winterfeldt <wfeldt at opensuse.org> --- com32/gfxboot/gfxboot.c | 69 ++++++++++++++++++++++++++++++++++------------- 1 files changed, 50 insertions(+), 19 deletions(-) diff --git a/com32/gfxboot/gfxboot.c b/com32/gfxboot/gfxboot.c index bfdd8cc..640422b 100644 --- a/com32/gfxboot/gfxboot.c +++ b/com32/gfxboot/gfxboot.c @@ -165,7 +165,7 @@ void gfx_done(void); int gfx_input(void); ssize_t save_read(int fd, void *buf, size_t size); void *load_one(char *file, ssize_t *file_size); -void boot(void); +void boot(int index); void boot_entry(menu_t *menu_ptr, char *arg); @@ -234,7 +234,7 @@ int main(int argc, char **argv) } // does not return if it succeeds - boot(); + boot(menu_index); } if(argc > 2) show_message(argv[2]); @@ -321,19 +321,19 @@ int read_config_file(void) if(*t) *t++ = 0; t = skip_spaces(t); - if(!strcmp(s, "timeout")) { + if(!strcasecmp(s, "timeout")) { timeout = atoi(t); continue; } - if(!strcmp(s, "default")) { + if(!strcasecmp(s, "default")) { menu_default->label = strdup(t); u = strlen(t); if(u > label_size) label_size = u; continue; } - if(!strcmp(s, "label")) { + if(!strcasecmp(s, "label")) { menu_ptr = *menu_next = calloc(1, sizeof **menu_next); menu_next = &menu_ptr->next; menu_idx++; @@ -343,37 +343,51 @@ int read_config_file(void) continue; } - if(!strcmp(s, "kernel") && menu_ptr) { + if(!strcasecmp(s, "kernel") && menu_ptr) { menu_ptr->kernel = strdup(t); continue; } - if(!strcmp(s, "linux") && menu_ptr) { + if(!strcasecmp(s, "linux") && menu_ptr) { menu_ptr->linux = strdup(t); continue; } - if(!strcmp(s, "localboot") && menu_ptr) { + if(!strcasecmp(s, "localboot") && menu_ptr) { menu_ptr->localboot = strdup(t); continue; } - if(!strcmp(s, "initrd") && menu_ptr) { + if(!strcasecmp(s, "initrd") && menu_ptr) { menu_ptr->initrd = strdup(t); continue; } - if(!strcmp(s, "append")) { + if(!strcasecmp(s, "append")) { (menu_ptr ?: menu_default)->append = strdup(t); u = strlen(t); if(u > append_size) append_size = u; continue; } - if(!strcmp(s, "ipappend")) { + if(!strcasecmp(s, "ipappend")) { (menu_ptr ?: menu_default)->ipappend = strdup(t); continue; } + + if(!strcasecmp(s, "menu") && menu_ptr) { + s = skip_spaces(t); + t = skip_nonspaces(s); + if(*t) *t++ = 0; + t = skip_spaces(t); + + if(!strcasecmp(s, "label")) { + menu_ptr->label = strdup(t); + u = strlen(t); + if(u > label_size) label_size = u; + continue; + } + } } fclose(f); @@ -686,21 +700,36 @@ void *load_one(char *file, ssize_t *file_size) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Locate menu entry and boot. +// Boot menu entry. // -void boot(void) +// cmdline can optionally start with label string. +// +void boot(int index) { - char *label, *arg, *s; + char *arg; menu_t *menu_ptr; + int label_len; + + for(menu_ptr = menu; menu_ptr; menu_ptr = menu_ptr->next, index--) { + if(!index) break; + } - label = skip_spaces(cmdline); - arg = skip_spaces(s = skip_nonspaces(label)); - *s = 0; + // invalid index or menu entry + if(!menu_ptr || !menu_ptr->label) return; - for(menu_ptr = menu; menu_ptr; menu_ptr = menu_ptr->next) { - if(menu_ptr->label && !strcmp(menu_ptr->label, label)) break; + arg = skip_spaces(cmdline); + label_len = strlen(menu_ptr->label); + + // if it does not start with label string, skip first word + if(strncmp(arg, menu_ptr->label, label_len)) { + arg = skip_nonspaces(arg); + } + else { + arg += label_len; } + arg = skip_spaces(arg); + boot_entry(menu_ptr, arg); } @@ -807,6 +836,8 @@ void boot_entry(menu_t *menu_ptr, char *arg) __farcall(gfx.code_seg, gfx.jmp_table[GFX_CB_PROGRESS_DONE], &r, &r); + gfx_done(); + syslinux_boot_linux(kernel, kernel_size, initrd, arg); } -- 1.6.4.2
H. Peter Anvin
2010-Apr-23 18:32 UTC
[syslinux] [PATCH] gfxboot: support MENU LABEL statement
On 04/09/2010 09:08 AM, Steffen Winterfeldt wrote:> > The config file parser now accepts MENU LABEL. Also, make config statements > case-insensitive. > > Signed-off-by: Steffen Winterfeldt <wfeldt at opensuse.org>Hi Steffen, This patch arrived corrupt... could you send it again? Thanks, -hpa
Sebastian Herbszt
2010-Apr-23 20:12 UTC
[syslinux] [PATCH] gfxboot: support MENU LABEL statement
H. Peter Anvin wrote:> On 04/09/2010 09:08 AM, Steffen Winterfeldt wrote: >> >> The config file parser now accepts MENU LABEL. Also, make config statements >> case-insensitive. >> >> Signed-off-by: Steffen Winterfeldt <wfeldt at opensuse.org> > > Hi Steffen, > > This patch arrived corrupt... could you send it again? > > Thanks, > > -hpaI got this and another 6 patches from Steffen queued up. Will commit and send a pull request this weekend. Sebastian
Seemingly Similar Threads
- [PATCH] gfxboot: add include and menu include support
- [PATCH] gfxboot: allow boot entry to start with label instead of menu_label
- [patch 1/1] syslinux: add suport for com32 entries in the menu
- [patch 1/1] syslinux: add suport for com32 entries inthe menu
- [PATCH] Adding ocfs support to blkid