add a new command tftpserver.
This commit is contained in:
parent
83038ffbbc
commit
7ca6bf9d91
6 changed files with 62 additions and 4 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2000-05-29 OKUJI Yoshinori <okuji@gnu.org>
|
||||
|
||||
Based on a patch by Neal H Walfield <neal@walfield.org>:
|
||||
* netboot/misc.c [GRUB] (inet_aton): Defined.
|
||||
* netboot/main.c (arp_server_override): New function.
|
||||
* netboot/etherboot.h [GRUB] (arp_server_override): Declared.
|
||||
(inet_aton): Likewise.
|
||||
* stage2/builtins.c (tftpserver_func): New function.
|
||||
(builtin_tftpserver): New variable.
|
||||
(builtin_table): Added a pointer to BUILTIN_TFTPSERVER.
|
||||
|
||||
2000-05-28 OKUJI Yoshinori <okuji@gnu.org>
|
||||
|
||||
* stage2/asm.S (codestart): Fix a typo: DISKLESS_SUPPORT ->
|
||||
|
|
2
NEWS
2
NEWS
|
@ -35,6 +35,8 @@ New in 0.5.95 - XXXX-XX-XX:
|
|||
and "make" will produce two additional images, ``nbgrub'' for Net Boot
|
||||
Image Proposal and ``pxegrub'' for Preboot Execution Environment. See
|
||||
the documentation, for more details.
|
||||
* The command "tftpserver" overrides a TFTP server address returned by a
|
||||
BOOTP server, a DHCP server or a RARP server.
|
||||
|
||||
New in 0.5.94 - 2000-03-06:
|
||||
* Stage 1 supports both the LBA mode and the CHS mode.
|
||||
|
|
|
@ -457,6 +457,7 @@ External prototypes
|
|||
/* main.c */
|
||||
#ifdef GRUB
|
||||
extern void print_network_configuration P((void));
|
||||
extern int arp_server_override P((const char *buf));
|
||||
#endif /* GRUB */
|
||||
|
||||
#ifndef GRUB
|
||||
|
@ -517,7 +518,9 @@ 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));
|
||||
|
|
|
@ -167,6 +167,19 @@ print_network_configuration (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Override the server IP address. */
|
||||
int
|
||||
arp_server_override (const char *buffer)
|
||||
{
|
||||
in_addr in;
|
||||
|
||||
if (! inet_aton ((char *) buffer, &in))
|
||||
return 0;
|
||||
|
||||
arptable[ARP_SERVER].ipaddr.s_addr = in.s_addr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
DEFAULT_NETMASK - Return default netmask for IP address
|
||||
**************************************************************************/
|
||||
|
|
|
@ -159,8 +159,9 @@ void printf(const char *fmt, ...)
|
|||
do_printf(buf, fmt, ((const int *)&fmt)+1);
|
||||
while (*p) putchar(*p++);
|
||||
}
|
||||
#endif /* ! GRUB */
|
||||
|
||||
#ifdef IMAGE_MENU
|
||||
#if defined(IMAGE_MENU) || defined(GRUB)
|
||||
/**************************************************************************
|
||||
INET_ATON - Convert an ascii x.x.x.x to binary form
|
||||
**************************************************************************/
|
||||
|
@ -184,9 +185,7 @@ int inet_aton(char *p, in_addr *i)
|
|||
i->s_addr = htonl((ip << 8) | val);
|
||||
return(1);
|
||||
}
|
||||
|
||||
#endif /* IMAGE_MENU */
|
||||
#endif /* ! GRUB */
|
||||
#endif /* IMAGE_MENU || GRUB */
|
||||
|
||||
int getdec(char **ptr)
|
||||
{
|
||||
|
|
|
@ -2943,6 +2943,35 @@ static struct builtin builtin_testload =
|
|||
" step is to try loading a kernel."
|
||||
};
|
||||
|
||||
|
||||
/* tftpserver */
|
||||
static int
|
||||
tftpserver_func (char *arg, int flags)
|
||||
{
|
||||
#ifdef SUPPORT_NETBOOT
|
||||
if (! *arg || ! arp_server_override (arg))
|
||||
{
|
||||
errnum = ERR_BAD_ARGUMENT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
print_network_configuration ();
|
||||
return 0;
|
||||
#else
|
||||
errnum = ERR_UNRECOGNIZED;
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct builtin builtin_tftpserver =
|
||||
{
|
||||
"tftpserver",
|
||||
tftpserver_func,
|
||||
BUILTIN_CMDLINE | BUILTIN_MENU,
|
||||
"tftpserver IPADDR",
|
||||
"Override the TFTP server address."
|
||||
};
|
||||
|
||||
|
||||
/* timeout */
|
||||
static int
|
||||
|
@ -3077,6 +3106,7 @@ struct builtin *builtin_table[] =
|
|||
&builtin_setkey,
|
||||
&builtin_setup,
|
||||
&builtin_testload,
|
||||
&builtin_tftpserver,
|
||||
&builtin_timeout,
|
||||
&builtin_title,
|
||||
&builtin_unhide,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue