Extending cdboot with options "Press any key to boot from CD" prompt
Maxim Sobolev
sobomax at portaone.com
Thu Aug 19 07:09:08 PDT 2004
Hi,
Please review/comment on attached patch, which extends cdboot with
"Press any key to boot from CD" prompt inspired by Windows installation
CDs. IMHO this feature is quite useful for installation CDs, and
probably for other interactive one-shot CDs, to prevent machine from
booting off CD again after work is complete. If there is no objections,
I'd like to request repo copy from cdboot.s into cdboot.S and then
commit this change. My plan is to keep this feature turned off by
default, and provide make(1) knob to turn it one if necessary.
Thanks!
-Maxim
-------------- next part --------------
? cdboot
Index: cdboot.s
===================================================================
RCS file: /home/ncvs/src/sys/boot/i386/cdboot/cdboot.s,v
retrieving revision 1.13
diff -d -u -r1.13 cdboot.s
--- cdboot.s 22 Jun 2004 21:55:22 -0000 1.13
+++ cdboot.s 19 Aug 2004 14:08:32 -0000
@@ -100,6 +100,13 @@
.set DIR_SIZE,10 # Offset of 64-bit length
.set DIR_NAMELEN,32 # Offset of 8-bit name len
.set DIR_NAME,33 # Offset of dir name
+
+#
+# Various constants
+#
+ .set ASCII_BEL,0x07 # ASCII code for <BEL>
+ .set TICKS,91 # 5 seconds at 18.2 ticks/s
+
#
# We expect to be loaded by the BIOS at 0x7c00 (standard boot loader entry
# point)
@@ -117,7 +124,27 @@
mov %ax,%ds # setup the
mov %ax,%es # data segments
mov %dl,drive # Save BIOS boot device
- mov $msg_welcome,%si # %ds:(%si) -> welcome message
+#if defined(CDBOOT_PROMPT)
+ mov $msg_press,%si # %ds:(%si) -> press any key message
+ call putstr # display the press any key message
+ movb $ASCII_BEL,%al # Signal
+ callw putc # beep!
+ xorb %ah,%ah # BIOS: Get
+ int $0x1a # system time
+ movw %dx,%di # Ticks when
+ addw $TICKS,%di # timeout
+pressloop:
+ movb $0x1,%ah # BIOS: Check
+ int $0x16 # for keypress
+ jnz bootcd # Have one, continue cdboot
+ xorb %ah,%ah # BIOS: Get
+ int $0x1a # system time
+ cmpw %di,%dx # Timeout?
+ jb pressloop # No
+ int $0x18 # Yes: try another boot device
+ jmp halt # Should Not Happen[tm]
+#endif
+bootcd: mov $msg_welcome,%si # %ds:(%si) -> welcome message
call putstr # display the welcome message
#
# Setup the arguments that the loader is expecting from boot[12]
@@ -586,6 +613,9 @@
msg_lookupfail: .asciz "File not found\r\n"
msg_load2big: .asciz "File too big\r\n"
msg_failed: .asciz "Boot failed\r\n"
+#if defined(CDBOOT_PROMPT)
+msg_press: .asciz "Press any key to boot from CD\r\n"
+#endif
twiddle_chars: .ascii "|/-\\"
loader_paths: .asciz "/BOOT/LOADER"
.asciz "/boot/loader"
More information about the freebsd-current
mailing list