[syslinux] [RFC][PATCH] Gfxboot COMBOOT module

Sebastian Herbszt herbszt at gmx.de
Sat Nov 29 12:51:14 PST 2008


Sebastian Herbszt wrote:
> H. Peter Anvin wrote:
>> Sebastian Herbszt wrote:
>>> 
>>> If i don't mistake the original gfxboot patch did only implement gfxboot for
>>> syslinux and isolinux. The gfxboot COMBOOT module does work with syslinux,
>>> isolinux and extlinux. The cb_fopen callback from gfxboot core does expect file
>>> length in ecx. I did assume pxelinux can not return the file length on file open, tho
>>> i did not verify it.
>>> 
>> 
>> PXELINUX will return that information if it gets it (i.e. if using TFTP
>> and the TFTP server support tsize.)  This used to be required, but
>> gPXELINUX obviously can't handle those restrictions.
> 
> Then the module should work as long as pxelinux does return the file size.
> The cb_fopen callback should then check for size -1 and fail if size is not
> available.

This change allows the use of the module with pxelinux.

- Sebastian

--- gfxboot.asm-1 2008-11-29 21:05:03.000000000 +0100
+++ gfxboot.asm 2008-11-29 21:33:08.000000000 +0100
@@ -5,6 +5,8 @@
 pspCmdLen: resb 1
 pspCmdArg: resb 127
 
+;%define DEBUG
+
   section .text
   org 100h
 
@@ -25,10 +27,9 @@
   cmp al,32h
   jnz not_pxelinux
 
-  mov ax,2
-  mov bx,msg_pxelinux
-  int 22h
-  ret
+  mov dl,0 ; fake drive number
+  mov cl,11 ; fake sector size 2048 bytes
+
 not_pxelinux:
   mov [derivative_id],al
   mov [drivenumber],dl
@@ -198,9 +199,12 @@
   mov si,fname_buf
   int 22h
   jnc cb_fopen_ok
+cb_fopen_failed:
   mov al,1
   jmp cb_fopen_end
 cb_fopen_ok:
+  cmp eax,-1 ; unknown file size?
+  jz cb_fopen_failed
   mov ecx,eax
   mov [f_handle],si
   mov [f_size],ecx
@@ -275,10 +279,13 @@
   int 22h
   pop edi
   pop esi
+  mov al,1
+  jc cb_readsector_end
   mov edx,ds
   shl dx,4
   add edx,trackbuf
   xor al,al
+cb_readsector_end:
   ret
 
 gfx_init:
@@ -381,6 +388,16 @@
 ; eax - length of file in bytes, or -1
 ; cx - file block size
 
+  cmp eax,-1 ; unknown file size?
+  jnz gfx_file_read_size
+
+  mov ax,2
+  mov bx, msg_unknown_file_size
+  int 22h
+  stc
+  ret
+
+gfx_file_read_size:
   mov [file_length],eax
   mov edx,eax
   mov [gfx_archive_end],edx
@@ -787,8 +804,6 @@
   ret
 
   section .data
-msg_progname  db 'gfxboot: ',0
-gfxboot_file  db 'bootlogo',0
 derivative_id  db 0
 drivenumber  db 0
 sectorshift  db 0
@@ -806,12 +821,14 @@
 label_keyword  db 6,'label',0
 label_cnt  dw 0
 
+msg_progname  db 'gfxboot: ',0
 msg_config_file  db 'Configuration file',0
 msg_missing  db 'missing',0
 msg_usage  db 'Usage: gfxboot.com <bootlogo>',0dh,0ah,0
 msg_memory  db 'Could not detect available memory size',0dh,0ah,0
 msg_bootlogo_toobig db 'bootlogo file too big',0dh,0ah,0
 msg_pxelinux  db 'pxelinux is not supported',0dh,0ah,0
+msg_unknown_file_size db 'unknown file size',0dh,0ah,0
 msg_space  db ' ',0
 msg_crlf  db 0dh,0ah,0
 




More information about the Syslinux mailing list