add minix fs support. use the name "the grub shell" instead of "the stage2 emulator".

This commit is contained in:
okuji 1999-08-26 09:42:57 +00:00
parent 29286d8365
commit 434d8607cc
20 changed files with 899 additions and 108 deletions

View file

@ -1,3 +1,35 @@
1999-08-26 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* docs/Makefile.am [GRUB_MAINT] (grub.8): The argument for the
option --name is changed to "the grub shell".
* docs/grub.8: Regenerated.
* docs/grub.texi: Do not use the name "the Stage 2 emulator" any
more. Use the name "the grub shell" instead.
1999-08-26 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
From Klaus Reichl <klaus.reichl@alcatel.at>:
* stage2/fsys_minix.c: New file.
* stage2/size_test: Added a check for the size of minix_stage1_5.
* stage2/Makefile.am (libgrub_a_SOURCES): Added fsys_minix.c.
(libgrub_a_CFLAGS): Added -DFSYS_MINIX=1.
(nodist_pkgdata_DATA): Added minix_stage1_5.
(noinst_PROGRAMS): Added minix_stage1_5.exec.
(stage2_exec_SOURCES): Added fsys_minix.c.
(minix_stage1_5_exec_SOURCES): New variable.
(minix_stage1_5_exec_CFLAGS): Likewise.
(minix_stage1_5_exec_LDFLAGS): Likewise.
* stage2/pc_slice.h (PC_SLICE_TYPE_MINIX): New macro.
* stage2/disk_io.c (fsys_table) [FSYS_MINIX]: Added minix entry.
* stage2/filesys.h [FSYS_MINIX] (FSYS_MINIX_NUM): Set to 1.
[!FSYS_MINIX] (FSYS_MINIX_NUM): Set to 0.
[!NUM_FSYS] (NUM_FSYS): Added FSYS_MINIX_NUM.
* stage2/shared.h (STAGE2_ID_MINIX_STAGE1_5): New macro.
[STAGE1_5 && FSYS_MINIX] (STAGE2_ID): Set to
STAGE2_ID_MINIX_STAGE1_5.
* grub/Makefile.am (AM_CFLAGS): Added -DFSYS_MINIX=1.
* configure.in (--disable-minix): New option.
1999-08-25 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp> 1999-08-25 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
From Jochen Hoenicke <jochen@gnu.org>: From Jochen Hoenicke <jochen@gnu.org>:

3
NEWS
View file

@ -3,10 +3,11 @@ NEWS - list of user-visible changes between releases of GRUB
New in 0.5.93: New in 0.5.93:
* ELF format of FreeBSD kernel is supported. * ELF format of FreeBSD kernel is supported.
* Support the partition ids for NetBSD and OpenBSD. * Support the partition ids for NetBSD and OpenBSD.
* Exit from the grub emulator just by pushing the key `q' in the menu. * Exit from the grub shell just by pushing the key `q' in the menu.
* The options --disable-ext2fs, --disable-fat and --disable-ffs disable * The options --disable-ext2fs, --disable-fat and --disable-ffs disable
ext2fs, FAT and FFS support in Stage 2 respectively. ext2fs, FAT and FFS support in Stage 2 respectively.
* FAT32 support is added. * FAT32 support is added.
* Minix fs support is added.
New in 0.5.92 - 1999-07-26: New in 0.5.92 - 1999-07-26:
* Bug fixes (i.e. Stage 1.5 can work fine again). * Bug fixes (i.e. Stage 1.5 can work fine again).

4
README
View file

@ -4,8 +4,8 @@ personal computer BIOSes:
- provides fully-featured command line and graphical interfaces - provides fully-featured command line and graphical interfaces
- recognizes fdisk partitions and BSD disklabels - recognizes fdisk partitions and BSD disklabels
- can dynamically read Linux ext2fs, BSD ufs, and MS-DOS FAT - can dynamically read Linux ext2fs, BSD ufs, MS-DOS FAT16 and FAT32,
filesystems, plus hardcoded blocklists and Minix fs filesystems, plus hardcoded blocklists
- can boot Multiboot-compliant kernels (such as GNU Mach), as well - can boot Multiboot-compliant kernels (such as GNU Mach), as well
as standard Linux and BSD kernels as standard Linux and BSD kernels

2
TODO
View file

@ -33,7 +33,7 @@ Add keyboard layout configuration support.
Clean up and enhance the manuals, especially concept indexes. Clean up and enhance the manuals, especially concept indexes.
Add more filesystems support (minix, NTFS, etc.) Add more filesystems support (XFS, NTFS, etc.)
??? Add hide and unhide facilities. ??? Add hide and unhide facilities.

125
configure vendored
View file

