Hello!
I think that the latest changes break GRUB not only on OpenBSD that I've
just insalled, but also all other a.out and COFF based systems.
EXT_C was missing in some places in asm.S
There is no opendisk() in OpenBSD, but the "c" slice always represents
the whole disk, even for floppies.
ChangeLog:
* stage2/asm.S (int1_handler): use EXT_C(io_map) instead of io_map
(int1_handler): use EXT_C(bios_key_map) instead of bios_key_map
* grub/asmstub.c [__OpenBSD__]: Include <sys/ioctl.h> and
<sys/disklabel.h>
[__OpenBSD__] (get_floppy_disk_name): Added support for OpenBSD.
[__OpenBSD__] (get_ide_disk_name): Likewise.
[__OpenBSD__] (get_scsi_disk_name): Likewise.
(get_drive_geometry) [__OpenBSD__]: Use for OpenBSD the same ioctl
as for NetBSD and FreeBSD.
<OFFTOPIC>
I'm moving to the United States. I have signed a contract with a company
based near Boston, MA. I'm arriving in Boston on the 4th of November.
My address @geocities remains valid, but maybe I'll have a better address
soon. Sorry for possible delays in answers.
</OFFTOPIC>
Pavel Roskin
Index: stage2/asm.S
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/stage2/asm.S,v
retrieving revision 1.21
diff -u -r1.21 asm.S
--- asm.S 1999/10/29 10:52:23 1.21
+++ asm.S 1999/10/31 13:20:37
@@ -331,7 +331,7 @@
movw %ax, %ds
/* set %si to the io map */
- movw $ABS(io_map), %si
+ movw $ABS(EXT_C(io_map)), %si
9: /* check if the io map already has the port */
@@ -346,7 +346,7 @@
jmp 8f
1: /* check for the buffer overrun */
- cmpw $(ABS(io_map) + (IO_MAP_SIZE + 1) * 2), %si
+ cmpw $(ABS(EXT_C(io_map)) + (IO_MAP_SIZE + 1) * 2), %si
je 8f
/* add the port into the io map */
movw %dx, -2(%si)
@@ -490,7 +490,7 @@
xorw %ax, %ax
movw %ax, %ds
/* set %si to the key map */
- movw $ABS(bios_key_map), %si
+ movw $ABS(EXT_C(bios_key_map)), %si
/* find the key code from the key map */
2:
Index: grub/asmstub.c
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/grub/asmstub.c,v
retrieving revision 1.32
diff -u -r1.32 asmstub.c
--- asmstub.c 1999/10/31 04:15:32 1.32
+++ asmstub.c 1999/10/31 13:20:38
@@ -58,10 +58,10 @@
# endif /* ! BLKFLSBUF */
#endif /* __linux__ */
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# include <sys/ioctl.h> /* ioctl */
# include <sys/disklabel.h>
-#endif /* __FreeBSD__ || __NetBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
#ifdef HAVE_OPENDISK
# include <util.h>
@@ -405,6 +405,9 @@
/* NetBSD */
/* opendisk() doesn't work for floppies. */
sprintf (name, "/dev/rfd%da", unit);
+#elif defined(__OpenBSD__)
+ /* OpenBSD */
+ sprintf (name, "/dev/rfd%dc", unit);
#else
# warning "BIOS floppy drives cannot be guessed in your operating system."
/* Set NAME to a bogus string. */
@@ -435,6 +438,9 @@
0 /* char device */
);
close (fd);
+#elif defined(__OpenBSD__)
+ /* OpenBSD */
+ sprintf (name, "/dev/rwd%dc", unit);
#else
# warning "BIOS IDE drives cannot be guessed in your operating system."
/* Set NAME to a bogus string. */
@@ -465,6 +471,9 @@
0 /* char device */
);
close (fd);
+#elif defined(__OpenBSD__)
+ /* OpenBSD */
+ sprintf (name, "/dev/rsd%dc", unit);
#else
# warning "BIOS SCSI drives cannot be guessed in your operating system."
/* Set NAME to a bogus string. */
@@ -841,7 +850,7 @@
geom->total_sectors = hdg.cylinders * hdg.heads * hdg.sectors;
return 1;
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
/* FreeBSD */
struct disklabel hdg;
if (ioctl (disks[drive].flags, DIOCGDINFO, &hdg))