fix a fat32 bug and some netboot bugs.

This commit is contained in:
okuji 2000-02-08 21:20:46 +00:00
parent 844cb6f07d
commit 1bb94397a5
8 changed files with 110 additions and 42 deletions

View file

@ -1,3 +1,35 @@
2000-02-09 OKUJI Yoshinori <okuji@gnu.org>
From Jochen Hoenicke:
* stage2/fsys_fat.c (fat_create_blocklist): The previous change
is reversed. Set FIRST_FAT_ENTRY to a unsigned long value in
FAT_BUF + (NEW_MAPBLOCK - MAPBLOCK) instead of a unsigned short
value. Mask FIRST_FAT_ENTRY with 0xFFF if FAT_SIZE is equal to
3, whether the bit 0 of LAST_FAT_ENTRY is set or not.
* netboot/config.c (eth_probe): If PROBED is set to non-zero,
return 1 without probing ethernet cards. Clear NETWORK_READY. If
*T->ETH_PROBE return sucessfully, set PROBED to 1.
* netboot/main.c (rarp): Call eth_probe and return zero if
fails. Clear NETWORK_READY at first, and set NETWORK_READY to 1
if RETRY is less than MAX_ARP_RETRIES. If IP_ABORT is non-zero,
return zero instead of one.
(bootp): Call eth_probe and return zero if fails. Clear
NETWORK_READY at first, and set NETWORK_READY to 1 if
await_reply returns successfully.
(bootp) [T509HACK]: If FLAG is non-zero, skip calling
await_reply. Don't call await_reply here any more.
(bootp) [!NO_DHCP_SUPPORT]: If any ack packet is not reached
within MAX_BOOTP_RETRIES times, return zero. If DHCP_REPLY isn't
DHCPOFFER, set NETWORK_READY to one and return one.
* netboot/etherboot.h (NO_DHCP_SUPPORT): Undefined.
* stage2/builtins.c (print_root_device): Use the macro
NETWORK_DRIVE instead of 0x20.
* stage2/disk_io.c [!STAGE1_5] (sane_partition): Likewise.
(real_open_partition) [!STAGE1_5]: Likewise.
(set_device) [!STAGE1_5]: Likewise.
2000-02-08 OKUJI Yoshinori <okuji@gnu.org>
* grub/asmstub.c (biosdisk) [__linux__]: Use _llseek when
@ -163,7 +195,7 @@
2000-02-07 OKUJI Yoshinori <okuji@gnu.org>
* stage2/asm.S: Undo the previous changes. Is
binutils-2.9.5.0.25 too strict to break the compatibility?
binutils-2.9.5.0.25 too strict to retain the compatibility?
Reported by Kalle Olavi Niemitalo <tosi@ees2.oulu.fi>.
2000-02-03 OKUJI Yoshinori <okuji@gnu.org>

View file

@ -28,7 +28,7 @@
struct pci_device; /* for the probe prototype */
#undef INCLUDE_PCI
#if defined(INCLUDE_NEPCI) || defined(INCLUDE_EEPRO100) || defined(INCLUDE_LANCEPCI) || defined(INCLUDE_EPIC100) || defined(INCLUDE_TULIP) || defined(INCLUDE_NTULIP) || defined(INCLUDE_3C90X) || defined(INCLUDE_RTL8139) || defined(INCLUDE_VIA_RHINE)
#if defined(INCLUDE_NEPCI) || defined(INCLUDE_EEPRO100) || defined(INCLUDE_LANCEPCI) || defined(INCLUDE_EPIC100) || defined(INCLUDE_TULIP) || defined(INCLUDE_NTULIP) || defined(INCLUDE_3C90X) || defined(INCLUDE_RTL8139) || defined(INCLUDE_VIA_RHINE) || defined(INCLUDE_3C59X)
/* || others later */
#if defined(ETHERBOOT32) /* only for 32 bit machines */
#define INCLUDE_PCI
@ -425,7 +425,15 @@ int eth_probe(void)
{
struct pci_device *p;
struct dispatch_table *t;
static int probed = 0;
/* If already probed, don't try to probe it any longer. */
if (probed)
return 1;
/* Clear the ready flag. */
network_ready = 0;
p = 0;
#ifdef INCLUDE_PCI
/* In GRUB, the ROM info is initialized here. */
@ -448,7 +456,10 @@ int eth_probe(void)
{
printf("[%s]", t->nic_name);
if ((*t->eth_probe)(&nic, t->probe_ioaddrs, p))
return (1);
{
probed = 1;
return (1);
}
}
return (0);
}

View file

@ -9,10 +9,10 @@ Author: Martin Renters
/* Include GRUB-specific macros and prototypes here. */
#include <shared.h>
/* FIXME: For now, disable the DHCP support. Perhaps I should segregate
/* FIXME: For now, enable the DHCP support. Perhaps I should segregate
the DHCP support from the BOOTP support, and permit both to
co-exist. */
#define NO_DHCP_SUPPORT 1
#undef NO_DHCP_SUPPORT
#include "osdep.h"

View file

@ -63,7 +63,7 @@ buf_fill (int abort)
if (! block && retry++ < MAX_TFTP_RETRIES)
{
/* Maybe initial request was lost. */
rfc951_sleep(retry);
rfc951_sleep (retry);
if (! udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr,
++isocket, TFTP, len, (char *) &tp))
return 0;

