]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2005-02-27 Yoshinori K. Okuji <okuji@enbug.org>
authorokuji <okuji@localhost>
Sun, 27 Feb 2005 21:19:06 +0000 (21:19 +0000)
committerokuji <okuji@localhost>
Sun, 27 Feb 2005 21:19:06 +0000 (21:19 +0000)
  * commands/default.h: New file.
  * commands/timeout.h: Likewise.
  * normal/context.c: Likewise.

  * util/misc.c: Do not include sys/times.h.
  Include sys/time.h and grub/machine/time.h.
  (grub_get_rtc): Rewritten with gettimeofday.

  * util/grub-emu.c (main): Call grub_default_init and
  grub_timeout_init before grub_normal_init, and call
  grub_timeout_fini and grub_default_fini after grub_main.

  * util/console.c (grub_ncurses_checkkey): Return the read
  character or -1.

  * normal/menu.c (run_menu): Set MENU->TIMEOUT to -1 once it
  timeouts.

  * normal/main.c (read_config_file): Push MENU. If this fails,
  print an error and wait for a user input.
  Print an error only if GRUB_ERRNO is not GRUB_ERR_NONE.
  If a menu is empty or an error occurs, pop MENU.
  (grub_normal_execute): Pop and free MENU after grub_menu_run
  returns.

  * kern/loader.c (grub_loader_boot): Call grub_machine_fini.

  * include/grub/powerpc/ieee1275/time.h [GRUB_UTIL]: Do not
  include time.h.
  [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
  without GRUB_UTIL.
  * include/grub/i386/pc/time.h [GRUB_UTIL]: Do not include
  time.h.
  [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
  without GRUB_UTIL.

  * include/grub/normal.h (struct grub_menu_list): New struct.
  (grub_menu_list_t): New type.
  (struct grub_context): New struct.
  (grub_context_t): New type.
  (grub_register_command): Got rid of EXPORT_FUNC.
  (grub_unregister_command): Likewise.
  (grub_context_get): New prototype.
  (grub_context_get_current_menu): Likewise.
  (grub_context_push_menu): Likewise.
  (grub_context_pop_menu): Likewise.
  [GRUB_UTIL] (grub_default_init): Likewise.
  [GRUB_UTIL] (grub_default_fini): Likewise.
  [GRUB_UTIL] (grub_timeout_init): Likewise.
  [GRUB_UTIL] (grub_timeout_fini): Likewise.

  * conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/default.c,
  commands/timeout.c and normal/context.c.
  (pkgdata_MODULES): Added default.mod and timeout.mod.
  (normal_mod_SOURCES): Added normal/context.c.
  (default_mod_SOURCES): New variable.
  (default_mod_CFLAGS): Likewise.
  (timeout_mod_SOURCES): Likewise.
  (timeout_mod_CFLAGS): Likewise.
  * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Copied from
  conf/i386-pc.rmk.
  (pkgdata_MODULES): Added default.mod and timeout.mod.
  (normal_mod_SOURCES): Added normal/context.c.
  (default_mod_SOURCES): New variable.
  (default_mod_CFLAGS): Likewise.
  (timeout_mod_SOURCES): Likewise.
  (timeout_mod_CFLAGS): Likewise.

  * Makefile.in (all-local): Added $(MKFILES).

18 files changed:
ChangeLog
Makefile.in
commands/default.c [new file with mode: 0644]
commands/timeout.c [new file with mode: 0644]
conf/i386-pc.mk
conf/i386-pc.rmk
conf/powerpc-ieee1275.mk
conf/powerpc-ieee1275.rmk
include/grub/i386/pc/time.h
include/grub/normal.h
include/grub/powerpc/ieee1275/time.h
kern/loader.c
normal/context.c [new file with mode: 0644]
normal/main.c
normal/menu.c
util/console.c
util/grub-emu.c
util/misc.c

index b43ec904aca17deee48b7e227323392791eb46db..940056b79c5d8c9d4d45d57071c856c1e959aaaf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,75 @@
+2005-02-27  Yoshinori K. Okuji  <okuji@enbug.org>
+
+       * commands/default.h: New file.
+       * commands/timeout.h: Likewise.
+       * normal/context.c: Likewise.
+       
+       * util/misc.c: Do not include sys/times.h.
+       Include sys/time.h and grub/machine/time.h.
+       (grub_get_rtc): Rewritten with gettimeofday.
+
+       * util/grub-emu.c (main): Call grub_default_init and
+       grub_timeout_init before grub_normal_init, and call
+       grub_timeout_fini and grub_default_fini after grub_main.
+
+       * util/console.c (grub_ncurses_checkkey): Return the read
+       character or -1.
+
+       * normal/menu.c (run_menu): Set MENU->TIMEOUT to -1 once it
+       timeouts.
+
+       * normal/main.c (read_config_file): Push MENU. If this fails,
+       print an error and wait for a user input.
+       Print an error only if GRUB_ERRNO is not GRUB_ERR_NONE.
+       If a menu is empty or an error occurs, pop MENU.
+       (grub_normal_execute): Pop and free MENU after grub_menu_run
+       returns.
+
+       * kern/loader.c (grub_loader_boot): Call grub_machine_fini.
+
+       * include/grub/powerpc/ieee1275/time.h [GRUB_UTIL]: Do not
+       include time.h.
+       [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
+       without GRUB_UTIL.
+       * include/grub/i386/pc/time.h [GRUB_UTIL]: Do not include
+       time.h.
+       [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
+       without GRUB_UTIL.
+
+       * include/grub/normal.h (struct grub_menu_list): New struct.
+       (grub_menu_list_t): New type.
+       (struct grub_context): New struct.
+       (grub_context_t): New type.
+       (grub_register_command): Got rid of EXPORT_FUNC.
+       (grub_unregister_command): Likewise.
+       (grub_context_get): New prototype.
+       (grub_context_get_current_menu): Likewise.
+       (grub_context_push_menu): Likewise.
+       (grub_context_pop_menu): Likewise.
+       [GRUB_UTIL] (grub_default_init): Likewise.
+       [GRUB_UTIL] (grub_default_fini): Likewise.
+       [GRUB_UTIL] (grub_timeout_init): Likewise.
+       [GRUB_UTIL] (grub_timeout_fini): Likewise.
+
+       * conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/default.c,
+       commands/timeout.c and normal/context.c.
+       (pkgdata_MODULES): Added default.mod and timeout.mod.
+       (normal_mod_SOURCES): Added normal/context.c.
+       (default_mod_SOURCES): New variable.
+       (default_mod_CFLAGS): Likewise.
+       (timeout_mod_SOURCES): Likewise.
+       (timeout_mod_CFLAGS): Likewise.
+       * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Copied from
+       conf/i386-pc.rmk.
+       (pkgdata_MODULES): Added default.mod and timeout.mod.
+       (normal_mod_SOURCES): Added normal/context.c.
+       (default_mod_SOURCES): New variable.
+       (default_mod_CFLAGS): Likewise.
+       (timeout_mod_SOURCES): Likewise.
+       (timeout_mod_CFLAGS): Likewise.
+
+       * Makefile.in (all-local): Added $(MKFILES).
+
 2005-02-21  Vincent Pelletier  <subdino2004@yahoo.fr>
 
        * conf/i386-pc.rmk (grub_setup_SOURCES): Add `partmap/sun.c'.
index d095672c5677a4c8b3c2443b81c2a40ad18f68d3..b552502810b6e25cdebdaea25817d77fdd9fb6fa 100644 (file)
@@ -1,6 +1,6 @@
 # -*- makefile -*-
 #
-# Copyright (C) 1994,95,96,97,98,99,2000,01,02,04 Free Software Foundation, Inc.
+# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005 Free Software Foundation, Inc.
 #
 # This Makefile.in is free software; the author
 # gives unlimited permission to copy and/or distribute it,
@@ -138,7 +138,7 @@ include $(srcdir)/conf/$(host_cpu)-$(host_vendor).mk
 
 ### General targets.
 
-all-local: $(PROGRAMS) $(DATA) $(SCRIPTS)
+all-local: $(PROGRAMS) $(DATA) $(SCRIPTS) $(MKFILES)
 
 install: install-local
 
diff --git a/commands/default.c b/commands/default.c
new file mode 100644 (file)
index 0000000..880a0a8
--- /dev/null
@@ -0,0 +1,72 @@
+/* default.c - set the default boot entry */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/arg.h>
+#include <grub/misc.h>
+#include <grub/normal.h>
+#include <grub/err.h>
+#include <grub/dl.h>
+
+/* This is a simple version. This should support a saved boot entry,
+   a label, etc.  */
+static grub_err_t
+grub_cmd_default (struct grub_arg_list *state __attribute__ ((unused)),
+                 int argc, char **args)
+{
+  grub_menu_t menu;
+  
+  if (argc != 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "entry number required");
+
+  menu = grub_context_get_current_menu ();
+  if (menu)
+    menu->default_entry = grub_strtoul (args[0], 0, 0);
+
+  return grub_errno;
+}
+
+\f
+
+#ifdef GRUB_UTIL
+void
+grub_default_init (void)
+{
+  grub_register_command ("default", grub_cmd_default, GRUB_COMMAND_FLAG_MENU,
+                        "default ENTRY", "Set the default entry", 0);
+}
+
+void
+grub_default_fini (void)
+{
+  grub_unregister_command ("default");
+}
+#else /* ! GRUB_UTIL */
+GRUB_MOD_INIT
+{
+  (void)mod;                   /* To stop warning. */
+  grub_register_command ("default", grub_cmd_default, GRUB_COMMAND_FLAG_MENU,
+                        "default ENTRY", "Set the default entry", 0);
+}
+
+GRUB_MOD_FINI
+{
+  grub_unregister_command ("default");
+}
+#endif /* ! GRUB_UTIL */
diff --git a/commands/timeout.c b/commands/timeout.c
new file mode 100644 (file)
index 0000000..6f80cb3
--- /dev/null
@@ -0,0 +1,70 @@
+/* timeout.c - set the timeout */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/arg.h>
+#include <grub/misc.h>
+#include <grub/normal.h>
+#include <grub/err.h>
+#include <grub/dl.h>
+
+static grub_err_t
+grub_cmd_timeout (struct grub_arg_list *state __attribute__ ((unused)),
+                 int argc, char **args)
+{
+  grub_menu_t menu;
+  
+  if (argc != 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "timeout value required");
+
+  menu = grub_context_get_current_menu ();
+  if (menu)
+    menu->timeout = grub_strtoul (args[0], 0, 0);
+
+  return grub_errno;
+}
+
+\f
+
+#ifdef GRUB_UTIL
+void
+grub_timeout_init (void)
+{
+  grub_register_command ("timeout", grub_cmd_timeout, GRUB_COMMAND_FLAG_MENU,
+                        "timeout SECS", "Set the timeout", 0);
+}
+
+void
+grub_timeout_fini (void)
+{
+  grub_unregister_command ("timeout");
+}
+#else /* ! GRUB_UTIL */
+GRUB_MOD_INIT
+{
+  (void)mod;                   /* To stop warning. */
+  grub_register_command ("timeout", grub_cmd_timeout, GRUB_COMMAND_FLAG_MENU,
+                        "timeout SECS", "Set the timeout", 0);
+}
+
+GRUB_MOD_FINI
+{
+  grub_unregister_command ("timeout");
+}
+#endif /* ! GRUB_UTIL */
index 3fc3102f3322d7e20baa604124fc82f0fd2a8e90..3c449199b04369513b4a8aef183297587358130c 100644 (file)
@@ -504,9 +504,10 @@ grub_setup-fs_fshelp.d: fs/fshelp.c
 -include grub_setup-fs_fshelp.d
 
 
-# For grub
+# For grub_emu.
 grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c       \
-       commands/help.c commands/terminal.c commands/ls.c               \
+       commands/default.c commands/help.c commands/terminal.c          \
+       commands/ls.c commands/timeout.c                                \
        commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
        disk/loopback.c                                                 \
        fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
@@ -514,16 +515,16 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c  \
        kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c       \
        kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c     \
        kern/partition.c kern/rescue.c kern/term.c                      \
-       normal/arg.c normal/cmdline.c normal/command.c normal/main.c    \
-       normal/menu.c normal/menu_entry.c                               \
+       normal/arg.c normal/cmdline.c normal/command.c normal/context.c \
+       normal/main.c normal/menu.c normal/menu_entry.c                 \
        partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c      \
        util/console.c util/grub-emu.c util/misc.c                      \
        util/i386/pc/biosdisk.c util/i386/pc/getroot.c                  \
        util/i386/pc/misc.c
-CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
-MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d
+CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
+MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d
 
-grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
+grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
        $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
 
 grub_emu-commands_boot.o: commands/boot.c
@@ -550,6 +551,14 @@ grub_emu-commands_cmp.d: commands/cmp.c
 
 -include grub_emu-commands_cmp.d
 
+grub_emu-commands_default.o: commands/default.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-commands_default.d: commands/default.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,default\.o[ :]*,grub_emu-commands_default.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+
+-include grub_emu-commands_default.d
+
 grub_emu-commands_help.o: commands/help.c
        $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
@@ -574,6 +583,14 @@ grub_emu-commands_ls.d: commands/ls.c
 
 -include grub_emu-commands_ls.d
 
+grub_emu-commands_timeout.o: commands/timeout.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-commands_timeout.d: commands/timeout.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,timeout\.o[ :]*,grub_emu-commands_timeout.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+
+-include grub_emu-commands_timeout.d
+
 grub_emu-commands_i386_pc_halt.o: commands/i386/pc/halt.c
        $(BUILD_CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
@@ -790,6 +807,14 @@ grub_emu-normal_command.d: normal/command.c
 
 -include grub_emu-normal_command.d
 
+grub_emu-normal_context.o: normal/context.c
+       $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-normal_context.d: normal/context.c
+       set -e;           $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,context\.o[ :]*,grub_emu-normal_context.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+
+-include grub_emu-normal_context.d
+
 grub_emu-normal_main.o: normal/main.c
        $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
@@ -915,10 +940,12 @@ genmoddep-util_genmoddep.d: util/genmoddep.c
 
 
 # Modules.
-pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
-       hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
-       boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod \
-       amiga.mod apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod help.mod
+pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod      \
+       ext2.mod minix.mod hfs.mod jfs.mod normal.mod hello.mod vga.mod \
+       font.mod _multiboot.mod ls.mod boot.mod cmp.mod cat.mod         \
+       terminal.mod fshelp.mod chain.mod multiboot.mod amiga.mod       \
+       apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod       \
+       help.mod default.mod timeout.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -1355,10 +1382,10 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
 
 # For normal.mod.
 normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c    \
-       normal/main.c normal/menu.c normal/menu_entry.c                 \
-       normal/i386/setjmp.S
-CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_i386_setjmp.o def-normal.lst und-normal.lst
-MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_i386_setjmp.d
+       normal/context.c normal/main.c normal/menu.c                    \
+       normal/menu_entry.c normal/i386/setjmp.S
+CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_context.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_i386_setjmp.o def-normal.lst und-normal.lst
+MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_context.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_i386_setjmp.d
 DEFSYMFILES += def-normal.lst
 UNDSYMFILES += und-normal.lst
 
@@ -1367,7 +1394,7 @@ normal.mod: pre-normal.o mod-normal.o
        $(LD) -r -d -o $@ $^
        $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
 
-pre-normal.o: normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_i386_setjmp.o
+pre-normal.o: normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_context.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_i386_setjmp.o
        -rm -f $@
        $(LD) -r -d -o $@ $^
 
@@ -1408,6 +1435,14 @@ normal_mod-normal_command.d: normal/command.c
 
 -include normal_mod-normal_command.d
 
+normal_mod-normal_context.o: normal/context.c
+       $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_context.d: normal/context.c
+       set -e;           $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $<      | sed 's,context\.o[ :]*,normal_mod-normal_context.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_context.d
+
 normal_mod-normal_main.o: normal/main.c
        $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
 
@@ -2144,6 +2179,84 @@ loopback_mod-disk_loopback.d: disk/loopback.c
 -include loopback_mod-disk_loopback.d
 
 loopback_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For default.mod
+default_mod_SOURCES = commands/default.c
+CLEANFILES += default.mod mod-default.o mod-default.c pre-default.o default_mod-commands_default.o def-default.lst und-default.lst
+MOSTLYCLEANFILES += default_mod-commands_default.d
+DEFSYMFILES += def-default.lst
+UNDSYMFILES += und-default.lst
+
+default.mod: pre-default.o mod-default.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-default.o: default_mod-commands_default.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-default.o: mod-default.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(default_mod_CFLAGS) -c -o $@ $<
+
+mod-default.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'default' $< > $@ || (rm -f $@; exit 1)
+
+def-default.lst: pre-default.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 default/' > $@
+
+und-default.lst: pre-default.o
+       echo 'default' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+default_mod-commands_default.o: commands/default.c
+       $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(default_mod_CFLAGS) -c -o $@ $<
+
+default_mod-commands_default.d: commands/default.c
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(default_mod_CFLAGS) -M $<         | sed 's,default\.o[ :]*,default_mod-commands_default.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
+
+-include default_mod-commands_default.d
+
+default_mod_CFLAGS =  $(COMMON_CFLAGS)
+
+# For timeout.mod
+timeout_mod_SOURCES = commands/timeout.c
+CLEANFILES += timeout.mod mod-timeout.o mod-timeout.c pre-timeout.o timeout_mod-commands_timeout.o def-timeout.lst und-timeout.lst
+MOSTLYCLEANFILES += timeout_mod-commands_timeout.d
+DEFSYMFILES += def-timeout.lst
+UNDSYMFILES += und-timeout.lst
+
+timeout.mod: pre-timeout.o mod-timeout.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-timeout.o: timeout_mod-commands_timeout.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-timeout.o: mod-timeout.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(timeout_mod_CFLAGS) -c -o $@ $<
+
+mod-timeout.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'timeout' $< > $@ || (rm -f $@; exit 1)
+
+def-timeout.lst: pre-timeout.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 timeout/' > $@
+
+und-timeout.lst: pre-timeout.o
+       echo 'timeout' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+timeout_mod-commands_timeout.o: commands/timeout.c
+       $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(timeout_mod_CFLAGS) -c -o $@ $<
+
+timeout_mod-commands_timeout.d: commands/timeout.c
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(timeout_mod_CFLAGS) -M $<         | sed 's,timeout\.o[ :]*,timeout_mod-commands_timeout.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
+
+-include timeout_mod-commands_timeout.d
+
+timeout_mod_CFLAGS =  $(COMMON_CFLAGS)
 CLEANFILES += moddep.lst
 pkgdata_DATA += moddep.lst
 moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
index 03d5c4956508b88064c80e93f54246cc63d17c3b..db4d5402aaa08a95efc75b7dffcc9ee5ee844a47 100644 (file)
@@ -64,9 +64,10 @@ grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
        kern/partition.c partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
        fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c
 
-# For grub
+# For grub_emu.
 grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c       \
-       commands/help.c commands/terminal.c commands/ls.c               \
+       commands/default.c commands/help.c commands/terminal.c          \
+       commands/ls.c commands/timeout.c                                \
        commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
        disk/loopback.c                                                 \
        fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
@@ -74,8 +75,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c      \
        kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c       \
        kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c     \
        kern/partition.c kern/rescue.c kern/term.c                      \
-       normal/arg.c normal/cmdline.c normal/command.c normal/main.c    \
-       normal/menu.c normal/menu_entry.c                               \
+       normal/arg.c normal/cmdline.c normal/command.c normal/context.c \
+       normal/main.c normal/menu.c normal/menu_entry.c                 \
        partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c      \
        util/console.c util/grub-emu.c util/misc.c                      \
        util/i386/pc/biosdisk.c util/i386/pc/getroot.c                  \
@@ -87,10 +88,12 @@ grub_emu_LDFLAGS = -lncurses
 genmoddep_SOURCES = util/genmoddep.c
 
 # Modules.
-pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
-       hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
-       boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod \
-       amiga.mod apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod help.mod
+pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod      \
+       ext2.mod minix.mod hfs.mod jfs.mod normal.mod hello.mod vga.mod \
+       font.mod _multiboot.mod ls.mod boot.mod cmp.mod cat.mod         \
+       terminal.mod fshelp.mod chain.mod multiboot.mod amiga.mod       \
+       apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod       \
+       help.mod default.mod timeout.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -142,8 +145,8 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
 
 # For normal.mod.
 normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c    \
-       normal/main.c normal/menu.c normal/menu_entry.c                 \
-       normal/i386/setjmp.S
+       normal/context.c normal/main.c normal/menu.c                    \
+       normal/menu_entry.c normal/i386/setjmp.S
 normal_mod_CFLAGS = $(COMMON_CFLAGS)
 normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
 
@@ -218,3 +221,11 @@ sun_mod_CFLAGS = $(COMMON_CFLAGS)
 # For loopback.mod
 loopback_mod_SOURCES = disk/loopback.c
 loopback_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For default.mod
+default_mod_SOURCES = commands/default.c
+default_mod_CFLAGS =  $(COMMON_CFLAGS)
+
+# For timeout.mod
+timeout_mod_SOURCES = commands/timeout.c
+timeout_mod_CFLAGS =  $(COMMON_CFLAGS)
index 8edf2b8b950c2035b440ea5e181332be5feec152..bedbd5b496679db1ce4b29cd9533e91784f80ab5 100644 (file)
@@ -62,134 +62,131 @@ grub_mkimage-util_resolve.d: util/resolve.c
 
 
 # For grub-emu
-grub_emu_SOURCES = kern/main.c kern/device.c                           \
-       kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c          \
-        kern/misc.c kern/loader.c kern/rescue.c kern/term.c            \
-       partmap/amiga.c partmap/pc.c partmap/apple.c fs/fshelp.c        \
-       util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \
-       fs/jfs.c fs/iso9660.c partmap/sun.c \
-       normal/cmdline.c normal/command.c normal/main.c normal/menu.c   \
-       normal/menu_entry.c normal/arg.c kern/partition.c       \
-       util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c \
-       kern/env.c disk/loopback.c commands/ls.c commands/help.c        \
-       commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c
-CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-partmap_sun.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_arg.o grub_emu-kern_partition.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-disk_loopback.o grub_emu-commands_ls.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
-MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-partmap_amiga.d grub_emu-partmap_pc.d grub_emu-partmap_apple.d grub_emu-fs_fshelp.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-partmap_sun.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_arg.d grub_emu-kern_partition.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d grub_emu-kern_env.d grub_emu-disk_loopback.d grub_emu-commands_ls.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d
-
-grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-partmap_sun.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_arg.o grub_emu-kern_partition.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-disk_loopback.o grub_emu-commands_ls.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
+grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c       \
+       commands/default.c commands/help.c commands/terminal.c          \
+       commands/ls.c commands/timeout.c                                \
+       commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
+       disk/loopback.c                                                 \
+       fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
+       fs/minix.c fs/ufs.c                                             \
+       kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c       \
+       kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c     \
+       kern/partition.c kern/rescue.c kern/term.c                      \
+       normal/arg.c normal/cmdline.c normal/command.c normal/context.c \
+       normal/main.c normal/menu.c normal/menu_entry.c                 \
+       partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c      \
+       util/console.c util/grub-emu.c util/misc.c                      \
+       util/i386/pc/biosdisk.c util/i386/pc/getroot.c                  \
+       util/i386/pc/misc.c
+CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
+MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d
+
+grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
        $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
 
-grub_emu-kern_main.o: kern/main.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
-
-grub_emu-kern_main.d: kern/main.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,main\.o[ :]*,grub_emu-kern_main.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
-
--include grub_emu-kern_main.d
-
-grub_emu-kern_device.o: kern/device.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_boot.o: commands/boot.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_device.d: kern/device.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,device\.o[ :]*,grub_emu-kern_device.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-commands_boot.d: commands/boot.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,boot\.o[ :]*,grub_emu-commands_boot.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_device.d
+-include grub_emu-commands_boot.d
 
-grub_emu-kern_disk.o: kern/disk.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_cat.o: commands/cat.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_disk.d: kern/disk.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,disk\.o[ :]*,grub_emu-kern_disk.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+grub_emu-commands_cat.d: commands/cat.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,cat\.o[ :]*,grub_emu-commands_cat.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_disk.d
+-include grub_emu-commands_cat.d
 
-grub_emu-kern_dl.o: kern/dl.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_cmp.o: commands/cmp.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_dl.d: kern/dl.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,dl\.o[ :]*,grub_emu-kern_dl.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-commands_cmp.d: commands/cmp.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,cmp\.o[ :]*,grub_emu-commands_cmp.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_dl.d
+-include grub_emu-commands_cmp.d
 
-grub_emu-kern_file.o: kern/file.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_default.o: commands/default.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_file.d: kern/file.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,file\.o[ :]*,grub_emu-kern_file.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+grub_emu-commands_default.d: commands/default.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,default\.o[ :]*,grub_emu-commands_default.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_file.d
+-include grub_emu-commands_default.d
 
-grub_emu-kern_fs.o: kern/fs.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_help.o: commands/help.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_fs.d: kern/fs.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,fs\.o[ :]*,grub_emu-kern_fs.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-commands_help.d: commands/help.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,help\.o[ :]*,grub_emu-commands_help.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_fs.d
+-include grub_emu-commands_help.d
 
-grub_emu-kern_err.o: kern/err.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_terminal.o: commands/terminal.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_err.d: kern/err.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,err\.o[ :]*,grub_emu-kern_err.o $@ : ,g' > $@;         [ -s $@ ] || rm -f $@
+grub_emu-commands_terminal.d: commands/terminal.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,terminal\.o[ :]*,grub_emu-commands_terminal.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_err.d
+-include grub_emu-commands_terminal.d
 
-grub_emu-kern_misc.o: kern/misc.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_ls.o: commands/ls.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_misc.d: kern/misc.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,misc\.o[ :]*,grub_emu-kern_misc.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+grub_emu-commands_ls.d: commands/ls.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,ls\.o[ :]*,grub_emu-commands_ls.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_misc.d
+-include grub_emu-commands_ls.d
 
-grub_emu-kern_loader.o: kern/loader.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_timeout.o: commands/timeout.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_loader.d: kern/loader.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,loader\.o[ :]*,grub_emu-kern_loader.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-commands_timeout.d: commands/timeout.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,timeout\.o[ :]*,grub_emu-commands_timeout.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_loader.d
+-include grub_emu-commands_timeout.d
 
-grub_emu-kern_rescue.o: kern/rescue.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_i386_pc_halt.o: commands/i386/pc/halt.c
+       $(BUILD_CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_rescue.d: kern/rescue.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,rescue\.o[ :]*,grub_emu-kern_rescue.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-commands_i386_pc_halt.d: commands/i386/pc/halt.c
+       set -e;           $(BUILD_CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,halt\.o[ :]*,grub_emu-commands_i386_pc_halt.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_rescue.d
+-include grub_emu-commands_i386_pc_halt.d
 
-grub_emu-kern_term.o: kern/term.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_i386_pc_reboot.o: commands/i386/pc/reboot.c
+       $(BUILD_CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_term.d: kern/term.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,term\.o[ :]*,grub_emu-kern_term.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+grub_emu-commands_i386_pc_reboot.d: commands/i386/pc/reboot.c
+       set -e;           $(BUILD_CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,reboot\.o[ :]*,grub_emu-commands_i386_pc_reboot.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_term.d
+-include grub_emu-commands_i386_pc_reboot.d
 
-grub_emu-partmap_amiga.o: partmap/amiga.c
-       $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-disk_loopback.o: disk/loopback.c
+       $(BUILD_CC) -Idisk -I$(srcdir)/disk $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-partmap_amiga.d: partmap/amiga.c
-       set -e;           $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<      | sed 's,amiga\.o[ :]*,grub_emu-partmap_amiga.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
+grub_emu-disk_loopback.d: disk/loopback.c
+       set -e;           $(BUILD_CC) -Idisk -I$(srcdir)/disk $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,loopback\.o[ :]*,grub_emu-disk_loopback.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
 
--include grub_emu-partmap_amiga.d
+-include grub_emu-disk_loopback.d
 
-grub_emu-partmap_pc.o: partmap/pc.c
-       $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-fs_ext2.o: fs/ext2.c
+       $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-partmap_pc.d: partmap/pc.c
-       set -e;           $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<      | sed 's,pc\.o[ :]*,grub_emu-partmap_pc.o $@ : ,g' > $@;        [ -s $@ ] || rm -f $@
+grub_emu-fs_ext2.d: fs/ext2.c
+       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,ext2\.o[ :]*,grub_emu-fs_ext2.o $@ : ,g' > $@;         [ -s $@ ] || rm -f $@
 
--include grub_emu-partmap_pc.d
+-include grub_emu-fs_ext2.d
 
-grub_emu-partmap_apple.o: partmap/apple.c
-       $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-fs_fat.o: fs/fat.c
+       $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-partmap_apple.d: partmap/apple.c
-       set -e;           $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<      | sed 's,apple\.o[ :]*,grub_emu-partmap_apple.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
+grub_emu-fs_fat.d: fs/fat.c
+       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,fat\.o[ :]*,grub_emu-fs_fat.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-partmap_apple.d
+-include grub_emu-fs_fat.d
 
 grub_emu-fs_fshelp.o: fs/fshelp.c
        $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
@@ -199,29 +196,37 @@ grub_emu-fs_fshelp.d: fs/fshelp.c
 
 -include grub_emu-fs_fshelp.d
 
-grub_emu-util_i386_pc_biosdisk.o: util/i386/pc/biosdisk.c
-       $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-fs_hfs.o: fs/hfs.c
+       $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-util_i386_pc_biosdisk.d: util/i386/pc/biosdisk.c
-       set -e;           $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,biosdisk\.o[ :]*,grub_emu-util_i386_pc_biosdisk.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+grub_emu-fs_hfs.d: fs/hfs.c
+       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,hfs\.o[ :]*,grub_emu-fs_hfs.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-util_i386_pc_biosdisk.d
+-include grub_emu-fs_hfs.d
 
-grub_emu-fs_fat.o: fs/fat.c
+grub_emu-fs_iso9660.o: fs/iso9660.c
        $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-fs_fat.d: fs/fat.c
-       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,fat\.o[ :]*,grub_emu-fs_fat.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-fs_iso9660.d: fs/iso9660.c
+       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,iso9660\.o[ :]*,grub_emu-fs_iso9660.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-fs_fat.d
+-include grub_emu-fs_iso9660.d
 
-grub_emu-fs_ext2.o: fs/ext2.c
+grub_emu-fs_jfs.o: fs/jfs.c
        $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-fs_ext2.d: fs/ext2.c
-       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,ext2\.o[ :]*,grub_emu-fs_ext2.o $@ : ,g' > $@;         [ -s $@ ] || rm -f $@
+grub_emu-fs_jfs.d: fs/jfs.c
+       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,jfs\.o[ :]*,grub_emu-fs_jfs.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-fs_ext2.d
+-include grub_emu-fs_jfs.d
+
+grub_emu-fs_minix.o: fs/minix.c
+       $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-fs_minix.d: fs/minix.c
+       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,minix\.o[ :]*,grub_emu-fs_minix.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+
+-include grub_emu-fs_minix.d
 
 grub_emu-fs_ufs.o: fs/ufs.c
        $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
@@ -231,45 +236,117 @@ grub_emu-fs_ufs.d: fs/ufs.c
 
 -include grub_emu-fs_ufs.d
 
-grub_emu-fs_minix.o: fs/minix.c
-       $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-kern_device.o: kern/device.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-fs_minix.d: fs/minix.c
-       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,minix\.o[ :]*,grub_emu-fs_minix.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+grub_emu-kern_device.d: kern/device.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,device\.o[ :]*,grub_emu-kern_device.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-fs_minix.d
+-include grub_emu-kern_device.d
 
-grub_emu-fs_hfs.o: fs/hfs.c
-       $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-kern_disk.o: kern/disk.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-fs_hfs.d: fs/hfs.c
-       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,hfs\.o[ :]*,grub_emu-fs_hfs.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-kern_disk.d: kern/disk.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,disk\.o[ :]*,grub_emu-kern_disk.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
 
--include grub_emu-fs_hfs.d
+-include grub_emu-kern_disk.d
 
-grub_emu-fs_jfs.o: fs/jfs.c
-       $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-kern_dl.o: kern/dl.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-fs_jfs.d: fs/jfs.c
-       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,jfs\.o[ :]*,grub_emu-fs_jfs.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-kern_dl.d: kern/dl.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,dl\.o[ :]*,grub_emu-kern_dl.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
 
--include grub_emu-fs_jfs.d
+-include grub_emu-kern_dl.d
 
-grub_emu-fs_iso9660.o: fs/iso9660.c
-       $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-kern_env.o: kern/env.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-fs_iso9660.d: fs/iso9660.c
-       set -e;           $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,iso9660\.o[ :]*,grub_emu-fs_iso9660.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-kern_env.d: kern/env.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,env\.o[ :]*,grub_emu-kern_env.o $@ : ,g' > $@;         [ -s $@ ] || rm -f $@
 
--include grub_emu-fs_iso9660.d
+-include grub_emu-kern_env.d
 
-grub_emu-partmap_sun.o: partmap/sun.c
-       $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-kern_err.o: kern/err.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-partmap_sun.d: partmap/sun.c
-       set -e;           $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<      | sed 's,sun\.o[ :]*,grub_emu-partmap_sun.o $@ : ,g' > $@;      [ -s $@ ] || rm -f $@
+grub_emu-kern_err.d: kern/err.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,err\.o[ :]*,grub_emu-kern_err.o $@ : ,g' > $@;         [ -s $@ ] || rm -f $@
 
--include grub_emu-partmap_sun.d
+-include grub_emu-kern_err.d
+
+grub_emu-kern_file.o: kern/file.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-kern_file.d: kern/file.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,file\.o[ :]*,grub_emu-kern_file.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+
+-include grub_emu-kern_file.d
+
+grub_emu-kern_fs.o: kern/fs.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-kern_fs.d: kern/fs.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,fs\.o[ :]*,grub_emu-kern_fs.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+
+-include grub_emu-kern_fs.d
+
+grub_emu-kern_loader.o: kern/loader.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-kern_loader.d: kern/loader.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,loader\.o[ :]*,grub_emu-kern_loader.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+
+-include grub_emu-kern_loader.d
+
+grub_emu-kern_main.o: kern/main.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-kern_main.d: kern/main.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,main\.o[ :]*,grub_emu-kern_main.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+
+-include grub_emu-kern_main.d
+
+grub_emu-kern_misc.o: kern/misc.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-kern_misc.d: kern/misc.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,misc\.o[ :]*,grub_emu-kern_misc.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+
+-include grub_emu-kern_misc.d
+
+grub_emu-kern_partition.o: kern/partition.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-kern_partition.d: kern/partition.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,partition\.o[ :]*,grub_emu-kern_partition.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+
+-include grub_emu-kern_partition.d
+
+grub_emu-kern_rescue.o: kern/rescue.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-kern_rescue.d: kern/rescue.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,rescue\.o[ :]*,grub_emu-kern_rescue.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+
+-include grub_emu-kern_rescue.d
+
+grub_emu-kern_term.o: kern/term.c
+       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-kern_term.d: kern/term.c
+       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,term\.o[ :]*,grub_emu-kern_term.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+
+-include grub_emu-kern_term.d
+
+grub_emu-normal_arg.o: normal/arg.c
+       $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-normal_arg.d: normal/arg.c
+       set -e;           $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,arg\.o[ :]*,grub_emu-normal_arg.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+
+-include grub_emu-normal_arg.d
 
 grub_emu-normal_cmdline.o: normal/cmdline.c
        $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
@@ -287,6 +364,14 @@ grub_emu-normal_command.d: normal/command.c
 
 -include grub_emu-normal_command.d
 
+grub_emu-normal_context.o: normal/context.c
+       $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-normal_context.d: normal/context.c
+       set -e;           $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,context\.o[ :]*,grub_emu-normal_context.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+
+-include grub_emu-normal_context.d
+
 grub_emu-normal_main.o: normal/main.c
        $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
@@ -311,21 +396,37 @@ grub_emu-normal_menu_entry.d: normal/menu_entry.c
 
 -include grub_emu-normal_menu_entry.d
 
-grub_emu-normal_arg.o: normal/arg.c
-       $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-partmap_amiga.o: partmap/amiga.c
+       $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-normal_arg.d: normal/arg.c
-       set -e;           $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<        | sed 's,arg\.o[ :]*,grub_emu-normal_arg.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+grub_emu-partmap_amiga.d: partmap/amiga.c
+       set -e;           $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<      | sed 's,amiga\.o[ :]*,grub_emu-partmap_amiga.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
 
--include grub_emu-normal_arg.d
+-include grub_emu-partmap_amiga.d
 
-grub_emu-kern_partition.o: kern/partition.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-partmap_apple.o: partmap/apple.c
+       $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-kern_partition.d: kern/partition.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,partition\.o[ :]*,grub_emu-kern_partition.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+grub_emu-partmap_apple.d: partmap/apple.c
+       set -e;           $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<      | sed 's,apple\.o[ :]*,grub_emu-partmap_apple.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
 
--include grub_emu-kern_partition.d
+-include grub_emu-partmap_apple.d
+
+grub_emu-partmap_pc.o: partmap/pc.c
+       $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-partmap_pc.d: partmap/pc.c
+       set -e;           $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<      | sed 's,pc\.o[ :]*,grub_emu-partmap_pc.o $@ : ,g' > $@;        [ -s $@ ] || rm -f $@
+
+-include grub_emu-partmap_pc.d
+
+grub_emu-partmap_sun.o: partmap/sun.c
+       $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-partmap_sun.d: partmap/sun.c
+       set -e;           $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<      | sed 's,sun\.o[ :]*,grub_emu-partmap_sun.o $@ : ,g' > $@;      [ -s $@ ] || rm -f $@
+
+-include grub_emu-partmap_sun.d
 
 grub_emu-util_console.o: util/console.c
        $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
@@ -351,6 +452,14 @@ grub_emu-util_misc.d: util/misc.c
 
 -include grub_emu-util_misc.d
 
+grub_emu-util_i386_pc_biosdisk.o: util/i386/pc/biosdisk.c
+       $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-util_i386_pc_biosdisk.d: util/i386/pc/biosdisk.c
+       set -e;           $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,biosdisk\.o[ :]*,grub_emu-util_i386_pc_biosdisk.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+
+-include grub_emu-util_i386_pc_biosdisk.d
+
 grub_emu-util_i386_pc_getroot.o: util/i386/pc/getroot.c
        $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
@@ -359,69 +468,14 @@ grub_emu-util_i386_pc_getroot.d: util/i386/pc/getroot.c
 
 -include grub_emu-util_i386_pc_getroot.d
 
-grub_emu-kern_env.o: kern/env.c
-       $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
-
-grub_emu-kern_env.d: kern/env.c
-       set -e;           $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,env\.o[ :]*,grub_emu-kern_env.o $@ : ,g' > $@;         [ -s $@ ] || rm -f $@
-
--include grub_emu-kern_env.d
-
-grub_emu-disk_loopback.o: disk/loopback.c
-       $(BUILD_CC) -Idisk -I$(srcdir)/disk $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
-
-grub_emu-disk_loopback.d: disk/loopback.c
-       set -e;           $(BUILD_CC) -Idisk -I$(srcdir)/disk $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,loopback\.o[ :]*,grub_emu-disk_loopback.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
-
--include grub_emu-disk_loopback.d
-
-grub_emu-commands_ls.o: commands/ls.c
-       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
-
-grub_emu-commands_ls.d: commands/ls.c
-       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,ls\.o[ :]*,grub_emu-commands_ls.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
-
--include grub_emu-commands_ls.d
-
-grub_emu-commands_help.o: commands/help.c
-       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
-
-grub_emu-commands_help.d: commands/help.c
-       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,help\.o[ :]*,grub_emu-commands_help.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
-
--include grub_emu-commands_help.d
-
-grub_emu-commands_terminal.o: commands/terminal.c
-       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
-
-grub_emu-commands_terminal.d: commands/terminal.c
-       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,terminal\.o[ :]*,grub_emu-commands_terminal.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
-
--include grub_emu-commands_terminal.d
-
-grub_emu-commands_boot.o: commands/boot.c
-       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
-
-grub_emu-commands_boot.d: commands/boot.c
-       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,boot\.o[ :]*,grub_emu-commands_boot.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
-
--include grub_emu-commands_boot.d
-
-grub_emu-commands_cmp.o: commands/cmp.c
-       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
-
-grub_emu-commands_cmp.d: commands/cmp.c
-       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,cmp\.o[ :]*,grub_emu-commands_cmp.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
-
--include grub_emu-commands_cmp.d
+grub_emu-util_i386_pc_misc.o: util/i386/pc/misc.c
+       $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-commands_cat.o: commands/cat.c
-       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-util_i386_pc_misc.d: util/i386/pc/misc.c
+       set -e;           $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,misc\.o[ :]*,grub_emu-util_i386_pc_misc.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
 
-grub_emu-commands_cat.d: commands/cat.c
-       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,cat\.o[ :]*,grub_emu-commands_cat.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+-include grub_emu-util_i386_pc_misc.d
 
--include grub_emu-commands_cat.d
 
 grub_emu_LDFLAGS = -lncurses
 
@@ -657,7 +711,8 @@ genmoddep-util_genmoddep.d: util/genmoddep.c
 pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
        hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
        boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
-       pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod
+       pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
+       default.mod timeout.mod
 
 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
@@ -1016,10 +1071,11 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
 
 # For normal.mod.
 normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c    \
-       normal/main.c normal/menu.c normal/menu_entry.c                 \
+       normal/context.c normal/main.c normal/menu.c                    \
+       normal/menu_entry.c                                             \
        normal/powerpc/setjmp.S
-CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_powerpc_setjmp.o def-normal.lst und-normal.lst
-MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_powerpc_setjmp.d
+CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_context.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_powerpc_setjmp.o def-normal.lst und-normal.lst
+MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_context.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_powerpc_setjmp.d
 DEFSYMFILES += def-normal.lst
 UNDSYMFILES += und-normal.lst
 
@@ -1028,7 +1084,7 @@ normal.mod: pre-normal.o mod-normal.o
        $(LD) -r -d -o $@ $^
        $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
 
-pre-normal.o: normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_powerpc_setjmp.o
+pre-normal.o: normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_context.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_powerpc_setjmp.o
        -rm -f $@
        $(LD) -r -d -o $@ $^
 
@@ -1069,6 +1125,14 @@ normal_mod-normal_command.d: normal/command.c
 
 -include normal_mod-normal_command.d
 
+normal_mod-normal_context.o: normal/context.c
+       $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_context.d: normal/context.c
+       set -e;           $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $<      | sed 's,context\.o[ :]*,normal_mod-normal_context.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_context.d
+
 normal_mod-normal_main.o: normal/main.c
        $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
 
@@ -1727,6 +1791,84 @@ help_mod-commands_help.d: commands/help.c
 -include help_mod-commands_help.d
 
 help_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For default.mod
+default_mod_SOURCES = commands/default.c
+CLEANFILES += default.mod mod-default.o mod-default.c pre-default.o default_mod-commands_default.o def-default.lst und-default.lst
+MOSTLYCLEANFILES += default_mod-commands_default.d
+DEFSYMFILES += def-default.lst
+UNDSYMFILES += und-default.lst
+
+default.mod: pre-default.o mod-default.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-default.o: default_mod-commands_default.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-default.o: mod-default.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(default_mod_CFLAGS) -c -o $@ $<
+
+mod-default.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'default' $< > $@ || (rm -f $@; exit 1)
+
+def-default.lst: pre-default.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 default/' > $@
+
+und-default.lst: pre-default.o
+       echo 'default' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+default_mod-commands_default.o: commands/default.c
+       $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(default_mod_CFLAGS) -c -o $@ $<
+
+default_mod-commands_default.d: commands/default.c
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(default_mod_CFLAGS) -M $<         | sed 's,default\.o[ :]*,default_mod-commands_default.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
+
+-include default_mod-commands_default.d
+
+default_mod_CFLAGS =  $(COMMON_CFLAGS)
+
+# For timeout.mod
+timeout_mod_SOURCES = commands/timeout.c
+CLEANFILES += timeout.mod mod-timeout.o mod-timeout.c pre-timeout.o timeout_mod-commands_timeout.o def-timeout.lst und-timeout.lst
+MOSTLYCLEANFILES += timeout_mod-commands_timeout.d
+DEFSYMFILES += def-timeout.lst
+UNDSYMFILES += und-timeout.lst
+
+timeout.mod: pre-timeout.o mod-timeout.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-timeout.o: timeout_mod-commands_timeout.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-timeout.o: mod-timeout.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(timeout_mod_CFLAGS) -c -o $@ $<
+
+mod-timeout.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'timeout' $< > $@ || (rm -f $@; exit 1)
+
+def-timeout.lst: pre-timeout.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 timeout/' > $@
+
+und-timeout.lst: pre-timeout.o
+       echo 'timeout' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+timeout_mod-commands_timeout.o: commands/timeout.c
+       $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(timeout_mod_CFLAGS) -c -o $@ $<
+
+timeout_mod-commands_timeout.d: commands/timeout.c
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(timeout_mod_CFLAGS) -M $<         | sed 's,timeout\.o[ :]*,timeout_mod-commands_timeout.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
+
+-include timeout_mod-commands_timeout.d
+
+timeout_mod_CFLAGS =  $(COMMON_CFLAGS)
 CLEANFILES += moddep.lst
 pkgdata_DATA += moddep.lst
 moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
index 9834c2342407133a84a65538abf9818ee284b828..2d0f0d04bdbfbac38e6f6d6ad726583e7de96082 100644 (file)
@@ -32,17 +32,23 @@ grub_mkimage_SOURCES = util/powerpc/ieee1275/grub-mkimage.c util/misc.c \
         util/resolve.c 
 
 # For grub-emu
-grub_emu_SOURCES = kern/main.c kern/device.c                           \
-       kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c          \
-        kern/misc.c kern/loader.c kern/rescue.c kern/term.c            \
-       partmap/amiga.c partmap/pc.c partmap/apple.c fs/fshelp.c        \
-       util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \
-       fs/jfs.c fs/iso9660.c partmap/sun.c \
-       normal/cmdline.c normal/command.c normal/main.c normal/menu.c   \
-       normal/menu_entry.c normal/arg.c kern/partition.c       \
-       util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c \
-       kern/env.c disk/loopback.c commands/ls.c commands/help.c        \
-       commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c
+grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c       \
+       commands/default.c commands/help.c commands/terminal.c          \
+       commands/ls.c commands/timeout.c                                \
+       commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
+       disk/loopback.c                                                 \
+       fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
+       fs/minix.c fs/ufs.c                                             \
+       kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c       \
+       kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c     \
+       kern/partition.c kern/rescue.c kern/term.c                      \
+       normal/arg.c normal/cmdline.c normal/command.c normal/context.c \
+       normal/main.c normal/menu.c normal/menu_entry.c                 \
+       partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c      \
+       util/console.c util/grub-emu.c util/misc.c                      \
+       util/i386/pc/biosdisk.c util/i386/pc/getroot.c                  \
+       util/i386/pc/misc.c
+
 grub_emu_LDFLAGS = -lncurses
 
 grubof_SOURCES = boot/powerpc/ieee1275/crt0.S boot/powerpc/ieee1275/cmain.c \
@@ -65,7 +71,8 @@ genmoddep_SOURCES = util/genmoddep.c
 pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
        hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
        boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
-       pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod
+       pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
+       default.mod timeout.mod
 
 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
@@ -109,7 +116,8 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
 
 # For normal.mod.
 normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c    \
-       normal/main.c normal/menu.c normal/menu_entry.c                 \
+       normal/context.c normal/main.c normal/menu.c                    \
+       normal/menu_entry.c                                             \
        normal/powerpc/setjmp.S
 normal_mod_CFLAGS = $(COMMON_CFLAGS)
 normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
@@ -177,3 +185,11 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
 # For help.mod.
 help_mod_SOURCES = commands/help.c
 help_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For default.mod
+default_mod_SOURCES = commands/default.c
+default_mod_CFLAGS =  $(COMMON_CFLAGS)
+
+# For timeout.mod
+timeout_mod_SOURCES = commands/timeout.c
+timeout_mod_CFLAGS =  $(COMMON_CFLAGS)
index e95e6ee2cb930b553f9e3dcb8b89a70de36ad7d8..a02f892f720495f31fe543a20ec4ebfbf21b64d3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003,2004  Free Software Foundation, Inc.
+ *  Copyright (C) 2003,2004,2005  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
 
 #include <grub/symbol.h>
 
-#ifdef GRUB_UTIL
-# include <time.h>
-# define GRUB_TICKS_PER_SECOND CLOCKS_PER_SEC
-#else
-# define GRUB_TICKS_PER_SECOND 18
-#endif
+#define GRUB_TICKS_PER_SECOND  18
 
 /* Return the real time in ticks.  */
 grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
index f89b6c7cbff1fd76f3b81f102efeaf4eacdc2a79..1a9fb94192a436fa834e3364a0115e2153607951 100644 (file)
@@ -116,6 +116,22 @@ struct grub_menu
 };
 typedef struct grub_menu *grub_menu_t;
 
+/* A list of menus.  */
+struct grub_menu_list
+{
+  grub_menu_t menu;
+  struct grub_menu_list *next;
+};
+typedef struct grub_menu_list *grub_menu_list_t;
+
+/* The context.  A context holds some global information.  */
+struct grub_context
+{
+  /* The menu list.  */
+  grub_menu_list_t menu_list;
+};
+typedef struct grub_context *grub_context_t;
+
 /* To exit from the normal mode.  */
 extern grub_jmp_buf grub_exit_env;
 
@@ -126,14 +142,14 @@ void grub_menu_entry_run (grub_menu_entry_t entry);
 void grub_cmdline_run (int nested);
 int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
                      int echo_char, int readline);
-void EXPORT_FUNC(grub_register_command) (const char *name,
+void grub_register_command (const char *name,
                            grub_err_t (*func) (struct grub_arg_list *state,
                                                int argc, char **args),
                            unsigned flags,
                            const char *summary,
                            const char *description,
                            const struct grub_arg_option *parser);
-void EXPORT_FUNC(grub_unregister_command) (const char *name);
+void grub_unregister_command (const char *name);
 grub_command_t grub_command_find (char *cmdline);
 grub_err_t grub_set_history (int newsize);
 int grub_iterate_commands (int (*iterate) (grub_command_t));
@@ -144,7 +160,10 @@ void grub_menu_init_page (int nested, int edit);
 int grub_arg_parse (grub_command_t parser, int argc, char **argv,
                    struct grub_arg_list *usr, char ***args, int *argnum);
 void grub_arg_show_help (grub_command_t cmd);
-
+grub_context_t grub_context_get (void);
+grub_menu_t grub_context_get_current_menu (void);
+grub_menu_t grub_context_push_menu (grub_menu_t menu);
+void grub_context_pop_menu (void);
 
 #ifdef GRUB_UTIL
 void grub_normal_init (void);
@@ -169,6 +188,10 @@ void grub_halt_init (void);
 void grub_halt_fini (void);
 void grub_reboot_init (void);
 void grub_reboot_fini (void);
+void grub_default_init (void);
+void grub_default_fini (void);
+void grub_timeout_init (void);
+void grub_timeout_fini (void);
 #endif
 
 #endif /* ! GRUB_NORMAL_HEADER */
index dcfdc6e6c726f74c557be701a9a8a05cffbdb975..899f659c56f7fa84e4ab9b6d5bc50377dcdd16db 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003,2004, 2005 Marco Gerards <metgerards@student.han.nl>
+ *  Copyright (C) 2003,2004,2005  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
 
 #include <grub/symbol.h>
 
-#ifdef GRUB_UTIL
-# include <time.h>
-# define GRUB_TICKS_PER_SECOND CLOCKS_PER_SEC
-#else
-# define GRUB_TICKS_PER_SECOND 1000
-#endif
+#define GRUB_TICKS_PER_SECOND  1000
 
 /* Return the real time in ticks.  */
 grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
index 2c1dbe2ed912512c6b470062a676ec4a3cb3a66f..772ca66b99d9830c842f3243cb73a608beb6e577 100644 (file)
@@ -21,6 +21,7 @@
 #include <grub/misc.h>
 #include <grub/mm.h>
 #include <grub/err.h>
+#include <grub/kernel.h>
 
 static grub_err_t (*grub_loader_boot_func) (void);
 static grub_err_t (*grub_loader_unload_func) (void);
@@ -64,6 +65,8 @@ grub_loader_boot (void)
   if (! grub_loader_loaded)
     return grub_error (GRUB_ERR_NO_KERNEL, "no loaded kernel");
 
+  grub_machine_fini ();
+  
   return (grub_loader_boot_func) ();
 }
 
diff --git a/normal/context.c b/normal/context.c
new file mode 100644 (file)
index 0000000..0125e30
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  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.
+ */
+
+#include <grub/normal.h>
+#include <grub/mm.h>
+
+static struct grub_context context =
+  {
+    .menu_list = 0
+  };
+
+/* Return a pointer to the context.  */
+grub_context_t
+grub_context_get (void)
+{
+  return &context;
+}
+
+/* Return the current menu.  */
+grub_menu_t
+grub_context_get_current_menu (void)
+{
+  if (context.menu_list)
+    return context.menu_list->menu;
+
+  return 0;
+}
+
+/* Push a new menu. Return this menu. If any error occurs, return NULL.  */
+grub_menu_t
+grub_context_push_menu (grub_menu_t menu)
+{
+  grub_menu_list_t menu_list;
+
+  menu_list = grub_malloc (sizeof (*menu_list));
+  if (! menu_list)
+    return 0;
+
+  menu_list->menu = menu;
+  menu_list->next = context.menu_list;
+  context.menu_list = menu_list;
+
+  return menu;
+}
+
+/* Pop a menu.  */
+void
+grub_context_pop_menu (void)
+{
+  grub_menu_list_t menu_list;
+
+  menu_list = context.menu_list;
+  if (menu_list)
+    {
+      context.menu_list = menu_list->next;
+      grub_free (menu_list);
+    }
+}
+
index 499e6ffb1402135379228dd7bd832aa477a0f94d..27e63a0417264edf7bae0972bae1d4ac3930cc6e 100644 (file)
@@ -1,7 +1,7 @@
 /* main.c - the normal mode main routine */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2000,2001,2002,2003  Free Software Foundation, Inc.
+ *  Copyright (C) 2000,2001,2002,2003,2005  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
@@ -154,6 +154,21 @@ read_config_file (const char *config)
   menu->size = 0;
   menu->entry_list = 0;
 
+  if (! grub_context_push_menu (menu))
+    {
+      grub_print_error ();
+      grub_errno = GRUB_ERR_NONE;
+
+      free_menu (menu);
+      grub_file_close (file);
+      
+      /* Wait until the user pushes any key so that the user
+        can see what happened.  */
+      grub_printf ("\nPress any key to continue...");
+      (void) grub_getkey ();
+      return 0;
+    }
+  
   next_entry = &(menu->entry_list);
   next_cmd = 0;
   
@@ -207,8 +222,11 @@ read_config_file (const char *config)
          if (cmd->flags & GRUB_COMMAND_FLAG_MENU)
            {
              grub_command_execute (cmdline);
-             grub_print_error ();
-             grub_errno = GRUB_ERR_NONE;
+             if (grub_errno != GRUB_ERR_NONE)
+               {
+                 grub_print_error ();
+                 grub_errno = GRUB_ERR_NONE;
+               }
            }
          else
            {
@@ -245,6 +263,7 @@ read_config_file (const char *config)
   /* If no entry was found or any error occurred, return NULL.  */
   if (menu->size == 0 || grub_errno != GRUB_ERR_NONE)
     {
+      grub_context_pop_menu ();
       free_menu (menu);
       return 0;
     }
@@ -301,7 +320,11 @@ grub_normal_execute (const char *config, int nested)
     }
 
   if (menu)
-    grub_menu_run (menu, nested);
+    {
+      grub_menu_run (menu, nested);
+      grub_context_pop_menu ();
+      free_menu (menu);
+    }
   else
     grub_cmdline_run (nested);
 }
index e8d77070a555720cec2ddf5bc484a610dfb11df2..d0c80b9ec4d2d746096ec9a82c214e1fca61f213 100644 (file)
@@ -219,7 +219,10 @@ run_menu (grub_menu_t menu, int nested)
        }
 
       if (menu->timeout == 0)
-       return menu->default_entry;
+       {
+         menu->timeout = -1;
+         return menu->default_entry;
+       }
       
       if (grub_checkkey () >= 0 || menu->timeout < 0)
        {
index 3f00b73356a4ee478a4f993d73607c18d66236d6..4ecce3cf4f1d9da2594e3a23765fad87db8bc466 100644 (file)
@@ -105,7 +105,7 @@ grub_ncurses_checkkey (void)
   /* Check for SAVED_CHAR. This should not be true, because this
      means checkkey is called twice continuously.  */
   if (saved_char != ERR)
-    return 1;
+    return saved_char;
   
   wtimeout (stdscr, 100);
   c = getch ();
@@ -113,10 +113,10 @@ grub_ncurses_checkkey (void)
   if (c != ERR)
     {
       saved_char = c;
-      return 1;
+      return c;
     }
 
-  return 0;
+  return -1;
 }
 
 static int
index 5f7a0419849a8e4dba1b261615a62faeb04e71a1..85541ec0f747d19ee882d08becd87fda544f3179 100644 (file)
@@ -191,6 +191,8 @@ main (int argc, char *argv[])
   grub_help_init ();
   grub_halt_init ();
   grub_reboot_init ();
+  grub_default_init ();
+  grub_timeout_init ();
   
   /* XXX: Should normal mode be started by default?  */
   grub_normal_init ();
@@ -199,6 +201,8 @@ main (int argc, char *argv[])
   if (setjmp (main_env) == 0)
     grub_main ();
 
+  grub_timeout_fini ();
+  grub_default_fini ();
   grub_reboot_fini ();
   grub_halt_fini ();
   grub_help_fini ();
index 49480ee0f562ea8d8edfb1a087df46feb1b1e16c..7c92215e749db4911506abc7576900bbbcca4b20 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2005  Free Software Foundation, Inc.
  *
  *  GRUB is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/times.h>
+#include <sys/time.h>
 #include <malloc.h>
 #include <unistd.h>
 
 #include <grub/util/misc.h>
 #include <grub/mm.h>
 #include <grub/term.h>
+#include <grub/machine/time.h>
 
 char *progname = 0;
 int verbosity = 0;
@@ -256,9 +257,13 @@ grub_stop (void)
 grub_uint32_t
 grub_get_rtc (void)
 {
-  struct tms currtime;
+  struct timeval tv;
 
-  return times (&currtime);
+  gettimeofday (&tv, 0);
+  
+  return (tv.tv_sec * GRUB_TICKS_PER_SECOND
+         + (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
+            * GRUB_TICKS_PER_SECOND / 1000000));
 }
 
 void