[syslinux] syslinux 3.11 patch for handling both KVM and serial console input

Alford, Seth Seth_Alford at adp.com
Tue Jun 30 13:22:00 PDT 2009


We modified our copy of syslinux.  We're now sharing those
modifications.  That's so that:

1.  We fulfill our requirements under the GPL
2.  Our modifications might be picked up and included in the base
    code.  That way we wouldn't have to make the same
    modifications, again, later.

Since we're using CentOS 5.3, and CentOS 5.3 derives from RHEL
5.3, and RHEL 5.3 uses syslinux 3.11, we modified syslinux
version 3.11.

The modification are in the form of a patch, which appears below.

Our Linux systems may have an old-style "green screen" terminal
attached to the serial console.  Or they may have a keyboard, VGA
display and mouse (KVM.)  Originally, our isolinux menu more or
less offered the user the choices of

1.  Install using the KVM
2.  Install using the serial terminal
3.  Restore from tape using the KVM
4.  Restore from tape using the terminal
5.  Use rescue mode from the KVM
6.  Use rescue mode from the terminal

The user was supposed to input a number, 1 through 6, based on
what the user wanted to do and what type of display the system
had.

We decided that syslinux itself could figure out whether input
came from the KVM or a serial console.  So all the user needed to
do was figure out whether to install, restore, or use rescue
mode.  That way, the user would only have to figure out a 3 item
menu, rather than a 6 item menu.  So now the user sees a menu
which looks more or less like:

                        If you want to..........type:

                          Restore.................1
                          Install.................2
                          Use rescue mode.........3

The user still inputs a number, 1 through 3.

To make this work, we added a FromFlag byte before the command
line buffer in the syslinux code.  If the input came from the
serial terminal, FromFlag got a "-" character (without the
quotes) stored in it.  If the input came from the KVM, FromFlag
got a "+" character (without quotes).  In the isolinux.cfg menu,
we created entries for +1, -1, +2, -2, +3, and -3, with
appropriate flags for serial console for the "-" entries.  The
"1" entries do a restore.  The "2" entries do an install.  The
"3" entries put the system into rescue mode.  With the patch,
syslinux also tries the user input with the +/- prepended.

Here's the isolinux.cfg menu:

----isolinux.cfg menu starts----
serial 0 38400
prompt 1
timeout 0
display boot.msg
F1 boot.msg
label +1
  kernel vmlinuz
  append initrd=initrd.img ks=cdrom:isolinux/ks_restore.cfg text
label -1
  kernel vmlinuz
  append initrd=initrd.img console=ttyS0,38400n8 ks=cdrom:isolinux/ks_restore.cfg text
label +2
  kernel vmlinuz
  append initrd=initrd.img ks=cdrom:isolinux/ks.cfg text
label -2
  kernel vmlinuz
  append initrd=initrd.img console=ttyS0,38400n8 ks=cdrom:isolinux/ks.cfg text
label +3
  kernel vmlinuz
  append rescue initrd=initrd.img text
label -3
  kernel vmlinuz
  append rescue initrd=initrd.img console=ttyS0,38400n8 text
----isolinux.cfg menu ends----

David Parsons, who is no longer with ADP, did most of the
modifications which made this work.

--Seth Alford
ADP Dealer Services
seth_alford at adp.com

----patch follows----
--- s_yslinux-3.11.orig/conio.inc	2005-08-18 13:53:39.000000000 -0700
+++ s_yslinux-3.11.new/conio.inc	2009-03-19 17:29:55.000000000 -0700
@@ -356,8 +356,10 @@
 .serial:	xor ah,ah		; Avoid confusion
 		xchg dx,bx		; Data port
 		in al,dx
+		mov byte [FromFlag],45  ; '-' flags input from serial
 		ret
-.kbd:		mov ah,10h		; Get keyboard input
+.kbd:		mov byte [FromFlag],43  ; '+' flags input from console
+		mov ah,10h		; Get keyboard input
 		int 16h
 		cmp al,0E0h
 		jnz .not_ext
--- s_yslinux-3.11.orig/parseconfig.inc	2005-08-30 15:36:49.000000000 -0700
+++ s_yslinux-3.11.new/parseconfig.inc	2009-03-20 13:51:17.000000000 -0700
@@ -393,6 +393,7 @@
 
 		section .latebss
                 alignb 4		; For the good of REP MOVSD
+FromFlag	resb 1			; ADP: becomes '-' for serial, '+' for kbd
 command_line	resb max_cmd_len+2	; Command line buffer
 		alignb 4
 default_cmd	resb max_cmd_len+1	; "default" command line
--- s_yslinux-3.11.orig/ui.inc	2005-08-30 15:54:14.000000000 -0700
+++ s_yslinux-3.11.new/ui.inc	2009-03-20 15:12:45.000000000 -0700
@@ -196,6 +196,13 @@
 ; First we need to mangle the kernel name the way DOS would...
 ;
 		mov si,command_line
+		call find
+		mov si,FromFlag
+		call find
+		mov si,command_line
+		jmp bad_kernel
+
+find:
                 mov di,KernelName
                 push si
                 push di
@@ -346,6 +353,8 @@
 		add bx,byte 4
 		cmp bx,exten_table_end
 		jna .search_loop		; allow == case (final case)
+		ret
+
 		; Fall into bad_kernel
 ;
 ; bad_kernel: Kernel image not found


This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.




More information about the Syslinux mailing list