PXE interactive menu - multi level


This part will describe how to make a multi-level NetBoot menu.


You need to have complete the following steps:



Start situation

If you've done the previous part you should have something like:

/tftpboot/
   |
   | 
   |_____ pxelinux.0                 NetBoot PXE root file
   |
   |
   |_____ rescue/                    Ubuntu 14.04 installation disk
             |
             |______ pxelinux.0        -Symlink-
             |
             |______ pxelinux.cfg/     -Symlink-
             |
             |______ ubuntu-installer/
             | 
             |______ version.info
   |
   |
   |_____ pxelinux.cfg/              PXE NetBoot configuration folder
             |
             |______ default         NetBoot menu
             |
             |______ vesamenu.c32
             |
             |______ splash.png
   |
   |
   |_____ images/
             |
             |______ wheezy/         Debian 7.x [wheezy] - ready to use
             |
             |______ trusty/         Ubuntu 14.04 [trusty] - ready to use



Move all distribution to the same root

For the multi-level menu to work, everything must share the same root!


So, we must move the "/rescue/ubuntu-installer" to "/ubuntu-installer"


cd /tftpboot
mv rescue/ubuntu-installer/ .
rm -Rf rescue/


Now, you should have:


/tftpboot/
   |
   | 
   |_____ pxelinux.0                 NetBoot PXE root file
   |
   |
   |_____ pxelinux.cfg/              PXE NetBoot configuration folder
             |
             |______ default         NetBoot menu
             |
             |______ vesamenu.c32
             |
             |______ splash.png
   |
   |
   |_____ ubuntu-installer/          Ubuntu 14.04 installation disk
   |
   |
   |_____ images/
             |
             |______ wheezy/         Debian 7.x [wheezy] - ready to use
             |
             |______ trusty/         Ubuntu 14.04 [trusty] - ready to use



Configure / setup menu content

Edit the PXE NetBoot file:

vim /tftpboot/pxelinux.cfg/default


Put:

#### GENERIC OPTIONS #####
# Enable text menu
#DEFAULT pxelinux.cfg/menu.c32
# Enable graphical menu
DEFAULT pxelinux.cfg/vesamenu.c32
# Prompt for user input? (0 = choose from menu, 1 = you can type anything)
PROMPT 0
# Allow or not the user to left the menu (1 = user is locked to the menu)
NOESCAPE 1
# Time before using default option
TIMEOUT 50


#### Menu settings #####
MENU TITLE my super netboot menu
# Setup background image (the resolution is $WIDTH $HEIGHT and must match the given picture)
MENU RESOLUTION 640 480
MENU BACKGROUND pxelinux.cfg/splash.png
# Setup text properties
MENU WIDTH 80
MENU ROWS 14
MENU MARGIN 10


#### Distributions - ready to be use #####
# Debian wheezy
LABEL wheezy
    MENU LABEL Debian 7.x [wheezy]
    MENU DEFAULT
    # Kernel and boot files
    KERNEL images/wheezy/vmlinuz 
    APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/wheezy

# Ubuntu 14.04
LABEL trusty
    MENU LABEL Ubuntu 14.04 [trusty]
    # Kernel and boot files
    KERNEL images/trusty/vmlinuz
    APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/trusty

MENU END


#### Rescue #####
MENU BEGIN rescue
    LABEL previous
          MENU LABEL previous menu
    MENU exit
    MENU separator
    MENU include ubuntu-installer/amd64/boot-screens/menu.cfg
MENU END


You must always use "MENU END" before starting a new menu.


The Label is used to go back to the previous screen. It something you should always do!


Note all the new "MENU" commands:

  • EXIT
  • SEPARATOR
  • INCLUDE => to import the sub-menu file



References

More about the menu configuration: