aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-09-22 23:24:45 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-09-22 23:24:45 -0700
commitce38624d82626553018b85d210beb8ea34bd7eab (patch)
treedbdc3387cdfc596015a48b3f494e26476a04e7d1
parenta584b423450923389f4dc25480e30472c8641d38 (diff)
downloadsyslinux-elf-ce38624d82626553018b85d210beb8ea34bd7eab.tar.gz
syslinux-elf-ce38624d82626553018b85d210beb8ea34bd7eab.tar.xz
syslinux-elf-ce38624d82626553018b85d210beb8ea34bd7eab.zip
Add support for forcing the filetype, and loading a secondary config file.
Add support for forcing the filetype, and loading a secondary config file. Also bump the version number to version 3.40.
-rw-r--r--NEWS6
-rw-r--r--bootsect.inc9
-rw-r--r--comboot.doc15
-rw-r--r--conio.inc2
-rw-r--r--extlinux.asm3
-rw-r--r--font.inc2
-rw-r--r--graphics.inc2
-rw-r--r--init.inc26
-rw-r--r--isolinux.asm30
-rw-r--r--kernel.inc13
-rw-r--r--keywords7
-rw-r--r--keywords.inc9
-rw-r--r--layout.inc5
-rw-r--r--ldlinux.asm2
-rw-r--r--parseconfig.inc17
-rw-r--r--pxelinux.asm5
-rw-r--r--syslinux.doc17
-rw-r--r--ui.inc55
-rw-r--r--version2
19 files changed, 160 insertions, 67 deletions
diff --git a/NEWS b/NEWS
index d8a8a643..c208c9cf 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@ Starting with 1.47, changes marked with SYSLINUX/PXELINUX/ISOLINUX
apply to that specific program only; other changes apply to all of
them.
+Changes in 3.40:
+ * New keywords allow the type of file to be specified in the
+ configuration file.
+ * It is now supported to load a different configuration file
+ with the CONFIG keyword.
+
Changes in 3.31:
* The simple menu system (menu.c32 and vesamenu.c32) now
support loading more than one configuration file at a time,
diff --git a/bootsect.inc b/bootsect.inc
index b1360a57..b0077b2a 100644
--- a/bootsect.inc
+++ b/bootsect.inc
@@ -145,12 +145,3 @@ replace_bootstrap:
movzx esp,di
jmp shuffle_and_boot
-
-%if IS_SYSLINUX || IS_MDSLINUX
- ; Nothing
-%else
-is_bss_sector:
- mov si,err_bssimage
- call cwritestr
- jmp enter_command
-%endif
diff --git a/comboot.doc b/comboot.doc
index 58549e65..23ab384e 100644
--- a/comboot.doc
+++ b/comboot.doc
@@ -639,7 +639,7 @@ AX=0016h [3.10] Run kernel image
DS:SI Filename of kernel image (zero-terminated string)
ES:BX Command line (zero-terminated string)
ECX IPAPPEND flags [PXELINUX]
- EDX Reserved - MUST BE ZERO
+ EDX Type of file (since 3.40)
Output: Does not return if successful; returns with CF=1 if
the kernel image is not found.
@@ -659,6 +659,19 @@ AX=0016h [3.10] Run kernel image
may still return to the command line if the image is somehow
corrupt, however.)
+ The file types are defined as follows:
+
+ Equivalent
+ EDX Config Extensions Type of file
+ 0 KERNEL Determined by filename extension
+ 1 LINUX none Linux kernel image
+ 2 BOOT .0 .bs .bin Bootstrap program
+ 3 BSS .bss Boot sector with patch [SYSLINUX]
+ 4 FDIMAGE .img Floppy disk image [ISOLINUX]
+ 5 COMBOOT .com .cbt 16-bit COMBOOT program
+ 6 COM32 .c32 COM32 program
+ 7 CONFIG Configuration file
+
AX=0017h [3.30] Report video mode change
Input: AX 0017h
diff --git a/conio.inc b/conio.inc
index 8fd9d9d2..f8b80739 100644
--- a/conio.inc
+++ b/conio.inc
@@ -386,7 +386,7 @@ debug_tracer: pushad
ret
%endif ; DEBUG_TRACERS
- section .data
+ section .config
; This is a word to pc_setint16 can set it
DisplayCon dw 01h ; Console display enabled
diff --git a/extlinux.asm b/extlinux.asm
index 7ddc278a..ddc0cc6b 100644
--- a/extlinux.asm
+++ b/extlinux.asm
@@ -62,6 +62,7 @@ SYMLINK_SECTORS equ 2 ; Max number of sectors in a symlink
vk_vname: resb FILENAME_MAX ; Virtual name **MUST BE FIRST!**
vk_rname: resb FILENAME_MAX ; Real name
vk_appendlen: resw 1
+vk_type: resb 1 ; Type of file
alignb 4
vk_append: resb max_cmd_len+1 ; Command line
alignb 4
@@ -1516,6 +1517,7 @@ getfssec:
%include "conio.inc" ; Console I/O
%include "plaincon.inc" ; writechr
%include "writestr.inc" ; String output
+%include "configinit.inc" ; Initialize configuration
%include "parseconfig.inc" ; High-level config file handling
%include "parsecmd.inc" ; Low-level config file handling
%include "bcopy32.inc" ; 32-bit bcopy
@@ -1556,7 +1558,6 @@ err_oldkernel db 'Cannot load a ramdisk with an old kernel image.'
db CR, LF, 0
err_notdos db ': attempted DOS system call', CR, LF, 0
err_comlarge db 'COMBOOT image too large.', CR, LF, 0
-err_bssimage db 'BSS images not supported.', CR, LF, 0
err_a20 db CR, LF, 'A20 gate not responding!', CR, LF, 0
err_bootfailed db CR, LF, 'Boot failed: please change disks and press '
db 'a key to continue.', CR, LF, 0
diff --git a/font.inc b/font.inc
index 04080ba7..c2d1350e 100644
--- a/font.inc
+++ b/font.inc
@@ -102,8 +102,6 @@ use_font:
mov ax,1103h ; Select page 0
int 10h
- ; Fall through to adjust_screen
-
lf_ret equ use_font.lf_ret
;
diff --git a/graphics.inc b/graphics.inc
index cfdcf6e6..e80e04cd 100644
--- a/graphics.inc
+++ b/graphics.inc
@@ -307,8 +307,8 @@ vgaclearmode:
; int 10h
mov [UsingVGA], byte 0
- call use_font ; Restore text font/data
mov byte [ScrollAttribute], 07h
+ call use_font ; Restore text font/data
.done:
popad
pop es
diff --git a/init.inc b/init.inc
index a01c6e94..2f31b0ed 100644
--- a/init.inc
+++ b/init.inc
@@ -22,23 +22,10 @@ common_init:
; Now set up screen parameters
call adjust_screen
- ; Wipe the F-key area
- mov al,NULLFILE
- mov di,FKeyName
- mov cx,10*(1 << FILENAME_MAX_LG2)
- rep stosb
-
- mov si,linuxauto_cmd ; Default command: "linux auto"
- mov di,default_cmd
- mov cx,linuxauto_len
- rep movsb
-
- mov di,KbdMap ; Default keymap 1:1
- xor al,al
- inc ch ; CX <- 256
-mkkeymap: stosb
- inc al
- loop mkkeymap
+;
+; Initialize configuration information
+;
+ call reset_config
;
; Clear Files structures
@@ -57,9 +44,4 @@ mkkeymap: stosb
add ax,PKTBUF_SIZE
loop .setbufptr
%endif
-
- section .data
-linuxauto_cmd db 'linux auto',0
-linuxauto_len equ $-linuxauto_cmd
-
section .text ; This is an inline file...
diff --git a/isolinux.asm b/isolinux.asm
index fd7cb75a..91746260 100644
--- a/isolinux.asm
+++ b/isolinux.asm
@@ -56,6 +56,7 @@ SECTOR_SIZE equ (1 << SECTOR_SHIFT)
vk_vname: resb FILENAME_MAX ; Virtual name **MUST BE FIRST!**
vk_rname: resb FILENAME_MAX ; Real name
vk_appendlen: resw 1
+vk_type: resb 1 ; Type of file
alignb 4
vk_append: resb max_cmd_len+1 ; Command line
alignb 4
@@ -825,17 +826,16 @@ rl_checkpt_off equ ($-$$)
; ----------------------------------------------------------------------------
all_read:
+
+; Test tracers
+ TRACER 'T'
+ TRACER '>'
+
;
-; Initialize screen (if we're using one)
+; Common initialization code
;
- ; Now set up screen parameters
- call adjust_screen
-
- ; Wipe the F-key area
- mov al,NULLFILE
- mov di,FKeyName
- mov cx,10*(1 << FILENAME_MAX_LG2)
- rep stosb
+%include "init.inc"
+%include "cpuinit.inc"
; Patch the writechr routine to point to the full code
mov word [writechr+1], writechr_full-(writechr+3)
@@ -846,16 +846,6 @@ all_read:
call writestr
%endif
-; Test tracers
- TRACER 'T'
- TRACER '>'
-
-;
-; Common initialization code
-;
-%include "init.inc"
-%include "cpuinit.inc"
-
;
; Now we're all set to start with our *real* business. First load the
; configuration file (if any) and parse it.
@@ -1476,6 +1466,7 @@ getfssec:
%include "getc.inc" ; getc et al
%include "conio.inc" ; Console I/O
+%include "configinit.inc" ; Initialize configuration
%include "parseconfig.inc" ; High-level config file handling
%include "parsecmd.inc" ; Low-level config file handling
%include "bcopy32.inc" ; 32-bit bcopy
@@ -1514,7 +1505,6 @@ err_oldkernel db 'Cannot load a ramdisk with an old kernel image.'
db CR, LF, 0
err_notdos db ': attempted DOS system call', CR, LF, 0
err_comlarge db 'COMBOOT image too large.', CR, LF, 0
-err_bssimage db 'BSS images not supported.', CR, LF, 0
err_a20 db CR, LF, 'A20 gate not responding!', CR, LF, 0
notfound_msg db 'not found', CR, LF, 0
localboot_msg db 'Booting from local disk...', CR, LF, 0
diff --git a/kernel.inc b/kernel.inc
index 48a704bc..2a99da57 100644
--- a/kernel.inc
+++ b/kernel.inc
@@ -87,4 +87,17 @@ pxelinux_id equ 032h ; 3 = SYSLINUX family; 2 = PXELINUX
isolinux_id equ 033h ; 3 = SYSLINUX family; 3 = ISOLINUX
extlinux_id equ 034h ; 3 = SYSLINUX family; 4 = EXTLINUX
+;
+; Types of vkernels
+;
+VK_KERNEL equ 0 ; Choose by filename
+VK_LINUX equ 1 ; Linux kernel image
+VK_BOOT equ 2 ; Boot sector
+VK_BSS equ 3 ; BSS boot sector
+VK_FDIMAGE equ 4 ; Floppy disk image
+VK_COMBOOT equ 5 ; COMBOOT image
+VK_COM32 equ 6 ; COM32 image
+VK_CONFIG equ 7 ; Configuration file
+VK_TYPES equ 8 ; Number of VK types
+
%endif ; _KERNEL_INC
diff --git a/keywords b/keywords
index bfcbc2a4..31a60851 100644
--- a/keywords
+++ b/keywords
@@ -1,5 +1,6 @@
menu
append
+config
default
display
font
@@ -7,6 +8,12 @@ implicit
ipappend
kbdmap
kernel
+linux
+boot
+bss
+fdimage
+comboot
+com32
label
localboot
prompt
diff --git a/keywords.inc b/keywords.inc
index cffe6a75..e15ea998 100644
--- a/keywords.inc
+++ b/keywords.inc
@@ -50,7 +50,14 @@ keywd_table:
keyword font, pc_filecmd, loadfont
keyword implicit, pc_setint16, AllowImplicit
keyword kbdmap, pc_filecmd, loadkeys
- keyword kernel, pc_kernel
+ keyword kernel, pc_kernel, VK_KERNEL
+ keyword linux, pc_kernel, VK_LINUX
+ keyword boot, pc_kernel, VK_BOOT
+ keyword bss, pc_kernel, VK_BSS
+ keyword fdimage, pc_kernel, VK_FDIMAGE
+ keyword comboot, pc_kernel, VK_COMBOOT
+ keyword com32, pc_kernel, VK_COM32
+ keyword config, pc_kernel, VK_CONFIG
keyword label, pc_label
keyword prompt, pc_setint16, ForcePrompt
keyword say, pc_say
diff --git a/layout.inc b/layout.inc
index d688a6e9..d3b9f05b 100644
--- a/layout.inc
+++ b/layout.inc
@@ -47,8 +47,11 @@ STACK_START equ TEXT_START-STACK_SIZE
section .earlybss nobits start=BSS_START
section .bcopy32 align=4 valign=16 follows=.data vfollows=.earlybss
+ section .config align=4 valign=16 follows=.bcopy32 vfollows=.bcopy32
+ section .config.end nobits align=4 follows=.config
+
; NASM BUG: follows= here should be vfollows=
- section .bss nobits align=256 follows=.bcopy32
+ section .bss nobits align=256 follows=.config.end
section .text start=TEXT_START
; NASM BUG: follows=.text not accepted here
diff --git a/ldlinux.asm b/ldlinux.asm
index b5a9ebf6..a3b24a8c 100644
--- a/ldlinux.asm
+++ b/ldlinux.asm
@@ -64,6 +64,7 @@ SECTOR_SIZE equ (1 << SECTOR_SHIFT)
vk_vname: resb FILENAME_MAX ; Virtual name **MUST BE FIRST!**
vk_rname: resb FILENAME_MAX ; Real name
vk_appendlen: resw 1
+vk_type: resb 1 ; Type of file
alignb 4
vk_append: resb max_cmd_len+1 ; Command line
alignb 4
@@ -1408,6 +1409,7 @@ getfatsector:
%include "conio.inc" ; Console I/O
%include "plaincon.inc" ; writechr
%include "writestr.inc" ; String output
+%include "configinit.inc" ; Initialize configuration
%include "parseconfig.inc" ; High-level config file handling
%include "parsecmd.inc" ; Low-level config file handling
%include "bcopy32.inc" ; 32-bit bcopy
diff --git a/parseconfig.inc b/parseconfig.inc
index aef31613..c96895d4 100644
--- a/parseconfig.inc
+++ b/parseconfig.inc
@@ -1,6 +1,6 @@
;; -----------------------------------------------------------------------
;;
-;; Copyright 1994-2004 H. Peter Anvin - All Rights Reserved
+;; Copyright 1994-2006 H. Peter Anvin - All Rights Reserved
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -100,9 +100,11 @@ pc_localboot: call getint
%endif
;
-; "kernel" command
+; "kernel", "config", ... command
+;
pc_kernel: cmp byte [VKernel],0
je .err ; ("label" section only)
+ mov [VKernelBuf+vk_type],al
call pc_getline
mov di,VKernelBuf+vk_rname
call mangle_name
@@ -252,10 +254,15 @@ pc_serial: call getint
call slow_out
; Show some life
+ cmp byte [SerialNotice],0
+ je .notfirst
+ mov byte [SerialNotice],0
+
mov si,syslinux_banner
call write_serial_str
mov si,copyright_str
call write_serial_str
+.notfirst:
ret
.serial_port_bad:
@@ -374,7 +381,9 @@ commit_vk:
section .data
vk_overflow_msg db 'Out of memory parsing config file', CR, LF, 0
+SerialNotice db 1 ; Only print this once
+ section .config
align 4, db 0
KbdTimeout dd 0 ; Keyboard timeout (if any)
TotalTimeout dd 0 ; Total timeout (if any)
@@ -390,6 +399,10 @@ SerialPort dw 0 ; Serial port base (or 0 for no serial port)
VKernelBytes dw 0 ; Number of bytes used by vkernels
VKernel db 0 ; Have we seen any "label" statements?
+%if IS_PXELINUX
+IPAppend db 0 ; Default IPAPPEND option
+%endif
+
section .latebss
alignb 4 ; For the good of REP MOVSD
command_line resb max_cmd_len+2 ; Command line buffer
diff --git a/pxelinux.asm b/pxelinux.asm
index ac986d3a..6f99b324 100644
--- a/pxelinux.asm
+++ b/pxelinux.asm
@@ -96,7 +96,7 @@ TFTP_EOPTNEG equ htons(8) ; Option negotiation failure
vk_vname: resb FILENAME_MAX ; Virtual name **MUST BE FIRST!**
vk_rname: resb FILENAME_MAX ; Real name
vk_ipappend: resb 1 ; "IPAPPEND" flag
- resb 1 ; Pad
+vk_type: resb 1 ; Type of file
vk_appendlen: resw 1
alignb 4
vk_append: resb max_cmd_len+1 ; Command line
@@ -2305,6 +2305,7 @@ check_for_arp:
%include "writestr.inc" ; String output
writestr equ cwritestr
%include "writehex.inc" ; Hexadecimal output
+%include "configinit.inc" ; Initialize configuration
%include "parseconfig.inc" ; High-level config file handling
%include "parsecmd.inc" ; Low-level config file handling
%include "bcopy32.inc" ; 32-bit bcopy
@@ -2347,7 +2348,6 @@ err_oldkernel db 'Cannot load a ramdisk with an old kernel image.'
db CR, LF, 0
err_notdos db ': attempted DOS system call', CR, LF, 0
err_comlarge db 'COMBOOT image too large.', CR, LF, 0
-err_bssimage db 'BSS images not supported.', CR, LF, 0
err_a20 db CR, LF, 'A20 gate not responding!', CR, LF, 0
err_bootfailed db CR, LF, 'Boot failed: press a key to retry, or wait for reset...', CR, LF, 0
bailmsg equ err_bootfailed
@@ -2546,5 +2546,4 @@ EndOfGetCBuf dw getcbuf+trackbufsize ; = getcbuf+BufSafeBytes
%error trackbufsize must be a multiple of TFTP_BLOCKSIZE
%endif
%endif
-IPAppend db 0 ; Default IPAPPEND option
DHCPMagic db 0 ; DHCP site-specific option info
diff --git a/syslinux.doc b/syslinux.doc
index 356c2898..75968f66 100644
--- a/syslinux.doc
+++ b/syslinux.doc
@@ -183,6 +183,19 @@ LABEL label
The "kernel" doesn't have to be a Linux kernel; it can
be a boot sector or a COMBOOT file (see below.)
+ LINUX image - Linux kernel image (default)
+ BOOT image - Bootstrap program (.bs, .0, .bin)
+ BSS image - BSS image (.bss)
+ FDIMAGE image - Floppy disk image (.img)
+ COMBOOT image - COMBOOT program (.com, .cbt)
+ COM32 image - COM32 program (.c32)
+ CONFIG image - New configuration file
+ Using one of these keywords instead of KERNEL forces the
+ filetype, regardless of the filename.
+
+ CONFIG means restart the boot loader using a different
+ configuration file.
+
APPEND -
Append nothing. APPEND with a single hyphen as argument in a
LABEL section can be used to override a global APPEND.
@@ -501,6 +514,10 @@ file by adding extensions in the order listed above if the plain
filename is not found. Filenames in KERNEL statements must be fully
qualified.
+If this is specified with one of the keywords LINUX, BOOT, BSS,
+FDIMAGE, COMBOOT, COM32, or CONFIG instead of KERNEL, the filetype is
+considered to be the one specified regardless of the filename.
+
++++ BOOTING DOS (OR OTHER SIMILAR OPERATING SYSTEMS) ++++
diff --git a/ui.inc b/ui.inc
index 6ea3a4a6..ab395674 100644
--- a/ui.inc
+++ b/ui.inc
@@ -13,8 +13,10 @@
;
; This file should be entered with the config file open (for getc)
;
+load_config_file:
call parse_config ; Parse configuration file
no_config_file:
+
;
; Check whether or not we are supposed to display the boot prompt.
;
@@ -277,6 +279,9 @@ vk_check:
%endif
xor bx,bx ; Try only one version
+ mov al, [VKernelBuf+vk_type]
+ mov [KernelType], al
+
%if IS_PXELINUX || IS_ISOLINUX
; Is this a "localboot" pseudo-kernel?
%if IS_PXELINUX
@@ -312,6 +317,9 @@ vk_check:
pop di
pop si
pop es
+
+ mov [KernelType], cl ; CL == 0 here
+
;
; Find the kernel on disk
;
@@ -503,9 +511,14 @@ kernel_good:
%endif
;
-; At this point, DX:AX contains the size of the kernel, and SI contains
-; the file handle/cluster pointer.
+; At this point, DX:AX contains the size of the kernel, SI contains
+; the file handle/cluster pointer, and ECX contains the extension (if any.)
;
+ mov di,[KernelType]
+ add di,di
+ jmp [kerneltype_table+di]
+
+is_unknown_filetype:
or ecx,20202000h ; Force lower case (except dot)
cmp ecx,'.com'
@@ -536,6 +549,43 @@ kernel_good:
je is_bootsector
%endif
; Otherwise Linux kernel
+ jmp is_linux_kernel
+
+is_config_file:
+ call openfd
+ call reset_config
+ jmp load_config_file
+
+; This is an image type we can't deal with
+is_bad_image:
+ mov si,err_badimage
+ call cwritestr
+ jmp enter_command
+
+%if IS_SYSLINUX || IS_MDSLINUX
+ ; ok
+%else
+is_bss_sector equ is_bad_image
+%endif
+%if IS_ISOLINUX
+ ; ok
+%else
+is_disk_image equ is_bad_image
+%endif
+
+ section .data
+err_badimage db 'Invalid image type for this media type!', CR, LF, 0
+
+ align 2, db 0
+kerneltype_table:
+ dw is_unknown_filetype ; VK_KERNEL
+ dw is_linux_kernel ; VK_LINUX
+ dw is_bootsector ; VK_BOOT
+ dw is_bss_sector ; VK_BSS
+ dw is_disk_image ; VK_FDIMAGE
+ dw is_comboot_image ; VK_COMBOOT
+ dw is_com32_image ; VK_COM32
+ dw is_config_file ; VK_CONFIG
section .bss
alignb 4
@@ -545,5 +595,6 @@ KernelExtPtr resw 1 ; During search, final null pointer
CmdOptPtr resw 1 ; Pointer to first option on cmd line
KbdFlags resb 1 ; Check for keyboard escapes
FuncFlag resb 1 ; Escape sequences received from keyboard
+KernelType resb 1 ; Kernel type, from vkernel, if known
section .text
diff --git a/version b/version
index f606beb1..a2b1f510 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-3.31
+3.40