PXE Boot Menu with Sub-menus
Last Updated on 2017-03-25 by Sture
Description
A simple GUI menu system with sub-menus is used for selecting between different tasks.
WWW: http://syslinux.zytor.com/wiki/index.php/Menu.
Files: https://www.kernel.org/pub/linux/utils/boot/syslinux/.
Syslinux 5 Changelog:http://www.syslinux.org/wiki/index.php/Syslinux_6_Changelog#Changes_in_6.03/Menu.
Requirements
The following application(s) must be installed, configured and running before tftp-hpa is installed:
- isc-dhcp – ISC Dynamic Host Configuration Protocol server
- tftp-hpa – BSD derived TFTP Server
Preparation for Installation
Start PuTTY on a Windows PC, Terminal on a Mac or similar terminal application on a Linux PC.
In this example Terminal on a Mac is used.
Open a remote SSH session to the server with:
Mac:~ user$ ssh user@192.168.1.4 [enter]
N.B.: Replace user@192.168.1.4 with User ID and IP Address on Your server!
[user@server ~]$
Enable superuser privileges with:
[user@server ~]$ sudo -s [enter]
Password: <-- passwd [enter]
[root@server /usr/home/user]#
N.B.: Enter user password, not the root password!
Download
Download file syslinux-6.03.tar.xz, about 6.5M, with;;
[root@server /usr/home/user]# wget https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz --no-check-certificate [enter]
--2017-03-02 17:46:01-- https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz
Resolving www.kernel.org (www.kernel.org)... 199.204.44.194, 149.20.4.69, 198.145.20.140, ...
Connecting to www.kernel.org (www.kernel.org)|199.204.44.194|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6855224 (6,5M) [application/x-xz]
Saving to: ‘syslinux-6.03.tar.xz’
syslinux-6.03.tar.xz 100%[============================================================================================>] 6,54M 765KB/s in 9,8s
2017-03-02 17:46:12 (683 KB/s) - ‘syslinux-6.03.tar.xz’ saved [6855224/6855224]
[root@server /usr/home/user]#
Wait for download to be completed and than extract ~/syslinux-6.03.tar.xz with:
[root@server /usr/home/user]# tar -xf syslinux-6.03.tar.xz [enter]
[root@server /usr/home/user]#
Installation
For the lwIP embedded TCP/IP network stack copy file syslinux-6.03/bios/core/pxelinux.0 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/core/pxelinux.0 /tftpboot/ [enter]
[root@server /usr/home/user]#
For the new lwIP embedded TCP/IP network stack copy file ~/syslinux-6.03/bios/core/lpxelinux.0 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/core/lpxelinux.0 /tftpboot/ [enter]
[root@server /usr/home/user]#
For the legacy TCP/IP network stack copy file syslinux-6.03/bios/gpxe/gpxelinux.0 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/gpxe/gpxelinux.0 /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/bios/com32/lib/libcom32.c32 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/com32/lib/libcom32.c32 /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/bios/com32/libutil/libutil.c32 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/com32/libutil/libutil.c32 /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/bios/com32/menu/menu.c32 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/com32/menu/menu.c32 /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/bios/com32/menu/vesamenu.c32 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/com32/menu/vesamenu.c32 /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/bios/com32/modules/linux.c32 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/com32/modules/linux.c32 /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/bios/com32/modules/reboot.c32 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/com32/modules/reboot.c32 /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/bios/com32/chain/chain.c32 to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/com32/chain/chain.c32 /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/sample/syslinux_splash.jpg to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/sample/syslinux_splash.jpg /tftpboot/ [enter]
[root@server /usr/home/user]#
Copy file ~/syslinux-6.03/bios/memdisk/memdisk to /tftpboot/ with:
[root@server /usr/home/user]# cp syslinux-6.03/bios/memdisk/memdisk /tftpboot/ [enter]
[root@server /usr/home/user]#
Display files in directory /tftpboot with:
[root@server /usr/home/user]# ls -l /tftpboot/ [enter]
total 1343
-rwxr-xr-x 1 root wheel 24560 Mar 2 18:48 chain.c32
-rw-r--r-- 1 root wheel 111334 Mar 2 18:44 gpxelinux.0
drwxr-xr-x 2 root wheel 2 Mar 2 11:37 images
-rwxr-xr-x 1 root wheel 122308 Mar 2 18:48 ldlinux.c32
-rwxr-xr-x 1 root wheel 186500 Mar 2 18:44 libcom32.c32
-rwxr-xr-x 1 root wheel 24148 Mar 2 18:44 libutil.c32
-rwxr-xr-x 1 root wheel 4660 Mar 2 18:44 linux.c32
-rw-r--r-- 1 root wheel 91550 Mar 2 18:43 lpxelinux.0
-rw-r--r-- 1 root wheel 26140 Mar 2 18:49 memdisk
-rwxr-xr-x 1 root wheel 26596 Mar 2 18:44 menu.c32
-rw-r--r-- 1 root wheel 46909 Mar 2 18:41 pxelinux.0
drwxr-xr-x 2 root wheel 2 Mar 2 11:37 pxelinux.cfg
-rwxr-xr-x 1 root wheel 1376 Mar 2 18:48 reboot.c32
-rw-r--r-- 1 root wheel 56299 Mar 2 18:49 syslinux_splash.jpg
-rwxr-xr-x 1 root wheel 27104 Mar 2 18:44 vesamenu.c32
[root@server /usr/home/user]#
Delete the extracted folder and the downloaded .xz file with;
[root@server /usr/home/user]# rm -R syslinux-6.03; rm syslinux-6.03.tar.xz [enter]
[root@server /usr/home/user]#
Configuration
Critical Tasks Password
openssl passwd command can be used to compute the MD5-based hash of password used in the PXE Boot Menus.
[root@server /usr/home/user]# openssl passwd -1 passwd
$1$./xB0ZYM$EaUHney4jC51AtxBjdln2/
[root@server /usr/home/user]#
PXE Boot Main Menu
The PXE Boot Main Menu is defined in file /tftpboot/pxelinux.cfg/default.
Create this file with:
[root@server /usr/home/user]# ee /tftpboot/pxelinux.cfg/default
…and add the following text:
DEFAULT vesamenu.c32
PROMT 0
NOESCAPE 1
TIMEOUT 300
TOTALTIMEOUT 450
MENU WIDTH 78
MENU MARGIN 1
MENU ROWS 20
MENU TIMEOUTROW 25
MENU HELPMSGROW 26
MENU BACKGROUND syslinux_splash.jpg
MENU MASTER PASSWD $1$./xB0ZYM$EaUHney4jC51AtxBjdln2/
MENU PASSPROMT Enter Password
MENU TITLE PXE Boot Main Menu - server.example.net
MENU COLOR BORDER 0 #ffffffff #ee000000 std
MENU COLOR TITLE 0 #ffffffff #ee000000 std
MENU COLOR SEL 0 #ff00ff00 #ff000000 std
MENU COLOR UNSEL 0 #ffffffff #ee000000 std
MENU COLOR PWDHEADER 0 #ff000000 #99ffffff rev
MENU COLOR PWDBORDER 0 #ff000000 #99ffffff rev
MENU COLOR PWDENTRY 0 #ff000000 #99ffffff rev
MENU COLOR HOTKEY 0 #ff00ff00 #ee000000 std
MENU COLOR HOTSEL 0 #ffffffff #85000000 std
LABEL blank
MENU LABEL
LABEL hd
MENU LABEL ^H) Boot to Local Hard Disk
LOCALBOOT 0x80
LABEL floppy
MENU LABEL ^F) Boot to Local Floppy Disk
LOCALBOOT 0x00
LABEL cr
MENU LABEL ^R) Coold Reboot
COM32 reboot.c32
LABEL wr
MENU LABEL ^W) Warm Reboot
COM32 reboot.c32
APPEND -w
LABEL next
MENU LABEL ^N) Skip PXE Boot (Boot Next Device)
MENU DEFAULT
LOCALBOOT -1
N.B.: Remember to change MENU MASTER PASSWD and MENU TITLE PXE!
PXE Boot Sub-Menus – Top Part
PXE Boot Sub-Menus top part is defined in file tftpboot/top.cfg:
Create this file with:
[root@server /usr/home/user]# ee /tftpboot/top.cfg
…and add the following text:
DEFAULT vesamenu.c32
PROMT 0
NOESCAPE 1
TIMEOUT 300
TOTALTIMEOUT 450
MENU WIDTH 78
MENU MARGIN 1
MENU ROWS 20
MENU TIMEOUTROW 25
MENU HELPMSGROW 26
MENU BACKGROUND syslinux_splash.jpg
MENU MASTER PASSWD $1$./xB0ZYM$EaUHney4jC51AtxBjdln2/
MENU PASSPROMT Enter Password
MENU COLOR BORDER 0 #ffffffff #ee000000 std
MENU COLOR TITLE 0 #ffffffff #ee000000 std
MENU COLOR SEL 0 #ff00ff00 #ff000000 std
MENU COLOR UNSEL 0 #ffffffff #ee000000 std
MENU COLOR PWDHEADER 0 #ff000000 #99ffffff rev
MENU COLOR PWDBORDER 0 #ff000000 #99ffffff rev
MENU COLOR PWDENTRY 0 #ff000000 #99ffffff rev
MENU COLOR HOTKEY 0 #ff00ff00 #ee000000 std
MENU COLOR HOTSEL 0 #ffffffff #85000000 std
N.B.: Remember to change MENU MASTER PASSWD!
PXE Boot Sub-Menus – Bottom Part
PXE Boot Sub-Menus bottom part is defined in file tftpboot/bottom.cfg:
Create this file with:
[root@server /usr/home/user]# ee /tftpboot/bottom.cfg
…and add the following text:
LABEL blank
MENU LABEL
LABEL hd
MENU LABEL ^H) Boot to Local Hard Disk
localboot 0x80
LABEL floppy
MENU LABEL ^F) Boot to Local Floppy Disk
localboot 0x00
LABEL cr
MENU LABEL ^R) Coold Reboot
COM32 reboot.c32
LABEL wr
MENU LABEL ^W) Warm Reboot
COM32 reboot.c32
APPEND -w
LABEL return
MENU LABEL ^R) Return to PXE Boot Main Menu
MENU DEFAULT
KERNEL vesamenu.c32
APPEND ~
Change file modes
Change file modes for all files in directory /tftpboot with:
[root@server ~]# chmod -R 755 /tftpboot [enter]
[root@server /usr/home/user]#
The sub-menus in this example will be named tftpboot/f01.cfg, tftpboot/f02.cfg,… and any files used in the sub-menus will be stored in directory named tftpboot/f01, tftpboot/f02, …