diff --git a/ChangeLog b/ChangeLog index acc58e13e..230d4b420 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +1999-06-23 OKUJI Yoshinori + + * grub/asmstub.c [__linux__]: Include linux/fs.h for BLKFLSBUF. + (grub_stage2): Call sync before and after calling doit. + (gurb_stage2) [__linux__]: Invalidate buffer caches by BLKFLSBUF + ioctl. + * grub/main.c (main): Call sync first. Suggested by Pavel Roskin + . + + * configure.in: Curses libraries are always checked. + (--enable-sbin-grub): Deleted. Now /sbin/grub is always built. + (--enable-maintainer-mode): New option. + * grub/Makefile.am (EXTRA_PROGRAMS): Deleted. + (sbin_PROGRAMS): Just set to grub. + * docs/Makefile.am (man_MANS): New variable. + (HELP2MAN): Likewise. + (noinst_SCRIPTS): Likewise. + (EXTRA_DIST): Add $(man_MANS) and $(noinst_SCRIPTS). + [GRUB_MAINT]: Define the rule for the /sbin/grub manual. + * docs/help2man: Copied from texinfo-3.12i. + (--sector): New option to specify which section a manual belongs + to. + (opt_sector): New variable. + (sector): Likewise. + * docs/grub.8: Produced by help2man automatically. + 1999-06-22 OKUJI Yoshinori * shared_src/char_io.c (get_cmdline): Add two missing `break's. diff --git a/Makefile.in b/Makefile.in index 89cd7b508..3f346dae7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -70,7 +70,6 @@ VERSION = @VERSION@ host_cpu = @host_cpu@ host_vendor = @host_vendor@ install_sh = @install_sh@ -sbingrub = @sbingrub@ SUBDIRS = grub stage1 stage2 \ diff --git a/aclocal.m4 b/aclocal.m4 index 3e0d5ea71..1850e2307 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -230,3 +230,16 @@ else fi AC_SUBST($1)]) +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + diff --git a/configure b/configure index d6f8f5021..1ac15c5ec 100644 --- a/configure +++ b/configure @@ -12,7 +12,8 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help - --enable-sbin-grub build /sbin/grub command-line utility" + --enable-maintainer-mode + enable the maintainer mode" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -554,7 +555,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" # ./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 "configure:558: checking for a BSD compatible install" >&5 +echo "configure:559: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"\${ac_cv_path_install+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -611,7 +612,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:615: checking whether build environment is sane" >&5 +echo "configure:616: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -668,7 +669,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:672: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:673: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -717,7 +718,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:721: checking for working aclocal" >&5 +echo "configure:722: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -730,7 +731,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:734: checking for working autoconf" >&5 +echo "configure:735: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -743,7 +744,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:747: checking for working automake" >&5 +echo "configure:748: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -756,7 +757,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:760: checking for working autoheader" >&5 +echo "configure:761: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -769,7 +770,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:773: checking for working makeinfo" >&5 +echo "configure:774: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -789,7 +790,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:793: checking for $ac_word" >&5 +echo "configure:794: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -829,7 +830,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:833: checking host system type" >&5 +echo "configure:834: 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 # Make sure we can run config.sub. @@ -880,22 +881,36 @@ esac # # Options # -sbingrub= -# Check whether --enable-sbin-grub or --disable-sbin-grub was given. -if test "${enable_sbin_grub+set}" = set; then - enableval="$enable_sbin_grub" - test "x$enableval" = xno || sbingrub=grub + +# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + case "x${enableval}" in + xyes) maintainermode=yes ;; + xno) maintainermode=no ;; + *) { echo "configure: error: invalid value ${enableval} for --enable-maintainer-mode" 1>&2; exit 1; } ;; +esac +else + maintainermode=no fi +if test "x${maintainermode}" = xyes; then + GRUB_MAINT_TRUE= + GRUB_MAINT_FALSE='#' +else + GRUB_MAINT_TRUE='#' + GRUB_MAINT_FALSE= +fi + # # Programs # echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:899: checking build system type" >&5 +echo "configure:914: 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 # Make sure we can run config.sub. @@ -942,7 +957,7 @@ fi # 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 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:946: checking for $ac_word" >&5 +echo "configure:961: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -974,7 +989,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:978: checking for $ac_word" >&5 +echo "configure:993: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1004,7 +1019,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1008: checking for $ac_word" >&5 +echo "configure:1023: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1055,7 +1070,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1059: checking for $ac_word" >&5 +echo "configure:1074: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1087,7 +1102,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1091: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5 +echo "configure:1106: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1098,12 +1113,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1102 "configure" +#line 1117 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1129,12 +1144,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; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1133: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1148: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1138: checking whether we are using GNU C" >&5 +echo "configure:1153: checking whether we are using GNU C" >&5 if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1143,7 +1158,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1147: \"$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:1162: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1162,7 +1177,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1166: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1181: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1200,7 +1215,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. set dummy ${ac_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1204: checking for $ac_word" >&5 +echo "configure:1219: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_LD+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1232,7 +1247,7 @@ fi # 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 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1236: checking for $ac_word" >&5 +echo "configure:1251: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_OBJCOPY+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1265,7 +1280,7 @@ fi # Defined in acinclude.m4. echo $ac_n "checking symbol names produced by ${CC-cc}""... $ac_c" 1>&6 -echo "configure:1269: checking symbol names produced by ${CC-cc}" >&5 +echo "configure:1284: checking symbol names produced by ${CC-cc}" >&5 if eval "test \"\${grub_cv_asm_ext_c+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1278,7 +1293,7 @@ func (int *list) } EOF -if { ac_try='${CC-cc} -S conftest.c'; { (eval echo configure:1282: \"$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:1297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then : else { echo "configure: error: ${CC-cc} failed to produce assembly code" 1>&2; exit 1; } fi @@ -1307,7 +1322,7 @@ EOF echo $ac_n "checking whether ${OBJCOPY} works for absolute addresses""... $ac_c" 1>&6 -echo "configure:1311: checking whether ${OBJCOPY} works for absolute addresses" >&5 +echo "configure:1326: checking whether ${OBJCOPY} works for absolute addresses" >&5 if eval "test \"\${grub_cv_prog_objcopy_absolute+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1319,21 +1334,21 @@ blah (void) } EOF -if { (eval echo configure:1323: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then : +if { (eval echo configure:1338: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then : else { echo "configure: error: ${CC-cc} cannot compile C source code" 1>&2; exit 1; } fi grub_cv_prog_objcopy_absolute=yes 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:1329: \"$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:1344: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : else { echo "configure: error: ${LD-ld} cannot link at address $link_addr" 1>&2; exit 1; } fi - if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1333: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : + if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : else { echo "configure: error: ${OBJCOPY-objcopy} cannot create binary files" 1>&2; exit 1; } fi - if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'; { (eval echo configure:1337: \"$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:1352: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then mv -f conftest conftest.old else grub_cv_prog_objcopy_absolute=no @@ -1350,7 +1365,7 @@ fi echo $ac_n "checking for .code16 addr32 assembler support""... $ac_c" 1>&6 -echo "configure:1354: checking for .code16 addr32 assembler support" >&5 +echo "configure:1369: checking for .code16 addr32 assembler support" >&5 if eval "test \"\${grub_cv_asm_addr32+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1360,7 +1375,7 @@ l1: addr32 movb %al, l1 EOF -if { ac_try='${CC-cc} -c conftest.s'; { (eval echo configure:1364: \"$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:1379: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then grub_cv_asm_addr32=yes else grub_cv_asm_addr32=no @@ -1373,10 +1388,9 @@ if test "x$grub_cv_asm_addr32" != xyes; then { echo "configure: error: GRUB requires GAS .code16 addr32 support; upgrade your binutils" 1>&2; exit 1; } fi -# Check for curses libraries if we are building /sbin/grub. -if test -n "$sbingrub"; then - echo $ac_n "checking for getch in -lncurses""... $ac_c" 1>&6 -echo "configure:1380: checking for getch in -lncurses" >&5 +# Check for curses libraries. +echo $ac_n "checking for getch in -lncurses""... $ac_c" 1>&6 +echo "configure:1394: checking for getch in -lncurses" >&5 ac_lib_var=`echo ncurses'_'getch | sed 'y%./+-%__p_%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1384,7 +1398,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1418,7 +1432,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for getch in -lcurses""... $ac_c" 1>&6 -echo "configure:1422: checking for getch in -lcurses" >&5 +echo "configure:1436: checking for getch in -lcurses" >&5 ac_lib_var=`echo curses'_'getch | sed 'y%./+-%__p_%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1426,7 +1440,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1463,7 +1477,6 @@ fi fi -fi # Create rules for our shared sources. SHARED_SRC_RULES=./ssrcrules.mk @@ -1663,7 +1676,8 @@ s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g s%@host_vendor@%$host_vendor%g s%@host_os@%$host_os%g -s%@sbingrub@%$sbingrub%g +s%@GRUB_MAINT_TRUE@%$GRUB_MAINT_TRUE%g +s%@GRUB_MAINT_FALSE@%$GRUB_MAINT_FALSE%g s%@build@%$build%g s%@build_alias@%$build_alias%g s%@build_cpu@%$build_cpu%g diff --git a/configure.in b/configure.in index 1758eef41..1903034f8 100644 --- a/configure.in +++ b/configure.in @@ -32,11 +32,16 @@ AC_SUBST(host_vendor) # # Options # -sbingrub= -AC_ARG_ENABLE(sbin-grub, -[ --enable-sbin-grub build /sbin/grub command-line utility], -[test "x$enableval" = xno || sbingrub=grub]) -AC_SUBST(sbingrub) + +AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode + enable the maintainer mode], +[case "x${enableval}" in + xyes) maintainermode=yes ;; + xno) maintainermode=no ;; + *) AC_MSG_ERROR(invalid value ${enableval} for --enable-maintainer-mode) ;; +esac],[maintainermode=no]) +AM_CONDITIONAL(GRUB_MAINT, test "x${maintainermode}" = xyes) # # Programs @@ -63,13 +68,11 @@ if test "x$grub_cv_asm_addr32" != xyes; then AC_MSG_ERROR([GRUB requires GAS .code16 addr32 support; upgrade your binutils]) fi -# Check for curses libraries if we are building /sbin/grub. -if test -n "$sbingrub"; then - AC_CHECK_LIB(ncurses, getch, [LIBS="$LIBS -lncurses" +# Check for curses libraries. +AC_CHECK_LIB(ncurses, getch, [LIBS="$LIBS -lncurses" AC_DEFINE(HAVE_LIBCURSES)], [AC_CHECK_LIB(curses, getch, [LIBS="$LIBS -lcurses" AC_DEFINE(HAVE_LIBCURSES)])]) -fi # Create rules for our shared sources. AC_SUBST_FILE(SHARED_SRC_RULES)dnl diff --git a/debian/Makefile.in b/debian/Makefile.in index cf89303da..a6ac9f3af 100644 --- a/debian/Makefile.in +++ b/debian/Makefile.in @@ -70,7 +70,6 @@ VERSION = @VERSION@ host_cpu = @host_cpu@ host_vendor = @host_vendor@ install_sh = @install_sh@ -sbingrub = @sbingrub@ EXTRA_DIST = README.debian changelog control copyright rules diff --git a/docs/Makefile.am b/docs/Makefile.am index a30e23307..aaaa8baa6 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,2 +1,12 @@ info_TEXINFOS = grub.texi multiboot.texi -EXTRA_DIST = menu.lst +man_MANS = grub.8 +HELP2MAN = $(srcdir)/help2man +noinst_SCRIPTS = $(HELP2MAN) + +EXTRA_DIST = menu.lst $(man_MANS) $(noinst_SCRIPTS) + +if GRUB_MAINT +$(srcdir)/grub.8: ../grub/grub $(HELP2MAN) + $(HELP2MAN) --name="the stage2 emulator shell" --section=8 \ + --output=$@ $< +endif diff --git a/docs/Makefile.in b/docs/Makefile.in index 9f79ad349..81d1e3421 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -70,19 +70,28 @@ VERSION = @VERSION@ host_cpu = @host_cpu@ host_vendor = @host_vendor@ install_sh = @install_sh@ -sbingrub = @sbingrub@ info_TEXINFOS = grub.texi multiboot.texi -EXTRA_DIST = menu.lst +man_MANS = grub.8 +HELP2MAN = $(srcdir)/help2man +noinst_SCRIPTS = $(HELP2MAN) + +EXTRA_DIST = menu.lst $(man_MANS) $(noinst_SCRIPTS) subdir = docs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = +SCRIPTS = $(noinst_SCRIPTS) + DIST_SOURCES = TEXI2DVI = texi2dvi INFO_DEPS = grub.info multiboot.info DVIS = grub.dvi multiboot.dvi TEXINFOS = grub.texi multiboot.texi +man8dir = $(mandir)/man8 +MANS = $(man_MANS) + +NROFF = nroff DIST_COMMON = Makefile.am Makefile.in mdate-sh stamp-vti texinfo.tex \ version.texi @@ -252,6 +261,47 @@ maintainer-clean-aminfo: rm -f $$i-[0-9]*; \ fi; \ done + +install-man8: + $(mkinstalldirs) $(DESTDIR)$(man8dir) + @list='$(man8_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ + done + +uninstall-man8: + @list='$(man8_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ + rm -f $(DESTDIR)$(man8dir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-man8 +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-man8 tags: TAGS TAGS: @@ -264,6 +314,7 @@ distdir: $(DISTFILES) distdir=`cd $(distdir) && pwd`; \ cd $(top_srcdir) \ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu docs/Makefile + $(mkinstalldirs) $(distdir)/$(srcdir) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ @@ -286,20 +337,20 @@ installcheck: installcheck-am install-exec-am: install-exec: install-exec-am -install-data-am: install-info-am +install-data-am: install-info-am install-man install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am -uninstall-am: uninstall-info +uninstall-am: uninstall-info uninstall-man uninstall: uninstall-am -all-am: Makefile $(INFO_DEPS) +all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(MANS) all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install installdirs: - $(mkinstalldirs) $(DESTDIR)$(infodir) + $(mkinstalldirs) $(DESTDIR)$(infodir) $(DESTDIR)$(mandir)/man8 mostlyclean-generic: @@ -332,14 +383,19 @@ 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 \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +clean-aminfo maintainer-clean-aminfo install-man8 uninstall-man8 \ +install-man uninstall-man 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 maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean +@GRUB_MAINT_TRUE@$(srcdir)/grub.8: ../grub/grub $(HELP2MAN) +@GRUB_MAINT_TRUE@ $(HELP2MAN) --name="the stage2 emulator shell" --section=8 \ +@GRUB_MAINT_TRUE@ --output=$@ $< + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/docs/grub.8 b/docs/grub.8 new file mode 100644 index 000000000..a3830ad72 --- /dev/null +++ b/docs/grub.8 @@ -0,0 +1,57 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.010. +.TH GRUB "8" "June 2000" "GNU GRUB 0.5.92" "FSF" +.SH NAME +GRUB \- the stage2 emulator shell +.SH SYNOPSIS +.B GRUB +[\fIOPTION\fR]... +.SH DESCRIPTION +.PP +Enter the GRand Unified Bootloader command shell. +.TP +\fB\-\-batch\fR +turn on batch mode for non-interactive use +.TP +\fB\-\-boot\-drive\fR=\fIDRIVE\fR +specify stage2 boot_drive [default=0x0] +.TP +\fB\-\-config\-file\fR=\fIFILE\fR +specify stage2 config_file [default=/boot/grub/menu.lst] +.TP +\fB\-\-help\fR +display this message and exit +.TP +\fB\-\-hold\fR +wait until a debugger will attach +.TP +\fB\-\-install\-partition\fR=\fIPAR\fR +specify stage2 install_partition [default=0x20000] +.TP +\fB\-\-no\-config\-file\fR +do not use the config file +.TP +\fB\-\-no\-curses\fR +do not use curses +.TP +\fB\-\-read\-only\fR +do not write anything to devices +.TP +\fB\-\-verbose\fR +print verbose messages +.TP +\fB\-\-version\fR +print version information and exit +.SH "REPORTING BUGS" +Report bugs to bug-grub@gnu.org +.SH "SEE ALSO" +The full documentation for +.B GRUB +is maintained as a Texinfo manual. If the +.B info +and +.B GRUB +programs are properly installed at your site, the command +.IP +.B info GRUB +.PP +should give you access to the complete manual. diff --git a/docs/grub.texi b/docs/grub.texi index a6e512159..91336cedf 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -364,7 +364,7 @@ on the floppy. If you install GRUB using this method, it will only have access to the command-line interface, since there is no filesystem in which to find a -configuration file (FIXME: ref). If you want to use the menu interface, see +configuration file. If you want to use the menu interface, see @ref{Automated install}. Under an UNIX-like operating system, such as GNU, use @code{dd} as @@ -427,7 +427,7 @@ place the @file{stage2} (and if desired, your configuration file called (after booting from the GRUB floppy): @example -install= (fd0)+1 (hd0) (hd0,2)/boot/grub/stage2 0x8000 p +install= (fd0)+1 (hd0) (hd0,1)/boot/grub/stage2 0x8000 p @end example This tells GRUB to grab the first sector of the floppy and use it as the @@ -444,7 +444,7 @@ telling GRUB's stage1 to read from the first hard disk no matter where the stage1 was loaded from: @example -install= (fd0)+1 d (fd0) (hd0,2)/boot/grub/stage2 0x8000 p +install= (fd0)+1 d (fd0) (hd0,1)/boot/grub/stage2 0x8000 p @end example The @samp{d} option near the beginning is what sets the @emph{forced} @@ -452,6 +452,26 @@ loading from the disk where the stage2 was installed from. Also, the @dfn{destination device} is changed to place the finished stage1 on the floppy disk. +@item +@strong{Same as above, but place the stage1.5 in the first cylinder of +the hard disk, and load the stage2 via the stage1.5:} Each of Stage 1.5s +supports only one filesystem, so choose a stage1.5 that supports the +filesystem where stage2 is located. Here it is assumed that the +filesystem is ext2fs. + +First, copy @file{e2fs_stage1_5} to the first cylinder after MBR +(@pxref{MBR}): + +@example +dd if=e2fs_stage1_5/e2fs_stage1_5 of=/dev/hda bs=512 seek=1 +@end example + +Second, specify the stage2 argument in the block-list format: + +@example +install= (fd0)+1 (hd0) (hd0)1+1 0x2000 p (hd0,1)/boot/grub/stage2 +@end example + @item @strong{Installing from an @emph{install directory} to the second hard disk:} Here we're loading the stage1 from a file on the first hard disk, @@ -460,7 +480,7 @@ hard disk, and setting the stage2's @dfn{configuration file} to @file{(hd1,a)/grubdir/configfile}: @example -install= (hd0,2)/boot/grub/stage1 (hd1) (hd1,a)/boot/grub/stage2 0x8000 p /grubdir/configfile +install= (hd0,1)/boot/grub/stage1 (hd1) (hd1,a)/boot/grub/stage2 0x8000 p /grubdir/configfile @end example @end itemize @@ -517,7 +537,7 @@ file, used with exactly the same syntax. @c The list of available keys should be listed in @table, and should be @c explained exactly. Current explanation is obscure. Cursor movement and editing of the text on the line can be done via a -subset of the functions available in the BASH (FIXME: ref) shell +subset of the functions available in the BASH shell (@kbd{C-f} forward, @kbd{C-b} backward, @kbd{C-a} beginning of line, @kbd{C-e} end of line, @kbd{C-k} delete to end, @kbd{C-u} delete to beginning; the PC left and right arrow keys, @key{HOME}, @key{DEL}, and diff --git a/docs/help2man b/docs/help2man new file mode 100644 index 000000000..f19bb0514 --- /dev/null +++ b/docs/help2man @@ -0,0 +1,397 @@ +#!/usr/local/bin/perl -w + +# Generate a short man page from --help and --version output. +# Copyright © 1997, 98, 99 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Written by Brendan O'Dea + +use 5.004; +use strict; +use Getopt::Long; +use POSIX qw(strftime setlocale LC_TIME); + +my $this_program = 'help2man'; +my $this_version = '1.010'; +my $version_info = < +EOT + +my $help_info = < \$opt_name, + 'include=s' => \$include, + 'opt-include=s' => \$opt_include, + 'output=s' => \$opt_output, + 'no-info' => \$opt_no_info, + 'section=s' => \$opt_section, + help => sub { print $help_info; exit }, + version => sub { print $version_info; exit }, +) or die $help_info; + +die $help_info unless @ARGV == 1; + +my %include = (); +my @include = (); # to retain order + +# Process include file (if given). Format is: +# +# [section name] +# verbatim text + +if ($include or $opt_include) +{ + if (open INC, $include || $opt_include) + { + my $sect; + + while () + { + if (/^\[([^]]+)\]/) + { + $sect = uc $1; + $sect =~ s/^\s+//; + $sect =~ s/\s+$//; + next; + } + + # Silently ignore anything before the first + # section--allows for comments and revision info. + next unless $sect; + + push @include, $sect unless $include{$sect}; + $include{$sect} ||= ''; + $include{$sect} .= $_; + } + + close INC; + + die "$this_program: no valid information found in `$include'\n" + unless %include; + + # Compress trailing blank lines. + for (keys %include) + { + $include{$_} =~ s/\n+$//; + $include{$_} .= "\n" unless /^NAME$/; + } + } + else + { + die "$this_program: can't open `$include' ($!)\n" if $include; + } +} + +# Turn off localisation of executable's ouput. +@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + +# Turn off localisation of date (for strftime) +setlocale LC_TIME, 'C'; + +# Grab help and version paragraphs from executable +my @help = split /\n\n+/, `$ARGV[0] --help 2>/dev/null` + or die "$this_program: can't get `--help' info from $ARGV[0]\n"; + +my @version = split /\n\n+/, `$ARGV[0] --version 2>/dev/null` + or die "$this_program: can't get `--version' info from $ARGV[0]\n"; + +my $date = strftime "%B %Y", localtime; +(my $program = $ARGV[0]) =~ s!.*/!!; +my $package = $program; +my $version; + +# Set the section to 1 by default. +my $section = 1; +$section = $opt_section if $opt_section; + +if ($opt_output) +{ + unlink $opt_output + or die "$this_program: can't unlink $opt_output ($!)\n" + if -e $opt_output; + + open STDOUT, ">$opt_output" + or die "$this_program: can't create $opt_output ($!)\n"; +} + +# The first line of the --version information is assumed to be in one +# of the following formats: +# +# +# +# {GNU,Free} +# ({GNU,Free} ) +# - {GNU,Free} +# +# and seperated from any copyright/author details by a blank line. + +$_ = shift @version; + +if (/^(\S+)\s+\(((?:GNU|Free)\s+[^)]+)\)\s+(.*)/ or + /^(\S+)\s+-\s*((?:GNU|Free)\s+\S+)\s+(.*)/) +{ + $program = $1; + $package = $2; + $version = $3; +} +elsif (/^((?:GNU|Free)\s+)?(\S+)\s+(.*)/) +{ + $program = $2; + $package = $1 ? "$1$2" : $2; + $version = $3; +} +else +{ + $version = $_; +} + +$program =~ s!.*/!!; + +# no info for `info' itself +$opt_no_info = 1 if $program eq 'info'; + +# --name overrides --include contents +$include{NAME} = "$program \\- $opt_name" if $opt_name; + +# Default (useless) NAME paragraph +$include{NAME} ||= "$program \\- manual page for $program $version"; + +# Man pages traditionally have the page title in caps. +my $PROGRAM = uc $program; + +# Header. +print < 0 and /^ {$ind}\S/) + { + s/^\s+//; + print "$_\n" if $_; + } + else + { + # use the words(s) before two or more spaces for the + # tag + s/^(\s+)//; + $ind = length $1; + + if (s/(\s\s+)/\n/) + { + $ind += (length $1) + index $_, "\n"; + } + else + { + $ind = 0; + } + + print ".TP\n$_\n" if $_; + } + } + # Anything else. + else + { + print ".PP\n" unless $ind < 0; + print "$_\n"; + $ind = -1; + } + } +} + +# Print any include items other than the ones we have already dealt +# with. +for (@include) +{ + print qq(.SH "$_"\n$include{$_}) + unless /^(NAME|SYNOPSIS|DESCRIPTION|SEE ALSO)$/; +} + +# Refer to the real documentation. +if ($include{'SEE ALSO'} or !$opt_no_info) +{ + print qq(.SH "SEE ALSO"\n); + print $include{'SEE ALSO'}, ".PP\n" if $include{'SEE ALSO'}; + + print < #include #include +#include #ifdef __linux__ # include /* ioctl */ # include /* HDIO_GETGEO */ /* FIXME: only include if libc doesn't have large file support. */ -# include # include /* _llseek */ +# include /* BLKFLSBUF */ #endif /* __linux__ */ /* Simulated memory sizes. */ @@ -223,10 +224,16 @@ grub_stage2 (void) } #endif + /* Make sure that actual writing is done. */ + sync (); + /* Set our stack, and go for it. */ simstack = (char *) PROTSTACKINIT; doit (); + /* I don't know if this is necessary really. */ + sync (); + #ifdef HAVE_LIBCURSES if (use_curses) endwin (); @@ -235,7 +242,14 @@ grub_stage2 (void) /* Close off the file descriptors we used. */ for (i = 0; i < NUM_DISKS; i ++) if (disks[i].flags != -1) - close (disks[i].flags); + { +#ifdef __linux__ + /* In Linux, invalidate the buffer cache. In other OSes, reboot + is one of the solutions... */ + ioctl (disks[i].flags, BLKFLSBUF, 0); +#endif + close (disks[i].flags); + } /* Release memory. */ for (i = 0; i < NUM_DISKS; i++) diff --git a/grub/main.c b/grub/main.c index 043c55b46..ef3d329b6 100644 --- a/grub/main.c +++ b/grub/main.c @@ -107,6 +107,12 @@ main (int argc, char **argv) { int c; int hold = 0; + + /* First of all, call sync so that all in-core data is scheduled to be + actually written to disks. This is very important because GRUB does + not use ordinary stdio interface but raw devices. */ + sync (); + program_name = argv[0]; default_boot_drive = boot_drive; default_install_partition = install_partition; diff --git a/shared_src/Makefile.in b/shared_src/Makefile.in index a4806c848..f30126b5b 100644 --- a/shared_src/Makefile.in +++ b/shared_src/Makefile.in @@ -70,7 +70,6 @@ VERSION = @VERSION@ host_cpu = @host_cpu@ host_vendor = @host_vendor@ install_sh = @install_sh@ -sbingrub = @sbingrub@ noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ diff --git a/stage1/Makefile.in b/stage1/Makefile.in index f0ac4f05c..669656803 100644 --- a/stage1/Makefile.in +++ b/stage1/Makefile.in @@ -68,7 +68,6 @@ VERSION = @VERSION@ host_cpu = @host_cpu@ host_vendor = @host_vendor@ install_sh = @install_sh@ -sbingrub = @sbingrub@ pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) diff --git a/stage2/Makefile.in b/stage2/Makefile.in index 4ecba7d7b..d0304e935 100644 --- a/stage2/Makefile.in +++ b/stage2/Makefile.in @@ -68,7 +68,6 @@ VERSION = @VERSION@ host_cpu = @host_cpu@ host_vendor = @host_vendor@ install_sh = @install_sh@ -sbingrub = @sbingrub@ pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)