Commit 39e3b1f9 authored by Mike Hibler's avatar Mike Hibler

Update to reflect the 6.2 based pxeboot.

parent f370e1cf
This directory contains diffs for a clean FreeBSD 4.10 RELEASE tree.
This directory contains diffs for a clean FreeBSD 6.2 RELEASE tree.
These diffs, for the lib/libstand and sys/boot source directories,
are necessary to build the "pxeboot" first-stage boot loader used on
Emulab nodes.
......@@ -30,10 +30,7 @@ sysboot.diffs:
conditionally compiled/assembled via the 'TESTBED' symbol). There
are new options in sys/boot/i386/Makefile.inc for forcing the serial
console, or changing its speed or port number, make sure these are
correct for your site. The ETHERBOOT_* conditionals are a hack to
get our pxeboot to load and run when booted via an older, modified
version of etherboot. These changes no longer for newer versions
of etherboot.
correct for your site.
There is also a directory (sys/boot/i386/emuboot0) which is a slightly
modified version of boot0 (the MBR-resident boot loader) that just
......
diff -ru 4.10-release/src/lib/libstand/bootp.c 4.10/src/lib/libstand/bootp.c
--- 4.10-release/src/lib/libstand/bootp.c Wed Sep 20 12:37:25 2000
+++ 4.10/src/lib/libstand/bootp.c Wed Oct 13 12:37:32 2004
@@ -158,6 +158,7 @@
diff -ru 6.2-release/src/lib/libstand/bootp.c 6.2/src/lib/libstand/bootp.c
--- 6.2-release/src/lib/libstand/bootp.c Thu Mar 21 16:38:48 2002
+++ 6.2/src/lib/libstand/bootp.c Thu Mar 1 12:05:17 2007
@@ -160,6 +160,7 @@
bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp))
== -1) {
printf("bootp: no reply\n");
......@@ -9,7 +9,7 @@ diff -ru 4.10-release/src/lib/libstand/bootp.c 4.10/src/lib/libstand/bootp.c
return;
}
@@ -190,6 +191,7 @@
@@ -192,6 +193,7 @@
bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp))
== -1) {
printf("DHCPREQUEST failed\n");
......@@ -17,7 +17,7 @@ diff -ru 4.10-release/src/lib/libstand/bootp.c 4.10/src/lib/libstand/bootp.c
return;
}
}
@@ -292,8 +294,13 @@
@@ -294,8 +296,13 @@
#endif
n = readudp(d, pkt, len, tleft);
......@@ -32,7 +32,7 @@ diff -ru 4.10-release/src/lib/libstand/bootp.c 4.10/src/lib/libstand/bootp.c
bp = (struct bootp *)pkt;
@@ -319,8 +326,13 @@
@@ -321,8 +328,13 @@
/* Suck out vendor info */
if (bcmp(vm_rfc1048, bp->bp_vend, sizeof(vm_rfc1048)) == 0) {
......@@ -47,16 +47,16 @@ diff -ru 4.10-release/src/lib/libstand/bootp.c 4.10/src/lib/libstand/bootp.c
}
#ifdef BOOTP_VEND_CMU
else if (bcmp(vm_cmu, bp->bp_vend, sizeof(vm_cmu)) == 0)
@@ -341,7 +353,7 @@
@@ -343,7 +355,7 @@
u_int len;
{
register u_char *ep;
- register int size;
+ register int size, n;
register u_char tag;
u_char *ep;
- int size;
+ int size, n;
u_char tag;
#ifdef BOOTP_DEBUG
@@ -369,13 +381,22 @@
@@ -371,13 +383,22 @@
/* let it override bp_siaddr */
bcopy(cp, &rootip.s_addr, sizeof(swapip.s_addr));
}
......@@ -83,9 +83,9 @@ diff -ru 4.10-release/src/lib/libstand/bootp.c 4.10/src/lib/libstand/bootp.c
}
#ifdef SUPPORT_DHCP
if (tag == TAG_DHCP_MSGTYPE) {
diff -ru 4.10-release/src/lib/libstand/bootp.h 4.10/src/lib/libstand/bootp.h
--- 4.10-release/src/lib/libstand/bootp.h Sat Sep 9 20:52:19 2000
+++ 4.10/src/lib/libstand/bootp.h Wed Oct 13 12:37:32 2004
diff -ru 6.2-release/src/lib/libstand/bootp.h 6.2/src/lib/libstand/bootp.h
--- 6.2-release/src/lib/libstand/bootp.h Fri Aug 11 02:36:12 2000
+++ 6.2/src/lib/libstand/bootp.h Thu Mar 1 12:05:17 2007
@@ -106,6 +106,7 @@
#define TAG_CLASSID ((unsigned char) 60)
#define TAG_CLIENTID ((unsigned char) 61)
......@@ -94,10 +94,10 @@ diff -ru 4.10-release/src/lib/libstand/bootp.h 4.10/src/lib/libstand/bootp.h
#define TAG_END ((unsigned char) 255)
diff -ru 4.10-release/src/lib/libstand/close.c 4.10/src/lib/libstand/close.c
--- 4.10-release/src/lib/libstand/close.c Sat Sep 9 19:32:06 2000
+++ 4.10/src/lib/libstand/close.c Thu May 27 14:00:18 2004
@@ -77,8 +77,10 @@
diff -ru 6.2-release/src/lib/libstand/close.c 6.2/src/lib/libstand/close.c
--- 6.2-release/src/lib/libstand/close.c Sun Sep 30 16:28:00 2001
+++ 6.2/src/lib/libstand/close.c Thu Mar 1 12:05:17 2007
@@ -79,8 +79,10 @@
errno = EBADF;
return (-1);
}
......@@ -109,10 +109,10 @@ diff -ru 4.10-release/src/lib/libstand/close.c 4.10/src/lib/libstand/close.c
if (!(f->f_flags & F_RAW) && f->f_ops)
err1 = (f->f_ops->fo_close)(f);
if (!(f->f_flags & F_NODEV) && f->f_dev)
diff -ru 4.10-release/src/lib/libstand/globals.c 4.10/src/lib/libstand/globals.c
--- 4.10-release/src/lib/libstand/globals.c Thu Aug 20 02:19:55 1998
+++ 4.10/src/lib/libstand/globals.c Wed Oct 13 12:37:32 2004
@@ -28,6 +28,7 @@
diff -ru 6.2-release/src/lib/libstand/globals.c 6.2/src/lib/libstand/globals.c
--- 6.2-release/src/lib/libstand/globals.c Sun Sep 30 16:28:01 2001
+++ 6.2/src/lib/libstand/globals.c Thu Mar 1 12:05:17 2007
@@ -31,6 +31,7 @@
struct in_addr rootip; /* root ip address */
struct in_addr swapip; /* swap ip address */
struct in_addr gateip; /* swap ip address */
......@@ -120,35 +120,50 @@ diff -ru 4.10-release/src/lib/libstand/globals.c 4.10/src/lib/libstand/globals.c
n_long netmask = 0xffffff00; /* subnet or net mask */
int errno; /* our old friend */
diff -ru 4.10-release/src/lib/libstand/net.c 4.10/src/lib/libstand/net.c
--- 4.10-release/src/lib/libstand/net.c Fri Apr 14 21:09:28 2000
+++ 4.10/src/lib/libstand/net.c Thu May 27 14:00:18 2004
@@ -70,14 +70,16 @@
diff -ru 6.2-release/src/lib/libstand/gzipfs.c 6.2/src/lib/libstand/gzipfs.c
--- 6.2-release/src/lib/libstand/gzipfs.c Wed Jan 21 13:12:23 2004
+++ 6.2/src/lib/libstand/gzipfs.c Thu Mar 1 12:05:17 2007
@@ -172,9 +172,18 @@
int error;
struct stat sb;
+ /*
+ * XXX this F_READ check is a bad idea.
+ * If both version of the file exist, opening for write would not get
+ * the .gz version while a following open for read would get the now
+ * stale .gz version. Better to fail on write for the .gz version
+ * and force the caller to remove it.
+ */
+#if 0
/* Have to be in "just read it" mode */
if (f->f_flags != F_READ)
return(EPERM);
+#endif
/* If the name already ends in .gz or .bz2, ignore it */
if ((cp = strrchr(fname, '.')) && (!strcmp(cp, ".gz")
diff -ru 6.2-release/src/lib/libstand/net.c 6.2/src/lib/libstand/net.c
--- 6.2-release/src/lib/libstand/net.c Tue May 31 14:01:58 2005
+++ 6.2/src/lib/libstand/net.c Thu Mar 1 12:05:17 2007
@@ -72,7 +72,7 @@
* zero errno to indicate it isn't done yet.
*/
ssize_t
-sendrecv(d, sproc, sbuf, ssize, rproc, rbuf, rsize)
- register struct iodesc *d;
- register ssize_t (*sproc)(struct iodesc *, void *, size_t);
- register void *sbuf;
- register size_t ssize;
- register ssize_t (*rproc)(struct iodesc *, void *, size_t, time_t);
- register void *rbuf;
- register size_t rsize;
+sendrecv_timo(d, sproc, sbuf, ssize, rproc, rbuf, rsize, mintmo, maxtmo)
+ struct iodesc *d;
+ ssize_t (*sproc)(struct iodesc *, void *, size_t);
+ void *sbuf;
+ size_t ssize;
+ ssize_t (*rproc)(struct iodesc *, void *, size_t, time_t);
+ void *rbuf;
+ size_t rsize;
struct iodesc *d;
ssize_t (*sproc)(struct iodesc *, void *, size_t);
void *sbuf;
@@ -80,6 +80,8 @@
ssize_t (*rproc)(struct iodesc *, void *, size_t, time_t);
void *rbuf;
size_t rsize;
+ int mintmo;
+ int maxtmo;
{
register ssize_t cc;
register time_t t, tmo, tlast;
@@ -88,12 +90,12 @@
ssize_t cc;
time_t t, tmo, tlast;
@@ -90,12 +92,12 @@
printf("sendrecv: called\n");
#endif
......@@ -163,7 +178,7 @@ diff -ru 4.10-release/src/lib/libstand/net.c 4.10/src/lib/libstand/net.c
errno = ETIMEDOUT;
return -1;
}
@@ -104,8 +106,8 @@
@@ -106,8 +108,8 @@
tleft = tmo;
tmo <<= 1;
......@@ -174,7 +189,7 @@ diff -ru 4.10-release/src/lib/libstand/net.c 4.10/src/lib/libstand/net.c
if (cc == -1) {
/* Error on transmit; wait before retrying */
@@ -116,6 +118,11 @@
@@ -118,6 +120,11 @@
tlast = t;
}
......@@ -186,7 +201,7 @@ diff -ru 4.10-release/src/lib/libstand/net.c 4.10/src/lib/libstand/net.c
/* Try to get a packet and process it. */
cc = (*rproc)(d, rbuf, rsize, tleft);
@@ -128,6 +135,20 @@
@@ -130,6 +137,20 @@
tleft -= t - tlast;
tlast = t;
}
......@@ -207,9 +222,9 @@ diff -ru 4.10-release/src/lib/libstand/net.c 4.10/src/lib/libstand/net.c
}
/*
diff -ru 4.10-release/src/lib/libstand/net.h 4.10/src/lib/libstand/net.h
--- 4.10-release/src/lib/libstand/net.h Sun Mar 4 23:27:18 2001
+++ 4.10/src/lib/libstand/net.h Wed Oct 13 12:37:32 2004
diff -ru 6.2-release/src/lib/libstand/net.h 6.2/src/lib/libstand/net.h
--- 6.2-release/src/lib/libstand/net.h Thu Nov 9 23:06:55 2000
+++ 6.2/src/lib/libstand/net.h Thu Mar 1 12:05:17 2007
@@ -86,6 +86,7 @@
extern struct in_addr swapip;
extern struct in_addr gateip;
......@@ -230,34 +245,63 @@ diff -ru 4.10-release/src/lib/libstand/net.h 4.10/src/lib/libstand/net.h
/* bootp/DHCP */
void bootp(int, int);
diff -ru 4.10-release/src/lib/libstand/sbrk.c 4.10/src/lib/libstand/sbrk.c
--- 4.10-release/src/lib/libstand/sbrk.c Thu May 18 02:00:57 2000
+++ 4.10/src/lib/libstand/sbrk.c Thu May 27 14:00:18 2004
@@ -51,6 +51,20 @@
diff -ru 6.2-release/src/lib/libstand/sbrk.c 6.2/src/lib/libstand/sbrk.c
--- 6.2-release/src/lib/libstand/sbrk.c Sun Oct 3 09:58:20 2004
+++ 6.2/src/lib/libstand/sbrk.c Thu Mar 1 17:43:06 2007
@@ -45,6 +45,15 @@
maxheap = (char *)top - (char *)heapbase;
}
+void
+showheap(void)
+{
+ char here;
+
+ printf("sbrk: heapbase@%p, curheap@%p, maxheap@%p, curstack@%p\n",
+ heapbase, heapbase+heapsize, heapbase+maxheap, &here);
+}
+
char *
sbrk(int incr)
{
@@ -52,6 +61,24 @@
if ((heapsize + incr) <= maxheap) {
ret = heapbase + heapsize;
ret = (char *)heapbase + heapsize;
+#if 0 /* heap may now be in extended memory, "above" the stack */
+#ifdef __i386__
+ /*
+ * Check for stack overrun
+ * XXX makes a couple of assumptions: stack frows downward,
+ * XXX makes a couple of assumptions: stack grows downward,
+ * and stack starts above the heap.
+ */
+ if (ret+incr > (char *)&ret) {
+ static int beentheredonethat;
+ if (!beentheredonethat) {
+ beentheredonethat = 1;
+ printf("sbrk: heap overruns stack!\n");
+ }
+ static int beentheredonethat;
+ if (!beentheredonethat) {
+ beentheredonethat = 1;
+ printf("sbrk: heap overruns stack!\n");
+ }
+ errno = ENOMEM;
+ return((char *)-1);
+ }
+#endif
+#endif
bzero(ret, incr);
heapsize += incr;
return(ret);
diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
--- 4.10-release/src/lib/libstand/tftp.c Sat Jul 14 08:00:03 2001
+++ 4.10/src/lib/libstand/tftp.c Wed Oct 13 12:37:32 2004
@@ -79,7 +79,7 @@
diff -ru 6.2-release/src/lib/libstand/tftp.c 6.2/src/lib/libstand/tftp.c
--- 6.2-release/src/lib/libstand/tftp.c Sun Oct 3 09:58:20 2004
+++ 6.2/src/lib/libstand/tftp.c Mon Mar 12 17:30:23 2007
@@ -34,6 +34,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/lib/libstand/tftp.c,v 1.12 2004/10/03 15:58:20 stefanf Exp $");
+#undef DEBUG
+
/*
* Simple TFTP implementation for libsa.
* Assumes:
@@ -80,7 +82,7 @@
extern struct in_addr servip;
......@@ -266,7 +310,7 @@ diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
#define RSPACE 520 /* max data packet, rounded up */
@@ -129,7 +129,7 @@
@@ -130,10 +132,14 @@
case DATA: {
int got;
......@@ -275,16 +319,14 @@ diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
/*
* Expected block?
*/
@@ -139,7 +139,7 @@
/*
* First data packet from new port.
*/
- register struct udphdr *uh;
+ struct udphdr *uh;
uh = (struct udphdr *) pkt - 1;
d->destport = uh->uh_sport;
} /* else check uh_sport has not changed??? */
@@ -160,11 +160,47 @@
+#ifdef DEBUG
+ printf("got wrong tftp block (%d != %lu)\n",
+ ntohs(t->th_block), d->xid);
+#endif
return (-1);
}
if (d->xid == 1) {
@@ -161,11 +167,47 @@
default:
#ifdef DEBUG
printf("tftp type %d not handled\n", ntohs(t->th_opcode));
......@@ -332,7 +374,7 @@ diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
/* send request, expect first block (or error) */
static int
tftp_makereq(h)
@@ -179,10 +215,13 @@
@@ -180,10 +222,13 @@
int l;
ssize_t res;
struct tftphdr *t;
......@@ -346,7 +388,7 @@ diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
bcopy(h->path, wtail, l + 1);
wtail += l + 1;
bcopy("octet", wtail, 6);
@@ -190,14 +229,22 @@
@@ -191,14 +236,22 @@
t = &h->lastdata.t;
......@@ -374,7 +416,7 @@ diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
if (res == -1)
return (errno);
@@ -261,15 +308,20 @@
@@ -267,15 +320,22 @@
if (io == NULL)
return (EINVAL);
......@@ -391,6 +433,8 @@ diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
return(ENOMEM);
}
+ strcpy(tftpfile->path, rootpath);
+ if (path[0] != '/')
+ strcat(tftpfile->path, "/");
+ strcat(tftpfile->path, path);
- res = tftp_makereq(tftpfile, path);
......@@ -398,7 +442,7 @@ diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
if (res) {
free(tftpfile->path);
@@ -309,7 +361,7 @@
@@ -315,7 +375,7 @@
res = tftp_getnextblock(tftpfile);
if (res) { /* no answer */
#ifdef DEBUG
......@@ -407,15 +451,7 @@ diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
#endif
return (res);
}
@@ -346,7 +398,6 @@
#endif
return (EINVAL);
}
-
}
if (resid)
@@ -361,9 +412,8 @@
@@ -367,9 +427,8 @@
struct tftp_handle *tftpfile;
tftpfile = (struct tftp_handle *) f->f_fsdata;
......@@ -426,25 +462,3 @@ diff -ru 4.10-release/src/lib/libstand/tftp.c 4.10/src/lib/libstand/tftp.c
free(tftpfile->path);
free(tftpfile);
}
diff -ru 4.10-release/src/lib/libstand/zipfs.c 4.10/src/lib/libstand/zipfs.c
--- 4.10-release/src/lib/libstand/zipfs.c Mon Apr 8 07:50:09 2002
+++ 4.10/src/lib/libstand/zipfs.c Thu May 27 14:00:18 2004
@@ -169,9 +169,18 @@
int error;
struct stat sb;
+ /*
+ * XXX this F_READ check is a bad idea.
+ * If both version of the file exist, opening for write would not get
+ * the .gz version while a following open for read would get the now
+ * stale .gz version. Better to fail on write for the .gz version
+ * and force the caller to remove it.
+ */
+#if 0
/* Have to be in "just read it" mode */
if (f->f_flags != F_READ)
return(EPERM);
+#endif
/* If the name already ends in .gz or .bz2, ignore it */
if ((cp = strrchr(fname, '.')) && (!strcmp(cp, ".gz")
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment