aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO6
-rw-r--r--ldlinux.asm241
-rw-r--r--syslinux.doc38
3 files changed, 172 insertions, 113 deletions
diff --git a/TODO b/TODO
index f08abae3..5a949350 100644
--- a/TODO
+++ b/TODO
@@ -1,9 +1,9 @@
-- Serial support:
- - Error messages need to be redirected to the serial port
- Cleaned up documentation, with a real man page.
- Support for clusters larger than 16K. This would require changing
a lot of the SYSLINUX internals so we can read partial clusters;
change the current "cluster pointers" to become
"cluster:sector pointers".
- Support initrd that span multiple input media?
-- Support a small set of DOS system calls for COMBOOT images?
+- Support a small set of DOS system calls for COMBOOT images? (Serial
+ console support makes this particularly desirable.)
+
diff --git a/ldlinux.asm b/ldlinux.asm
index cab2f3fb..8e0c0cea 100644
--- a/ldlinux.asm
+++ b/ldlinux.asm
@@ -579,12 +579,12 @@ kaboom:
mov ss,si
mov sp,StackBuf ; Reset stack
mov ds,si ; Reset data segment
- mov si,bailmsg
+.patch: mov si,bailmsg
call writestr ; Returns with AL = 0
cbw ; AH <- 0
int 16h ; Wait for keypress
int 19h ; And try once more to boot...
-norge: jmp short norge ; If int 19h returned; this is the end
+.norge: jmp short .norge ; If int 19h returned; this is the end
;
; found_it: now we compute the location of the first sector, then
@@ -1169,6 +1169,13 @@ is_486:
;
call adjust_screen
;
+; Now, everything is "up and running"... patch kaboom for more
+; verbosity and using the full screen system
+;
+ mov byte [kaboom.patch],0e9h ; JMP NEAR
+ mov word [kaboom.patch+1],kaboom2-(kaboom.patch+3)
+
+;
; Now we're all set to start with our *real* business. First load the
; configuration file (if any) and parse it.
;
@@ -1326,8 +1333,12 @@ pc_serial: call getint ; "serial" command
xor al,al ; IRQ disable
call slow_out
- mov al,'>'
- call write_serial
+ ; Show some life
+ mov si,syslinux_banner
+ call write_serial_str
+ mov si,copyright_str
+ call write_serial_str
+
jmp short parse_config_3
pc_fkey: sub ah,'1'
@@ -1454,17 +1465,9 @@ get_char_time: mov cx,[KbdTimeOut]
; know the appropriate DX value
time_loop: push cx
tick_loop: push dx
- mov ah,1 ; Check for pending keystroke
- int 16h
+ call pollchar
jnz get_char_pop
- mov dx,[SerialPort] ; Check for serial port input
- and dx,dx
- je .noserial
- add dx,byte 5
- in al,dx
- test al,1 ; Receive data ready
- jnz get_char_pop
-.noserial: xor ax,ax
+ xor ax,ax
int 1Ah ; Get time "of day"
pop ax
cmp dx,ax ; Has the timer advanced?
@@ -1474,27 +1477,9 @@ tick_loop: push dx
jmp command_done ; Timeout!
get_char_pop: pop eax ; Clear stack
-get_char: mov ah,1 ; Keyboard char ready?
- int 16h
- jnz get_kbd
- mov dx,[SerialPort] ; Serial port input?
- and dx,dx
- jz get_char
- add dx,byte 5
- in al,dx
- test al,1
- jz get_char
-
-get_serial: mov dx,[SerialPort] ; Valid only when we have already
- in al,dx ; tested for input!!
- jmp short got_ascii
-
-get_kbd: xor ax,ax ; Get char
- int 16h
+get_char: call getchar
and al,al
jz func_key
- mov bx,KbdMap ; Keyboard map translation
- xlatb
got_ascii: cmp al,7Fh ; <DEL> == <BS>
je backspace
@@ -2346,24 +2331,6 @@ bad_bootsec:
jmp enter_command
;
-; cwritestr: write a null-terminated string to the console, saving
-; registers on entry (we can't use this in the boot sector,
-; since we haven't verified 386-ness yet)
-;
-cwritestr:
- pusha
-.top: lodsb
- and al,al
- jz .end
- call write_serial ; Write to serial port if enabled
- mov ah,0Eh ; Write to screen as TTY
- mov bx,0007h ; White on black, current page
- int 10h
- jmp short .top
-.end: popa
- ret
-
-;
; 32-bit bcopy routine for real mode
;
; We enter protected mode, set up a flat 32-bit environment, run rep movsd
@@ -2620,23 +2587,16 @@ rd_load_done:
; abort_check: let the user abort with <ESC> or <Ctrl-C>
;
abort_check:
- pusha
-ac1:
- mov ah,1 ; Check for pending keystroke
- int 16h
- jz ac_nokbd ; If no pending keystroke
- xor ax,ax ; Load pending keystroke
- int 16h
- mov bx,KbdMap
- xlatb
-ac_char: ; Character received
- cmp al,27 ; <ESC> aborts (DOS geeks)
- je ac2
- cmp al,3 ; So does Ctrl-C (UNIX geeks)
- jne ac1 ; Unknown key... try again
-ac2: ; If we get here, ABORT!
- mov si,aborted_msg
- ; Fall through to abort_load
+ call pollchar
+ jz ac_ret1
+ pusha
+ call getchar
+ cmp al,27 ; <ESC>
+ je ac_kill
+ cmp al,3 ; <Ctrl-C>
+ jne ac_ret2
+ac_kill: mov si,aborted_msg
+
;
; abort_load: Called by various routines which wants to print a fatal
; error message and return to the command prompt. Since this
@@ -2657,24 +2617,10 @@ abort_load:
call cwritestr ; Expects SI -> error msg
al_ok: jmp enter_command ; Return to command prompt
;
-; Check for serial port abort
-;
-ac_nokbd:
- mov bx,[SerialPort]
- and bx,bx
- jz ac_ret ; No serial port
- lea dx,[bx+5]
- in al,dx
- and al,01h
- jz ac_ret ; Nothing on the serial port
- xchg dx,bx
- in al,dx
- jmp short ac_char ; Character received!
-;
; End of abort_check
;
-ac_ret: popa
- ret
+ac_ret2: popa
+ac_ret1: ret
;
; searchdir: Search the root directory for a pre-mangled filename in
@@ -2767,19 +2713,6 @@ dir_return:
ret
;
-; writechr: Write a single character in AL to the screen without
-; mangling any registers
-;
-writechr:
- call write_serial ; write to serial port if needed
- pusha
- mov ah,0Eh
- mov bx,0007h ; white text on this page
- int 10h
- popa
- ret
-
-;
; adjust_screen: Set the internal variables associated with the screen size.
; This is a subroutine in case we're loading a custom font.
;
@@ -2931,10 +2864,10 @@ msg_ctrl_o: ; ^O = color code follows
mov word [NextCharJump],msg_setbg
ret
msg_newline: ; Newline char or end of line
- mov al,0Dh
- call write_serial
- mov al,0Ah
- call write_serial
+ push si
+ mov si,crlf_msg
+ call write_serial_str
+ pop si
mov byte [CursorCol],0
mov al,[CursorRow]
inc ax
@@ -2950,10 +2883,10 @@ msg_scroll: xor cx,cx ; Upper left hand corner
int 10h
jmp short msg_gotoxy
msg_formfeed: ; Form feed character
- mov al,0Dh
- call write_serial
- mov al,0Ch
- call write_serial
+ push si
+ mov si,crff_msg
+ call write_serial_str
+ pop si
xor cx,cx
mov [CursorDX],cx ; Upper lefthand corner
mov dx,[ScreenSize]
@@ -2999,6 +2932,99 @@ write_serial:
ret
;
+; write_serial_str: write_serial for strings
+;
+write_serial_str:
+.loop lodsb
+ and al,al
+ jz .end
+ call write_serial
+ jmp short .loop
+.end: ret
+
+;
+; writechr: Write a single character in AL to the console without
+; mangling any registers
+;
+writechr:
+ call write_serial ; write to serial port if needed
+ pusha
+ mov ah,0Eh
+ mov bx,0007h ; white text on this page
+ int 10h
+ popa
+ ret
+
+;
+; cwritestr: write a null-terminated string to the console, saving
+; registers on entry.
+;
+cwritestr:
+ pusha
+.top: lodsb
+ and al,al
+ jz .end
+ call writechr
+ jmp short .top
+.end: popa
+ ret
+
+;
+; pollchar: check if we have an input character pending (ZF = 0)
+;
+pollchar:
+ pusha
+ mov ah,1 ; Poll keyboard
+ int 16h
+ jnz .done ; Keyboard response
+ mov dx,[SerialPort]
+ and dx,dx
+ jz .done ; No serial port -> no input
+ add dx,byte 5 ; Serial status register
+ in al,dx
+ test al,1 ; ZF = 0 if traffic
+.done: popa
+ ret
+
+;
+; getchar: Read a character from keyboard or serial port
+;
+getchar:
+.again: mov ah,1 ; Poll keyboard
+ int 16h
+ jnz .kbd ; Keyboard input?
+ mov bx,[SerialPort]
+ and bx,bx
+ jz .again
+ lea dx,[bx+5] ; Serial status register
+ in al,dx
+ test al,1
+ jz .again
+.serial: xor ah,ah ; Avoid confusion
+ xchg dx,bx ; Data port
+ in al,dx
+ ret
+.kbd: xor ax,ax ; Get keyboard input
+ int 16h
+ and al,al
+ jz .func_key
+ mov bx,KbdMap ; Convert character sets
+ xlatb
+.func_key: ret
+
+;
+;
+; kaboom2: once everything is loaded, replace the part of kaboom
+; starting with "kaboom.patch" with this part
+
+kaboom2:
+ mov si,err_bootfailed
+ call cwritestr
+ call getchar
+ int 19h ; And try once more to boot...
+.norge: jmp short .norge ; If int 19h returned; this is the end
+
+;
; open,getc: Load a file a character at a time for parsing in a manner
; similar to the C library getc routine. Only one simultaneous
; use is supported. Note: "open" trashes the trackbuf.
@@ -3523,7 +3549,7 @@ lcase_tab db 135, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138
;
copyright_str db ' Copyright (C) 1994-', year, ' H. Peter Anvin'
db 0Dh, 0Ah, 0
-boot_prompt db 'boot: ',0
+boot_prompt db 'boot: ', 0
wipe_char db 08h, ' ', 08h, 0
err_notfound db 'Could not find kernel image: ',0
err_notkernel db 0Dh, 0Ah, 'Invalid or corrupt kernel image.', 0Dh, 0Ah, 0
@@ -3554,11 +3580,14 @@ err_notdos db ': attempted DOS system call', 0Dh, 0Ah, 0
err_comlarge db 'COMBOOT image too large.', 0Dh, 0Ah, 0
err_bootsec db 'Invalid or corrupt boot sector image.', 0Dh, 0Ah, 0
err_a20 db 0Dh, 0Ah, 'A20 gate not responding!', 0Dh, 0Ah, 0
+err_bootfailed db 0Dh, 0Ah, 'Boot failed: please change disks and press '
+ db 'a key to continue.', 0Dh, 0Ah, 0
loading_msg db 'Loading ', 0
dotdot_msg db '.'
dot_msg db '.', 0
aborted_msg db ' aborted.' ; Fall through to crlf_msg!
crlf_msg db 0Dh, 0Ah, 0
+crff_msg db 0Dh, 0Ch, 0
syslinux_cfg db 'SYSLINUXCFG'
;
; Command line options we'd like to take a look at
diff --git a/syslinux.doc b/syslinux.doc
index e8ea734b..072f90a3 100644
--- a/syslinux.doc
+++ b/syslinux.doc
@@ -1,6 +1,6 @@
SYSLINUX
- Version 1.44
- March ??, 1999
+ Version 1.45
+ June 14, 1999
A bootloader for Linux using MS-DOS floppies
@@ -22,6 +22,7 @@ SYSLINUX floppy can be manipulated using standard MS-DOS (or any other
OS that can access an MS-DOS filesystem) tools once it has been
created.
+
++++ WHAT SYSLINUX IS NOT ++++
SYSLINUX is probably not suitable as a general purpose boot loader.
@@ -34,6 +35,7 @@ to use.
However, SYSLINUX has shown itself to be quite useful in a number of
special-purpose applications.
+
++++ CREATING A BOOTABLE LINUX FLOPPY +++
In order to create a bootable Linux floppy using SYSLINUX, prepare a
@@ -76,6 +78,7 @@ The SYSLINUX loader does not need to know about the kernel file in
advance; all that is required is that it is a file located in the root
directory on the disk.
+
++++ CONFIGURATION FILE ++++
All the configurable defaults in SYSLINUX can be changed by putting a
@@ -148,6 +151,15 @@ TIMEOUT timeout
NOTE: The maximum possible timeout value is 35996; corresponding to
just below one hour.
+SERIAL port [baudrate]
+ Enables a serial port to act as the console. "port" is a
+ number (0 = /dev/ttyS0 = COM1, etc.); if "baudrate" is
+ omitted, the baud rate defaults to 9600 bps. The serial
+ parameters are hardcoded to be 8 bits, no parity, 1 stop bit.
+
+ For this directive to be guaranteed to work properly, it
+ should be the first directive in the configuration file.
+
FONT filename
Load a font in .psf format before displaying any output
(except the copyright line, which is output as ldlinux.sys
@@ -197,12 +209,18 @@ F0 filename
file names to F11 and F12. Please see the section below on
DISPLAY files.
-Blank lines, and comment lines beginning with a hash mark (#) are ignored.
+ When using the serial console, press <Ctrl-F><digit> to get to
+ the help screens, e.g. <Ctrl-F><2> to get to the F2 screen,
+ and <Ctrl-F><0> for the F10 one.
+
+In the configuration file blank lines and comment lines beginning
+with a hash mark (#) are ignored.
Note that the configuration file is not completely decoded. Syntax
different from the one described above may still work correctly in this
version of SYSLINUX, but may break in a future one.
+
++++ LARGE KERNELS AND INITIAL RAMDISK SUPPORT ++++
This version of SYSLINUX supports large kernels (bzImage format),
@@ -234,6 +252,7 @@ To bzImage and recent zImage kernels, SYSLINUX 1.30 and higher will
identify using the ID byte 0x31. The ID range 0x32-0x3f is reserved
for future versions of SYSLINUX.
+
++++ DISPLAY FILE FORMAT ++++
DISPLAY and function-key help files are text files in either DOS or UNIX
@@ -261,9 +280,12 @@ are interpreted:
Picking a bright color (8-f) for the background results in the
corresponding dark color (0-7), with the foreground flashing.
+ Colors are not visible over the serial console.
+
<SUB> <SUB> = <Ctrl-Z> = ASCII 26
End of file (DOS convention).
+
++++ COMBOOT IMAGES AND OTHER OPERATING SYSTEMS ++++
This version of SYSLINUX supports chain loading of other operating
@@ -288,7 +310,8 @@ file by adding extensions in the order listed above if the plain
filename is not found. Filenames in KERNEL statements must be fully
qualified.
- ++++ BOOTING DOS ++++
+
+ ++++ BOOTING DOS (OR OTHER SIMILAR OPERATING SYSTEMS) ++++
This is the recommended procedure for creating a SYSLINUX disk that
can boot either DOS or Linux. This example assumes the drive is A: in
@@ -357,6 +380,7 @@ To make this installation in DOS only, you need the utility copybs.com
copy vmlinux a:
copy initrd.gz a:
+
++++ COMBOOT EXECUTABLES ++++
@@ -391,6 +415,7 @@ COMBOOT files. If there is need, a future version may contain an INT
interface to some SYSLINUX functions; please contact me if you have a
need or ideas for such an API.
+
++++ NOVICE PROTECTION ++++
SYSLINUX will attempt to detect if the user is trying to boot on a 286
@@ -407,6 +432,7 @@ Any file that SYSLINUX uses can be marked hidden, system or readonly if
so is convenient; SYSLINUX ignores all file attributes. The SYSLINUX
installed automatically sets the readonly attribute on LDLINUX.SYS.
+
++++ NOTES ON BOOTABLE CD-ROMS ++++
SYSLINUX can be used to create bootdisk images for El
@@ -422,6 +448,7 @@ that is bootable on the largest possible number of machines:
A CD-ROM is so much faster than a floppy that the -s option shouldn't
matter from a speed perspective.
+
++++ BOOTING FROM A FAT FILESYSTEM PARTITION ON A HARD DISK ++++
SYSLINUX can boot from a FAT12 or FAT16 filesystem partition on a hard
@@ -438,6 +465,7 @@ disk by running the command:
Then use the FDISK command to mark the appropriate partition active.
+
++++ KNOWN BUGS ++++
SYSLINUX is unsafe to use on any filesystem that extends past cylinder
@@ -447,6 +475,7 @@ SYSLINUX will not work (and will refuse to install) on filesystems
with a cluster size of more than 16K (typically means a filesystem of
more than 1 GB.)
+
++++ COMPATIBILITY WITH SYSLINUX 1.0 ++++
The following combinations of options can be used to mimic the behaviour
@@ -459,6 +488,7 @@ prompt 1
# Mimic SYSLINUX 1.0 with BOOTMSG.TXT file present:
display bootmsg.txt
+
++++ BUG REPORTS ++++
I would appreciate hearing of any problems you have with SYSLINUX. I