Difference between revisions of "PXE interactive menu - multi level"

(Created page with "This part will describe how to make a multi-level NetBoot menu. You need to have complete the following steps: * NetBoot server * Diskless netboot|Diskless server / w...")
 
Line 141: Line 141:
  
  
#### Distributions #####
+
#### Distributions - ready to be use #####
 
# Debian wheezy
 
# Debian wheezy
 
LABEL wheezy
 
LABEL wheezy
Line 157: Line 157:
 
     APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=192.168.2.2:/nfs/trusty
 
     APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=192.168.2.2:/nfs/trusty
  
# Ubuntu 14.04
+
MENU END
LABEL trusty
+
 
     MENU LABEL Xubuntu 14.04 - LIVE CD
+
 
     # Kernel and boot files
+
#### Rescue #####
     KERNEL images/trusty/vmlinuz
+
MENU BEGIN rescue
     APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=192.168.2.2:/nfs/xubuntu
+
     LABEL previous
 +
     MENU exit
 +
     MENU separator
 +
     MENU include ubuntu-installer/amd64/boot-screens/menu.cfg
 +
MENU END
  
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
Note all the "MENU" commands + PROMPT 0
+
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
  
  

Revision as of 15:50, 4 June 2014

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=192.168.2.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=192.168.2.2:/nfs/trusty

MENU END


#### Rescue #####
MENU BEGIN rescue
    LABEL previous
    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: https://eldon.me/?p=54