@ -20,6 +20,8 @@ ac_help="$ac_help
--disable-fat disable FAT support in Stage 2" --disable-fat disable FAT support in Stage 2"
ac_help="$ac_help ac_help="$ac_help
--disable-ffs disable FFS support in Stage 2" --disable-ffs disable FFS support in Stage 2"
ac_help="$ac_help
--disable-minix disable Minix fs support in Stage 2"
# Initialize some variables set by options. # Initialize some variables set by options.
# The variables have the same names as the options, with # The variables have the same names as the options, with
@ -561,7 +563,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh. # ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:565: checking for a BSD compatible install" >&5 echo "configure:567: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then if test -z "$INSTALL"; then
if eval "test \"\${ac_cv_path_install+set}\" = set"; then if eval "test \"\${ac_cv_path_install+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -618,7 +620,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
echo "configure:622: checking whether build environment is sane" >&5 echo "configure:624: checking whether build environment is sane" >&5
# Just in case # Just in case
sleep 1 sleep 1
echo timestamp > conftestfile echo timestamp > conftestfile
@ -679,7 +681,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:683: checking for $ac_word" >&5 echo "configure:685: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -709,7 +711,7 @@ test -n "$AWK" && break
done done
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:713: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo "configure:715: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -758,7 +760,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd` missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
echo "configure:762: checking for working aclocal" >&5 echo "configure:764: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if # Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected. # an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh. # Redirect stdin to placate older versions of autoconf. Sigh.
@ -771,7 +773,7 @@ else
fi fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
echo "configure:775: checking for working autoconf" >&5 echo "configure:777: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if # Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected. # an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh. # Redirect stdin to placate older versions of autoconf. Sigh.
@ -784,7 +786,7 @@ else
fi fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6 echo $ac_n "checking for working automake""... $ac_c" 1>&6
echo "configure:788: checking for working automake" >&5 echo "configure:790: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if # Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected. # an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh. # Redirect stdin to placate older versions of autoconf. Sigh.
@ -797,7 +799,7 @@ else
fi fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
echo "configure:801: checking for working autoheader" >&5 echo "configure:803: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if # Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected. # an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh. # Redirect stdin to placate older versions of autoconf. Sigh.
@ -810,7 +812,7 @@ else
fi fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
echo "configure:814: checking for working makeinfo" >&5 echo "configure:816: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if # Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected. # an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh. # Redirect stdin to placate older versions of autoconf. Sigh.
@ -830,7 +832,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:834: checking for $ac_word" >&5 echo "configure:836: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -871,7 +873,7 @@ fi
echo $ac_n "checking host system type""... $ac_c" 1>&6 echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:875: checking host system type" >&5 echo "configure:877: checking host system type" >&5
if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
# Make sure we can run config.sub. # Make sure we can run config.sub.
@ -956,7 +958,7 @@ fi
echo $ac_n "checking build system type""... $ac_c" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6
echo "configure:960: checking build system type" >&5 echo "configure:962: checking build system type" >&5
if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
# Make sure we can run config.sub. # Make sure we can run config.sub.
@ -1003,7 +1005,7 @@ fi
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2 set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1007: checking for $ac_word" >&5 echo "configure:1009: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1035,7 +1037,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args. # Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2 set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1039: checking for $ac_word" >&5 echo "configure:1041: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1065,7 +1067,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args. # Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2 set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1069: checking for $ac_word" >&5 echo "configure:1071: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1116,7 +1118,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args. # Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2 set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1120: checking for $ac_word" >&5 echo "configure:1122: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1148,7 +1150,7 @@ fi
fi fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1152: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5 echo "configure:1154: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
ac_ext=c ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1159,12 +1161,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF cat > conftest.$ac_ext << EOF
#line 1163 "configure" #line 1165 "configure"
#include "confdefs.h" #include "confdefs.h"
main(){return(0);} main(){return(0);}
EOF EOF
if { (eval echo configure:1168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler. # If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then if (./conftest; exit) 2>/dev/null; then
@ -1190,12 +1192,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:1194: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "configure:1196: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:1199: checking whether we are using GNU C" >&5 echo "configure:1201: checking whether we are using GNU C" >&5
if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1204,7 +1206,7 @@ else
yes; yes;
#endif #endif
EOF EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1210: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes ac_cv_prog_gcc=yes
else else
ac_cv_prog_gcc=no ac_cv_prog_gcc=no
@ -1223,7 +1225,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS" ac_save_CFLAGS="$CFLAGS"
CFLAGS= CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:1227: checking whether ${CC-cc} accepts -g" >&5 echo "configure:1229: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1257,7 +1259,7 @@ fi
# Extract the first word of "ranlib", so it can be a program name with args. # Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2 set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1261: checking for $ac_word" >&5 echo "configure:1263: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1292,7 +1294,7 @@ if test "x$ac_cv_prog_gcc" = xyes; then
STAGE1_CFLAGS="-O2" STAGE1_CFLAGS="-O2"
GRUB_CFLAGS="-O2" GRUB_CFLAGS="-O2"
echo $ac_n "checking whether optimization for size works""... $ac_c" 1>&6 echo $ac_n "checking whether optimization for size works""... $ac_c" 1>&6
echo "configure:1296: checking whether optimization for size works" >&5 echo "configure:1298: checking whether optimization for size works" >&5
if eval "test \"\${size_flag+set}\" = set"; then if eval "test \"\${size_flag+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1300,14 +1302,14 @@ else
saved_CFLAGS=$CFLAGS saved_CFLAGS=$CFLAGS
CFLAGS="-Os -g" CFLAGS="-Os -g"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1304 "configure" #line 1306 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
size_flag=yes size_flag=yes
else else
@ -1340,7 +1342,7 @@ CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused"
# Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
set dummy ${ac_tool_prefix}ld; ac_word=$2 set dummy ${ac_tool_prefix}ld; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1344: checking for $ac_word" >&5 echo "configure:1346: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_LD+set}\" = set"; then if eval "test \"\${ac_cv_prog_LD+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1372,7 +1374,7 @@ fi
# Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args.
set dummy ${ac_tool_prefix}objcopy; ac_word=$2 set dummy ${ac_tool_prefix}objcopy; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1376: checking for $ac_word" >&5 echo "configure:1378: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_OBJCOPY+set}\" = set"; then if eval "test \"\${ac_cv_prog_OBJCOPY+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1405,7 +1407,7 @@ fi
# Defined in acinclude.m4. # Defined in acinclude.m4.
echo $ac_n "checking symbol names produced by ${CC-cc}""... $ac_c" 1>&6 echo $ac_n "checking symbol names produced by ${CC-cc}""... $ac_c" 1>&6
echo "configure:1409: checking symbol names produced by ${CC-cc}" >&5 echo "configure:1411: checking symbol names produced by ${CC-cc}" >&5
if eval "test \"\${grub_cv_asm_ext_c+set}\" = set"; then if eval "test \"\${grub_cv_asm_ext_c+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1418,7 +1420,7 @@ func (int *list)
} }
EOF EOF
if { ac_try='${CC-cc} -S conftest.c'; { (eval echo configure:1422: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then : if { ac_try='${CC-cc} -S conftest.c'; { (eval echo configure:1424: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then :
else else
{ echo "configure: error: ${CC-cc} failed to produce assembly code" 1>&2; exit 1; } { echo "configure: error: ${CC-cc} failed to produce assembly code" 1>&2; exit 1; }
fi fi
@ -1447,7 +1449,7 @@ EOF
echo $ac_n "checking whether ${OBJCOPY} works for absolute addresses""... $ac_c" 1>&6 echo $ac_n "checking whether ${OBJCOPY} works for absolute addresses""... $ac_c" 1>&6
echo "configure:1451: checking whether ${OBJCOPY} works for absolute addresses" >&5 echo "configure:1453: checking whether ${OBJCOPY} works for absolute addresses" >&5
if eval "test \"\${grub_cv_prog_objcopy_absolute+set}\" = set"; then if eval "test \"\${grub_cv_prog_objcopy_absolute+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1459,21 +1461,21 @@ blah (void)
} }
EOF EOF
if { (eval echo configure:1463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then : if { (eval echo configure:1465: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then :
else else
{ echo "configure: error: ${CC-cc} cannot compile C source code" 1>&2; exit 1; } { echo "configure: error: ${CC-cc} cannot compile C source code" 1>&2; exit 1; }
fi fi
grub_cv_prog_objcopy_absolute=yes grub_cv_prog_objcopy_absolute=yes
for link_addr in 2000 8000 7C00; do for link_addr in 2000 8000 7C00; do
if { ac_try='${LD-ld} -N -Ttext $link_addr conftest.o -o conftest.exec'; { (eval echo configure:1469: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : if { ac_try='${LD-ld} -N -Ttext $link_addr conftest.o -o conftest.exec'; { (eval echo configure:1471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
else else
{ echo "configure: error: ${LD-ld} cannot link at address $link_addr" 1>&2; exit 1; } { echo "configure: error: ${LD-ld} cannot link at address $link_addr" 1>&2; exit 1; }
fi fi
if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1473: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1475: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
else else
{ echo "configure: error: ${OBJCOPY-objcopy} cannot create binary files" 1>&2; exit 1; } { echo "configure: error: ${OBJCOPY-objcopy} cannot create binary files" 1>&2; exit 1; }
fi fi
if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'; { (eval echo configure:1477: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'; { (eval echo configure:1479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
mv -f conftest conftest.old mv -f conftest conftest.old
else else
grub_cv_prog_objcopy_absolute=no grub_cv_prog_objcopy_absolute=no
@ -1490,7 +1492,7 @@ fi
echo $ac_n "checking for .code16 addr32 assembler support""... $ac_c" 1>&6 echo $ac_n "checking for .code16 addr32 assembler support""... $ac_c" 1>&6
echo "configure:1494: checking for .code16 addr32 assembler support" >&5 echo "configure:1496: checking for .code16 addr32 assembler support" >&5
if eval "test \"\${grub_cv_asm_addr32+set}\" = set"; then if eval "test \"\${grub_cv_asm_addr32+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1500,7 +1502,7 @@ l1: addr32
movb %al, l1 movb %al, l1
EOF EOF
if { ac_try='${CC-cc} -c conftest.s'; { (eval echo configure:1504: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then if { ac_try='${CC-cc} -c conftest.s'; { (eval echo configure:1506: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
grub_cv_asm_addr32=yes grub_cv_asm_addr32=yes
else else
grub_cv_asm_addr32=no grub_cv_asm_addr32=no
@ -1515,7 +1517,7 @@ fi
echo $ac_n "checking whether addr32 must be in the same line as the instruction""... $ac_c" 1>&6 echo $ac_n "checking whether addr32 must be in the same line as the instruction""... $ac_c" 1>&6
echo "configure:1519: checking whether addr32 must be in the same line as the instruction" >&5 echo "configure:1521: checking whether addr32 must be in the same line as the instruction" >&5
if eval "test \"\${grub_cv_asm_prefix_requirement+set}\" = set"; then if eval "test \"\${grub_cv_asm_prefix_requirement+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1524,7 +1526,7 @@ else
l1: addr32 movb %al, l1 l1: addr32 movb %al, l1
EOF EOF
if { ac_try='${CC-cc} -c conftest.s'; { (eval echo configure:1528: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then if { ac_try='${CC-cc} -c conftest.s'; { (eval echo configure:1530: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
grub_cv_asm_prefix_requirement=yes grub_cv_asm_prefix_requirement=yes
else else
grub_cv_asm_prefix_requirement=no grub_cv_asm_prefix_requirement=no
@ -1555,7 +1557,7 @@ fi
# Check for curses libraries. # Check for curses libraries.
echo $ac_n "checking for getch in -lncurses""... $ac_c" 1>&6 echo $ac_n "checking for getch in -lncurses""... $ac_c" 1>&6
echo "configure:1559: checking for getch in -lncurses" >&5 echo "configure:1561: checking for getch in -lncurses" >&5
ac_lib_var=`echo ncurses'_'getch | sed 'y%./+-:%__p__%'` ac_lib_var=`echo ncurses'_'getch | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -1563,7 +1565,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lncurses $LIBS" LIBS="-lncurses $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1567 "configure" #line 1569 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -1574,7 +1576,7 @@ int main() {
getch() getch()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -1597,7 +1599,7 @@ EOF
else else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking for getch in -lcurses""... $ac_c" 1>&6 echo $ac_n "checking for getch in -lcurses""... $ac_c" 1>&6
echo "configure:1601: checking for getch in -lcurses" >&5 echo "configure:1603: checking for getch in -lcurses" >&5
ac_lib_var=`echo curses'_'getch | sed 'y%./+-:%__p__%'` ac_lib_var=`echo curses'_'getch | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -1605,7 +1607,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lcurses $LIBS" LIBS="-lcurses $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1609 "configure" #line 1611 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -1616,7 +1618,7 @@ int main() {
getch() getch()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -1646,7 +1648,7 @@ fi
# Check for headers. # Check for headers.
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1650: checking how to run the C preprocessor" >&5 echo "configure:1652: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory. # On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then if test -n "$CPP" && test -d "$CPP"; then
CPP= CPP=
@ -1661,13 +1663,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser, # On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. # not just through cpp.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1665 "configure" #line 1667 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1673: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
: :
@ -1678,13 +1680,13 @@ else
rm -rf conftest* rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp" CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1682 "configure" #line 1684 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1688: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1690: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
: :
@ -1695,13 +1697,13 @@ else
rm -rf conftest* rm -rf conftest*
CPP="${CC-cc} -nologo -E" CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1699 "configure" #line 1701 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
: :
@ -1729,17 +1731,17 @@ for ac_hdr in string.h strings.h
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1733: checking for $ac_hdr" >&5 echo "configure:1735: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1738 "configure" #line 1740 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1745: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
@ -1802,6 +1804,17 @@ if test x"$enable_ffs" != xno; then
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1" FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1"
fi fi
# Check whether --enable-minix or --disable-minix was given.
if test "${enable_minix+set}" = set; then
enableval="$enable_minix"
:
fi
if test x"$enable_minix" != xno; then
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1"
fi

View file

@ -141,6 +141,13 @@ if test x"$enable_ffs" != xno; then
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1" FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1"
fi fi
AC_ARG_ENABLE(minix,
[ --disable-minix disable Minix fs support in Stage 2])
if test x"$enable_minix" != xno; then
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1"
fi
AC_SUBST(FSYS_CFLAGS) AC_SUBST(FSYS_CFLAGS)

View file

@ -13,6 +13,6 @@ grub.info: grub.texi
if GRUB_MAINT if GRUB_MAINT
$(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN) $(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN)
$(srcdir)/$(HELP2MAN) --name="the stage2 emulator shell" \ $(srcdir)/$(HELP2MAN) --name="the grub shell" \
--section=8 --output=$@ $< --section=8 --output=$@ $<
endif endif

View file

@ -405,7 +405,7 @@ grub.info: grub.texi
&& sed 's/@command/@file/g; s/ifnottex/ifinfo/' grub.texi | $(MAKEINFO) && sed 's/@command/@file/g; s/ifnottex/ifinfo/' grub.texi | $(MAKEINFO)
@GRUB_MAINT_TRUE@$(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN) @GRUB_MAINT_TRUE@$(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN)
@GRUB_MAINT_TRUE@ $(srcdir)/$(HELP2MAN) --name="the stage2 emulator shell" \ @GRUB_MAINT_TRUE@ $(srcdir)/$(HELP2MAN) --name="the grub shell" \
@GRUB_MAINT_TRUE@ --section=8 --output=$@ $< @GRUB_MAINT_TRUE@ --section=8 --output=$@ $<
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.

View file

@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.012. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.012.
.TH GRUB "8" "June 1999" "GNU GRUB 0.5.92" FSF .TH GRUB "8" "August 1999" "GNU GRUB 0.5.93" FSF
.SH NAME .SH NAME
GRUB \- the stage2 emulator shell GRUB \- the grub shell
.SH SYNOPSIS .SH SYNOPSIS
.B GRUB .B GRUB
[\fIOPTION\fR]... [\fIOPTION\fR]...

View file

@ -82,7 +82,7 @@ edition documents version @value{VERSION}.
* Using:: Booting your operating system. * Using:: Booting your operating system.
* Filesystems:: Filesystem syntax and semantics. * Filesystems:: Filesystem syntax and semantics.
* Troubleshooting:: Error messages produced by GRUB. * Troubleshooting:: Error messages produced by GRUB.
* Stage 2 emulator:: The @command{grub} command. * The grub shell:: The @command{grub} command.
* Hacking:: Implementation details. * Hacking:: Implementation details.
* Index:: Index. * Index:: Index.
@ -120,7 +120,7 @@ Error messages reported by GRUB
The @command{grub} command The @command{grub} command
* Basic usage:: How to use the Stage 2 emulator. * Basic usage:: How to use the grub shell.
* Installation under UNIX:: How to install GRUB via @command{grub}. * Installation under UNIX:: How to install GRUB via @command{grub}.
Implementation details Implementation details
@ -250,8 +250,8 @@ partitions, and files in a directory depending on context.
@item Multiple Filesystem Types @item Multiple Filesystem Types
Supports multiple filesystem types transparently, plus a useful explicit Supports multiple filesystem types transparently, plus a useful explicit
blocklist notation. The currently supported filesystem types are blocklist notation. The currently supported filesystem types are
@dfn{BSD FFS}, @dfn{DOS FAT}, and @dfn{Linux ext2fs}. @dfn{BSD FFS}, @dfn{DOS FAT16 and FAT32}, @dfn{Minix fs}, and
@xref{Filesystems}, for more information. @dfn{Linux ext2fs}. @xref{Filesystems}, for more information.
@item Decompression Support @item Decompression Support
Can decompress files which were compressed by Can decompress files which were compressed by
@ -890,8 +890,8 @@ Filesystem test mode is turned off by any use of the @command{install=}
or @command{testload=} commands. or @command{testload=} commands.
@item quit @item quit
Exit from the GRUB stage2 emulator @command{grub} (@pxref{Stage 2 Exit from the grub shell @command{grub} (@pxref{The grub shell}). This
emulator}). This is just ignored in the native Stage 2. is just ignored in the native Stage 2.
@end table @end table
@ -1177,19 +1177,19 @@ install of set active partition command.
@end table @end table
@node Stage 2 emulator @node The grub shell
@chapter The command @command{grub} @chapter The command @command{grub}
This chapter documents the Stage 2 emulator @command{grub}. This chapter documents the grub shell @command{grub}.
@menu @menu
* Basic usage:: How to use the Stage 2 emulator. * Basic usage:: How to use the grub shell.
* Installation under UNIX:: How to install GRUB via @command{grub}. * Installation under UNIX:: How to install GRUB via @command{grub}.
@end menu @end menu
@node Basic usage @node Basic usage
@section Introduction into the Stage 2 emulator @section Introduction into the grub shell
You can use the command @command{grub} for installing GRUB under your You can use the command @command{grub} for installing GRUB under your
operating systems and for a testbed when you add a new feature into GRUB operating systems and for a testbed when you add a new feature into GRUB

View file

@ -1,7 +1,7 @@
sbin_PROGRAMS = grub sbin_PROGRAMS = grub
AM_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \ AM_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
-DFSYS_FFS=1 -fwritable-strings \ -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings \
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1 -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
grub_SOURCES = main.c asmstub.c getopt.c getopt1.c getopt.h grub_SOURCES = main.c asmstub.c getopt.c getopt1.c getopt.h

View file

@ -82,7 +82,7 @@ install_sh = @install_sh@
sbin_PROGRAMS = grub sbin_PROGRAMS = grub
AM_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \ AM_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
-DFSYS_FFS=1 -fwritable-strings \ -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings \
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1 -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1

View file

@ -14,16 +14,18 @@ INCLUDES = -I$(top_srcdir)/stage1
# The library for /sbin/grub. # The library for /sbin/grub.
noinst_LIBRARIES = libgrub.a noinst_LIBRARIES = libgrub.a
libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \ libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \
gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c stage2.c gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c fsys_minix.c \
stage2.c
libgrub_a_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \ libgrub_a_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \
-DFSYS_FAT=1 -DFSYS_FFS=1 -fwritable-strings -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings
# Stage 2 and Stage 1.5's. # Stage 2 and Stage 1.5's.
pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \
minix_stage1_5
CLEANFILES = $(pkgdata_DATA) CLEANFILES = $(pkgdata_DATA)
noinst_PROGRAMS = stage2.exec e2fs_stage1_5.exec fat_stage1_5.exec \ noinst_PROGRAMS = stage2.exec e2fs_stage1_5.exec fat_stage1_5.exec \
ffs_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec
MOSTLYCLEANFILES = $(noinst_PROGRAMS) MOSTLYCLEANFILES = $(noinst_PROGRAMS)
STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
@ -37,7 +39,7 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
# For stage2 target. # For stage2 target.
stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \ stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \
disk_io.c gunzip.c stage2.c bios.c smp-imps.c fsys_ext2fs.c \ disk_io.c gunzip.c stage2.c bios.c smp-imps.c fsys_ext2fs.c \
fsys_fat.c fsys_ffs.c fsys_fat.c fsys_ffs.c fsys_minix.c
stage2_exec_CFLAGS = $(STAGE2_COMPILE) @FSYS_CFLAGS@ stage2_exec_CFLAGS = $(STAGE2_COMPILE) @FSYS_CFLAGS@
stage2_exec_LDFLAGS = $(STAGE2_LINK) stage2_exec_LDFLAGS = $(STAGE2_LINK)
@ -62,6 +64,13 @@ ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
-DNO_BLOCK_FILES=1 -DNO_BLOCK_FILES=1
ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
# For minix_stage1_5 target.
minix_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_minix.c bios.c
minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \
-DNO_BLOCK_FILES=1
minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
# General rule for making a raw binary. # General rule for making a raw binary.
%: %.exec %: %.exec
$(OBJCOPY) -O binary $< $@ $(OBJCOPY) -O binary $< $@

View file

@ -95,18 +95,21 @@ INCLUDES = -I$(top_srcdir)/stage1
# The library for /sbin/grub. # The library for /sbin/grub.
noinst_LIBRARIES = libgrub.a noinst_LIBRARIES = libgrub.a
libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \ libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \
gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c stage2.c gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c fsys_minix.c \
stage2.c
libgrub_a_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \ libgrub_a_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \
-DFSYS_FAT=1 -DFSYS_FFS=1 -fwritable-strings -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings
# Stage 2 and Stage 1.5's. # Stage 2 and Stage 1.5's.
pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \
minix_stage1_5
CLEANFILES = $(pkgdata_DATA) CLEANFILES = $(pkgdata_DATA)
noinst_PROGRAMS = stage2.exec e2fs_stage1_5.exec fat_stage1_5.exec \ noinst_PROGRAMS = stage2.exec e2fs_stage1_5.exec fat_stage1_5.exec \
ffs_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec
MOSTLYCLEANFILES = $(noinst_PROGRAMS) MOSTLYCLEANFILES = $(noinst_PROGRAMS)
@ -122,7 +125,7 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
# For stage2 target. # For stage2 target.
stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \ stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \
disk_io.c gunzip.c stage2.c bios.c smp-imps.c fsys_ext2fs.c \ disk_io.c gunzip.c stage2.c bios.c smp-imps.c fsys_ext2fs.c \
fsys_fat.c fsys_ffs.c fsys_fat.c fsys_ffs.c fsys_minix.c
stage2_exec_CFLAGS = $(STAGE2_COMPILE) @FSYS_CFLAGS@ stage2_exec_CFLAGS = $(STAGE2_COMPILE) @FSYS_CFLAGS@
stage2_exec_LDFLAGS = $(STAGE2_LINK) stage2_exec_LDFLAGS = $(STAGE2_LINK)
@ -152,6 +155,15 @@ ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
-DNO_BLOCK_FILES=1 -DNO_BLOCK_FILES=1
ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
# For minix_stage1_5 target.
minix_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_minix.c bios.c
minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \
-DNO_BLOCK_FILES=1
minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
subdir = stage2 subdir = stage2
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
@ -167,7 +179,7 @@ libgrub_a_LIBADD =
am_libgrub_a_OBJECTS = libgrub_a-boot.o libgrub_a-common.o \ am_libgrub_a_OBJECTS = libgrub_a-boot.o libgrub_a-common.o \
libgrub_a-char_io.o libgrub_a-cmdline.o libgrub_a-disk_io.o \ libgrub_a-char_io.o libgrub_a-cmdline.o libgrub_a-disk_io.o \
libgrub_a-gunzip.o libgrub_a-fsys_ffs.o libgrub_a-fsys_ext2fs.o \ libgrub_a-gunzip.o libgrub_a-fsys_ffs.o libgrub_a-fsys_ext2fs.o \
libgrub_a-fsys_fat.o libgrub_a-stage2.o libgrub_a-fsys_fat.o libgrub_a-fsys_minix.o libgrub_a-stage2.o
libgrub_a_OBJECTS = $(am_libgrub_a_OBJECTS) libgrub_a_OBJECTS = $(am_libgrub_a_OBJECTS)
AR = ar AR = ar
PROGRAMS = $(noinst_PROGRAMS) PROGRAMS = $(noinst_PROGRAMS)
@ -193,11 +205,18 @@ ffs_stage1_5_exec-fsys_ffs.o ffs_stage1_5_exec-bios.o
ffs_stage1_5_exec_OBJECTS = $(am_ffs_stage1_5_exec_OBJECTS) ffs_stage1_5_exec_OBJECTS = $(am_ffs_stage1_5_exec_OBJECTS)
ffs_stage1_5_exec_LDADD = $(LDADD) ffs_stage1_5_exec_LDADD = $(LDADD)
ffs_stage1_5_exec_DEPENDENCIES = ffs_stage1_5_exec_DEPENDENCIES =
am_minix_stage1_5_exec_OBJECTS = minix_stage1_5_exec-asm.o \
minix_stage1_5_exec-common.o minix_stage1_5_exec-char_io.o \
minix_stage1_5_exec-disk_io.o minix_stage1_5_exec-stage1_5.o \
minix_stage1_5_exec-fsys_minix.o minix_stage1_5_exec-bios.o
minix_stage1_5_exec_OBJECTS = $(am_minix_stage1_5_exec_OBJECTS)
minix_stage1_5_exec_LDADD = $(LDADD)
minix_stage1_5_exec_DEPENDENCIES =
am_stage2_exec_OBJECTS = stage2_exec-asm.o stage2_exec-boot.o \ am_stage2_exec_OBJECTS = stage2_exec-asm.o stage2_exec-boot.o \
stage2_exec-common.o stage2_exec-char_io.o stage2_exec-cmdline.o \ stage2_exec-common.o stage2_exec-char_io.o stage2_exec-cmdline.o \
stage2_exec-disk_io.o stage2_exec-gunzip.o stage2_exec-stage2.o \ stage2_exec-disk_io.o stage2_exec-gunzip.o stage2_exec-stage2.o \
stage2_exec-bios.o stage2_exec-smp-imps.o stage2_exec-fsys_ext2fs.o \ stage2_exec-bios.o stage2_exec-smp-imps.o stage2_exec-fsys_ext2fs.o \
stage2_exec-fsys_fat.o stage2_exec-fsys_ffs.o stage2_exec-fsys_fat.o stage2_exec-fsys_ffs.o stage2_exec-fsys_minix.o
stage2_exec_OBJECTS = $(am_stage2_exec_OBJECTS) stage2_exec_OBJECTS = $(am_stage2_exec_OBJECTS)
stage2_exec_LDADD = $(LDADD) stage2_exec_LDADD = $(LDADD)
stage2_exec_DEPENDENCIES = stage2_exec_DEPENDENCIES =
@ -209,7 +228,7 @@ CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libgrub_a_SOURCES) $(e2fs_stage1_5_exec_SOURCES) \ DIST_SOURCES = $(libgrub_a_SOURCES) $(e2fs_stage1_5_exec_SOURCES) \
$(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) \ $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) \
$(stage2_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(stage2_exec_SOURCES)
DATA = $(nodist_pkgdata_DATA) DATA = $(nodist_pkgdata_DATA)
HEADERS = $(noinst_HEADERS) HEADERS = $(noinst_HEADERS)
@ -222,10 +241,10 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
GZIP_ENV = --best GZIP_ENV = --best
DEP_FILES = .deps/asm.P .deps/bios.P .deps/boot.P .deps/char_io.P \ DEP_FILES = .deps/asm.P .deps/bios.P .deps/boot.P .deps/char_io.P \
.deps/cmdline.P .deps/common.P .deps/disk_io.P .deps/fsys_ext2fs.P \ .deps/cmdline.P .deps/common.P .deps/disk_io.P .deps/fsys_ext2fs.P \
.deps/fsys_fat.P .deps/fsys_ffs.P .deps/gunzip.P .deps/smp-imps.P \ .deps/fsys_fat.P .deps/fsys_ffs.P .deps/fsys_minix.P .deps/gunzip.P \
.deps/stage1_5.P .deps/stage2.P .deps/smp-imps.P .deps/stage1_5.P .deps/stage2.P
SOURCES = $(libgrub_a_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(stage2_exec_SOURCES) SOURCES = $(libgrub_a_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(stage2_exec_SOURCES)
OBJECTS = $(am_libgrub_a_OBJECTS) $(am_e2fs_stage1_5_exec_OBJECTS) $(am_fat_stage1_5_exec_OBJECTS) $(am_ffs_stage1_5_exec_OBJECTS) $(am_stage2_exec_OBJECTS) OBJECTS = $(am_libgrub_a_OBJECTS) $(am_e2fs_stage1_5_exec_OBJECTS) $(am_fat_stage1_5_exec_OBJECTS) $(am_ffs_stage1_5_exec_OBJECTS) $(am_minix_stage1_5_exec_OBJECTS) $(am_stage2_exec_OBJECTS)
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
@ -265,6 +284,7 @@ libgrub_a-gunzip.o: gunzip.c
libgrub_a-fsys_ffs.o: fsys_ffs.c libgrub_a-fsys_ffs.o: fsys_ffs.c
libgrub_a-fsys_ext2fs.o: fsys_ext2fs.c libgrub_a-fsys_ext2fs.o: fsys_ext2fs.c
libgrub_a-fsys_fat.o: fsys_fat.c libgrub_a-fsys_fat.o: fsys_fat.c
libgrub_a-fsys_minix.o: fsys_minix.c
libgrub_a-stage2.o: stage2.c libgrub_a-stage2.o: stage2.c
libgrub.a: $(libgrub_a_OBJECTS) $(libgrub_a_DEPENDENCIES) libgrub.a: $(libgrub_a_OBJECTS) $(libgrub_a_DEPENDENCIES)
@ -316,6 +336,18 @@ ffs_stage1_5_exec-bios.o: bios.c
ffs_stage1_5.exec: $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_DEPENDENCIES) ffs_stage1_5.exec: $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_DEPENDENCIES)
@rm -f ffs_stage1_5.exec @rm -f ffs_stage1_5.exec
$(LINK) $(ffs_stage1_5_exec_LDFLAGS) $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_LDADD) $(LIBS) $(LINK) $(ffs_stage1_5_exec_LDFLAGS) $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_LDADD) $(LIBS)
minix_stage1_5_exec-asm.o: asm.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-asm.o $<
minix_stage1_5_exec-common.o: common.c
minix_stage1_5_exec-char_io.o: char_io.c
minix_stage1_5_exec-disk_io.o: disk_io.c
minix_stage1_5_exec-stage1_5.o: stage1_5.c
minix_stage1_5_exec-fsys_minix.o: fsys_minix.c
minix_stage1_5_exec-bios.o: bios.c
minix_stage1_5.exec: $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_DEPENDENCIES)
@rm -f minix_stage1_5.exec
$(LINK) $(minix_stage1_5_exec_LDFLAGS) $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_LDADD) $(LIBS)
stage2_exec-asm.o: asm.S stage2_exec-asm.o: asm.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o stage2_exec-asm.o $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o stage2_exec-asm.o $<
stage2_exec-boot.o: boot.c stage2_exec-boot.o: boot.c
@ -330,6 +362,7 @@ stage2_exec-smp-imps.o: smp-imps.c
stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c
stage2_exec-fsys_fat.o: fsys_fat.c stage2_exec-fsys_fat.o: fsys_fat.c
stage2_exec-fsys_ffs.o: fsys_ffs.c stage2_exec-fsys_ffs.o: fsys_ffs.c
stage2_exec-fsys_minix.o: fsys_minix.c
stage2.exec: $(stage2_exec_OBJECTS) $(stage2_exec_DEPENDENCIES) stage2.exec: $(stage2_exec_OBJECTS) $(stage2_exec_DEPENDENCIES)
@rm -f stage2.exec @rm -f stage2.exec
@ -612,6 +645,25 @@ libgrub_a-fsys_fat.lo: fsys_fat.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
libgrub_a-fsys_minix.o: fsys_minix.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp
libgrub_a-fsys_minix.lo: fsys_minix.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp
libgrub_a-stage2.o: stage2.c libgrub_a-stage2.o: stage2.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@ -973,6 +1025,120 @@ ffs_stage1_5_exec-bios.lo: bios.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-common.o: common.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-common.lo: common.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-char_io.o: char_io.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-char_io.lo: char_io.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-disk_io.o: disk_io.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-disk_io.lo: disk_io.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-stage1_5.o: stage1_5.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-stage1_5.lo: stage1_5.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-fsys_minix.o: fsys_minix.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-fsys_minix.lo: fsys_minix.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-bios.o: bios.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp
minix_stage1_5_exec-bios.lo: bios.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp
stage2_exec-boot.o: boot.c stage2_exec-boot.o: boot.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@ -1200,6 +1366,25 @@ stage2_exec-fsys_ffs.lo: fsys_ffs.c
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-fsys_minix.o: fsys_minix.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp
stage2_exec-fsys_minix.lo: fsys_minix.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp
check-TESTS: $(TESTS) check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \ @failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \ srcdir=$(srcdir); export srcdir; \

View file

@ -40,6 +40,9 @@ struct fsys_entry fsys_table[NUM_FSYS + 1] =
# endif # endif
# ifdef FSYS_EXT2FS # ifdef FSYS_EXT2FS
{"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir}, {"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir},
# endif
# ifdef FSYS_MINIX
{"minix", minix_mount, minix_read, minix_dir},
# endif # endif
/* XX FFS should come last as it's superblock is commonly crossing tracks /* XX FFS should come last as it's superblock is commonly crossing tracks
on floppies from track 1 to 2, while others only use 1. */ on floppies from track 1 to 2, while others only use 1. */

View file

@ -51,8 +51,18 @@ int ext2fs_dir (char *dirname);
#define FSYS_EXT2FS_NUM 0 #define FSYS_EXT2FS_NUM 0
#endif #endif
#ifdef FSYS_MINIX
#define FSYS_MINIX_NUM 1
int minix_mount (void);
int minix_read (char *buf, int len);
int minix_dir (char *dirname);
#else
#define FSYS_MINIX_NUM 0
#endif
#ifndef NUM_FSYS #ifndef NUM_FSYS
#define NUM_FSYS ( FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM ) #define NUM_FSYS \
(FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM)
#endif #endif
/* defines for the block filesystem info area */ /* defines for the block filesystem info area */

524
stage2/fsys_minix.c Normal file
View file

@ -0,0 +1,524 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Restrictions:
This is MINIX V1 only (yet)
Disk creation is like:
mkfs.minix -c -n14 DEVICE
*/
#ifdef FSYS_MINIX
#include "shared.h"
#include "filesys.h"
/* #define DEBUG_MINIX */
/* indirect blocks */
static int mapblock1, mapblock2;
/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */
#define DEV_BSIZE 512
/* include/linux/fs.h */
#define BLOCK_SIZE_BITS 10
#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
/* made up, defaults to 1 but can be passed via mount_opts */
#define WHICH_SUPER 1
/* kind of from fs/ext2/super.c (is OK for minix) */
#define SBLOCK (WHICH_SUPER * BLOCK_SIZE / DEV_BSIZE) /* = 2 */
/* include/asm-i386/type.h */
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
/* include/linux/minix_fs.h */
#define MINIX_ROOT_INO 1
/* Not the same as the bogus LINK_MAX in <linux/limits.h>. Oh well. */
#define MINIX_LINK_MAX 250
#define MINIX2_LINK_MAX 65530
#define MINIX_I_MAP_SLOTS 8
#define MINIX_Z_MAP_SLOTS 64
#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */
#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */
#define MINIX_VALID_FS 0x0001 /* Clean fs. */
#define MINIX_ERROR_FS 0x0002 /* fs has errors. */
#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
#define MINIX_V1 0x0001 /* original minix fs */
#define MINIX_V2 0x0002 /* minix V2 fs */
/* originally this is :
#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
here we have */
#define INODE_VERSION(inode) (SUPERBLOCK->s_version)
#define MINIX_NAME_LEN 14 /* XXX depend on version */
/*
* This is the original minix inode layout on disk.
* Note the 8-bit gid and atime and ctime.
*/
struct minix_inode {
__u16 i_mode;
__u16 i_uid;
__u32 i_size;
__u32 i_time;
__u8 i_gid;
__u8 i_nlinks;
__u16 i_zone[9];
};
/*
* The new minix inode has all the time entries, as well as
* long block numbers and a third indirect block (7+1+1+1
* instead of 7+1+1). Also, some previously 8-bit values are
* now 16-bit. The inode is now 64 bytes instead of 32.
*/
struct minix2_inode {
__u16 i_mode;
__u16 i_nlinks;
__u16 i_uid;
__u16 i_gid;
__u32 i_size;
__u32 i_atime;
__u32 i_mtime;
__u32 i_ctime;
__u32 i_zone[10];
};
/*
* minix super-block data on disk
*/
struct minix_super_block {
__u16 s_ninodes;
__u16 s_nzones;
__u16 s_imap_blocks;
__u16 s_zmap_blocks;
__u16 s_firstdatazone;
__u16 s_log_zone_size;
__u32 s_max_size;
__u16 s_magic;
__u16 s_state;
__u32 s_zones;
};
struct minix_dir_entry {
__u16 inode;
char name[0];
};
/* made up, these are pointers into FSYS_BUF */
/* read once, always stays there: */
#define SUPERBLOCK \
((struct minix_super_block *)(FSYS_BUF))
#define INODE \
((struct minix_inode *)((int) SUPERBLOCK + BLOCK_SIZE))
#define DATABLOCK1 \
((int)((int)INODE + sizeof(struct minix_inode)))
#define DATABLOCK2 \
((int)((int)DATABLOCK1 + BLOCK_SIZE))
/* linux/stat.h */
#define S_IFMT 00170000
#define S_IFLNK 0120000
#define S_IFREG 0100000
#define S_IFDIR 0040000
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define PATH_MAX 1024 /* include/linux/limits.h */
#define MAX_LINK_COUNT 5 /* number of symbolic links to follow */
/* check filesystem types and read superblock into memory buffer */
int
minix_mount (void)
{
int retval = 1;
if ((((current_drive & 0x80 || current_slice != 0))
&& (current_slice != PC_SLICE_TYPE_MINIX)
&& ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))
|| part_length < (SBLOCK +
(sizeof (struct minix_super_block) / DEV_BSIZE))
|| ! devread (SBLOCK, 0, sizeof (struct minix_super_block),
(char *) SUPERBLOCK)
|| SUPERBLOCK->s_magic != MINIX_SUPER_MAGIC)
retval = 0;
return retval;
}
/* Takes a file system block number and reads it into BUFFER. */
static int
minix_rdfsb (int fsblock, int buffer)
{
return devread (fsblock * (BLOCK_SIZE / DEV_BSIZE), 0,
BLOCK_SIZE, (char *) buffer);
}
/* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into
a physical block (the location in the file system) via an inode. */
static int
minix_block_map (int logical_block)
{
int i;
if (logical_block < 7)
return INODE->i_zone[logical_block];
logical_block -= 7;
if (logical_block < 512)
{
i = INODE->i_zone[7];
if (!i || ((mapblock1 != 1)
&& !minix_rdfsb (i, DATABLOCK1)))
{
errnum = ERR_FSYS_CORRUPT;
return -1;
}
mapblock1 = 1;
return ((__u16 *) DATABLOCK1) [logical_block];
}
logical_block -= 512;
i = INODE->i_zone[8];
if (!i || ((mapblock1 != 2)
&& !minix_rdfsb (i, DATABLOCK1)))
{
errnum = ERR_FSYS_CORRUPT;
return -1;
}
mapblock1 = 2;
i = ((__u16 *) DATABLOCK1)[logical_block >> 9];
if (!i || ((mapblock2 != i)
&& !minix_rdfsb (i, DATABLOCK2)))
{
errnum = ERR_FSYS_CORRUPT;
return -1;
}
mapblock2 = i;
return ((__u16 *) DATABLOCK2)[logical_block & 511];
}
/* read from INODE into BUF */
int
minix_read (char *buf, int len)
{
int logical_block;
int offset;
int map;
int ret = 0;
int size = 0;
while (len > 0)
{
/* find the (logical) block component of our location */
logical_block = filepos >> BLOCK_SIZE_BITS;
offset = filepos & (BLOCK_SIZE - 1);
map = minix_block_map (logical_block);
#ifdef DEBUG_MINIX
printf ("map=%d\n", map);
#endif
if (map < 0)
break;
size = BLOCK_SIZE;
size -= offset;
if (size > len)
size = len;
#ifndef STAGE1_5
debug_fs_func = debug_fs;
#endif /* STAGE1_5 */
devread (map * (BLOCK_SIZE / DEV_BSIZE),
offset, size, buf);
#ifndef STAGE1_5
debug_fs_func = NULL;
#endif /* STAGE1_5 */
buf += size;
len -= size;
filepos += size;
ret += size;
}
if (errnum)
ret = 0;
return ret;
}
/* preconditions: minix_mount already executed, therefore supblk in buffer
known as SUPERBLOCK
returns: 0 if error, nonzero iff we were able to find the file successfully
postconditions: on a nonzero return, buffer known as INODE contains the
inode of the file we were trying to look up
side effects: none yet */
int
minix_dir (char *dirname)
{
int current_ino = MINIX_ROOT_INO; /* start at the root */
int updir_ino = current_ino; /* the parent of the current directory */
int ino_blk; /* fs pointer of the inode's info */
int str_chk; /* used ot hold the results of a string
compare */
struct minix_inode * raw_inode; /* inode info for current_ino */
char linkbuf[PATH_MAX]; /* buffer for following sym-links */
int link_count = 0;
char * rest;
char ch;
int off; /* offset within block of directory
entry */
int loc; /* location within a directory */
int blk; /* which data blk within dir entry */
long map; /* fs pointer of a particular block from
dir entry */
struct minix_dir_entry * dp; /* pointer to directory entry */
/* loop invariants:
current_ino = inode to lookup
dirname = pointer to filename component we are cur looking up within
the directory known pointed to by current_ino (if any) */
#ifdef DEBUG_MINIX
printf ("\n");
#endif
while (1)
{
#ifdef DEBUG_MINIX
printf ("inode %d, dirname %s\n", current_ino, dirname);
#endif
ino_blk = (2 + SUPERBLOCK->s_imap_blocks + SUPERBLOCK->s_zmap_blocks
+ (current_ino - 1) / MINIX_INODES_PER_BLOCK);
if (! minix_rdfsb (ino_blk, (int) INODE))
return 0;
/* reset indirect blocks! */
mapblock2 = mapblock1 = -1;
raw_inode = INODE + ((current_ino - 1) % MINIX_INODES_PER_BLOCK);
/* copy inode to fixed location */
memmove ((void *) INODE, (void *) raw_inode,
sizeof (struct minix_inode));
/* If we've got a symbolic link, then chase it. */
if (S_ISLNK (INODE->i_mode))
{
int len;
if (++link_count > MAX_LINK_COUNT)
{
errnum = ERR_SYMLINK_LOOP;
return 0;
}
#ifdef DEBUG_MINIX
printf ("S_ISLNK (%s)\n", dirname);
#endif
/* Find out how long our remaining name is. */
len = 0;
while (dirname[len] && !isspace (dirname[len]))
len++;
/* Get the symlink size. */
filemax = (INODE->i_size);
if (filemax + len > sizeof (linkbuf) - 2)
{
errnum = ERR_FILELENGTH;
return 0;
}
if (len)
{
/* Copy the remaining name to the end of the symlink data.
Note that DIRNAME and LINKBUF may overlap! */
memmove (linkbuf + filemax, dirname, len);
}
linkbuf[filemax + len] = '\0';
/* Read the necessary blocks, and reset the file pointer. */
len = grub_read (linkbuf, filemax);
filepos = 0;
if (!len)
return 0;
#ifdef DEBUG_MINIX
printf ("symlink=%s\n", linkbuf);
#endif
dirname = linkbuf;
if (*dirname == '/')
{
/* It's an absolute link, so look it up in root. */
current_ino = MINIX_ROOT_INO;
updir_ino = current_ino;
}
else
{
/* Relative, so look it up in our parent directory. */
current_ino = updir_ino;
}
/* Try again using the new name. */
continue;
}
/* If end of filename, INODE points to the file's inode */
if (!*dirname || isspace (*dirname))
{
if (!S_ISREG (INODE->i_mode))
{
errnum = ERR_BAD_FILETYPE;
return 0;
}
filemax = (INODE->i_size);
return 1;
}
/* else we have to traverse a directory */
updir_ino = current_ino;
/* skip over slashes */
while (*dirname == '/')
dirname++;
/* if this isn't a directory of sufficient size to hold our file,
abort */
if (!(INODE->i_size) || !S_ISDIR (INODE->i_mode))
{
errnum = ERR_BAD_FILETYPE;
return 0;
}
/* skip to next slash or end of filename (space) */
for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/';
rest++);
/* look through this directory and find the next filename component */
/* invariant: rest points to slash after the next filename component */
*rest = 0;
loc = 0;
do
{
#ifdef DEBUG_MINIX
printf ("dirname=`%s', rest=`%s', loc=%d\n", dirname, rest, loc);
#endif
/* if our location/byte offset into the directory exceeds the size,
give up */
if (loc >= INODE->i_size)
{
if (print_possibilities < 0)
{
putchar ('\n');
}
else
{
errnum = ERR_FILE_NOT_FOUND;
*rest = ch;
}
return (print_possibilities < 0);
}
/* else, find the (logical) block component of our location */
blk = loc >> BLOCK_SIZE_BITS;
/* we know which logical block of the directory entry we are looking
for, now we have to translate that to the physical (fs) block on
the disk */
map = minix_block_map (blk);
#ifdef DEBUG_MINIX
printf ("fs block=%d\n", map);
#endif
mapblock2 = -1;
if ((map < 0) || !minix_rdfsb (map, DATABLOCK2))
{
errnum = ERR_FSYS_CORRUPT;
*rest = ch;
return 0;
}
off = loc & (BLOCK_SIZE - 1);
dp = (struct minix_dir_entry *) (DATABLOCK2 + off);
/* advance loc prematurely to next on-disk directory entry */
loc += sizeof (dp->inode) + 14; /* XXX */
/* NOTE: minix filenames are NULL terminated if < 14 else exact */
#ifdef DEBUG_MINIX
printf ("directory entry ino=%d\n", dp->inode);
if (dp->inode)
printf ("entry=%s\n", dp->name);
#endif
if (dp->inode)
{
int saved_c = dp->name[MINIX_NAME_LEN+1];
dp->name[MINIX_NAME_LEN+1] = 0;
str_chk = substring (dirname, dp->name);
# ifndef STAGE1_5
if (print_possibilities && ch != '/'
&& (!*dirname || str_chk <= 0))
{
if (print_possibilities > 0)
print_possibilities = -print_possibilities;
print_a_completion (dp->name);
}
# endif
dp->name[MINIX_NAME_LEN+1] = saved_c;
}
}
while (!dp->inode || (str_chk || (print_possibilities && ch != '/')));
current_ino = dp->inode;
*(dirname = rest) = ch;
}
/* never get here */
}
#endif /* FSYS_MINIX */

View file

@ -106,6 +106,7 @@
#define PC_SLICE_TYPE_FAT32_LBA 0xc #define PC_SLICE_TYPE_FAT32_LBA 0xc
#define PC_SLICE_TYPE_FAT16_LBA 0xe #define PC_SLICE_TYPE_FAT16_LBA 0xe
#define PC_SLICE_TYPE_WIN95_EXTENDED 0xf #define PC_SLICE_TYPE_WIN95_EXTENDED 0xf
#define PC_SLICE_TYPE_MINIX 0x80
#define PC_SLICE_TYPE_EXT2FS 0x83 #define PC_SLICE_TYPE_EXT2FS 0x83
/* For convinience. */ /* For convinience. */

View file

@ -134,19 +134,22 @@ extern char *grub_scratch_mem;
#define STAGE2_ID_FFS_STAGE1_5 1 #define STAGE2_ID_FFS_STAGE1_5 1
#define STAGE2_ID_E2FS_STAGE1_5 2 #define STAGE2_ID_E2FS_STAGE1_5 2
#define STAGE2_ID_FAT_STAGE1_5 3 #define STAGE2_ID_FAT_STAGE1_5 3
#define STAGE2_ID_MINIX_STAGE1_5 4
#ifndef STAGE1_5 #ifndef STAGE1_5
#define STAGE2_ID STAGE2_ID_STAGE2 # define STAGE2_ID STAGE2_ID_STAGE2
#else #else
#if defined(FSYS_FFS) # if defined(FSYS_FFS)
#define STAGE2_ID STAGE2_ID_FFS_STAGE1_5 # define STAGE2_ID STAGE2_ID_FFS_STAGE1_5
#elif defined(FSYS_EXT2FS) # elif defined(FSYS_EXT2FS)
#define STAGE2_ID STAGE2_ID_E2FS_STAGE1_5 # define STAGE2_ID STAGE2_ID_E2FS_STAGE1_5
#elif defined(FSYS_FAT) # elif defined(FSYS_FAT)
#define STAGE2_ID STAGE2_ID_FAT_STAGE1_5 # define STAGE2_ID STAGE2_ID_FAT_STAGE1_5
#else # elif defined(FSYS_MINIX)
#error "unknown Stage 2" # define STAGE2_ID STAGE2_ID_MINIX_STAGE1_5
#endif # else
# error "unknown Stage 2"
# endif
#endif #endif
/* /*

View file

@ -47,6 +47,9 @@ check fat_stage1_5 31744
# Likewise. # Likewise.
check e2fs_stage1_5 31744 check e2fs_stage1_5 31744
# Likewise.
check minix_stage1_5 31744
# This limitation is arbitrary; If you want to make this larger, just # This limitation is arbitrary; If you want to make this larger, just
# modify Stage 1. # modify Stage 1.
check stage2 46080 check stage2 46080