core: make localboot another vkernel type syslinux-3.80-pre4
authorH. Peter Anvin <hpa@zytor.com>
Wed, 29 Apr 2009 22:55:21 +0000 (15:55 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 29 Apr 2009 22:55:21 +0000 (15:55 -0700)
Change "localboot" to be another vkernel type.  It still needs some
special treatment (because it doesn't take a filename), but overall
this makes it a lot cleaner than what it was before.  It should also
avoid the problem of empty labels (e.g. menu quit) doing weird things.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/kernel.inc
core/parseconfig.inc
core/ui.inc

index 0da0363..9b888cc 100644 (file)
@@ -98,6 +98,7 @@ extlinux_id   equ 034h                ; 3 = SYSLINUX family; 4 = EXTLINUX
 ;
 ; Types of vkernels
 ;
+VK_LOCALBOOT   equ -1                  ; localboot (no actual kernel loaded)
 VK_KERNEL      equ 0                   ; Choose by filename
 VK_LINUX       equ 1                   ; Linux kernel image
 VK_BOOT                equ 2                   ; Boot sector
index 5159a1a..ce5450c 100644 (file)
@@ -83,24 +83,15 @@ pc_ipappend:        call getint
 %endif
 
 ;
-; "localboot" command (PXELINUX, ISOLINUX)
+; "localboot" command
 ;
 %if HAS_LOCALBOOT
 
 pc_localboot:  call getint
                cmp byte [VKernel],0            ; ("label" section only)
                je .err
-               mov di,VKernelBuf+vk_rname
-               xor ax,ax
-               mov cx,FILENAME_MAX
-               rep stosb                       ; Null kernel name
-%if IS_PXELINUX
-               ; PXELINUX uses the first 4 bytes of vk_rname for the
-               ; mangled IP address
-               mov [VKernelBuf+vk_rname+5], bx ; Return type
-%else
-               mov [VKernelBuf+vk_rname+1], bx ; Return type
-%endif
+               mov [VKernelBuf+vk_rname],bx
+               mov byte [VKernelBuf+vk_type],VK_LOCALBOOT
 .err:          ret
 
 %endif ; HAS_LOCALBOOT
index cb6e03b..d14245c 100644 (file)
@@ -396,26 +396,18 @@ vk_check:
 %endif
                xor bx,bx                       ; Try only one version
 
-               mov al, [VKernelBuf+vk_type]
-               mov [KernelType], al
+               mov al,[VKernelBuf+vk_type]
+               mov [KernelType],al
 
 %if HAS_LOCALBOOT
                ; Is this a "localboot" pseudo-kernel?
-%if IS_PXELINUX
-               cmp byte [VKernelBuf+vk_rname+4], 0
-%else
-               cmp byte [VKernelBuf+vk_rname], 0
+               cmp al,VK_LOCALBOOT             ; al == KernelType
+               mov ax,[VKernelBuf+vk_rname]    ; Possible localboot type
+               je local_boot
 %endif
-               jne get_kernel          ; No, it's real, go get it
-
-               mov ax, [VKernelBuf+vk_rname+1]
-               jmp local_boot
-%else
                jmp get_kernel
-%endif
 
 .not_vk:
-
 ;
 ; Not a "virtual kernel" - check that's OK and construct the command line
 ;
@@ -442,6 +434,8 @@ vk_check:
 ;
 get_kernel:     mov byte [KernelName+FILENAME_MAX],0   ; Zero-terminate filename/extension
                mov di,KernelName+4*IS_PXELINUX
+               cmp byte [di],' '
+               jb bad_kernel                   ; Missing kernel name
                xor al,al
                mov cx,FILENAME_MAX-5           ; Need 4 chars + null
                repne scasb                     ; Scan for final null