mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-26 00:59:55 +00:00
2002-01-03 Yoshinori K. Okuji <okuji@gnu.org>
Update the netboot stuff to Etherboot-5.0.5. * configure.in (--enable-3c590): Removed. This was a mistake. (--enable-davicom): New option. (--enable-eepro): Likewise. (--enable-natsemi): Likewise. (--enable-ni5010): Likewise. (--enable-sis900): Likewise. (--enable-w89c840): Likewise. (--enable-3c509-hack): Removed. (--enable-ns8390-force-16bit): Likewise. * netboot/Makefile.am (libdrivers_a_SOURCES): Added timer.c and timer.h. (EXTRA_libdrivers_a_SOURCES): Added davicom.c, eepro.c, fa311.c, natsemi.c, ni5010.c, sis900.c, sis900.h, tlan.c and w89c840.c. (EXTRA_DIST): Added sis900.txt. (3c595_drivers): Remove 3c590.o from this. (davicom_drivers): New variable. (eepro_drivers): Likewise. (natsemi_drivers): Likewise. (ni5010_drivers): Likewise. (sis900_drivers): Likewise. (w89c840_drivers): Likewise. (3c590_o_CFLAGS): Removed. (davicom_o_CFLAGS): New variable. (eepro_o_CFLAGS): Likewise. (natsemi_o_CFLAGS): Likewise. (ni5010_o_CFLAGS): Likewise. (sis900_o_CFLAGS): Likewise. (w89c840_o_CFLAGS): Likewise. * netboot/davicom.c: New file, from Etherboot-5.0.5. * netboot/eepro.c: Likewise. * netboot/natsemi.c: Likewise. * netboot/ni5010.c: Likewise. * netboot/sis900.c: Likewise. * netboot/sis900.h: Likewise. * netboot/sis900.txt: Likewise. * netboot/timer.c: Likewise. * netboot/timer.h: Likewise. * netboot/w89c840.c: Likewise. * netboot/fa311.c: Likewise. * netboot/tlan.c: Likewise. * netboot/3c509.c: Copied from Etherboot-5.0.5. * netboot/3c509.h: Likewise. * netboot/3c595.c: Likewise. * netboot/3c90x.c: Likewise. * netboot/3c90x.txt: Likewise. * netboot/cards.h: Likewise. * netboot/cs89x0.c: Likewise. * netboot/depca.c: Likewise. * netboot/eepro100.c: Likewise. * netboot/epic100.c: Likewise. * netboot/i82586.c: Likewise. * netboot/lance.c: Likewise. * netboot/linux-asm-string.h: Likewise. * netboot/nic.h: Likewise. * netboot/ns8390.c: Likewise. * netboot/ns8390.h: Likewise. * netboot/otulip.c: Likewise. * netboot/pci.h: Likewise. * netboot/rtl8139.c: Likewise. * netboot/sk_g16.c: Likewise. * netboot/smc9000.c: Likewise. * netboot/tiara.c: Likewise. * netboot/tulip.c: Likewise. * netboot/via-rhine.c: Likewise. * netboot/config.c: Applied a diff between Etherboot-4.6.18 and Etherboot-5.0.5 manually. * netboot/main.c: Likewise. * netboot/pci.c: Likewise. * netboot/etherboot.h: Rewritten mostly from scratch, based on the same file in Etherboot-5.0.5. * netboot/misc.c: Likewise. * netboot/osdep.h: Likewise. * netboot/fsys_tftp.c (GRUB): Defined. (buf_fill): Use rfc2131_sleep_interval instead of rfc951_sleep. * stage2/builtins.c [SUPPORT_NETBOOT] (GRUB): Defined. (boot_func) [SUPPORT_NETBOOT]: Call cleanup_net. * stage2/cmdline.c [SUPPORT_DISKLESS] (GRUB): Defined. * stage2/common.c [SUPPORT_DISKLESS] (GRUB): Likewise.
This commit is contained in:
1 parent
daa965eccc
commit
973e6f4129
54 files changed
+13400
-3545
No files matched your search
+277
-359
@@ -1,3 +1,27 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* RULE: You must define the macro ``GRUB'' when including this header
|
||||
file in GRUB code. */
|
||||
|
||||
/* Based on "src/etherboot.h" in etherboot-5.0.5. */
|
||||
|
||||
/**************************************************************************
|
||||
ETHERBOOT - BOOTP/TFTP Bootstrap Program
|
||||
|
||||
@@ -6,151 +30,75 @@ Author: Martin Renters
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/* Enable GRUB-specific stuff. */
|
||||
#define GRUB 1
|
||||
|
||||
#ifdef GRUB
|
||||
/* Include GRUB-specific macros and prototypes here. */
|
||||
# include <shared.h>
|
||||
#include <shared.h>
|
||||
|
||||
/* FIXME: For now, enable the DHCP support. Perhaps I should segregate
|
||||
the DHCP support from the BOOTP support, and permit both to
|
||||
co-exist. */
|
||||
# undef NO_DHCP_SUPPORT
|
||||
#undef NO_DHCP_SUPPORT
|
||||
|
||||
/* In GRUB, the relocated address in Etherboot doesn't have any sense.
|
||||
Just define it as a bogus value. */
|
||||
# define RELOC 0
|
||||
|
||||
/* Force to use the internal buffer. */
|
||||
# define INTERNAL_BOOTP_DATA 1
|
||||
|
||||
/* Likewise. */
|
||||
# define USE_INTERNAL_BUFFER 1
|
||||
#define RELOC 0
|
||||
|
||||
/* FIXME: Should be an option. */
|
||||
# define BACKOFF_LIMIT 7
|
||||
#endif /* GRUB */
|
||||
#define BACKOFF_LIMIT 7
|
||||
|
||||
#include "osdep.h"
|
||||
#include <osdep.h>
|
||||
|
||||
/* These could be customised for different languages perhaps */
|
||||
#define ASK_PROMPT "Boot from (N)etwork or from (L)ocal? "
|
||||
#define ANS_NETWORK 'N'
|
||||
#define ANS_LOCAL 'L'
|
||||
#ifndef ANS_DEFAULT /* in case left out in Makefile */
|
||||
#define ANS_DEFAULT ANS_NETWORK
|
||||
#endif
|
||||
|
||||
#define TAGGED_IMAGE /* eventually optional */
|
||||
#if !defined(TAGGED_IMAGE) && !defined(AOUT_IMAGE) && !defined(ELF_IMAGE)
|
||||
#define TAGGED_IMAGE /* choose at least one */
|
||||
#endif
|
||||
|
||||
#ifdef GRUB
|
||||
# define CTRL_C 3
|
||||
#else /* ! GRUB */
|
||||
# define ESC 0x1B
|
||||
#endif /* ! GRUB */
|
||||
|
||||
#ifndef DEFAULT_BOOTFILE
|
||||
#define DEFAULT_BOOTFILE "/tftpboot/kernel"
|
||||
#endif
|
||||
|
||||
/* Clean up console settings... mainly CONSOLE_CRT and CONSOLE_SERIAL are used
|
||||
* in the sources (except start.S and serial.S which cannot include
|
||||
* etherboot.h). At least one of the CONSOLE_xxx has to be set, and
|
||||
* CONSOLE_DUAL sets both CONSOLE_CRT and CONSOLE_SERIAL. If none is set,
|
||||
* CONSOLE_CRT is assumed. */
|
||||
#ifdef CONSOLE_DUAL
|
||||
#undef CONSOLE_CRT
|
||||
#define CONSOLE_CRT
|
||||
#undef CONSOLE_SERIAL
|
||||
#define CONSOLE_SERIAL
|
||||
#endif
|
||||
#if defined(CONSOLE_CRT) && defined(CONSOLE_SERIAL)
|
||||
#undef CONSOLE_DUAL
|
||||
#define CONSOLE_DUAL
|
||||
#endif
|
||||
#if !defined(CONSOLE_CRT) && !defined(CONSOLE_SERIAL)
|
||||
#define CONSOLE_CRT
|
||||
#endif
|
||||
|
||||
#ifndef DOWNLOAD_PROTO_NFS
|
||||
#undef DOWNLOAD_PROTO_TFTP
|
||||
#define DOWNLOAD_PROTO_TFTP /* default booting protocol */
|
||||
#endif
|
||||
|
||||
#ifdef DOWNLOAD_PROTO_TFTP
|
||||
#define download(fname,loader) tftp((fname),(loader))
|
||||
#endif
|
||||
#ifdef DOWNLOAD_PROTO_NFS
|
||||
#define download(fname,loader) nfs((fname),(loader))
|
||||
#endif
|
||||
#define CTRL_C 3
|
||||
|
||||
#ifndef MAX_TFTP_RETRIES
|
||||
#define MAX_TFTP_RETRIES 20
|
||||
# define MAX_TFTP_RETRIES 20
|
||||
#endif
|
||||
|
||||
#ifndef MAX_BOOTP_RETRIES
|
||||
#define MAX_BOOTP_RETRIES 20
|
||||
# define MAX_BOOTP_RETRIES 20
|
||||
#endif
|
||||
|
||||
#ifndef MAX_BOOTP_EXTLEN
|
||||
#if (RELOC < 0x94000)
|
||||
/* Force internal buffer (if external buffer would overlap with our code...) */
|
||||
#undef INTERNAL_BOOTP_DATA
|
||||
#define INTERNAL_BOOTP_DATA
|
||||
#endif
|
||||
/* sizeof(struct bootp_t) == 0x240 */
|
||||
#if defined(INTERNAL_BOOTP_DATA) || (RELOC >= 0x94240)
|
||||
#define MAX_BOOTP_EXTLEN 1024
|
||||
#else
|
||||
#define MAX_BOOTP_EXTLEN (1024-sizeof(struct bootp_t))
|
||||
#endif
|
||||
#endif
|
||||
#define MAX_BOOTP_EXTLEN (ETH_FRAME_LEN - ETH_HLEN - \
|
||||
sizeof (struct bootp_t))
|
||||
|
||||
#ifndef MAX_ARP_RETRIES
|
||||
#define MAX_ARP_RETRIES 20
|
||||
# define MAX_ARP_RETRIES 20
|
||||
#endif
|
||||
|
||||
#ifndef MAX_RPC_RETRIES
|
||||
#define MAX_RPC_RETRIES 20
|
||||
# define MAX_RPC_RETRIES 20
|
||||
#endif
|
||||
|
||||
#define TICKS_PER_SEC 18
|
||||
|
||||
/* Inter-packet retry in ticks */
|
||||
#define TIMEOUT (10*TICKS_PER_SEC)
|
||||
#define TIMEOUT (10 * TICKS_PER_SEC)
|
||||
|
||||
/* These settings have sense only if compiled with -DCONGESTED */
|
||||
/* total retransmission timeout in ticks */
|
||||
#define TFTP_TIMEOUT (30*TICKS_PER_SEC)
|
||||
#define TFTP_TIMEOUT (30 * TICKS_PER_SEC)
|
||||
/* packet retransmission timeout in ticks */
|
||||
#define TFTP_REXMT (3*TICKS_PER_SEC)
|
||||
#define TFTP_REXMT (3 * TICKS_PER_SEC)
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
# define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
/*
|
||||
I'm moving towards the defined names in linux/if_ether.h for clarity.
|
||||
The confusion between 60/64 and 1514/1518 arose because the NS8390
|
||||
counts the 4 byte frame checksum in the incoming packet, but not
|
||||
in the outgoing packet. 60/1514 are the correct numbers for most
|
||||
if not all of the other NIC controllers. I will be retiring the
|
||||
64/1518 defines in the lead-up to 5.0.
|
||||
*/
|
||||
|
||||
#define ETHER_ADDR_SIZE 6 /* Size of Ethernet address */
|
||||
#define ETHER_HDR_SIZE 14 /* Size of ethernet header */
|
||||
#define ETH_MIN_PACKET 64
|
||||
#define ETH_MAX_PACKET 1518
|
||||
|
||||
#define VENDOR_NONE 0
|
||||
#define VENDOR_WD 1
|
||||
#define VENDOR_NOVELL 2
|
||||
#define VENDOR_3COM 3
|
||||
#define VENDOR_3C509 4
|
||||
#define VENDOR_CS89x0 5
|
||||
|
||||
#define FLAG_PIO 0x01
|
||||
#define FLAG_16BIT 0x02
|
||||
#define FLAG_790 0x04
|
||||
#define ETH_ALEN 6 /* Size of Ethernet address */
|
||||
#define ETH_HLEN 14 /* Size of ethernet header */
|
||||
#define ETH_ZLEN 60 /* Minimum packet */
|
||||
/*#define ETH_MIN_PACKET 64*/
|
||||
#define ETH_FRAME_LEN 1514 /* Maximum packet */
|
||||
/*#define ETH_MAX_PACKET 1518*/
|
||||
#define ETH_MAX_MTU (ETH_FRAME_LEN - ETH_HLEN)
|
||||
|
||||
#define ARP_CLIENT 0
|
||||
#define ARP_SERVER 1
|
||||
@@ -181,7 +129,7 @@ Author: Martin Renters
|
||||
#define BOOTP_REQUEST 1
|
||||
#define BOOTP_REPLY 2
|
||||
|
||||
#define TAG_LEN(p) (*((p)+1))
|
||||
#define TAG_LEN(p) (*((p) + 1))
|
||||
#define RFC1533_COOKIE 99, 130, 83, 99
|
||||
#define RFC1533_PAD 0
|
||||
#define RFC1533_NETMASK 1
|
||||
@@ -239,6 +187,7 @@ Author: Martin Renters
|
||||
#define RFC2132_SRV_ID 54
|
||||
#define RFC2132_PARAM_LIST 55
|
||||
#define RFC2132_MAX_SIZE 57
|
||||
#define RFC2132_VENDOR_CLASS_ID 60
|
||||
|
||||
#define DHCPDISCOVER 1
|
||||
#define DHCPOFFER 2
|
||||
@@ -251,9 +200,6 @@ Author: Martin Renters
|
||||
|
||||
#define RFC1533_VENDOR_MAGIC 128
|
||||
#define RFC1533_VENDOR_ADDPARM 129
|
||||
#ifdef IMAGE_FREEBSD
|
||||
#define RFC1533_VENDOR_HOWTO 132
|
||||
#endif
|
||||
#define RFC1533_VENDOR_MNUOPTS 160
|
||||
#define RFC1533_VENDOR_SELECTION 176
|
||||
#define RFC1533_VENDOR_MOTD 184
|
||||
@@ -261,11 +207,10 @@ Author: Martin Renters
|
||||
#define RFC1533_VENDOR_IMG 192
|
||||
#define RFC1533_VENDOR_NUMOFIMG 16
|
||||
|
||||
#ifdef GRUB
|
||||
# define RFC1533_VENDOR_CONFIGFILE 150
|
||||
#endif /* GRUB */
|
||||
#define RFC1533_VENDOR_CONFIGFILE 150
|
||||
|
||||
#define RFC1533_END 255
|
||||
|
||||
#define BOOTP_VENDOR_LEN 64
|
||||
#ifndef NO_DHCP_SUPPORT
|
||||
#define DHCP_OPT_LEN 312
|
||||
@@ -294,129 +239,196 @@ Author: Martin Renters
|
||||
#define AWAIT_RPC 4
|
||||
#define AWAIT_QDRAIN 5 /* drain queue, process ARP requests */
|
||||
|
||||
typedef struct {
|
||||
unsigned long s_addr;
|
||||
} in_addr;
|
||||
typedef struct
|
||||
{
|
||||
unsigned long s_addr;
|
||||
}
|
||||
in_addr;
|
||||
|
||||
struct arptable_t {
|
||||
in_addr ipaddr;
|
||||
unsigned char node[6];
|
||||
struct arptable_t
|
||||
{
|
||||
in_addr ipaddr;
|
||||
unsigned char node[6];
|
||||
};
|
||||
|
||||
/*
|
||||
* A pity sipaddr and tipaddr are not longword aligned or we could use
|
||||
* in_addr. No, I don't want to use #pragma packed.
|
||||
*/
|
||||
struct arprequest {
|
||||
unsigned short hwtype;
|
||||
unsigned short protocol;
|
||||
char hwlen;
|
||||
char protolen;
|
||||
unsigned short opcode;
|
||||
char shwaddr[6];
|
||||
char sipaddr[4];
|
||||
char thwaddr[6];
|
||||
char tipaddr[4];
|
||||
struct arprequest
|
||||
{
|
||||
unsigned short hwtype;
|
||||
unsigned short protocol;
|
||||
char hwlen;
|
||||
char protolen;
|
||||
unsigned short opcode;
|
||||
char shwaddr[6];
|
||||
char sipaddr[4];
|
||||
char thwaddr[6];
|
||||
char tipaddr[4];
|
||||
};
|
||||
|
||||
struct iphdr {
|
||||
char verhdrlen;
|
||||
char service;
|
||||
unsigned short len;
|
||||
unsigned short ident;
|
||||
unsigned short frags;
|
||||
char ttl;
|
||||
char protocol;
|
||||
unsigned short chksum;
|
||||
in_addr src;
|
||||
in_addr dest;
|
||||
struct iphdr
|
||||
{
|
||||
char verhdrlen;
|
||||
char service;
|
||||
unsigned short len;
|
||||
unsigned short ident;
|
||||
unsigned short frags;
|
||||
char ttl;
|
||||
char protocol;
|
||||
unsigned short chksum;
|
||||
in_addr src;
|
||||
in_addr dest;
|
||||
};
|
||||
|
||||
struct udphdr {
|
||||
unsigned short src;
|
||||
unsigned short dest;
|
||||
unsigned short len;
|
||||
unsigned short chksum;
|
||||
struct udphdr
|
||||
{
|
||||
unsigned short src;
|
||||
unsigned short dest;
|
||||
unsigned short len;
|
||||
unsigned short chksum;
|
||||
};
|
||||
|
||||
struct bootp_t {
|
||||
struct iphdr ip;
|
||||
struct udphdr udp;
|
||||
char bp_op;
|
||||
char bp_htype;
|
||||
char bp_hlen;
|
||||
char bp_hops;
|
||||
unsigned long bp_xid;
|
||||
unsigned short bp_secs;
|
||||
unsigned short unused;
|
||||
in_addr bp_ciaddr;
|
||||
in_addr bp_yiaddr;
|
||||
in_addr bp_siaddr;
|
||||
in_addr bp_giaddr;
|
||||
char bp_hwaddr[16];
|
||||
char bp_sname[64];
|
||||
char bp_file[128];
|
||||
/* Format of a bootp packet. */
|
||||
struct bootp_t
|
||||
{
|
||||
char bp_op;
|
||||
char bp_htype;
|
||||
char bp_hlen;
|
||||
char bp_hops;
|
||||
unsigned long bp_xid;
|
||||
unsigned short bp_secs;
|
||||
unsigned short unused;
|
||||
in_addr bp_ciaddr;
|
||||
in_addr bp_yiaddr;
|
||||
in_addr bp_siaddr;
|
||||
in_addr bp_giaddr;
|
||||
char bp_hwaddr[16];
|
||||
char bp_sname[64];
|
||||
char bp_file[128];
|
||||
#ifdef NO_DHCP_SUPPORT
|
||||
char bp_vend[BOOTP_VENDOR_LEN];
|
||||
char bp_vend[BOOTP_VENDOR_LEN];
|
||||
#else
|
||||
char bp_vend[DHCP_OPT_LEN];
|
||||
char bp_vend[DHCP_OPT_LEN];
|
||||
#endif /* NO_DHCP_SUPPORT */
|
||||
};
|
||||
|
||||
struct bootpd_t {
|
||||
struct bootp_t bootp_reply;
|
||||
unsigned char bootp_extension[MAX_BOOTP_EXTLEN];
|
||||
/* Format of a bootp IP packet. */
|
||||
struct bootpip_t
|
||||
{
|
||||
struct iphdr ip;
|
||||
struct udphdr udp;
|
||||
struct bootp_t bp;
|
||||
};
|
||||
|
||||
struct tftp_t {
|
||||
struct iphdr ip;
|
||||
struct udphdr udp;
|
||||
unsigned short opcode;
|
||||
union {
|
||||
char rrq[TFTP_DEFAULTSIZE_PACKET];
|
||||
struct {
|
||||
unsigned short block;
|
||||
char download[TFTP_MAX_PACKET];
|
||||
} data;
|
||||
struct {
|
||||
unsigned short block;
|
||||
} ack;
|
||||
struct {
|
||||
unsigned short errcode;
|
||||
char errmsg[TFTP_DEFAULTSIZE_PACKET];
|
||||
} err;
|
||||
struct {
|
||||
char data[TFTP_DEFAULTSIZE_PACKET+2];
|
||||
} oack;
|
||||
} u;
|
||||
/* Format of bootp packet with extensions. */
|
||||
struct bootpd_t
|
||||
{
|
||||
struct bootp_t bootp_reply;
|
||||
unsigned char bootp_extension[MAX_BOOTP_EXTLEN];
|
||||
};
|
||||
|
||||
struct tftp_t
|
||||
{
|
||||
struct iphdr ip;
|
||||
struct udphdr udp;
|
||||
unsigned short opcode;
|
||||
union
|
||||
{
|
||||
char rrq[TFTP_DEFAULTSIZE_PACKET];
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned short block;
|
||||
char download[TFTP_MAX_PACKET];
|
||||
}
|
||||
data;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned short block;
|
||||
}
|
||||
ack;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned short errcode;
|
||||
char errmsg[TFTP_DEFAULTSIZE_PACKET];
|
||||
}
|
||||
err;
|
||||
|
||||
struct
|
||||
{
|
||||
char data[TFTP_DEFAULTSIZE_PACKET+2];
|
||||
}
|
||||
oack;
|
||||
}
|
||||
u;
|
||||
};
|
||||
|
||||
/* Define a smaller tftp packet solely for making requests to conserve stack
|
||||
512 bytes should be enough. */
|
||||
struct tftpreq_t
|
||||
{
|
||||
struct iphdr ip;
|
||||
struct udphdr udp;
|
||||
unsigned short opcode;
|
||||
union
|
||||
{
|
||||
char rrq[512];
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned short block;
|
||||
}
|
||||
ack;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned short errcode;
|
||||
char errmsg[512-2];
|
||||
}
|
||||
err;
|
||||
}
|
||||
u;
|
||||
};
|
||||
|
||||
#define TFTP_MIN_PACKET (sizeof(struct iphdr) + sizeof(struct udphdr) + 4)
|
||||
|
||||
struct rpc_t {
|
||||
struct iphdr ip;
|
||||
struct udphdr udp;
|
||||
union {
|
||||
char data[300]; /* longest RPC call must fit!!!! */
|
||||
struct {
|
||||
long id;
|
||||
long type;
|
||||
long rpcvers;
|
||||
long prog;
|
||||
long vers;
|
||||
long proc;
|
||||
long data[1];
|
||||
} call;
|
||||
struct {
|
||||
long id;
|
||||
long type;
|
||||
long rstatus;
|
||||
long verifier;
|
||||
long v2;
|
||||
long astatus;
|
||||
long data[1];
|
||||
} reply;
|
||||
} u;
|
||||
struct rpc_t
|
||||
{
|
||||
struct iphdr ip;
|
||||
struct udphdr udp;
|
||||
union
|
||||
{
|
||||
char data[300]; /* longest RPC call must fit!!!! */
|
||||
|
||||
struct
|
||||
{
|
||||
long id;
|
||||
long type;
|
||||
long rpcvers;
|
||||
long prog;
|
||||
long vers;
|
||||
long proc;
|
||||
long data[1];
|
||||
}
|
||||
call;
|
||||
|
||||
struct
|
||||
{
|
||||
long id;
|
||||
long type;
|
||||
long rstatus;
|
||||
long verifier;
|
||||
long v2;
|
||||
long astatus;
|
||||
long data[1];
|
||||
}
|
||||
reply;
|
||||
}
|
||||
u;
|
||||
};
|
||||
|
||||
#define PROG_PORTMAP 100000
|
||||
@@ -446,179 +458,85 @@ struct rpc_t {
|
||||
#define NFS_READ_SIZE 1024
|
||||
|
||||
#define FLOPPY_BOOT_LOCATION 0x7c00
|
||||
/* Must match offsets in loader.S */
|
||||
#define ROM_SEGMENT 0x1fa
|
||||
#define ROM_LENGTH 0x1fc
|
||||
|
||||
#define ROM_INFO_LOCATION 0x7dfa
|
||||
#define ROM_INFO_LOCATION (FLOPPY_BOOT_LOCATION + ROM_SEGMENT)
|
||||
/* at end of floppy boot block */
|
||||
|
||||
struct rom_info {
|
||||
unsigned short rom_segment;
|
||||
unsigned short rom_length;
|
||||
struct rom_info
|
||||
{
|
||||
unsigned short rom_segment;
|
||||
unsigned short rom_length;
|
||||
};
|
||||
|
||||
static inline int
|
||||
rom_address_ok (struct rom_info *rom, int assigned_rom_segment)
|
||||
{
|
||||
return (assigned_rom_segment < 0xC000
|
||||
|| assigned_rom_segment == rom->rom_segment);
|
||||
}
|
||||
|
||||
/* Define a type for passing info to a loaded program. */
|
||||
struct ebinfo
|
||||
{
|
||||
unsigned char major, minor; /* Version */
|
||||
unsigned short flags; /* Bit flags */
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
External prototypes
|
||||
***************************************************************************/
|
||||
/* main.c */
|
||||
#ifdef GRUB
|
||||
extern void print_network_configuration P((void));
|
||||
extern int ifconfig P((char *ip, char *sm, char *gw, char *svr));
|
||||
#endif /* GRUB */
|
||||
|
||||
#ifndef GRUB
|
||||
extern void print_bytes P((unsigned char *bytes, int len));
|
||||
extern void load P((void));
|
||||
extern int load_linux P((int root_mount_port,int swap_mount_port,
|
||||
int root_nfs_port,char *kernel_handle));
|
||||
extern int downloadkernel P((unsigned char *, int, int, int));
|
||||
extern int tftp P((const char *name, int (*)(unsigned char *, int, int, int)));
|
||||
extern void rpc_init(void);
|
||||
extern int nfs P((const char *name, int (*)(unsigned char *, int, int, int)));
|
||||
extern void nfs_umountall P((int));
|
||||
#endif /* ! GRUB */
|
||||
extern int bootp P((void));
|
||||
extern int rarp P((void));
|
||||
extern int udp_transmit P((unsigned long destip, unsigned int srcsock,
|
||||
unsigned int destsock, int len, const void *buf));
|
||||
|
||||
extern int await_reply P((int type, int ival, void *ptr, int timeout));
|
||||
extern int decode_rfc1533 P((unsigned char *, int, int, int));
|
||||
extern unsigned short ipchksum P((unsigned short *, int len));
|
||||
extern void rfc951_sleep P((int));
|
||||
extern void cleanup_net P((void));
|
||||
extern void cleanup P((void));
|
||||
extern void print_network_configuration (void);
|
||||
extern int ifconfig (char *ip, char *sm, char *gw, char *svr);
|
||||
extern int udp_transmit (unsigned long destip, unsigned int srcsock,
|
||||
unsigned int destsock, int len, const void *buf);
|
||||
extern int await_reply (int type, int ival, void *ptr, int timeout);
|
||||
extern int decode_rfc1533 (unsigned char *, int, int, int);
|
||||
extern long rfc2131_sleep_interval (int base, int exp);
|
||||
extern void cleanup (void);
|
||||
extern int rarp (void);
|
||||
extern int bootp (void);
|
||||
extern void cleanup_net (void);
|
||||
|
||||
/* config.c */
|
||||
extern void print_config(void);
|
||||
extern void eth_reset(void);
|
||||
extern int eth_probe(void);
|
||||
extern int eth_poll(void);
|
||||
extern void eth_transmit(const char *d, unsigned int t, unsigned int s, const void *p);
|
||||
extern void eth_disable(void);
|
||||
|
||||
#ifndef GRUB
|
||||
/* bootmenu.c */
|
||||
extern int execute P((char *string));
|
||||
extern void bootmenu P((int));
|
||||
extern void show_motd P((void));
|
||||
extern void parse_menuopts P((char *,int));
|
||||
extern int getoptvalue P((char **, int *, int *));
|
||||
extern void selectImage P((char **));
|
||||
|
||||
/* osloader.c */
|
||||
#if defined(AOUT_IMAGE) || defined(ELF_IMAGE)
|
||||
extern int howto;
|
||||
#endif
|
||||
extern int os_download P((unsigned int, unsigned char *,unsigned int));
|
||||
#endif /* ! GRUB */
|
||||
extern void print_config (void);
|
||||
extern void eth_reset (void);
|
||||
extern int eth_probe (void);
|
||||
extern int eth_poll (void);
|
||||
extern void eth_transmit (const char *d, unsigned int t,
|
||||
unsigned int s, const void *p);
|
||||
extern void eth_disable (void);
|
||||
|
||||
/* misc.c */
|
||||
extern void twiddle P((void));
|
||||
extern void sleep P((int secs));
|
||||
#ifndef GRUB
|
||||
extern int strcasecmp P((char *a, char *b));
|
||||
extern char *substr P((char *a, char *b));
|
||||
#endif /* ! GRUB */
|
||||
extern int getdec P((char **));
|
||||
#ifndef GRUB
|
||||
extern void printf P((const char *, ...));
|
||||
extern char *sprintf P((char *, const char *, ...));
|
||||
#endif /* ! GRUB */
|
||||
extern int inet_aton P((char *p, in_addr *i));
|
||||
#ifndef GRUB
|
||||
extern void gateA20_set P((void));
|
||||
extern void gateA20_unset P((void));
|
||||
extern void putchar P((int));
|
||||
extern int getchar P((void));
|
||||
extern int iskey P((void));
|
||||
|
||||
/* start*.S */
|
||||
extern int getc P((void));
|
||||
extern void putc P((int));
|
||||
extern int ischar P((void));
|
||||
extern int getshift P((void));
|
||||
extern unsigned int memsize P((void));
|
||||
extern unsigned short basememsize P((void));
|
||||
extern void disk_init P((void));
|
||||
extern unsigned int disk_read P((int drv,int c,int h,int s,char *buf));
|
||||
extern void xstart P((unsigned long, unsigned long, char *));
|
||||
extern unsigned long currticks P((void));
|
||||
extern int setjmp P((void *jmpbuf));
|
||||
extern void longjmp P((void *jmpbuf, int where));
|
||||
extern void exit P((int status));
|
||||
extern void slowdownio P((void));
|
||||
|
||||
/* serial.S */
|
||||
extern int serial_getc P((void));
|
||||
extern void serial_putc P((int));
|
||||
extern int serial_ischar P((void));
|
||||
extern int serial_init P((void));
|
||||
|
||||
/* ansiesc.c */
|
||||
extern void ansi_reset P((void));
|
||||
extern void enable_cursor P((int));
|
||||
extern void handleansi P((unsigned char));
|
||||
|
||||
/* md5.c */
|
||||
extern void md5_put P((unsigned int ch));
|
||||
extern void md5_done P((unsigned char *buf));
|
||||
|
||||
/* floppy.c */
|
||||
extern int bootdisk P((int dev,int part));
|
||||
#endif /* ! GRUB */
|
||||
extern void twiddle (void);
|
||||
extern void sleep (int secs);
|
||||
extern int getdec (char **s);
|
||||
extern void etherboot_printf (const char *, ...);
|
||||
extern int etherboot_sprintf (char *, const char *, ...);
|
||||
extern int inet_aton (char *p, in_addr *i);
|
||||
|
||||
/***************************************************************************
|
||||
External variables
|
||||
***************************************************************************/
|
||||
/* main.c */
|
||||
#ifdef GRUB
|
||||
extern int ip_abort;
|
||||
extern int network_ready;
|
||||
#endif /* GRUB */
|
||||
|
||||
#ifndef GRUB
|
||||
extern const char *kernel;
|
||||
extern char kernel_buf[128];
|
||||
#endif /* ! GRUB */
|
||||
extern struct rom_info rom;
|
||||
#ifndef GRUB
|
||||
extern int hostnamelen;
|
||||
extern unsigned long netmask;
|
||||
extern int jmp_bootmenu[10];
|
||||
#endif /* ! GRUB */
|
||||
extern struct arptable_t arptable[MAX_ARP];
|
||||
#ifndef GRUB
|
||||
#ifdef IMAGE_MENU
|
||||
extern char *motd[RFC1533_VENDOR_NUMOFMOTD];
|
||||
extern int menutmo,menudefault;
|
||||
extern unsigned char *defparams;
|
||||
extern int defparams_max;
|
||||
#endif
|
||||
#endif /* ! GRUB */
|
||||
#if defined(ETHERBOOT32) && !defined(INTERNAL_BOOTP_DATA)
|
||||
#define BOOTP_DATA_ADDR ((struct bootpd_t *)0x93C00)
|
||||
#else
|
||||
extern struct bootpd_t bootp_data;
|
||||
#define BOOTP_DATA_ADDR (&bootp_data)
|
||||
#endif
|
||||
extern unsigned char *end_of_rfc1533;
|
||||
#ifdef IMAGE_FREEBSD
|
||||
extern int freebsd_howto;
|
||||
#endif
|
||||
|
||||
/* config.c */
|
||||
extern struct nic nic;
|
||||
|
||||
/* bootmenu.c */
|
||||
|
||||
/* osloader.c */
|
||||
|
||||
/* Local hack - define some macros to use etherboot source files "as is". */
|
||||
#ifndef GRUB
|
||||
/* created by linker */
|
||||
extern char _start[], _edata[], _end[];
|
||||
#endif /* ! GRUB */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* c-basic-offset: 8
|
||||
* End:
|
||||
*/
|
||||
# undef printf
|
||||
# define printf etherboot_printf
|
||||
# undef sprintf
|
||||
# define sprintf etherboot_sprintf
|
||||
#endif /* GRUB */
|
||||
Reference in new issue
Block a user