diff --git a/ChangeLog b/ChangeLog index 283c0b0d5..ee0ab73dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +1999-08-03 OKUJI Yoshinori + + From "Dan J. Walters" : + * 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 From Pavel Roskin : diff --git a/NEWS b/NEWS index 3f4dacd17..584996e32 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/README b/README index 1eca68a76..7bdcaf197 100644 --- a/README +++ b/README @@ -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 diff --git a/THANKS b/THANKS index 02b573004..838fb066b 100644 --- a/THANKS +++ b/THANKS @@ -10,6 +10,7 @@ Alexander K. Hudek Bradford Hovinen Brian Brunswick Bryan Ford +Dan J. Walters Eric Hanchrow Heiko Schroeder Klaus Reichl diff --git a/TODO b/TODO index 0801f2a39..cae30a305 100644 --- a/TODO +++ b/TODO @@ -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. diff --git a/configure b/configure index 022de046c..b676dc566 100644 --- a/configure +++ b/configure @@ -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 diff --git a/debian/changelog b/debian/changelog index 373f51391..a960032d1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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). diff --git a/stage2/boot.c b/stage2/boot.c index 5761f0d90..545ff4a8e 100644 --- a/stage2/boot.c +++ b/stage2/boot.c @@ -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))); diff --git a/stage2/i386-elf.h b/stage2/i386-elf.h index bf234cc10..576aa0fec 100644 --- a/stage2/i386-elf.h +++ b/stage2/i386-elf.h @@ -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 */