Update docs

This commit is contained in:
okuji 1999-05-14 11:19:13 +00:00
parent 05b7b72e3c
commit 421dbceb11
15 changed files with 918 additions and 974 deletions

View file

@ -2,5 +2,5 @@ html = boot-proposal.html errors.html faq.html grub.html install.html \
mem64mb.html technical.html using.html
txt = PC_partitioning.txt bios_mapping.txt commands.txt embedded_data.txt \
filesystem.txt
info_TEXINFOS = grub.texi
info_TEXINFOS = grub.texi multiboot.texi
EXTRA_DIST = BUGS $(txt) $(html) menu.lst

View file

@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.3 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -10,7 +10,8 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@ -31,7 +32,7 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
DISTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -48,7 +49,6 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_FLAG =
transform = @program_transform_name@
NORMAL_INSTALL = :
@ -72,32 +72,31 @@ host_vendor = @host_vendor@
sbingrub = @sbingrub@
stage2debug = @stage2debug@
html = boot-proposal.html errors.html faq.html grub.html install.html \
mem64mb.html technical.html using.html
txt = PC_partitioning.txt bios_mapping.txt commands.txt embedded_data.txt \
filesystem.txt
info_TEXINFOS = grub.texi
info_TEXINFOS = grub.texi multiboot.texi
EXTRA_DIST = BUGS $(txt) $(html) menu.lst
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
TEXI2DVI = texi2dvi
INFO_DEPS = grub.info
DVIS = grub.dvi
TEXINFOS = grub.texi
TEXINFO_TEX = $(srcdir)/texinfo.tex
INFO_DEPS = grub.info multiboot.info
DVIS = grub.dvi multiboot.dvi
TEXINFOS = grub.texi multiboot.texi
DIST_COMMON = COPYING Makefile.am Makefile.in TODO mdate-sh stamp-vti \
texinfo.tex version.texi
DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEXINFOS) $(EXTRA_DIST)
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
GZIP = --best
all: Makefile $(INFO_DEPS)
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
@ -105,18 +104,18 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(srcdir)/version.texi: stamp-vti
@:
version.texi: stamp-vti
cp $(srcdir)/stamp-vti $(srcdir)/version.texi
$(srcdir)/stamp-vti: grub.texi $(top_srcdir)/configure.in
@echo "@set UPDATED `$(SHELL) $(srcdir)/mdate-sh $(srcdir)/grub.texi`" > vti.tmp
stamp-vti: grub.texi $(top_srcdir)/configure.in
@echo "@set UPDATED `cd $(srcdir) \
&& $(SHELL) ./mdate-sh grub.texi`" > vti.tmp
@echo "@set EDITION $(VERSION)" >> vti.tmp
@echo "@set VERSION $(VERSION)" >> vti.tmp
@cmp -s vti.tmp $(srcdir)/version.texi \
|| (echo "Updating $(srcdir)/version.texi"; \
cp vti.tmp $(srcdir)/version.texi)
@cmp -s vti.tmp $(srcdir)/stamp-vti \
|| (echo "Updating $(srcdir)/stamp-vti"; \
cp vti.tmp $(srcdir)/stamp-vti)
-@rm -f vti.tmp
@cp $(srcdir)/version.texi $@
mostlyclean-vti:
-rm -f vti.tmp
@ -126,12 +125,16 @@ clean-vti:
distclean-vti:
maintainer-clean-vti:
-rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
-rm -f stamp-vti version.texi
grub.info: grub.texi version.texi
grub.dvi: grub.texi version.texi
multiboot.info: multiboot.texi
multiboot.dvi: multiboot.texi
DVIPS = dvips
.texi.info:
@ -181,8 +184,7 @@ DVIPS = dvips
install-info-am: $(INFO_DEPS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(infodir)
@list='$(INFO_DEPS)'; \
for file in $$list; do \
@for file in $(INFO_DEPS); do \
d=$(srcdir); \
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
if test -f $$d/$$ifile; then \
@ -193,8 +195,7 @@ install-info-am: $(INFO_DEPS)
done
@$(POST_INSTALL)
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
list='$(INFO_DEPS)'; \
for file in $$list; do \
for file in $(INFO_DEPS); do \
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
done; \
@ -203,24 +204,19 @@ install-info-am: $(INFO_DEPS)
uninstall-info:
$(PRE_UNINSTALL)
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
list='$(INFO_DEPS)'; \
for file in $$list; do \
echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file"; \
install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
done; \
else :; fi
ii=yes; \
else ii=; fi; \
for file in $(INFO_DEPS); do \
test -z "$ii" \
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
done
@$(NORMAL_UNINSTALL)
@list='$(INFO_DEPS)'; \
for file in $$list; do \
(if cd $(DESTDIR)$(infodir); then \
echo " rm -f $$file $$file-[0-9] $$file-[0-9][0-9])"; \
rm -f $$file $$file-[0-9] $$file-[0-9][0-9]; \
else :; fi); \
for file in $(INFO_DEPS); do \
(cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
done
dist-info: $(INFO_DEPS)
list='$(INFO_DEPS)'; \
for base in $$list; do \
for base in $(INFO_DEPS); do \
d=$(srcdir); \
for file in `cd $$d && eval echo $$base*`; do \
test -f $(distdir)/$$file \
@ -230,16 +226,21 @@ dist-info: $(INFO_DEPS)
done
mostlyclean-aminfo:
-rm -f grub.aux grub.cp grub.cps grub.dvi grub.fn grub.fns grub.pgs \
grub.ky grub.kys grub.ps grub.log grub.pg grub.toc grub.tp \
grub.tps grub.vr grub.vrs grub.op grub.tr grub.cv grub.cn
-rm -f grub.aux grub.cp grub.cps grub.dvi grub.fn grub.fns grub.ky \
grub.kys grub.ps grub.log grub.pg grub.toc grub.tp grub.tps \
grub.vr grub.vrs grub.op grub.tr grub.cv grub.cn \
multiboot.aux multiboot.cp multiboot.cps multiboot.dvi \
multiboot.fn multiboot.fns multiboot.ky multiboot.kys \
multiboot.ps multiboot.log multiboot.pg multiboot.toc \
multiboot.tp multiboot.tps multiboot.vr multiboot.vrs \
multiboot.op multiboot.tr multiboot.cv multiboot.cn
clean-aminfo:
distclean-aminfo:
maintainer-clean-aminfo:
cd $(srcdir) && for i in $(INFO_DEPS); do \
for i in $(INFO_DEPS); do \
rm -f $$i; \
if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
rm -f $$i-[0-9]*; \
@ -261,77 +262,64 @@ distdir: $(DISTFILES)
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu docs/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
info-am: $(INFO_DEPS)
info: info-am
dvi-am: $(DVIS)
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
info: $(INFO_DEPS)
dvi: $(DVIS)
check: all
$(MAKE)
installcheck:
install-exec:
@$(NORMAL_INSTALL)
install-data-am: install-info-am
install-data: install-data-am
install-data: install-info-am
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall: uninstall-info
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-info
uninstall: uninstall-am
all-am: Makefile $(INFO_DEPS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(infodir)
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
mostlyclean-am: mostlyclean-vti mostlyclean-aminfo mostlyclean-generic
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-vti mostlyclean-aminfo mostlyclean-generic
mostlyclean: mostlyclean-am
clean: clean-vti clean-aminfo clean-generic mostlyclean
clean-am: clean-vti clean-aminfo clean-generic mostlyclean-am
distclean: distclean-vti distclean-aminfo distclean-generic clean
-rm -f config.status
clean: clean-am
distclean-am: distclean-vti distclean-aminfo distclean-generic clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-vti maintainer-clean-aminfo \
maintainer-clean-generic distclean-am
maintainer-clean: maintainer-clean-vti maintainer-clean-aminfo \
maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-vti distclean-vti clean-vti maintainer-clean-vti \
install-info-am uninstall-info mostlyclean-aminfo distclean-aminfo \
clean-aminfo maintainer-clean-aminfo tags distdir info-am info dvi-am \
dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all install-strip \
installdirs mostlyclean-generic distclean-generic clean-generic \
clean-aminfo maintainer-clean-aminfo tags distdir info dvi installcheck \
install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean

View file

@ -80,7 +80,6 @@ edition documents version @value{VERSION}.
* Using:: Booting your operating systems.
* Filesystems:: Filesystem syntax and semantics.
* Troubleshooting:: Error messages produced by GRUB.
* Multiboot:: Standard boot interface.
* Hacking:: Implementation details.
* Index:: Index.
@ -117,6 +116,16 @@ Error messages reported by GRUB
* Stage1.5 errors:: Errors reported by the Stage 1.5.
* Stage2 errors:: Errors reported by the Stage 2.
Implementation details
* Memory map:: The memory map of the various
components.
* Embedded data:: Embedded variables in GRUB.
* Memory detection:: How to detect all installed @sc{ram}.
* Low-level disk I/O:: INT 13H disk I/O interrupts.
* MBR:: The structure of Master Boot Record.
* Partition table:: The format of partition table.
@end detailmenu
@end menu
@ -144,9 +153,10 @@ operating system (usually GNU).
GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU
Hurd with the University of Utah's Mach 4 microkernel (now known as GNU
Mach). Erich and Brian Ford designed the Multiboot Standard (FIXME
xref), because they were determined not to add to the large number of
mutually-incompatible PC boot methods.
Mach). Erich and Brian Ford designed the Multiboot Standard
(@pxref{Top, Multiboot Standard, Motivation, multiboot, The Multiboot
Standard}), because they were determined not to add to the large number
of mutually-incompatible PC boot methods.
Erich then began modifying the FreeBSD bootloader so that it would
understand Multiboot. He quickly realized that it would be a lot easier
@ -164,6 +174,7 @@ available via anonymous CVS.@footnote{The repository is
@node Features
@section GRUB features
technical.html: why another bootloader?
@ -940,21 +951,226 @@ should be correct.
@end table
@c In my opinion, Multiboot Standard should be separated and should have
@c its own manual, because Multiboot is not only for GRUB. Perhaps we
@c should write the Multiboot manual "multiboot.texinfo", and then
@c include it here. - okuji
@node Multiboot
@chapter Standard booting interface
boot-proposal.html
@node Hacking
@chapter Implementation details
technical.html
embedded_data.txt
This chapter describes the GRUB internals so that developers can
understand the implementation and start to hack GRUB. Of course, the
source code has the complete information, so refer to it when you are
not satisfied with this documentation.
@menu
* Memory map:: The memory map of the various
components.
* Embedded data:: Embedded variables in GRUB.
* Memory detection:: How to detect all installed @sc{ram}.
* Low-level disk I/O:: INT 13H disk I/O interrupts.
* MBR:: The structure of Master Boot Record.
* Partition table:: The format of partition table.
@end menu
@node Memory map
@section The memory map of various components
GRUB is broken into 2 distinct components, or @dfn{stages}, which are
loaded at different times in the boot process. The Stage 1 has to know
where to find Stage 2, and the Stage 2 has to know where to find its
configuration file (if Stage 2 doesn't have a configuration file, it
drops into the command-line interface and waits for a user command).
Here is the memory map of the various components:
@table @asis
@item 0 to 4K-1
Interrupt & BIOS area
@item down from 8K-1
16-bit stack area
@item 8K to (ebss1.5)
Stage 1.5 (optionally) loaded here by Stage 1
@item 0x7c00 to 0x7dff
Stage 1 loaded here by the BIOS
@item 0x7e00 to 0x7e08
Scratch space used by Stage 1
@item 32K to (ebss2)
Stage 2 loaded here by Stage 1.5 or Stage 1
@item (middle area)
Heap used for random memory allocation
@item down from 416K-1
32-bit stack area
@item 416K to 448K-1
Filesystem info buffer (when reading a filesystem)
@item 448K to 479.5K-1
BIOS track read buffer
@item 479.5K to 480K-1
512 byte fixed SCRATCH area
@item 480K to 511K-1
General storage heap
@end table
@node Embedded data
@section Embedded variables in GRUB
GRUB's stage1 and stage2 have embedded variables whose locations are
well-defined, so that the installation can patch the binary file
directly without recompilation of the modules.
In stage1, these are defined (The number in the parenthesis of each
entry is an offset number):
@table @asis
@item @dfn{major version} (0x1bc)
This is the major version byte (should be 2).
@item @dfn{minor version} (0x1bd)
This is the minor version byte (should be 0).
@item @dfn{stage2 start address} (0x1b8)
This is the data for the @code{ljmp} command to the starting address of
the component loaded by the stage1. The format is two 2-byte words: the
first is the IP, and the second is the CS segment register (remember,
we're in x86 real-mode@dots{} 16-bit instruction pointer and segment
registers shifted left by 4bits).
A @dfn{stage1.5} should be loaded at address 0x2000, and a @dfn{stage2}
should be loaded at address 0x8000. Both use a CS of 0.
@item @dfn{firstlist} (0x1b05)
This is the @emph{ending} address of the blocklst data area.
The trick here is that it is actually read backward, and the first
8-byte blocklist is not read here, but after the pointer is decremented
8 bytes, then after reading it, it decrements again, reads, decrements,
reads, etc. until it is finished. The terminating condition is when the
number of sectors to be read in the next blocklist is 0.
The format of a blocklist can be seen from the example in the code just
before the @code{firstlist} label. (note that it is always from the
beginning of the disk, and @emph{not} relative to the partition
boundaries)
@item @dfn{loading drive} (0x1b05)
This is the BIOS drive number to load the blocklists from. If the number
is 0xff, then load from the booting drive.
@end table
In stage1.5 and stage2 (these are all defined at the beginning of
@file{shared_src/asm.S}):
@table @asis
@item @dfn{major version} (0x6)
This is the major version byte (should be 2).
@item @dfn{minor version} (0x7)
This is the minor version byte (should be 0).
@item @dfn{install_partition} (0x8)
This is an unsigned long representing the partition on the currently
booted disk which GRUB should expect to find it's data files and treat
as the default root partition.
The format of is exactly the same as the @dfn{partition} part (the
@dfn{disk} part is ignored) of the data passed to an OS by a
Multiboot-compliant bootloader in the @dfn{boot_device} data element,
with one exception.
The exception is that if the first level of disk partitioning is left as
0xFF (decimal 255, which is marked as no partitioning being used), but
the second level does have a partition number, it looks for the first
BSD-style PC partition, and finds the numbered BSD sub-partition in it.
The default @dfn{install_partition} 0xFF00FF, would then find the first
BSD-style PC partition, and use the @samp{a} partition in it, and
0xFF01FF would use the @samp{b} partition, etc.
If an explicit first-level partition is given, then no search is
performed, and it will expect that the BSD-style PC partition is in the
appropriate location, else a @samp{no such partition} error will be
returned.
If a @dfn{stage1.5} is being used, it will pass its own
@dfn{install_partition} to any @dfn{stage2} it loads, therefore
overwriting the one present in the @dfn{stage2}.
@item @dfn{version_string} (0xc)
This is the @dfn{stage1.5} or @dfn{stage2} version string. It isn't
meant to be changed, simply easy to find.
@item @dfn{config_file} (after the terminating zero of @dfn{version_string})
This is the location, using the GRUB filesystem syntax, of the config
file. It will, by default, look in the @dfn{install_partition} of the
disk GRUB was loaded from, though one can use any valid GRUB filesystem
string, up to and including making it look on other disks.
The bootloader itself doesn't search for the end of
@dfn{version_string}, it simply knows where @dfn{config_file} is, so the
beginning of the string cannot be moved after compile-time. This should
be OK, since the @dfn{version_string} is meant to be static.
The code of stage2 starts again at offset 0x70, so @dfn{config_file}
string obviously can't go past there. Also, remember to terminate the
string with a 0.
@end table
@node Memory detection
@section How to detect all installed @sc{ram}
There are three BIOS calls which return the information of installed
@sc{ram}. GRUB uses these calls to detect all installed @sc{ram} and
which address range should be treated by operating systems.
@menu
* Query System Address Map:: INT 15H, AX=E820h interrupt call.
* Get Large Memory Size:: INT 15H, AX=E801h interrupt call.
* Get Extended Memory Size:: INT 15H, AX=88h interrupt call.
@end menu
@node Query System Address Map
@subsection INT 15H, AX=E820h interrupt call
mem64mb.html
@node Get Large Memory Size
@subsection INT 15H, AX=E801h interrupt call
mem64mb.html
@node Get Extended Memory Size
@subsection INT 15H, AX=88h interrupt call
mem64mb.html
@node Low-level disk I/O
@section INT 13H disk I/O interrupts
PC_partitioning.txt
@node MBR
@section The structure of Master Boot Record
PC_partitioning.txt
@node Partition table
@section The format of partition table
PC_partitioning.txt