2004-06-20  Yoshinori K. Okuji  <okuji@enbug.org>

	This is a big change on saving a default entry. This change
	makes it possible to set up a quite robust system using GRUB.
	Now we do not use the second sector of Stage 2 to store an
	entry number but use the file /boot/grub/default. This file
	must be generated by grub-set-default, although this file is
	plain-text.

	* util/grub-set-default.in: New file.

	* util/grub-install.in (grub_set_default): New variable.
	Use /grub instead of /boot/grub on OpenBSD as well as NetBSD.
	Run grub-set-default to make a default file.

	* util/Makefile.am (sbin_SCRIPTS): Added grub-set-default.

	* stage2/stage2.c (run_menu): Change the fallback handling to
	support multiple fallback entries.
	(cmain): Likewise. Also, get a saved entry from a default file
	if possible, before reading a config file.

	* stage2/shared.h (DEFAULT_FILE_BUF): New macro.
	(DEFAULT_FILE_BUFLEN): Likewise.
	(CMDLINE_BUF): Set to DEFAULT_FILE_BUF + DEFAULT_FILE_BUFLEN.
	(MENU_BUFLEN): Set to 0x8000 + PASSWORD_BUF - MENU_BUF.
	(fallback_entry): Removed.
	(fallback_entries): Declared.
	(fallback_entryno): Likewise.
	(MAX_FALLBACK_ENTRIES): New macro.

	* stage2/cmdline.c (run_script): Use FALLBACK_ENTRYNO instead of
	FALLBACK_ENTRY.

	* stage2/builtins.c (fallback_entry): Removed.
	(fallback_entryno): New variable.
	(fallback_entries): Likewise.
	(init_config): Initialize FALLBACK_ENTRYNO and FALLBACK_ENTRIES.
	(fallback_func): Rewritten completely.
	(savedefault_func): Likewise.

	* docs/grub.texi (grub-set-default): New direntry.
	(Installation): Describe grub-set-default for manual
	installations.
	(Making your system robust): New section.
	(Booting once-only): New subsection.
	(Booting fallback systems): Likewise.
	(fallback): Describe multiple fallback entries.
	(savedefault): Describe an optional argument.
	(Invoking grub-set-default): New chapter.
	(Future): Replaced with a description about GRUB 2.

	* configure.ac (AC_CONFIG_FILES): Added util/grub-set-default.
16 files changed