freebsd-elf support

This commit is contained in:
okuji 1999-08-03 02:22:50 +00:00
parent c19c1a588f
commit 70ba31d512
9 changed files with 61 additions and 15 deletions

View file

@ -1,3 +1,15 @@
1999-08-03 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
From "Dan J. Walters" <djw@cs.utexas.edu>:
* stage2/i386-elf.h (EI_BRAND): New macro.
* stage2/boot.c (load_image): If the kernel is ELF, check if it
is a FreeBSD kernel as well as a Multiboot kernel, and if it is
a FreeBSD kernel, then mask ENTRY_ADDR since FreeBSD requires
that. Likewise, mask MEMADDR.
(bsd_boot): Set the bi_symtab and the bi_esymtab members of BI
only if MBI.FLAGS has the flag MB_INFO_AOUT_SYMS. Otherwise,
clear them.
1999-07-30 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
From Pavel Roskin <pavel_roskin@geocities.com>:

3
NEWS
View file

@ -1,5 +1,8 @@
NEWS - list of user-visible changes between releases of GRUB
New in 0.5.93:
* ELF format of FreeBSD kernel is supported.
New in 0.5.92 - 1999-07-26:
* Bug fixes (i.e. Stage 1.5 can work fine again).
* The /sbin/grub stage2 simulator now works at least on GNU/Linux, and

4
README
View file

@ -37,10 +37,6 @@ http://sourceware.cygnus.com/autoconf/ for more information.
an unreleased version from the CVS. See
http://sourceware.cygnus.com/automake/ for more information.
* texinfo 3.12h and later
The latest snapshot of Texinfo is available from ftp.texinfo.org.
See the file INSTALL for instructions on how to build and install the
GRUB data and program files. See the GRUB manual for details about

1
THANKS
View file

@ -10,6 +10,7 @@ Alexander K. Hudek <alexhudek@home.com>
Bradford Hovinen <hovinen@redrose.net>
Brian Brunswick <brian@skarpsey.demon.co.uk>
Bryan Ford <baford@cs.utah.edu>
Dan J. Walters <djw@cs.utexas.edu>
Eric Hanchrow <erich@microsoft.com>
Heiko Schroeder <heiko@pool.informatik.rwth-aachen.de>
Klaus Reichl <klaus.reichl@alcatel.at>

2
TODO
View file

@ -30,8 +30,6 @@ larger than 16MB can be read.
Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot parameters
Support ELF format of FreeBSD kernel.
Support new partition IDs for NetBSD and OpenBSD.
Add ``configfile'' command, in a clean way.

2
configure vendored
View file

@ -734,7 +734,7 @@ fi
PACKAGE=grub
VERSION=0.5.92
VERSION=0.5.93
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then

2
debian/changelog vendored
View file

@ -1,3 +1,5 @@
grub (0.5.93) unstable; urgency=low
grub (0.5.92) unstable; urgency=low
* Data files are now in /usr/lib/grub/$(HWARCH).

View file

@ -86,11 +86,15 @@ load_image (void)
}
}
/* ELF loading only supported if kernel using multiboot */
if (type == 'm' && len > sizeof (Elf32_Ehdr)
/* ELF loading supported if multiboot and FreeBSD. */
if ((type == 'm' || grub_strcmp (pu.elf->e_ident + EI_BRAND, "FreeBSD"))
&& len > sizeof (Elf32_Ehdr)
&& BOOTABLE_I386_ELF ((*((Elf32_Ehdr *) buffer))))
{
entry_addr = (entry_func) pu.elf->e_entry;
if (type == 'm')
entry_addr = (entry_func) pu.elf->e_entry;
else
entry_addr = (entry_func) (pu.elf->e_entry & 0xFFFFFF);
if (((int) entry_addr) < 0x100000)
errnum = ERR_BELOW_1MB;
@ -102,6 +106,12 @@ load_image (void)
>= len))
errnum = ERR_EXEC_FORMAT;
str = "elf";
if (! type)
{
str2 = "FreeBSD";
type = 'f';
}
}
else if (flags & MULTIBOOT_AOUT_KLUDGE)
{
@ -403,7 +413,12 @@ load_image (void)
/* offset into file */
filepos = phdr->p_offset;
filesiz = phdr->p_filesz;
memaddr = RAW_ADDR (phdr->p_vaddr);
if (type == 'f')
memaddr = RAW_ADDR (phdr->p_vaddr & 0xFFFFFF);
else
memaddr = RAW_ADDR (phdr->p_vaddr);
memsiz = phdr->p_memsz;
if (memaddr < RAW_ADDR (0x100000))
errnum = ERR_BELOW_1MB;
@ -419,7 +434,6 @@ load_image (void)
loaded++;
/* load the segment */
memaddr = RAW_ADDR (memaddr);
if (memcheck (memaddr, memsiz)
&& grub_read ((char *) memaddr, filesiz) == filesiz)
{
@ -588,9 +602,25 @@ bsd_boot (int type, int bootdev)
bi.bi_memsizes_valid = 1;
bi.bi_basemem = mbi.mem_lower;
bi.bi_extmem = mbi.mem_upper;
bi.bi_symtab = mbi.syms.a.addr;
bi.bi_esymtab = mbi.syms.a.addr + 4
+ mbi.syms.a.tabsize + mbi.syms.a.strsize;
if (mbi.flags & MB_INFO_AOUT_SYMS)
{
bi.bi_symtab = mbi.syms.a.addr;
bi.bi_esymtab = mbi.syms.a.addr + 4
+ mbi.syms.a.tabsize + mbi.syms.a.strsize;
}
#if 0
else if (mbi.flags & MB_INFO_ELF_SHDR)
{
/* FIXME: Should check if a symbol table exists and, if exists,
pass the table to BI. */
}
#endif
else
{
bi.bi_symtab = 0;
bi.bi_esymtab = 0;
}
/* call entry point */
(*entry_addr) (clval, bootdev, 0, 0, 0, ((int) (&bi)));

View file

@ -54,6 +54,10 @@ typedef struct
#define EI_PAD 7 /* from here in is just padding */
#define EI_BRAND 8 /* start of OS branding (This is
obviously illegal against the ELF
standard.) */
unsigned char e_ident[EI_NIDENT]; /* basic identification block */
#define ET_EXEC 2 /* we only care about executable types */