From 41df320a2272c69aa4f99bd35303e25ce5ade7c1 Mon Sep 17 00:00:00 2001 From: okuji Date: Tue, 12 Oct 1999 08:42:11 +0000 Subject: [PATCH] fix the NetBSD and OpenBSD boot bug. --- ChangeLog | 8 ++++++++ NEWS | 1 + TODO | 1 - acinclude.m4 | 2 +- aclocal.m4 | 2 +- configure | 2 +- stage2/boot.c | 10 ++++++---- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index d70a3bbcb..cf6bc3912 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +1999-10-12 OKUJI Yoshinori + + From Pavel Roskin: + * acinclude.m4 (grub_PROG_OBJCOPY_ABSOLUTE): main -> cmain. + * stage2/boot.c (load_image): Only CUR_ADDR, not ENTRY_ADDR + should be 1M-aligned for NetBSD. Don't align symbol table on 4k + boundaries if the kernel doesn't require it. + 1999-10-10 OKUJI Yoshinori * stage2/asm.S [!STAGE1_5] (start): New label to force ld quiet. diff --git a/NEWS b/NEWS index f76c55ce0..fa03b99c4 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ NEWS - list of user-visible changes between releases of GRUB New in 0.5.94: * Stage 1 supports both the LBA mode and the CHS mode. +* The NetBSD and OpenBSD boot bug is fixed. New in 0.5.93: * ELF format of FreeBSD kernel is supported. diff --git a/TODO b/TODO index dac558d08..8714888da 100644 --- a/TODO +++ b/TODO @@ -26,7 +26,6 @@ Priorities: * Add indirect block support to the BSD FFS filesystem code, so files larger than 16MB can be read. ! ? Add command for modifying partition types. -* Add OpenBSD support. The recent versions cannot be loaded. !!! * Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot parameters. !! * Add a new installation command, such as `setup', which should be diff --git a/acinclude.m4 b/acinclude.m4 index aa91ca8a6..13e7e84cf 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -45,7 +45,7 @@ AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE, AC_CACHE_VAL(grub_cv_prog_objcopy_absolute, [cat > conftest.c <<\EOF void -main (void) +cmain (void) { *((int *) 0x1000) = 2; } diff --git a/aclocal.m4 b/aclocal.m4 index 07e0a2065..b1f10acd8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -57,7 +57,7 @@ AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE, AC_CACHE_VAL(grub_cv_prog_objcopy_absolute, [cat > conftest.c <<\EOF void -main (void) +cmain (void) { *((int *) 0x1000) = 2; } diff --git a/configure b/configure index d280f33c0..d17074811 100644 --- a/configure +++ b/configure @@ -1590,7 +1590,7 @@ if eval "test \"\${grub_cv_prog_objcopy_absolute+set}\" = set"; then else cat > conftest.c <<\EOF void -main (void) +cmain (void) { *((int *) 0x1000) = 2; } diff --git a/stage2/boot.c b/stage2/boot.c index 82b71b9cb..94ed72f06 100644 --- a/stage2/boot.c +++ b/stage2/boot.c @@ -155,23 +155,24 @@ load_image (char *kernel, char *arg) * one... plus of course we need to know which booting * method to use. */ + entry_addr = (entry_func) ((int) entry_addr & 0xFFFFFF); + if (buffer[0] == 0xb && buffer[1] == 1) { type = KERNEL_TYPE_FREEBSD; - entry_addr = (entry_func) (((int) entry_addr) & 0xFFFFFF); + cur_addr = (int) entry_addr; str2 = "FreeBSD"; } else { type = KERNEL_TYPE_NETBSD; - entry_addr = (entry_func) (((int) entry_addr) & 0xF00000); + cur_addr = (int) entry_addr & 0xF00000; if (N_GETMAGIC ((*(pu.aout))) != NMAGIC) align_4k = 0; str2 = "NetBSD"; } } - cur_addr = (int) entry_addr; /* first offset into file */ filepos = N_TXTOFF ((*(pu.aout))); text_len = pu.aout->a_text; @@ -351,7 +352,8 @@ load_image (char *kernel, char *arg) int symtab_err, orig_addr = cur_addr; /* we should align to a 4K boundary here for good measure */ - cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; + if (align_4k) + cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000; mbi.syms.a.addr = cur_addr;