add OpenBSD support, add some explanations into the manual.
This commit is contained in:
parent
0612bf14c0
commit
8fb66b3a69
8 changed files with 78 additions and 10 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
||||||
|
1999-11-01 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
* docs/grub.texi: Add "I/O ports detection" into the menu.
|
||||||
|
* docs/user-ref.texi: Added a description about the command
|
||||||
|
"ioprobe".
|
||||||
|
* docs/prog-ref.texi (I/O ports detection): New chapter.
|
||||||
|
|
||||||
|
1999-11-01 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
From Pavel Roskin:
|
||||||
|
* 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.
|
||||||
|
|
||||||
1999-10-31 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
1999-10-31 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
* grub/asmstub.c (init_device_map): Add a floppy device name
|
* grub/asmstub.c (init_device_map): Add a floppy device name
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -23,6 +23,7 @@ New in 0.5.94:
|
||||||
appendices.
|
appendices.
|
||||||
* The command "ioprobe" detects what I/O ports are used for a BIOS
|
* The command "ioprobe" detects what I/O ports are used for a BIOS
|
||||||
drive.
|
drive.
|
||||||
|
* OpenBSD support in the grub shell is improved.
|
||||||
|
|
||||||
New in 0.5.93:
|
New in 0.5.93:
|
||||||
* ELF format of FreeBSD kernel is supported.
|
* ELF format of FreeBSD kernel is supported.
|
||||||
|
|
6
TODO
6
TODO
|
@ -15,19 +15,17 @@ Priorities:
|
||||||
|
|
||||||
* Add configuration inclusion support by adding a command "include". !
|
* Add configuration inclusion support by adding a command "include". !
|
||||||
|
|
||||||
* Make symbolic links work for BSD FFS. !
|
* Make symbolic links work for BSD FFS. !!
|
||||||
|
|
||||||
* Add indirect block support to the BSD FFS filesystem code, so files
|
* Add indirect block support to the BSD FFS filesystem code, so files
|
||||||
larger than 16MB can be read. !
|
larger than 16MB can be read. !
|
||||||
|
|
||||||
* Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot
|
* Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot
|
||||||
parameters. !!
|
parameters. !!!
|
||||||
|
|
||||||
* Support embedding a Stage 1.5 in the "bootloader" area of a FFS
|
* Support embedding a Stage 1.5 in the "bootloader" area of a FFS
|
||||||
partition. !!!
|
partition. !!!
|
||||||
|
|
||||||
* Clean up and enhance the manuals, especially indices. !!!
|
|
||||||
|
|
||||||
* Complete the netboot support. !
|
* Complete the netboot support. !
|
||||||
|
|
||||||
* Add automatic configuration support.
|
* Add automatic configuration support.
|
||||||
|
|
|
@ -114,6 +114,7 @@ Part III: The Programmer Reference Manual
|
||||||
* Embedded data:: Embedded variables in GRUB
|
* Embedded data:: Embedded variables in GRUB
|
||||||
* Filesystem interface:: The generic interface for the fs code
|
* Filesystem interface:: The generic interface for the fs code
|
||||||
* Bootstrap tricks:: The bootstrap mechanism used in GRUB
|
* Bootstrap tricks:: The bootstrap mechanism used in GRUB
|
||||||
|
* I/O ports detection:: INT 13H tracking technique
|
||||||
* Memory detection:: How to detect all installed @sc{ram}
|
* Memory detection:: How to detect all installed @sc{ram}
|
||||||
* Low-level disk I/O:: INT 13H disk I/O interrupts
|
* Low-level disk I/O:: INT 13H disk I/O interrupts
|
||||||
* MBR:: The structure of Master Boot Record
|
* MBR:: The structure of Master Boot Record
|
||||||
|
|
|
@ -339,6 +339,38 @@ or the accessing mode of the @dfn{loading drive}, since @dfn{stage1} has
|
||||||
already probed them.
|
already probed them.
|
||||||
|
|
||||||
|
|
||||||
|
@node I/O ports detection
|
||||||
|
@chapter How to detect I/O ports used for a BIOS drive
|
||||||
|
|
||||||
|
In the @sc{pc} world, BIOS cannot detect if a hard disk drive is SCSI or
|
||||||
|
IDE, generally speaking. Thus, it is not trivial to know which BIOS
|
||||||
|
drive corresponds to an OS device. So the Multiboot Specification
|
||||||
|
describes some techniques on how to guess mappings (@pxref{BIOS device
|
||||||
|
mapping techniques, Multiboot Specification, BIOS device mapping
|
||||||
|
techniques, multiboot, The Multiboot Specification}).
|
||||||
|
|
||||||
|
However, the techniques decribed are unreliable or difficult to be
|
||||||
|
implemented, so we use a different technique from them in GRUB. Our
|
||||||
|
technique is @dfn{INT 13H tracking technique}. More precisely, it runs
|
||||||
|
the INT 13 call (@pxref{Low-level disk I/O}) in single-step mode just
|
||||||
|
like a debugger and parses the instructions.
|
||||||
|
|
||||||
|
To execute the call one instruction at a time, set the TF (trap flag)
|
||||||
|
flag in the register @dfn{FLAGS}. By this, your CPU generates @dfn{Break
|
||||||
|
Point Trap} after each instruction is executed and call INT 1. In the
|
||||||
|
stack in the interrupt handler, callee's FLAGS and the far pointer which
|
||||||
|
points to the next instruction to be executed are pushed, so we can know
|
||||||
|
what instruction will be executed in the next time and the current
|
||||||
|
contents of all the registers. If the next instruction is an I/O
|
||||||
|
operation, the interrupt handler adds the I/O port into the @dfn{I/O
|
||||||
|
map}.
|
||||||
|
|
||||||
|
If the INT 13 handler returns, the TF flag is cleared automatically by
|
||||||
|
the instruction @code{iret}, and then output the I/O map on the screen.
|
||||||
|
See the source code for the command @command{ioprobe}
|
||||||
|
(@pxref{Command-line-specific commands}), for more information.
|
||||||
|
|
||||||
|
|
||||||
@node Memory detection
|
@node Memory detection
|
||||||
@chapter How to detect all installed @sc{ram}
|
@chapter How to detect all installed @sc{ram}
|
||||||
|
|
||||||
|
|
|
@ -854,6 +854,12 @@ time. This command preserves the DOS BPB (and for hard disks, the
|
||||||
partition table) of the sector the Stage 1 is to be installed into.
|
partition table) of the sector the Stage 1 is to be installed into.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command ioprobe drive
|
||||||
|
Probe I/O ports used for the drive @var{drive}. This command will list
|
||||||
|
the I/O ports on the screen. For technical information, @xref{I/O ports
|
||||||
|
detection}.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
@deffn Command kernel file @dots{}
|
@deffn Command kernel file @dots{}
|
||||||
Attempt to load the primary boot image (Multiboot a.out or @sc{elf},
|
Attempt to load the primary boot image (Multiboot a.out or @sc{elf},
|
||||||
Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from
|
Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from
|
||||||
|
|
|
@ -58,10 +58,10 @@ int grub_stage2 (void);
|
||||||
# endif /* ! BLKFLSBUF */
|
# endif /* ! BLKFLSBUF */
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
# include <sys/ioctl.h> /* ioctl */
|
# include <sys/ioctl.h> /* ioctl */
|
||||||
# include <sys/disklabel.h>
|
# include <sys/disklabel.h>
|
||||||
#endif /* __FreeBSD__ || __NetBSD__ */
|
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
|
||||||
|
|
||||||
#ifdef HAVE_OPENDISK
|
#ifdef HAVE_OPENDISK
|
||||||
# include <util.h>
|
# include <util.h>
|
||||||
|
@ -405,6 +405,9 @@ get_floppy_disk_name (char *name, int unit)
|
||||||
/* NetBSD */
|
/* NetBSD */
|
||||||
/* opendisk() doesn't work for floppies. */
|
/* opendisk() doesn't work for floppies. */
|
||||||
sprintf (name, "/dev/rfd%da", unit);
|
sprintf (name, "/dev/rfd%da", unit);
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
/* OpenBSD */
|
||||||
|
sprintf (name, "/dev/rfd%dc", unit);
|
||||||
#else
|
#else
|
||||||
# warning "BIOS floppy drives cannot be guessed in your operating system."
|
# warning "BIOS floppy drives cannot be guessed in your operating system."
|
||||||
/* Set NAME to a bogus string. */
|
/* Set NAME to a bogus string. */
|
||||||
|
@ -435,6 +438,9 @@ get_ide_disk_name (char *name, int unit)
|
||||||
0 /* char device */
|
0 /* char device */
|
||||||
);
|
);
|
||||||
close (fd);
|
close (fd);
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
/* OpenBSD */
|
||||||
|
sprintf (name, "/dev/rwd%dc", unit);
|
||||||
#else
|
#else
|
||||||
# warning "BIOS IDE drives cannot be guessed in your operating system."
|
# warning "BIOS IDE drives cannot be guessed in your operating system."
|
||||||
/* Set NAME to a bogus string. */
|
/* Set NAME to a bogus string. */
|
||||||
|
@ -465,6 +471,9 @@ get_scsi_disk_name (char *name, int unit)
|
||||||
0 /* char device */
|
0 /* char device */
|
||||||
);
|
);
|
||||||
close (fd);
|
close (fd);
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
/* OpenBSD */
|
||||||
|
sprintf (name, "/dev/rsd%dc", unit);
|
||||||
#else
|
#else
|
||||||
# warning "BIOS SCSI drives cannot be guessed in your operating system."
|
# warning "BIOS SCSI drives cannot be guessed in your operating system."
|
||||||
/* Set NAME to a bogus string. */
|
/* Set NAME to a bogus string. */
|
||||||
|
@ -841,7 +850,7 @@ get_drive_geometry (int drive)
|
||||||
geom->total_sectors = hdg.cylinders * hdg.heads * hdg.sectors;
|
geom->total_sectors = hdg.cylinders * hdg.heads * hdg.sectors;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
/* FreeBSD */
|
/* FreeBSD */
|
||||||
struct disklabel hdg;
|
struct disklabel hdg;
|
||||||
if (ioctl (disks[drive].flags, DIOCGDINFO, &hdg))
|
if (ioctl (disks[drive].flags, DIOCGDINFO, &hdg))
|
||||||
|
|
|
@ -331,7 +331,7 @@ int1_handler:
|
||||||
movw %ax, %ds
|
movw %ax, %ds
|
||||||
|
|
||||||
/* set %si to the io map */
|
/* 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 */
|
9: /* check if the io map already has the port */
|
||||||
|
@ -346,7 +346,7 @@ int1_handler:
|
||||||
jmp 8f
|
jmp 8f
|
||||||
|
|
||||||
1: /* check for the buffer overrun */
|
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
|
je 8f
|
||||||
/* add the port into the io map */
|
/* add the port into the io map */
|
||||||
movw %dx, -2(%si)
|
movw %dx, -2(%si)
|
||||||
|
@ -490,7 +490,7 @@ int15_skip_flag:
|
||||||
xorw %ax, %ax
|
xorw %ax, %ax
|
||||||
movw %ax, %ds
|
movw %ax, %ds
|
||||||
/* set %si to the key map */
|
/* 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 */
|
/* find the key code from the key map */
|
||||||
2:
|
2:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue