Hi. I've ever wondered how nuch timeis left to timeout while waiting at the boot prompt, so I've writen this small patch to show it. This add a configuration command 'showtimeout'. If you like the patch I could improve it (for example to show the timeout in decimal because now it uses the writehex functions) Regards. -- ______ ________ / / \/ /___ ) I N T E G R A C I O N / / /___ / I N F O R M A T I C A /__/__/\___/_____' Diego Torres Milano Maipu 42 Office 164 - (C1084ABB) Buenos Aires Argentina diego at in3.com.ar Tel: +5411 4331-2233 Fax +5411 4331-3377 www.in3.com.ar -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.zytor.com/pipermail/syslinux/attachments/20020226/6106c0b4/attachment.html> -------------- next part -------------- Binary files ../syslinux-1.67/bootsect.bin and ./bootsect.bin differ Only in ../syslinux-1.67: copybs.com Only in ../syslinux-1.67: gethostip diff -ru -U10 ../syslinux-1.67/ldlinux.asm ./ldlinux.asm --- ../syslinux-1.67/ldlinux.asm Sun Feb 3 18:37:55 2002 +++ ./ldlinux.asm Mon Feb 25 15:43:27 2002 @@ -38,20 +38,23 @@ ; ; Should be updated with every release to avoid bootsector/SYS file mismatch ; %define version_str VERSION ; Must be 4 characters long! %define date DATE_STR ; Defined from the Makefile %define year '2001' ; ; Debgging stuff ; ; %define debug 1 ; Uncomment to enable debugging +; DTM BEGIN ------------------------------------------------ +%define writehex 1 ; writehex +; DTM END -------------------------------------------------- ; ; ID for SYSLINUX (reported to kernel) ; syslinux_id equ 031h ; SYSLINUX (3) version 1.x (1) ; ; Segments used by Linux ; ; Note: the real_mode_seg is supposed to be 9000h, but some device drivers ; hog some of high memory. Therefore, we load it at 7000:0000h and copy ; it before starting the Linux kernel. @@ -1198,20 +1201,24 @@ jz near no_config_file parse_config: call getkeyword jc near end_config_file ; Config file loaded cmp ax,'de' ; DEfault je pc_default cmp ax,'ap' ; APpend je pc_append cmp ax,'ti' ; TImeout je near pc_timeout + ; DTM BEGIN ------------------------------------------------ + cmp ax,'sh' ; Show timeout + je near pc_showtimeout + ; DTM END -------------------------------------------------- cmp ax,'pr' ; PRompt je near pc_prompt cmp ax,'fo' ; FOnt je near pc_font cmp ax,'kb' ; KBd je near pc_kbd cmp ax,'di' ; DIsplay je near pc_display cmp ax,'la' ; LAbel je near pc_label @@ -1260,20 +1267,27 @@ jmp short parse_config_2 pc_timeout: call getint ; "timeout" command jc parse_config_2 mov ax,0D215h ; There are approx 1.D215h mul bx ; clock ticks per 1/10 s add bx,dx mov [KbdTimeOut],bx jmp short parse_config_2 +; DTM BEGIN ------------------------------------------------ +pc_showtimeout: call getint ; "showtimeout" command + jc parse_config_2 + mov [ShowTimeOut],bx + jmp short parse_config_2 +; DTM END -------------------------------------------------- + pc_display: call pc_getfile ; "display" command jz parse_config_2 ; File not found? call get_msg_file ; Load and display file parse_config_2: jmp parse_config pc_prompt: call getint ; "prompt" command jc parse_config_2 mov [ForcePrompt],bx jmp short parse_config_2 @@ -1454,22 +1468,25 @@ ; ; Check whether or not we are supposed to display the boot prompt. ; check_for_key: cmp word [ForcePrompt],byte 0 ; Force prompt? jnz enter_command test byte [KbdFlags],5Bh ; Caps, Scroll, Shift, Alt jz near auto_boot ; If neither, default boot enter_command: - mov si,boot_prompt - call cwritestr + ; DTM BEGIN ------------------------------------------------ + ;;mov si,boot_prompt + ;;call cwritestr + call writeprompt + ; DTM END -------------------------------------------------- mov byte [FuncFlag],0 ; <Ctrl-F> not pressed mov di,command_line ; ; get the very first character -- we can either time ; out, or receive a character press at this time. Some dorky BIOSes stuff ; a return in the buffer on bootup, so wipe the keyboard buffer first. ; clear_buffer: mov ah,1 ; Check for pending char int 16h @@ -1479,30 +1496,67 @@ jmp short clear_buffer get_char_time: call vgashowcursor mov cx,[KbdTimeOut] and cx,cx jz get_char ; Timeout == 0 -> no timeout inc cx ; The first loop will happen ; immediately as we don't ; know the appropriate DX value time_loop: push cx + ; DTM BEGIN ------------------------------------------------ + push cx + ; DTM END -------------------------------------------------- tick_loop: push dx call pollchar jnz get_char_pop xor ax,ax int 1Ah ; Get time "of day" pop ax cmp dx,ax ; Has the timer advanced? je tick_loop + + ; DTM BEGIN ------------------------------------------------- + cmp [ShowTimeOut], word 0 + jne .showtimeout + pop ax ; extract saved cx + jmp .showtimeoutend +.showtimeout: + pop ax + mov cx,ax ; save current loop value in cx + mov bl,10 ; 1/10 sec + div bl + and ah,ah ; reminder + jnz .showtimeoutend + + mov si, boot_timeout_prompt_pos + call cwritestr + + mov ax,cx ; move loop value into ax + call writehex4 + + mov si, boot_timeout_prompt_end + call cwritestr +.showtimeoutend: + ; DTM END -------------------------------------------------- + pop cx loop time_loop ; If so, decrement counter + + ; DTM BEGIN ------------------------------------------------- + ; Fix prompt + mov si, boot_timeout_prompt_pos + call cwritestr + mov si, boot_timeout_prompt_begin + call cwritestr + ; DTM END -------------------------------------------------- + call vgahidecursor jmp command_done ; Timeout! get_char_pop: pop eax ; Clear stack get_char: call vgashowcursor call getchar call vgahidecursor and al,al jz func_key @@ -1570,22 +1624,26 @@ call searchdir jz fk_nofile push si call crlf pop si call get_msg_file jmp short fk_wrcmd fk_nofile: call crlf fk_wrcmd: - mov si,boot_prompt - call cwritestr + ; DTM BEGIN ------------------------------------------------ + ;;mov si,boot_prompt + ;;call cwritestr + call writeprompt + ; DTM END -------------------------------------------------- + pop di ; Command line write pointer push di mov byte [di],0 ; Null-terminate command line mov si,command_line call cwritestr ; Write command line so far pop di jmp short get_char_2 auto_boot: mov si,default_cmd mov di,command_line @@ -3377,21 +3435,24 @@ pushad .top: lodsb and al,al jz .end call writechr jmp short .top .end: popad popfd ret -%ifdef debug +; BEGIN DTM ------------------------------------------------ +;%ifdef debug +%ifdef debug or writehex +; END DTM -------------------------------------------------- ; ; writehex[248]: Write a hex number in (AL, AX, EAX) to the console ; writehex2: pushfd pushad rol eax,24 mov cx,2 jmp short writehex_common @@ -3414,33 +3475,38 @@ .low: add al,'0' jmp short .ischar .high: add al,'A'-10 .ischar: call writechr pop eax loop .loop popad popfd ret +%if 0 ; ; crlf: write CR LF ; +; DTM: Redefined if debug enabled +; crlf: push ax mov al, 13 call writechr mov al, 10 call writechr pop ax ret %endif +%endif + ; ; pollchar: check if we have an input character pending (ZF = 0) ; pollchar: pushad mov ah,1 ; Poll keyboard int 16h jnz .done ; Keyboard response mov dx,[SerialPort] and dx,dx @@ -4225,20 +4291,35 @@ cmp [UsingVGA], byte 1 jne .done mov ah,09h mov bx,0007h mov cx,1 int 10h .done: popad ret +; DTM BEGIN ------------------------------------------------ +; writeprompt +writeprompt: + cmp [ShowTimeOut], word 0 + jne .timeoutprompt + mov si, boot_prompt + call cwritestr + jmp .done +.timeoutprompt + mov si, boot_timeout_prompt + call cwritestr +.done + ret +; DTM END -------------------------------------------------- + ; Map colors to consecutive DAC registers linear_color db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 UsingVGA db 0 ; ---------------------------------------------------------------------------------- ; Begin data section ; ---------------------------------------------------------------------------------- CR equ 13 ; Carriage Return @@ -4252,20 +4333,26 @@ lcase_low equ 128 lcase_high equ 165 lcase_tab db 135, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138 db 139, 140, 141, 132, 134, 130, 145, 145, 147, 148, 149 db 150, 151, 152, 148, 129, 155, 156, 155, 158, 159, 160 db 161, 162, 163, 164, 164 copyright_str db ' Copyright (C) 1994-', year, ' H. Peter Anvin' db CR, LF, 0 boot_prompt db 'boot: ', 0 +; DTM BEGIN ------------------------------------------------ +boot_timeout_prompt db 'boot (' +boot_timeout_prompt_begin db '0000' +boot_timeout_prompt_end db '): ', 0 +boot_timeout_prompt_pos db BS, BS, BS, BS, BS, BS, BS, 0 +; DTM END -------------------------------------------------- wipe_char db BS, ' ', BS, 0 err_notfound db 'Could not find kernel image: ',0 err_notkernel db CR, LF, 'Invalid or corrupt kernel image.', CR, LF, 0 err_not386 db 'It appears your computer uses a 286 or lower CPU.' db CR, LF db 'You cannot run Linux unless you have a 386 or higher CPU' db CR, LF db 'in your machine. If you get this message in error, hold' db CR, LF db 'down the Ctrl key while booting, and I will take your' @@ -4305,20 +4392,23 @@ ; mem= and vga= are handled as normal 32-bit integer values initrd_cmd db 'initrd=' initrd_cmd_len equ 7 ; ; Config file keyword table ; align 2 keywd_table db 'ap' ; append db 'de' ; default db 'ti' ; timeout + ; DTM BEGIN ------------------------------------------------ + db 'sh' ; showtimeout + ; DTM END -------------------------------------------------- db 'fo' ; font db 'kb' ; kbd db 'di' ; display db 'pr' ; prompt db 'la' ; label db 'im' ; implicit db 'ke' ; kernel db 'se' ; serial db 'f1' ; F1 db 'f2' ; F2 @@ -4346,20 +4436,23 @@ exten_count equ (($-exten_table) >> 2) - 1 ; Number of alternates ; ; Misc initialized (data) variables ; %ifdef debug ; This code for debugging only debug_magic dw 0D00Dh ; Debug code sentinel %endif AppendLen dw 0 ; Bytes in append= command KbdTimeOut dw 0 ; Keyboard timeout (if any) +; DTM BEGIN ------------------------------------------------ +ShowTimeOut dw 0 ; Show timeout +; DTM END -------------------------------------------------- FKeyMap dw 0 ; Bitmap for F-keys loaded CmdLinePtr dw cmd_line_here ; Command line advancing pointer initrd_flag equ $ initrd_ptr dw 0 ; Initial ramdisk pointer/flag VKernelCtr dw 0 ; Number of registered vkernels ForcePrompt dw 0 ; Force prompt AllowImplicit dw 1 ; Allow implicit kernels SerialPort dw 0 ; Serial port base (or 0 for no serial port) A20List dw a20_dunno, a20_none, a20_bios, a20_kbc, a20_fast A20DList dw a20d_dunno, a20d_none, a20d_bios, a20d_kbc, a20d_fast Binary files ../syslinux-1.67/ldlinux.bin and ./ldlinux.bin differ Only in ../syslinux-1.67: ldlinux.lst Binary files ../syslinux-1.67/ldlinux.sys and ./ldlinux.sys differ Only in ../syslinux-1.67: mbr.lst Only in ../syslinux-1.67/memdisk: memdisk Only in ../syslinux-1.67/sample: syslogo.lss Only in ../syslinux-1.67: syslinux Only in ../syslinux-1.67: syslinux.com diff -ru -U10 ../syslinux-1.67/syslinux.doc ./syslinux.doc --- ../syslinux-1.67/syslinux.doc Sun Feb 3 18:37:55 2002 +++ ./syslinux.doc Mon Feb 25 16:09:55 2002 @@ -194,20 +194,26 @@ Indicates how long to wait at the boot: prompt until booting automatically, in units of 1/10 s. The timeout is cancelled as soon as the user types anything on the keyboard, the assumption being that the user will complete the command line already begun. A timeout of zero will disable the timeout completely, this is also the default. NOTE: The maximum possible timeout value is 35996; corresponding to just below one hour. +DTM BEGIN ------------------------------------------------------------ +SHOWTIMEOUT flag_val + If flag_val is not equal to 0, show the four hex digits timer + value to timeout. +DTM END -------------------------------------------------------------- + SERIAL port [[baudrate] flowcontrol] Enables a serial port to act as the console. "port" is a number (0 = /dev/ttyS0 = COM1, etc.) or an I/O port address (e.g. 0x3F8); 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. "flowcontrol" is a combination of the following bits: 0x001 - Assert DTR 0x002 - Assert RTS