summaryrefslogtreecommitdiffstats
path: root/sys/i386/boot/netboot
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-06-30 11:10:29 +0000
committerphk <phk@FreeBSD.org>1998-06-30 11:10:29 +0000
commit406115eeb396cf089147ab4705c4fe2018bc6969 (patch)
tree2690b5c0b56ee82603958624eebc47a3145d021d /sys/i386/boot/netboot
parent32d70b396743f853a9ab3ffdd1dbfb681ffe6a4d (diff)
downloadFreeBSD-src-406115eeb396cf089147ab4705c4fe2018bc6969.zip
FreeBSD-src-406115eeb396cf089147ab4705c4fe2018bc6969.tar.gz
These are a selection of small problems and annoyances with the netboot
code. Apart from the first one, none really affect typical configurations but are nevertheless unnecessary limitations. We use netbooted PCs as student X-terminals and all of the below fixes have been useful. Apologies for including them all in one PR, but some are just too silly or trivial to send on their own! a) Newer SMC cards have hardware addresses starting with 00:E0. Netboot compares the MAC address with 00:00:C0 to determine if it is a WD/SMC card, so it fails to detect these. b) Netboot is unable to boot kzipped kernels, as it assumes that the kernel load address is 0x100000. c) Users can abort the booting process and enter arbitrary network addresses, or boot from a floppy disk. This can be a problem when netbooted machines are used in a student environment. d) It is not possible to set all options via bootp. For example there is no way to remotely force a client to boot from disk. With both SECURE_BOOT(patch below) and NO_TFTP defined, short of unplugging the eprom there is no way at all to get the client to boot locally. A generic solution is to allow complete netboot commands to be sent using bootp lines such as: :T132="diskboot": e) The last character of netboot command names is not checked. You can type 'iz 10.0.0.1' and it will be interpreted as 'ip'. This is only important if you try to add a new command which is the same as an existing one except for the last character. f) We have a configuration where multiple servers are willing to serve a diskless client. The tftp config file, or the bootptab entry on each server must specify the root and swap filesystems as 'ip:/fs' even though 'ip' will usually be the responding server's IP address. It would be nice if netboot could automatically prepend the server's IP address to an entry specified as just '/fs', so that multiple servers can use the same tftp or bootp configuration files. Admittedly this is hardly a major problem! PR: 7098 Submitted by: Ian Dowse <iedowse@maths.tcd.ie>
Diffstat (limited to 'sys/i386/boot/netboot')
-rw-r--r--sys/i386/boot/netboot/Makefile3
-rw-r--r--sys/i386/boot/netboot/bootmenu.c46
-rw-r--r--sys/i386/boot/netboot/main.c16
-rw-r--r--sys/i386/boot/netboot/ns8390.c6
4 files changed, 56 insertions, 15 deletions
diff --git a/sys/i386/boot/netboot/Makefile b/sys/i386/boot/netboot/Makefile
index 8c3f40a..2352b2c 100644
--- a/sys/i386/boot/netboot/Makefile
+++ b/sys/i386/boot/netboot/Makefile
@@ -1,8 +1,9 @@
-# $Id: Makefile,v 1.16 1998/03/07 10:48:13 eivind Exp $
+# $Id: Makefile,v 1.17 1998/06/29 18:52:33 bde Exp $
#
# Makefile for NETBOOT
#
# Basic Options:
+# -DSECURE_BOOT - Disable 'boot>' prompt completely
# -DASK_BOOT - Ask "Boot from Network (Y/N) ?" at startup
# -DROMSIZE - Size of EPROM - Must be set (even for .COM files)
# -DRELOC - Relocation address (usually 0x90000)
diff --git a/sys/i386/boot/netboot/bootmenu.c b/sys/i386/boot/netboot/bootmenu.c
index ce1c416..71b350b 100644
--- a/sys/i386/boot/netboot/bootmenu.c
+++ b/sys/i386/boot/netboot/bootmenu.c
@@ -32,8 +32,8 @@ struct bootcmds_t {
{"netmask", cmd_netmask, "<addr> set network mask"},
{"hostname", cmd_hostname, "<name> set hostname"},
{"kernel", cmd_kernel, "<file> set boot filename"},
- {"rootfs", cmd_rootfs, "ip:/fs set root filesystem"},
- {"swapfs", cmd_swapfs, "ip:/fs set swap filesystem"},
+ {"rootfs", cmd_rootfs, "[ip:]/fs set root filesystem"},
+ {"swapfs", cmd_swapfs, "[ip:]/fs set swap filesystem"},
{"swapsize", cmd_swapsize, "<nblks> set swap size"},
{"swapopts", cmd_swapopts, "<options> swap mount options"},
{"rootopts", cmd_rootopts, "<options> root mount options"},
@@ -160,17 +160,22 @@ CMD_ROOTFS - Set root filesystem name
cmd_rootfs(p)
char *p;
{
- if (!setip(p, &arptable[ARP_ROOTSERVER].ipaddr)) {
+ if (*p == '/') {
+ bcopy(&arptable[ARP_SERVER].ipaddr,
+ &arptable[ARP_ROOTSERVER].ipaddr, 4);
+ } else if (!setip(p, &arptable[ARP_ROOTSERVER].ipaddr)) {
printf("Root filesystem is %I:%s\r\n",
nfsdiskless.root_saddr.sin_addr,
nfsdiskless.root_hostnam);
+ return;
} else {
- bcopy(&arptable[ARP_ROOTSERVER].ipaddr,
- &nfsdiskless.root_saddr.sin_addr, 4);
while (*p && (*p != ':')) p++;
if (*p == ':') p++;
- sprintf(&nfsdiskless.root_hostnam, "%s", p);
}
+
+ bcopy(&arptable[ARP_ROOTSERVER].ipaddr,
+ &nfsdiskless.root_saddr.sin_addr, 4);
+ sprintf(&nfsdiskless.root_hostnam, "%s", p);
}
/**************************************************************************
@@ -179,17 +184,22 @@ CMD_SWAPFS - Set swap filesystem name
cmd_swapfs(p)
char *p;
{
- if (!setip(p, &arptable[ARP_SWAPSERVER].ipaddr)) {
+ if (*p == '/') {
+ bcopy(&arptable[ARP_SERVER].ipaddr,
+ &arptable[ARP_SWAPSERVER].ipaddr, 4);
+ } else if (!setip(p, &arptable[ARP_SWAPSERVER].ipaddr)) {
printf("Swap filesystem is %I:%s\r\n",
nfsdiskless.swap_saddr.sin_addr,
nfsdiskless.swap_hostnam);
+ return;
} else {
- bcopy(&arptable[ARP_SWAPSERVER].ipaddr,
- &nfsdiskless.swap_saddr.sin_addr, 4);
while (*p && (*p != ':')) p++;
if (*p == ':') p++;
- sprintf(&nfsdiskless.swap_hostnam, "%s", p);
}
+
+ bcopy(&arptable[ARP_SWAPSERVER].ipaddr,
+ &nfsdiskless.swap_saddr.sin_addr, 4);
+ sprintf(&nfsdiskless.swap_hostnam, "%s", p);
}
/**************************************************************************
@@ -305,7 +315,8 @@ execute(buf)
while(cmd->name) {
p = buf;
q = cmd->name;
- while (*q && (*(q++) == *(p++))) ;
+ while (*q && *q == *p++)
+ q++;
if ((!(*q)) && ((*p == ' ') || (*p == '\t') || (!(*p)))) {
if (!cmd->func)
return(1);
@@ -327,6 +338,18 @@ bootmenu()
{
char cmd[80];
int ptr, c;
+#ifdef SECURE_BOOT
+ char *p;
+
+ printf("\r\n");
+
+ printf("Press any key to retry:");
+ while (iskey())
+ getchar();
+ getchar();
+ printf("\r\n");
+ eth_probe();
+#else
printf("\r\n");
while (1) {
ptr = 0;
@@ -349,5 +372,6 @@ bootmenu()
printf("\r\n");
if (execute(cmd)) break;
}
+#endif
eth_reset();
}
diff --git a/sys/i386/boot/netboot/main.c b/sys/i386/boot/netboot/main.c
index 7ffb5d0..086d71c 100644
--- a/sys/i386/boot/netboot/main.c
+++ b/sys/i386/boot/netboot/main.c
@@ -292,7 +292,7 @@ cfg_done:
printf("Bad executable format!\r\n");
longjmp(jmp_bootmenu, 1);
}
- loadpoint = (char *)0x100000;
+ loadpoint = (char *)(head.a_entry & 0x00FFFFFF);
offset = N_TXTOFF(head);
printf("text=0x%X, ",head.a_text);
nfsload(head.a_text);
@@ -343,7 +343,9 @@ POLLKBD - Check for Interrupt from keyboard
**************************************************************************/
pollkbd()
{
+#ifndef SECURE_BOOT
if (iskey() && (getchar() == ESC)) longjmp(jmp_bootmenu,1);
+#endif
}
/**************************************************************************
@@ -658,6 +660,18 @@ decode_rfc1048(p)
case 131: /* swap mount options */
bootp_string("swapopts", p);
break;
+ case 132: /* any other options */
+ case 133:
+ case 134:
+ case 135:
+ case 136:
+ case 137:
+ case 138:
+ case 139:
+ case 140:
+ case 141:
+ bootp_string("", p);
+ break;
default:
printf("Unknown RFC1048-tag ");
for(q=p;q<p+2+TAG_LEN(p);q++)
diff --git a/sys/i386/boot/netboot/ns8390.c b/sys/i386/boot/netboot/ns8390.c
index 3071a8a..c495d5a 100644
--- a/sys/i386/boot/netboot/ns8390.c
+++ b/sys/i386/boot/netboot/ns8390.c
@@ -82,8 +82,10 @@ eth_probe()
chksum = 0;
/* Check for WD/SMC card by checking ethernet address */
if (inb(eth_asic_base+8) != 0) continue;
- if (inb(eth_asic_base+9) != 0) continue;
- if (inb(eth_asic_base+10) != 0xC0) continue;
+ if (inb(eth_asic_base+9) != 0xE0) {
+ if (inb(eth_asic_base+9) != 0) continue;
+ if (inb(eth_asic_base+10) != 0xC0) continue;
+ }
for (i=8; i<16; i++)
chksum += inb(i+eth_asic_base);
if ((chksum & 0x00FF) == 0x00FF)
OpenPOWER on IntegriCloud