Add support for forcing the filetype, and loading a secondary config file.
Also bump the version number to version 3.40.
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,
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
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.
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
ret
%endif ; DEBUG_TRACERS
- section .data
+ section .config
; This is a word to pc_setint16 can set it
DisplayCon dw 01h ; Console display enabled
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
%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
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
mov ax,1103h ; Select page 0
int 10h
- ; Fall through to adjust_screen
-
lf_ret equ use_font.lf_ret
;
; 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
; 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
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...
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
; ----------------------------------------------------------------------------
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)
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.
%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
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
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
menu
append
+config
default
display
font
ipappend
kbdmap
kernel
+linux
+boot
+bss
+fdimage
+comboot
+com32
label
localboot
prompt
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
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
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
%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
;; -----------------------------------------------------------------------
;;
-;; 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
%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
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:
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)
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
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
%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
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
%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
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.
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) ++++
;
; 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.
;
%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
pop di
pop si
pop es
+
+ mov [KernelType], cl ; CL == 0 here
+
;
; Find the kernel on disk
;
%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'
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
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