[syslinux] Problem with "additional" submenus

Murali Ganapathy murali at google.com
Mon Nov 27 18:15:35 PST 2006


Found the problem. In "libmenu/menu.h" defines the maximum number of
menu's in the menusystem to be 10. You are using 11 menus. So the last
call to "add_named_menu" should be returning with an error. If you
increase the "MAXMENUS" in libmenu/menu.h to say 32, you should be OK.

- Murali

On 11/26/06, Murali Krishnan Ganapathy <gmkrishn.uofc at gmail.com> wrote:
> Thanks for including the code. My first guess would have been the
> named menu stuff (which you have kind off ruled out). Could you try to
> see which is the first version of the menu system where the current
> code breaks?
>
> I will try to hunt down the issue.
>
> - Murali
>
> On 11/22/06, Grant Gossett <ggossett at symantec.com> wrote:
> > Hello all,
> >
> > First off, thanks for the great work.
> >
> > I have recently added "more submenus" to a functioning advanced menu
> > that only had one "submenu off of the main menu before" The addition of
> > the new submenus has caused the main menu to not function correctly and
> > I have been pouring over the code for several weeks and I just cannot
> > see the error that I have introduced. This happens with both syslinux
> > 3.20-pre8 and newer versions (sorry, I want to say 3.31 something, but
> > don't have exact version number this was tried with other than
> > 3.20-pre8)
> >
> > What was a single first-level menu off of the main menu now instead of
> > having all "OPT_RUN" items now has additional "OPT_SUBMENU" items to aid
> > in organization. I'll refer to this menu as the first-level submenu,
> > because all of the subsequent submenus work perfectly off of this
> > first-level submenu.
> >
> > The best description of what is happening is this:
> >
> > Instead of the main menu options only being displayed, the first-level
> > submenu is displayed at the top of my now mangled main menu. The title
> > of the now mangled main menu is the displayed as the title of the
> > first-level submenu. The good main menu options are displayed below the
> > options for the first-level submenu in my now mangled main menu. For a
> > visual description here is the best I can do, and I apologize if it word
> > wraps and just makes it more confusing:
> >
> > What I want to see:
> >
> > (main menu title)
> > Boot Normally
> > Win 98 Startup Disk
> > Linux Kickstart Options -->     (Linux Kickstart Options level-1 submenu
> > title)
> >                                         Redhat EL (submenu) -->
> > (L2 submenu title..)
> >                                         Fedora Core (submenu) -->
> >                                         RedHat 9 (submenu) -->
> >                                         Return to main menu (exitmenu)
> > What I see:
> >
> > (Linux Kickstart Options level-1 submenu title)
> > Redhat EL (submenu) -->
> > Fedora Core (submenu) -->
> > RedHat 9 (submenu) -->
> > Return to main menu (exitmenu) --> (goes to boot: prompt)
> > Boot Normally
> > Win 98 Startup Disk
> > Linux Kickstart Options --> (goes to boot: prompt instead of first-level
> > submenu)
> >
> >
> > In addition to the code you'll find below, I have also tried to use the
> > add_menu funtion rather than add_named_menu to add the menus and have
> > used those return values in the calls to "add_item(.., OPT_SUBMENU,..)"
> > for the 5th parameters and I get the exact same results.
> >
> > Here is my code, hopefully someone can spot what I am doing wrong:
> >
> > #ifndef NULL
> > #define NULL ((void *) 0)
> > #endif
> >
> > #include "menu.h"
> > #include "com32io.h"
> > #include <string.h>
> >
> >
> > TIMEOUTCODE ontimeout()
> > {
> >   return CODE_ENTER;
> > }
> >
> >
> > int main(void)
> > {
> >   t_menuitem * curr;
> >
> >   // Choose the default title and setup default values for all
> > attributes....
> >   init_menusystem(NULL);
> >   set_window_size(1,1,23,78); // Leave one row/col border all around
> >
> >   reg_ontimeout(ontimeout, 3000, 0);
> >
> >
> >   // Advanced Server 4 Submenu
> >   add_named_menu("Advanced Server 4", "Select Update revision", -1);
> >   add_item("Release", "Release", OPT_RUN, "RHELAS4_x86", 0);
> >   add_item("Update 1", "Update 1", OPT_RUN, "RHELAS4_x86_U1", 0);
> >   add_item("Update 2", "Update 2", OPT_RUN, "RHELAS4_x86_U2", 0);
> >   add_item("Update 3", "Update 3", OPT_RUN, "RHELAS4_x86_U3", 0);
> >   add_item("Update 4", "Update 4", OPT_RUN, "RHELAS4_x86_U4", 0);
> >   add_item("Back to RHEL Options Menu", "Back to Redhat Enterprise Linux
> > Options Menu", OPT_EXITMENU, "exit", 0);
> >
> >   // Enterprise Server 4 Submenu
> >   add_named_menu("Enterprise Server 4", "Select Update revision", -1);
> >   add_item("Release", "Release", OPT_RUN, "RHELES4_x86", 0);
> >   add_item("Update 1", "Update 1", OPT_RUN, "RHELES4_x86_U1", 0);
> >   add_item("Update 2", "Update 2", OPT_RUN, "RHELES4_x86_U2", 0);
> >   add_item("Update 3", "Update 3", OPT_RUN, "RHELES4_x86_U3", 0);
> >   add_item("Update 4", "Update 4", OPT_RUN, "RHELES4_x86_U4", 0);
> >   add_item("Back to RHEL Options Menu", "Back to Redhat Enterprise Linux
> > Options Menu", OPT_EXITMENU, "exit", 0);
> >
> >   // Workstation 4 Submenu
> >   add_named_menu("Workstation 4", "Select Update revision", -1);
> >   add_item("Release", "Release", OPT_RUN, "RHELWS4_x86", 0);
> >   add_item("Update 1", "Update 1", OPT_RUN, "RHELWS4_x86_U1", 0);
> >   add_item("Update 2", "Update 2", OPT_RUN, "RHELWS4_x86_U2", 0);
> >   add_item("Update 3", "Update 3", OPT_RUN, "RHELWS4_x86_U3", 0);
> >   add_item("Update 4", "Update 4", OPT_RUN, "RHELWS4_x86_U4", 0);
> >   add_item("Back to RHEL Options Menu", "Back to Redhat Enterprise Linux
> > Options Menu", OPT_EXITMENU, "exit", 0);
> >
> >   // Advanced Server 3 Submenu
> >   add_named_menu("Advanced Server 3", "Select Update revision", -1);
> >   add_item("Release", "Release", OPT_RUN, "RHELAS3_x86", 0);
> >   add_item("Update 1", "Update 1", OPT_RUN, "RHELAS3_x86_U1", 0);
> >   add_item("Update 2", "Update 2", OPT_RUN, "RHELAS3_x86_U2", 0);
> >   add_item("Update 3", "Update 3", OPT_RUN, "RHELAS3_x86_U3", 0);
> >   add_item("Update 4", "Update 4", OPT_RUN, "RHELAS3_x86_U4", 0);
> >   add_item("Update 5", "Update 5", OPT_RUN, "RHELAS3_x86_U5", 0);
> >   add_item("Update 6", "Update 6", OPT_RUN, "RHELAS3_x86_U6", 0);
> >   add_item("Update 7", "Update 7", OPT_RUN, "RHELAS3_x86_U7", 0);
> >   add_item("Update 8", "Update 8", OPT_RUN, "RHELAS3_x86_U8", 0);
> >   add_item("Back to RHEL Options Menu", "Back to Redhat Enterprise Linux
> > Options Menu", OPT_EXITMENU, "exit", 0);
> >
> >   // Enterprise Server 3 Submenu
> >   add_named_menu("Enterprise Server 3", "Select Update revision", -1);
> >   add_item("Release", "Release", OPT_RUN, "RHELES3_x86", 0);
> >   add_item("Update 1", "Update 1", OPT_RUN, "RHELES3_x86_U1", 0);
> >   add_item("Update 2", "Update 2", OPT_RUN, "RHELES3_x86_U2", 0);
> >   add_item("Update 3", "Update 3", OPT_RUN, "RHELES3_x86_U3", 0);
> >   add_item("Update 4", "Update 4", OPT_RUN, "RHELES3_x86_U4", 0);
> >   add_item("Update 5", "Update 5", OPT_RUN, "RHELES3_x86_U5", 0);
> >   add_item("Update 6", "Update 6", OPT_RUN, "RHELES3_x86_U6", 0);
> >   add_item("Update 7", "Update 7", OPT_RUN, "RHELES3_x86_U7", 0);
> >   add_item("Update 8", "Update 8", OPT_RUN, "RHELES3_x86_U8", 0);
> >   add_item("Back to RHEL Options Menu", "Back to Redhat Enterprise Linux
> > Options Menu", OPT_EXITMENU, "exit", 0);
> >
> >   // Workstation 3 Submenu
> >   add_named_menu("Workstation 3", "Select Update revision", -1);
> >   add_item("Release", "Release", OPT_RUN, "RHELWS3_x86", 0);
> >   add_item("Update 1", "Update 1", OPT_RUN, "RHELWS3_x86_U1", 0);
> >   add_item("Update 2", "Update 2", OPT_RUN, "RHELWS3_x86_U2", 0);
> >   add_item("Update 3", "Update 3", OPT_RUN, "RHELWS3_x86_U3", 0);
> >   add_item("Update 4", "Update 4", OPT_RUN, "RHELWS4_x86_U4", 0);
> >   add_item("Update 5", "Update 5", OPT_RUN, "RHELWS3_x86_U5", 0);
> >   add_item("Update 6", "Update 6", OPT_RUN, "RHELWS3_x86_U6", 0);
> >   add_item("Update 7", "Update 7", OPT_RUN, "RHELWS3_x86_U7", 0);
> >   add_item("Update 8", "Update 8", OPT_RUN, "RHELWS3_x86_U8", 0);
> >   add_item("Back to RHEL Options Menu", "Back to Redhat Enterprise Linux
> > Options Menu", OPT_EXITMENU, "exit", 0);
> >
> >   // Redhat Enterprise Linux Kickstart Submenu Items
> >   add_named_menu("Redhat Enterprise Linux Options", "Redhat Enterprise
> > Linux Options", -1);
> >   add_item("Advanced Server version 4", "Kickstart Redhat Enterprise
> > Linux Advanced Server 4", OPT_SUBMENU, "Advanced Server 4", 0);
> >   add_item("Enterprise Server version 4", "Kickstart Redhat Enterprise
> > Linux Enterprise Server 4", OPT_SUBMENU, "Enterprise Server 4", 0);
> >   add_item("Workstation version 4", "Kickstart Redhat Enterprise Linux
> > Workstation 4", OPT_SUBMENU, "Workstation 4", 0);
> >   add_item("Advanced Server version 3", "Kickstart Redhat Enterprise
> > Linux Advanced Server 3", OPT_SUBMENU, "Advanced Server 3", 0);
> >   add_item("Enterprise Server version 3", "Kickstart Redhat Enterprise
> > Linux Enterprise Server 3", OPT_SUBMENU, "Enterprise Server 3", 0);
> >   add_item("Workstation version 3", "Kickstart Redhat Enterprise Linux
> > Workstation 3", OPT_SUBMENU, "Workstation 3", 0);
> >   add_item("Back to Kickstart Options Menu", "Back to Kickstart Options
> > Menu", OPT_EXITMENU, "exit", 0);
> >
> >   // Fedora Core Kickstart Submenu Items
> >   add_named_menu("Fedora Core Options", "Fedora Core Options", -1);
> >   add_item("Fedora Core version 4", "Kickstart Fedora Core 4", OPT_RUN,
> > "FC4_x86", 0);
> >   add_item("Fedora Core version 5", "Kickstart Fedora Core 5", OPT_RUN,
> > "FC5_x86", 0);
> >   add_item("Fedora Core version 6", "Kickstart Fedora Core 6", OPT_RUN,
> > "FC6_x86", 0);
> >   add_item("Back to Kickstart Options Menu", "Back to Kickstart Options
> > Menu", OPT_EXITMENU, "exit", 0);
> >
> >   // Redhat Linux Kickstart Submenu Items
> >   add_named_menu("Redhat Linux Options", "Redhat Linux Options", -1);
> >   add_item("Redhat version 9", "Kickstart Redhat 9", OPT_RUN, "RH9_x86",
> > 0);
> >   add_item("Back to Kickstart Options Menu", "Back to Kickstart Options
> > Menu", OPT_EXITMENU, "exit", 0);
> >
> >   // Linux Kickstart Submenu
> >   add_named_menu("Linux Kickstart Options", "Linux Kickstart Options",
> > -1);
> >   add_item("Redhat Enterprise Linux", "Kickstart Redhat Enterprise Linux
> > versions", OPT_SUBMENU, "Redhat Enterprise Linux Options", 0);
> >   add_item("Fedora Core", "Kickstart Fedora Core versions", OPT_SUBMENU,
> > "Fedora Core Options", 0);
> >   add_item("Redhat Linux", "Kickstart Redhat Linux versions",
> > OPT_SUBMENU, "Redhat Linux Options", 0);
> >   add_item("Back to QALABS PXE Menu", "Back to QALABS PXE Menu",
> > OPT_EXITMENU, "exit", 0);
> >
> >   // Main Menu Items
> >   add_named_menu("PXE Menu", "PXE Menu", -1);
> >   add_item("Boot Normally", "Boot Normally", OPT_RUN,
> > "normal_boot_order", 0);
> >   add_item("Windows 98 SE Startup Disk", "Windows 98 SE Startup Disk",
> > OPT_RUN, "win98_bootdisk", 0);
> >   add_item("Linux Kickstart Options", "Kickstart install various Linux
> > distributions", OPT_SUBMENU, "Linux Kickstart Options", 0);
> >
> >
> >
> >   curr = showmenus(find_menu_num("PXE Menu"));
> >
> >   if (curr)
> >   {
> >         if (curr->action == OPT_RUN)
> >         {
> >             if (issyslinux()) runsyslinuxcmd(curr->data);
> >             else csprint(curr->data,0x07);
> >             return 1;
> >         }
> >         csprint("Error! Bad things have happened to the network boot
> > menu", 0x07);
> >   }
> >   return 0;
> > }
> >
> > _______________________________________________
> > SYSLINUX mailing list
> > Submissions to SYSLINUX at zytor.com
> > Unsubscribe or set options at:
> > http://www.zytor.com/mailman/listinfo/syslinux
> > Please do not send private replies to mailing list traffic.
> >
> >
>
> _______________________________________________
> SYSLINUX mailing list
> Submissions to SYSLINUX at zytor.com
> Unsubscribe or set options at:
> http://www.zytor.com/mailman/listinfo/syslinux
> Please do not send private replies to mailing list traffic.
>
>




More information about the Syslinux mailing list