mirror of
https://github.com/ipxe/ipxe
synced 2026-02-14 02:31:26 +03:00
Initial revision
This commit is contained in:
40
contrib/auto-default/mail
Normal file
40
contrib/auto-default/mail
Normal file
@@ -0,0 +1,40 @@
|
||||
Date: 11/9/2001 3:56 PM
|
||||
Received: 11/9/2001 4:05 PM
|
||||
From: Steve Tilden, stilden@sicom-sys.com
|
||||
|
||||
...
|
||||
|
||||
2) I have added conditional code to main.c from Etherboot 5.0.4 to add
|
||||
a new default boot option and I have included the modified main.c as an
|
||||
attachment to this message.
|
||||
|
||||
As I received Etherboot 5.0.4, in the Config file, if you select
|
||||
ASK_BOOT with a non zero time-out option, then you also get to set
|
||||
ANS_DEFAULT = ANS_NETWORK or ANS_DEFAULT = ANS_LOCAL to determine what
|
||||
will happen if the operator does not respond to the prompt. I have now
|
||||
added conditional code in main.c such that if you set ANS_DEFAULT =
|
||||
ANS_AUTO, the default answer will be set according to whether or not
|
||||
there is a hard disk in the system (as detected by the BIOS). If a hard
|
||||
disk is present, then if the operator does nothing, the system will boot
|
||||
from it. If a hard disk does not exist, then again if the operator does
|
||||
nothing, the system will boot via the network. Either way, for our
|
||||
particular environment, the operator has to do nothing to get it to boot
|
||||
correctly. Yet the operator can still override the default selection
|
||||
to, for example, allow a unit without a hard disk, to boot directly from
|
||||
a floppy rather than the network, or to allow a unit with a hard disk,
|
||||
to boot from the network.
|
||||
|
||||
I don't know it the code I have added might be correct for a future
|
||||
production version of Etherboot, but I thought I'd send it to you and
|
||||
let you get it into the system if you feel it might be appropriate.
|
||||
|
||||
Thanks,
|
||||
|
||||
Steve Tilden
|
||||
Sicom Systems Inc.
|
||||
stilden@sicom-sys.com
|
||||
|
||||
[Ed: On a compliant BIOS, it will actually boot the next device in the
|
||||
BIOS list if local is selected, either explicitly or by timeout, which
|
||||
may or may not be the hard disk, which is why it's less than general and
|
||||
not included in the distribution by default.]
|
||||
55
contrib/auto-default/main.c.patch
Normal file
55
contrib/auto-default/main.c.patch
Normal file
@@ -0,0 +1,55 @@
|
||||
--- main.c Mon Nov 5 18:58:30 2001
|
||||
+++ main.c.new Thu Nov 15 01:45:12 2001
|
||||
@@ -149,21 +151,49 @@
|
||||
static unsigned short ipchksum(unsigned short *ip, int len);
|
||||
static unsigned short udpchksum(struct iphdr *packet);
|
||||
|
||||
+
|
||||
+#if defined(ASK_BOOT) && ASK_BOOT > 0 && (ANS_DEFAULT == ANS_AUTO)
|
||||
+/*
|
||||
+ * Read Installed Hard Disk Count from BIOS memory at 0:0475
|
||||
+ */
|
||||
+static int hdsk_cnt(void)
|
||||
+{
|
||||
+ int retv;
|
||||
+ __asm__ __volatile__(
|
||||
+ "xorw %%ax,%%ax\n\t"
|
||||
+ "movb 0x475,%%al\n"
|
||||
+ : "=a" (retv)
|
||||
+ : /* no inputs */
|
||||
+ : "ax", "cc", "memory"
|
||||
+ );
|
||||
+ return(retv);
|
||||
+}
|
||||
+#endif /* ASK_BOOT && ANS_AUTO */
|
||||
+
|
||||
+
|
||||
static inline void ask_boot(void)
|
||||
{
|
||||
#if defined(ASK_BOOT) && ASK_BOOT > 0
|
||||
while(1) {
|
||||
- int c;
|
||||
+ int c, deflt;
|
||||
unsigned long time;
|
||||
+#if defined(ASK_BOOT) && ASK_BOOT > 0 && (ANS_DEFAULT == ANS_AUTO)
|
||||
+ if (hdsk_cnt() != 0)
|
||||
+ deflt = ANS_LOCAL;
|
||||
+ else
|
||||
+ deflt = ANS_NETWORK;
|
||||
+#else
|
||||
+ deflt = ANS_DEFAULT;
|
||||
+#endif
|
||||
printf(ASK_PROMPT);
|
||||
for (time = currticks() + ASK_BOOT*TICKS_PER_SEC; !iskey(); )
|
||||
if (currticks() > time) {
|
||||
- c = ANS_DEFAULT;
|
||||
+ c = deflt;
|
||||
goto done;
|
||||
}
|
||||
c = getchar();
|
||||
if ((c >= 'a') && (c <= 'z')) c &= 0x5F;
|
||||
- if (c == '\n') c = ANS_DEFAULT;
|
||||
+ if (c == '\n') c = deflt;
|
||||
done:
|
||||
if ((c >= ' ') && (c <= '~')) putchar(c);
|
||||
putchar('\n');
|
||||
Reference in New Issue
Block a user