View file

@ -35,8 +35,12 @@ Author: Martin Renters
#include <netboot_config.h>
struct arptable_t arptable[MAX_ARP];
/* Set if the user pushes the ESC key. */
int ip_abort = 0;
/* Set if an ethernet card is probed and IP addresses are set. */
int network_ready = 0;
struct rom_info rom;
static int vendorext_isvalid;
@ -398,6 +402,13 @@ rarp (void)
/* arp and rarp requests share the same packet structure. */
struct arprequest rarpreq;
/* Make sure that an ethernet is probed. */
if (! eth_probe ())
return 0;
/* Clear the ready flag. */
network_ready = 0;
memset (&rarpreq, 0, sizeof (rarpreq));
rarpreq.hwtype = htons (1);
@ -420,11 +431,14 @@ rarp (void)
break;
if (ip_abort)
return 1;
return 0;
}
if (retry < MAX_ARP_RETRIES)
return 1;
{
network_ready = 1;
return 1;
}
return 0;
}
@ -446,6 +460,14 @@ bootp (void)
flag = 1;
#endif
/* Make sure that an ethernet is probed. */
if (! eth_probe ())
return 0;
/* Clear the ready flag. */
network_ready = 0;
grub_memset (&bp, 0, sizeof (struct bootp_t));
bp.bp_op = BOOTP_REQUEST;
bp.bp_htype = 1;
@ -487,27 +509,19 @@ bootp (void)
if (flag)
{
flag--;
continue;
}
else
{
if (await_reply (AWAIT_BOOTP, 0, NULL, 0))
return 1;
if (ip_abort)
return 0;
rfc951_sleep (++retry);
}
#else /* ! T509HACK */
#endif /* T509HACK */
# ifdef NO_DHCP_SUPPORT
if (await_reply (AWAIT_BOOTP, 0, NULL, 0))
# else
#ifdef NO_DHCP_SUPPORT
if (await_reply (AWAIT_BOOTP, 0, NULL, 0))
{
network_ready = 1;
return 1;
}
#else /* ! NO_DHCP_SUPPORT */
if (await_reply (AWAIT_BOOTP, 0, NULL, 0))
{
if (ip_abort)
return 0;
if (dhcp_reply == DHCPOFFER)
{
dhcp_reply = 0;
@ -526,27 +540,36 @@ bootp (void)
dhcp_reply = 0;
if (await_reply (AWAIT_BOOTP, 0, NULL, 0))
if (dhcp_reply == DHCPACK)
return 1;
{
network_ready = 1;
return 1;
}
if (ip_abort)
return 0;
rfc951_sleep (++retry1);
}
/* Timeout. */
return 0;
}
else
# endif /* ! NO_DHCP_SUPPORT */
return 1;
# ifndef NO_DHCP_SUPPORT
{
network_ready = 1;
return 1;
}
}
rfc951_sleep (++retry);
# endif /* ! NO_DHCP_SUPPORT */
#endif /* ! T509HACK */
#endif /* ! NO_DHCP_SUPPORT */
if (ip_abort)
return 0;
rfc951_sleep (++retry);
bp.bp_secs = htons ((currticks () - starttime) / 20);
}
/* Timeout. */
return 0;
}
@ -892,7 +915,9 @@ decode_rfc1533 (unsigned char *p, int block, int len, int eof)
}
extdata = extend = end;
/* Perhaps we can eliminate this because we doesn't require so
much information, but I leave this alone. */
if (block == 0 && extpath != NULL)
{
char fname[64];

View file

@ -1957,7 +1957,7 @@ static struct builtin builtin_read =
static void
print_root_device (void)
{
if (saved_drive == 0x20)
if (saved_drive == NETWORK_DRIVE)
{
/* Network drive. */
grub_printf (" (nd):");

View file

@ -247,7 +247,7 @@ static int
sane_partition (void)
{
/* network drive */
if (current_drive == 0x20)
if (current_drive == NETWORK_DRIVE)
return 1;
if (!(current_partition & 0xFF000000uL)
@ -464,7 +464,7 @@ real_open_partition (int flags)
#ifndef STAGE1_5
/* network drive */
if (current_drive == 0x20)
if (current_drive == NETWORK_DRIVE)
return 1;
if (! sane_partition ())
@ -739,7 +739,7 @@ set_device (char *device)
errnum = ERR_NUMBER_PARSING;
if (ch == 'n')
current_drive = 0x20;
current_drive = NETWORK_DRIVE;
else
{
safe_parse_maxint (&device, (int *) &current_drive);

View file

@ -124,14 +124,14 @@ fat_create_blocklist (int first_fat_entry)
}
first_fat_entry
= *((unsigned short *) (FAT_BUF + (new_mapblock - mapblock)));
= *((unsigned long *) (FAT_BUF + (new_mapblock - mapblock)));
if (fat_size == 3)
{
if (last_fat_entry & 1)
first_fat_entry >>= 4;
else
first_fat_entry &= 0xFFF;
first_fat_entry &= 0xFFF;
}
else if (fat_size == 4)
first_fat_entry &= 0xFFFF;