Finished basic loading support.

This commit is contained in:
gord 1999-03-23 14:28:59 +00:00
parent 3688d873d4
commit eea6c34440
6 changed files with 50 additions and 24 deletions

View file

@ -1,3 +1,11 @@
1999-03-22 Gordon Matzigkeit <gord@trick.fig.org>
* shared_src/cmdline.c (enter_cmdline): Check the return value of
set_device in the `root' command.
* shared_src/char_io.c (memcheck): Special-case cur_part_desc and
reenable memory checking.
1999-03-21 Gordon Matzigkeit <gord@trick.fig.org> 1999-03-21 Gordon Matzigkeit <gord@trick.fig.org>
* shared_src/boot.c (load_image): Make sure we use the mapped * shared_src/boot.c (load_image): Make sure we use the mapped

View file

@ -15,6 +15,11 @@ edit configuration files or rerun a special installation program.
NOTE: GRUB does not yet have a simple installation mechanism, but NOTE: GRUB does not yet have a simple installation mechanism, but
we're working on this, so please don't report it as a bug. Until we're working on this, so please don't report it as a bug. Until
then, read the documentation (starting with docs/grub.html or then, read the documentation (starting with docs/grub.html or
docs/install.html), and use the binary files in /usr/share/grub. docs/install.html), and copy the binary files in /share/grub/$(HWARCH)
to /boot/grub.
WARNING: Never use the binary files in /share/grub directly
(i.e. without first copying them to /boot/grub), or else your system
will break the next time you upgrade.
Gordon Matzigkeit <gord@debian.org>, Sat, 13 Mar 1999 17:30:29 -0600 Gordon Matzigkeit <gord@debian.org>, Sat, 13 Mar 1999 17:30:29 -0600

View file

@ -365,9 +365,9 @@ load_image (void)
/* offset into file */ /* offset into file */
filepos = phdr->p_offset; filepos = phdr->p_offset;
filesiz = phdr->p_filesz; filesiz = phdr->p_filesz;
memaddr = phdr->p_vaddr; memaddr = RAW_ADDR (phdr->p_vaddr);
memsiz = phdr->p_memsz; memsiz = phdr->p_memsz;
if (memaddr < 0x100000) if (memaddr < RAW_ADDR (0x100000))
errnum = ERR_BELOW_1MB; errnum = ERR_BELOW_1MB;
/* make sure we only load what we're supposed to! */ /* make sure we only load what we're supposed to! */
if (filesiz > memsiz) if (filesiz > memsiz)

View file

@ -563,18 +563,24 @@ strstr (char *s1, char *s2)
int int
memcheck (int start, int len) memcheck (int start, int len)
{ {
/* FIXME: Don't bother checking memory for now, since our globals #ifdef GRUB_UTIL
are out of range. */ /* FIXME: cur_part_desc is the only global variable that we bcopy
#ifndef GRUB_UTIL to. We should fix this so that we don't need a special case
(i.e. so that it lives on the stack, or somewhere inside
grub_scratch_mem). */
extern char cur_part_desc[];
if (start >= (int) cur_part_desc && start + len <= (int) cur_part_desc + 16)
return ! errnum;
#endif /* GRUB_UTIL */
if ((start < RAW_ADDR (0x1000)) || if ((start < RAW_ADDR (0x1000)) ||
(start < RAW_ADDR (0x100000) && (start < RAW_ADDR (0x100000) &&
RAW_ADDR (mbi.mem_lower * 1024) < (start + len)) || RAW_ADDR (mbi.mem_lower * 1024) < (start + len)) ||
(start >= RAW_ADDR (0x100000) && (start >= RAW_ADDR (0x100000) &&
RAW_ADDR (mbi.mem_upper * 1024) < ((start - 0x100000) + len))) RAW_ADDR (mbi.mem_upper * 1024) < ((start - 0x100000) + len)))
errnum = ERR_WONT_FIT; errnum = ERR_WONT_FIT;
#endif /* GRUB_UTIL */
return (!errnum); return ! errnum;
} }

View file

@ -284,28 +284,33 @@ returnit:
else if (substring("root", cur_heap) < 1) else if (substring("root", cur_heap) < 1)
{ {
int hdbias = 0; int hdbias = 0;
char *biasptr = skip_to(0, set_device(cur_cmdline)); char *next_cmd = set_device (cur_cmdline);
/* this will respond to any "rootn<XXX>" command, if (next_cmd)
but that's OK */
if (!errnum && (cur_heap[4] == 'n' || open_device()
|| errnum == ERR_FSYS_MOUNT))
{ {
errnum = 0; char *biasptr = skip_to (0, next_cmd);
saved_partition = current_partition;
saved_drive = current_drive;
if (cur_heap[4] != 'n') /* this will respond to any "rootn<XXX>" command,
but that's OK */
if (!errnum && (cur_heap[4] == 'n' || open_device()
|| errnum == ERR_FSYS_MOUNT))
{ {
/* BSD and chainloading evil hacks !! */
safe_parse_maxint(&biasptr, &hdbias);
errnum = 0; errnum = 0;
bootdev = set_bootdev(hdbias); saved_partition = current_partition;
saved_drive = current_drive;
print_fsys_type(); if (cur_heap[4] != 'n')
{
/* BSD and chainloading evil hacks !! */
safe_parse_maxint(&biasptr, &hdbias);
errnum = 0;
bootdev = set_bootdev(hdbias);
print_fsys_type();
}
else
current_drive = -1;
} }
else
current_drive = -1;
} }
} }
else if (substring("kernel", cur_heap) < 1) else if (substring("kernel", cur_heap) < 1)

View file

@ -385,7 +385,9 @@ check_BSD_parts (int flags)
#if !defined(STAGE1_5) || !defined(NO_BLOCK_FILES) #if !defined(STAGE1_5) || !defined(NO_BLOCK_FILES)
static char cur_part_desc[16]; /* This isn't static, because the GRUB utility's char_io.c (memcheck)
needs to know about it as a special case. */
char cur_part_desc[16];
static int static int
real_open_partition (int flags) real_open_partition (int flags)