* geninit.sh: New file.
* geninitheader.sh: Likewise.
* commands/boot.c (grub_boot_init, grub_boot_fini): Removed.
* commands/cat.c (grub_cat_init, grub_cat_fini): Likewise.
* commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise.
* commands/configfile.c (grub_configfile_init)
(grub_configfile_fini): Likewise.
* commands/default.c (grub_default_init, grub_default_fini):
Likewise.
* commands/help.c (grub_help_init, grub_help_fini): Likewise.
* commands/ls.c (grub_ls_init, grub_ls_fini): Likewise.
* commands/search.c (grub_search_init, grub_search_fini): Likewise.
* commands/terminal.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* commands/test.c (grub_test_init, grub_test_fini): Likewise.
* commands/timeout.c (grub_timeout_init, grub_timeout_fini):
Likewise.
* commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise.
* commands/iee1275/halt.c (grub_halt_init, grub_halt_fini):
Likewise.
* commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise.
* fs/affs.c (grub_affs_init, grub_affs_fini): Likewise.
* fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise.
* fs/fat.c (grub_fat_init, grub_fat_fini): Likewise.
* fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise.
* fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise.
* fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise.
* fs/minix.c (grub_minix_init, grub_minix_fini): Likewise.
* fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise.
* fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise.
* fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise.
* normal/main.c (grub_normal_init, grub_normal_fini): Likewise.
* partmap/amiga.c (grub_amiga_partition_map_init)
(grub_amiga_partition_map_fini): Likewise.
* partmap/apple.c (grub_apple_partition_map_init)
(grub_apple_partition_map_fini): Likewise.
* partmap/pc.c (grub_pc_partition_map_init)
(grub_pc_partition_map_fini): Likewise.
* partmap/sun.c (grub_sun_partition_map_init,
grub_sun_partition_map_fini): Likewise.
* term/terminfo.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* util/grub-emu.c: Include <grub_modules_init.h>.
(main): Don't initialize and de-initialize any modules directly,
use `grub_init_all' and `grub_fini_all' instead.
* term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to
`grub_vesafb_mod_init'.
(grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'. Updated
all users.
* term/i386/pc/vga.c (grub_vga_init): Renamed to
`grub_vga_mod_init'. Updated all users.
(grub_vga_fini): Renamed to `grub_vga_mod_fini'.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'.
(grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New
rules.
* include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'.
Generate a function to initialize the module in utilities.
Updated all callers.
(GRUB_MOD_FINI): Add argument `name'. Generate a function to
initialize the module in utilities. Updated all callers.
+2005-11-13 Marco Gerards <mgerards@xs4all.nl>
+
+ * geninit.sh: New file.
+
+ * geninitheader.sh: Likewise.
+
+ * commands/boot.c (grub_boot_init, grub_boot_fini): Removed.
+ * commands/cat.c (grub_cat_init, grub_cat_fini): Likewise.
+ * commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise.
+ * commands/configfile.c (grub_configfile_init)
+ (grub_configfile_fini): Likewise.
+ * commands/default.c (grub_default_init, grub_default_fini):
+ Likewise.
+ * commands/help.c (grub_help_init, grub_help_fini): Likewise.
+ * commands/ls.c (grub_ls_init, grub_ls_fini): Likewise.
+ * commands/search.c (grub_search_init, grub_search_fini): Likewise.
+ * commands/terminal.c (grub_terminal_init, grub_terminal_fini):
+ Likewise.
+ * commands/test.c (grub_test_init, grub_test_fini): Likewise.
+ * commands/timeout.c (grub_timeout_init, grub_timeout_fini):
+ Likewise.
+ * commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise.
+ * commands/iee1275/halt.c (grub_halt_init, grub_halt_fini):
+ Likewise.
+ * commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini):
+ Likewise.
+ * commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini):
+ Likewise.
+ * disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise.
+ * fs/affs.c (grub_affs_init, grub_affs_fini): Likewise.
+ * fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise.
+ * fs/fat.c (grub_fat_init, grub_fat_fini): Likewise.
+ * fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise.
+ * fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise.
+ * fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise.
+ * fs/minix.c (grub_minix_init, grub_minix_fini): Likewise.
+ * fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise.
+ * fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise.
+ * fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise.
+ * normal/main.c (grub_normal_init, grub_normal_fini): Likewise.
+ * partmap/amiga.c (grub_amiga_partition_map_init)
+ (grub_amiga_partition_map_fini): Likewise.
+ * partmap/apple.c (grub_apple_partition_map_init)
+ (grub_apple_partition_map_fini): Likewise.
+ * partmap/pc.c (grub_pc_partition_map_init)
+ (grub_pc_partition_map_fini): Likewise.
+ * partmap/sun.c (grub_sun_partition_map_init,
+ grub_sun_partition_map_fini): Likewise.
+ * term/terminfo.c (grub_terminal_init, grub_terminal_fini):
+ Likewise.
+
+ * util/grub-emu.c: Include <grub_modules_init.h>.
+ (main): Don't initialize and de-initialize any modules directly,
+ use `grub_init_all' and `grub_fini_all' instead.
+
+ * term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to
+ `grub_vesafb_mod_init'.
+ (grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'. Updated
+ all users.
+ * term/i386/pc/vga.c (grub_vga_init): Renamed to
+ `grub_vga_mod_init'. Updated all users.
+ (grub_vga_fini): Renamed to `grub_vga_mod_fini'.
+
+ * conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'.
+ (grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New
+ rules.
+
+ * include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'.
+ Generate a function to initialize the module in utilities.
+ Updated all callers.
+ (GRUB_MOD_FINI): Add argument `name'. Generate a function to
+ initialize the module in utilities. Updated all callers.
+
2005-11-09 Hollis Blanchard <hollis@penguinppc.org>
* term/ieee1275/ofconsole.c (grub_ofconsole_cls): Use both the ANSI
\f
-#ifdef GRUB_UTIL
-void
-grub_boot_init (void)
-{
- grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH,
- "boot", "Boot an operating system.", 0);
-}
-
-void
-grub_boot_fini (void)
-{
- grub_unregister_command ("boot");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(boot)
{
(void) mod; /* To stop warning. */
grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH,
"boot", "Boot an operating system.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(boot)
{
grub_unregister_command ("boot");
}
-#endif /* ! GRUB_UTIL */
}
\f
-#ifdef GRUB_UTIL
-void
-grub_cat_init (void)
-{
- grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
- "cat FILE", "Show the contents of a file.", 0);
-}
-
-void
-grub_cat_fini (void)
-{
- grub_unregister_command ("cat");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(cat)
{
(void) mod; /* To stop warning. */
grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
"cat FILE", "Show the contents of a file.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(cat)
{
grub_unregister_command ("cat");
}
-#endif /* ! GRUB_UTIL */
}
\f
-#ifdef GRUB_UTIL
-void
-grub_cmp_init (void)
-{
- grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH,
- "cmp FILE1 FILE2", "Compare two files.", 0);
-}
-
-void
-grub_cmp_fini (void)
-{
- grub_unregister_command ("cmp");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(cmp)
{
(void) mod; /* To stop warning. */
grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH,
"cmp FILE1 FILE2", "Compare two files.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(cmp)
{
grub_unregister_command ("cmp");
}
-#endif /* ! GRUB_UTIL */
}
\f
-#ifdef GRUB_UTIL
-void
-grub_configfile_init (void)
-{
- grub_register_command ("configfile", grub_cmd_configfile,
- GRUB_COMMAND_FLAG_BOTH, "configfile FILE",
- "Load another config file.", 0);
-}
-
-void
-grub_configfile_fini (void)
-{
- grub_unregister_command ("configfile");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(configfile)
{
(void) mod; /* To stop warning. */
grub_register_command ("configfile", grub_cmd_configfile,
"Load another config file.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(configfile)
{
grub_unregister_command ("configfile");
}
-#endif /* ! GRUB_UTIL */
\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
+GRUB_MOD_INIT(default)
{
(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_MOD_FINI(default)
{
grub_unregister_command ("default");
}
-#endif /* ! GRUB_UTIL */
\f
-#ifdef GRUB_UTIL
-void
-grub_help_init (void)
-{
- grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE,
- "help [PATTERN ...]", "Show a help message.", 0);
-}
-
-void
-grub_help_fini (void)
-{
- grub_unregister_command ("help");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(help)
{
(void)mod; /* To stop warning. */
grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE,
"help [PATTERN ...]", "Show a help message.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(help)
{
grub_unregister_command ("help");
}
-#endif /* ! GRUB_UTIL */
\f
-#ifdef GRUB_UTIL
-void
-grub_halt_init (void)
-{
- grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
- "halt [OPTIONS...]",
- "Halt the system, if possible using APM", options);
-}
-
-void
-grub_halt_fini (void)
-{
- grub_unregister_command ("halt");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(halt)
{
(void)mod; /* To stop warning. */
grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
"Halt the system, if possible using APM", options);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(halt)
{
grub_unregister_command ("halt");
}
-#endif /* ! GRUB_UTIL */
\f
-#ifdef GRUB_UTIL
-void
-grub_reboot_init (void)
-{
- grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
- "reboot", "Reboot the computer.", 0);
-}
-
-void
-grub_reboot_fini (void)
-{
- grub_unregister_command ("reboot");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(reboot)
{
(void)mod; /* To stop warning. */
grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
"reboot", "Reboot the computer", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(reboot)
{
grub_unregister_command ("reboot");
}
-#endif /* ! GRUB_UTIL */
return 0;
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(vbeinfo)
{
(void) mod; /* To stop warning. */
grub_register_command ("vbeinfo",
0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(vbeinfo)
{
grub_unregister_command ("vbeinfo");
}
return grub_errno;
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(vbetest)
{
(void) mod; /* To stop warning. */
grub_register_command ("vbetest",
0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(vbetest)
{
grub_unregister_command ("vbetest");
}
}
\f
-#ifdef GRUB_UTIL
-void
-grub_halt_init (void)
-{
- grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
- "halt", "halts the computer. This command does not"
- " work on all firmware.", 0);
-}
-
-void
-grub_halt_fini (void)
-{
- grub_unregister_command ("halt");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(ieee1275_halt)
{
(void)mod; /* To stop warning. */
grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
" work on all firmware.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(ieee1275_halt)
{
grub_unregister_command ("halt");
}
-#endif
}
\f
-#ifdef GRUB_UTIL
-void
-grub_reboot_init (void)
-{
- grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
- "reboot", "Reboot the computer", 0);
-}
-
-void
-grub_reboot_fini (void)
-{
- grub_unregister_command ("reboot");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(ieee1275_reboot)
{
(void)mod; /* To stop warning. */
grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
"reboot", "Reboot the computer", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(ieee1275_reboot)
{
grub_unregister_command ("reboot");
}
-#endif
}
\f
-GRUB_MOD_INIT
+GRUB_MOD_INIT(ieee1275_suspend)
{
(void)mod; /* To stop warning. */
grub_register_command ("suspend", grub_cmd_suspend, GRUB_COMMAND_FLAG_BOTH,
"suspend", "Return to Open Firmware prompt", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(ieee1275_suspend)
{
grub_unregister_command ("suspend");
}
return 0;
}
-#ifdef GRUB_UTIL
-void
-grub_ls_init (void)
-{
- grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
- "ls [-l|-h|-a] [FILE]",
- "List devices and files.", options);
-}
-
-void
-grub_ls_fini (void)
-{
- grub_unregister_command ("ls");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(ls)
{
(void)mod; /* To stop warning. */
grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
"List devices and files.", options);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(ls)
{
grub_unregister_command ("ls");
}
-#endif /* ! GRUB_UTIL */
return grub_errno;
}
-#ifdef GRUB_UTIL
-void
-grub_search_init (void)
-{
- grub_register_command ("search", grub_cmd_search, GRUB_COMMAND_FLAG_BOTH,
- "search [-f|-l|-s] NAME",
- "Search devices by a file or a filesystem label."
- " If --set is specified, the first device found is"
- " set to a variable. If no variable name is"
- " specified, \"root\" is used.",
- options);
-}
-
-void
-grub_search_fini (void)
-{
- grub_unregister_command ("search");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(search)
{
(void) mod; /* To stop warning. */
grub_register_command ("search", grub_cmd_search, GRUB_COMMAND_FLAG_BOTH,
options);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(search)
{
grub_unregister_command ("search");
}
-#endif /* ! GRUB_UTIL */
/* terminal.c - command to show and select a terminal */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2003 Free Software Foundation, Inc.
+ * Copyright (C) 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
}
\f
-#ifdef GRUB_UTIL
-void
-grub_terminal_init (void)
-{
- grub_register_command ("terminal", grub_cmd_terminal, GRUB_COMMAND_FLAG_BOTH,
- "terminal [TERM...]", "Select a terminal.", 0);
-}
-
-void
-grub_terminal_fini (void)
-{
- grub_unregister_command ("terminal");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(terminal)
{
(void)mod; /* To stop warning. */
grub_register_command ("terminal", grub_cmd_terminal, GRUB_COMMAND_FLAG_BOTH,
"terminal [TERM...]", "Select a terminal.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(terminal)
{
grub_unregister_command ("terminal");
}
-#endif /* ! GRUB_UTIL */
\f
-#ifdef GRUB_UTIL
-void
-grub_test_init (void)
-{
- grub_register_command ("[", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE,
- "[ EXPRESSION ]", "Evaluate an expression", 0);
- grub_register_command ("test", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE,
- "test EXPRESSION", "Evaluate an expression", 0);
-}
-
-void
-grub_test_fini (void)
-{
- grub_unregister_command ("[");
- grub_unregister_command ("test");
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(test)
{
(void)mod; /* To stop warning. */
grub_register_command ("[", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE,
"test EXPRESSION", "Evaluate an expression", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(test)
{
grub_unregister_command ("[");
grub_unregister_command ("test");
}
-#endif /* ! GRUB_UTIL */
\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
+GRUB_MOD_INIT(timeout)
{
(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_MOD_FINI(timeout)
{
grub_unregister_command ("timeout");
}
-#endif /* ! GRUB_UTIL */
# For grub-emu.
-grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
+grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/default.c commands/help.c \
commands/terminal.c commands/ls.c commands/test.c \
commands/search.c commands/timeout.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_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.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_affs.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_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.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-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.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_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_test.d grub_emu-commands_search.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_affs.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_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.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-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.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_function.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.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
+ util/i386/pc/misc.c grub_emu_init.c
+CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.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_affs.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_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.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-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.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_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_init.o
+MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_test.d grub_emu-commands_search.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_affs.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_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.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-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.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_function.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.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_init.d
-grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.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_affs.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_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.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-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.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_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.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_affs.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_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.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-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.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_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_init.o
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
grub_emu-commands_boot.o: commands/boot.c
-include grub_emu-util_i386_pc_misc.d
+grub_emu-grub_emu_init.o: grub_emu_init.c
+ $(BUILD_CC) -I. -I$(srcdir)/. $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-grub_emu_init.d: grub_emu_init.c
+ set -e; $(BUILD_CC) -I. -I$(srcdir)/. $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,grub_emu_init\.o[ :]*,grub_emu-grub_emu_init.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
+
+-include grub_emu-grub_emu_init.d
+
grub_emu_LDFLAGS = $(LIBCURSES)
+grub_modules_init.lst: geninit.sh
+ (cd $(srcdir); grep -r --include="*.c" GRUB_MOD_INIT *) > $@
+
+grub_modules_init.h: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh grub_modules_init.lst
+ sh $(srcdir)/geninitheader.sh > $@
+
+grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst grub_modules_init.h
+ sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@
+
# For genmoddep.
genmoddep_SOURCES = util/genmoddep.c
CLEANFILES += genmoddep genmoddep-util_genmoddep.o
fs/xfs.c fs/affs.c fs/sfs.c
# For grub-emu.
-grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
+grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/default.c commands/help.c \
commands/terminal.c commands/ls.c commands/test.c \
commands/search.c commands/timeout.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
+ util/i386/pc/misc.c grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
+grub_modules_init.lst: geninit.sh
+ (cd $(srcdir); grep -r --include="*.c" GRUB_MOD_INIT *) > $@
+
+grub_modules_init.h: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh grub_modules_init.lst
+ sh $(srcdir)/geninitheader.sh > $@
+
+grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst grub_modules_init.h
+ sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@
+
# For genmoddep.
genmoddep_SOURCES = util/genmoddep.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/powerpc/ieee1275/misc.c grub_script.tab.c
-CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.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_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.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_parser.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_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o
-MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_search.d grub_emu-commands_terminal.d grub_emu-commands_test.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.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_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.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_parser.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_completion.d grub_emu-normal_context.d grub_emu-normal_execute.d grub_emu-normal_function.d grub_emu-normal_lexer.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.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_powerpc_ieee1275_misc.d grub_emu-grub_script_tab.d
+ util/powerpc/ieee1275/misc.c grub_script.tab.c grub_emu_init.c
+CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.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_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.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_parser.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_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o grub_emu-grub_emu_init.o
+MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_search.d grub_emu-commands_terminal.d grub_emu-commands_test.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.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_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.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_parser.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_completion.d grub_emu-normal_context.d grub_emu-normal_execute.d grub_emu-normal_function.d grub_emu-normal_lexer.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.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_powerpc_ieee1275_misc.d grub_emu-grub_script_tab.d grub_emu-grub_emu_init.d
-grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.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_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.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_parser.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_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o
+grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.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_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.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_parser.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_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o grub_emu-grub_emu_init.o
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
grub_emu-commands_boot.o: commands/boot.c
-include grub_emu-grub_script_tab.d
+grub_emu-grub_emu_init.o: grub_emu_init.c
+ $(BUILD_CC) -I. -I$(srcdir)/. $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-grub_emu_init.d: grub_emu_init.c
+ set -e; $(BUILD_CC) -I. -I$(srcdir)/. $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,grub_emu_init\.o[ :]*,grub_emu-grub_emu_init.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
+
+-include grub_emu-grub_emu_init.d
+
grub_emu_LDFLAGS = $(LIBCURSES)
+grub_modules_init.lst: geninit.sh
+ (cd $(srcdir); grep -r --include="*.c" GRUB_MOD_INIT *) > $@
+
+grub_modules_init.h: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh grub_modules_init.lst
+ sh $(srcdir)/geninitheader.sh > $@
+
+grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst
+ sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@
+
grubof_SOURCES = kern/powerpc/ieee1275/crt0.S kern/powerpc/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.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/powerpc/ieee1275/misc.c grub_script.tab.c
+ util/powerpc/ieee1275/misc.c grub_script.tab.c grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
+grub_modules_init.lst: geninit.sh
+ (cd $(srcdir); grep -r --include="*.c" GRUB_MOD_INIT *) > $@
+
+grub_modules_init.h: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh grub_modules_init.lst
+ sh $(srcdir)/geninitheader.sh > $@
+
+grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst grub_modules_init.h
+ sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@
+
grubof_SOURCES = kern/powerpc/ieee1275/crt0.S kern/powerpc/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
};
\f
-#ifdef GRUB_UTIL
-void
-grub_loop_init (void)
-{
- grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
- "loopback [-d|-p] DEVICENAME FILE",
- "Make a device of a file.", options);
- grub_disk_dev_register (&grub_loopback_dev);
-}
-void
-grub_loop_fini (void)
-{
- grub_unregister_command ("loopback");
- grub_disk_dev_unregister (&grub_loopback_dev);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(loop)
{
(void)mod; /* To stop warning. */
grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
grub_disk_dev_register (&grub_loopback_dev);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(loop)
{
grub_unregister_command ("loopback");
grub_disk_dev_unregister (&grub_loopback_dev);
}
-#endif /* ! GRUB_UTIL */
+
return 0;
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(fontmanager)
{
(void) mod; /* Stop warning. */
grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH,
"Specify one or more font files to display.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(fontmanager)
{
grub_unregister_command ("font");
}
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_affs_init (void)
-{
- grub_fs_register (&grub_affs_fs);
-}
-
-void
-grub_affs_fini (void)
-{
- grub_fs_unregister (&grub_affs_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(affs)
{
grub_fs_register (&grub_affs_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(affs)
{
grub_fs_unregister (&grub_affs_fs);
}
-#endif /* ! GRUB_UTIL */
+
/* ext2.c - Second Extended filesystem */
/*
* 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
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_ext2_init (void)
-{
- grub_fs_register (&grub_ext2_fs);
-}
-
-void
-grub_ext2_fini (void)
-{
- grub_fs_unregister (&grub_ext2_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(ext2)
{
grub_fs_register (&grub_ext2_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(ext2)
{
grub_fs_unregister (&grub_ext2_fs);
}
-#endif /* ! GRUB_UTIL */
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_fat_init (void)
-{
- grub_fs_register (&grub_fat_fs);
-}
-
-void
-grub_fat_fini (void)
-{
- grub_fs_unregister (&grub_fat_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(fat)
{
grub_fs_register (&grub_fat_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(fat)
{
grub_fs_unregister (&grub_fat_fs);
}
-#endif /* ! GRUB_UTIL */
+
/* hfs.c - HFS. */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2004 Free Software Foundation, Inc.
+ * Copyright (C) 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
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_hfs_init (void)
-{
- grub_fs_register (&grub_hfs_fs);
-}
-
-void
-grub_hfs_fini (void)
-{
- grub_fs_unregister (&grub_hfs_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(hfs)
{
grub_fs_register (&grub_hfs_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(hfs)
{
grub_fs_unregister (&grub_hfs_fs);
}
-#endif /* ! GRUB_UTIL */
SUSP, Rock Ridge. */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2004 Free Software Foundation, Inc.
+ * Copyright (C) 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
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_iso9660_init (void)
-{
- grub_fs_register (&grub_iso9660_fs);
-}
-
-void
-grub_iso9660_fini (void)
-{
- grub_fs_unregister (&grub_iso9660_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(iso9660)
{
grub_fs_register (&grub_iso9660_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(iso9660)
{
grub_fs_unregister (&grub_iso9660_fs);
}
-#endif /* ! GRUB_UTIL */
/* jfs.c - JFS. */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2004 Free Software Foundation, Inc.
+ * Copyright (C) 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
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_jfs_init (void)
-{
- grub_fs_register (&grub_jfs_fs);
-}
-
-void
-grub_jfs_fini (void)
-{
- grub_fs_unregister (&grub_jfs_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(jfs)
{
grub_fs_register (&grub_jfs_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(jfs)
{
grub_fs_unregister (&grub_jfs_fs);
}
-#endif /* ! GRUB_UTIL */
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_minix_init (void)
-{
- grub_fs_register (&grub_minix_fs);
-}
-
-void
-grub_minix_fini (void)
-{
- grub_fs_unregister (&grub_minix_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(minix)
{
grub_fs_register (&grub_minix_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(minix)
{
grub_fs_unregister (&grub_minix_fs);
}
-#endif /* ! GRUB_UTIL */
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_sfs_init (void)
-{
- grub_fs_register (&grub_sfs_fs);
-}
-
-void
-grub_sfs_fini (void)
-{
- grub_fs_unregister (&grub_sfs_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(sfs)
{
grub_fs_register (&grub_sfs_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(sfs)
{
grub_fs_unregister (&grub_sfs_fs);
}
-#endif /* ! GRUB_UTIL */
/* ufs.c - Unix File System */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2004 Free Software Foundation, Inc.
+ * Copyright (C) 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
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_ufs_init (void)
-{
- grub_fs_register (&grub_ufs_fs);
-}
-
-void
-grub_ufs_fini (void)
-{
- grub_fs_unregister (&grub_ufs_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(ufs)
{
grub_fs_register (&grub_ufs_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(ufs)
{
grub_fs_unregister (&grub_ufs_fs);
}
-#endif /* ! GRUB_UTIL */
+
.next = 0
};
-#ifdef GRUB_UTIL
-void
-grub_xfs_init (void)
-{
- grub_fs_register (&grub_xfs_fs);
-}
-
-void
-grub_xfs_fini (void)
-{
- grub_fs_unregister (&grub_xfs_fs);
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(xfs)
{
grub_fs_register (&grub_xfs_fs);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(xfs)
{
grub_fs_unregister (&grub_xfs_fs);
}
-#endif /* ! GRUB_UTIL */
+
--- /dev/null
+#! /bin/sh
+#
+# Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+#
+# This gensymlist.sh is free software; the author
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+cat <<EOF
+/* This file is automatically generated by gensymlist.sh. DO NOT EDIT! */
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002, 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_modules_init.h>
+
+EOF
+
+cat <<EOF
+void
+grub_init_all (void)
+{
+EOF
+(
+ cat grub_modules_init.lst
+ for i in $*; do
+ echo $i':'
+ done
+) | sort -r | uniq -d -W1 -t':' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init ();/;p;}'
+
+cat <<EOF
+}
+EOF
+
+cat <<EOF
+void
+grub_fini_all (void)
+{
+EOF
+
+(
+ cat grub_modules_init.lst
+ for i in $*; do
+ echo $i':'
+ done
+) | sort -r | uniq -d -W1 -t':' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_fini ();/;p;}'
+
+cat <<EOF
+}
+EOF
--- /dev/null
+#! /bin/sh
+#
+# Copyright (C) 2005 Free Software Foundation, Inc.
+#
+# This gensymlist.sh is free software; the author
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+cat <<EOF
+/* This file is automatically generated by gensymlist.sh. DO NOT EDIT! */
+/*
+ * 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.
+ */
+
+EOF
+
+cat <<EOF
+void grub_init_all (void);
+void grub_fini_all (void);
+EOF
+
+cat grub_modules_init.lst | grep -v '^#' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_init (void);/;p;}'
+cat grub_modules_init.lst | grep -v '^#' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_fini (void);/;p;}'
return 0;
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(hello)
{
(void)mod; /* To stop warning. */
grub_register_command ("hello", grub_cmd_hello, GRUB_COMMAND_FLAG_BOTH,
"hello", "Say hello", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(hello)
{
grub_unregister_command ("hello");
}
#include <grub/err.h>
#include <grub/types.h>
-#define GRUB_MOD_INIT \
+#define GRUB_MOD_INIT(name) \
static void grub_mod_init (grub_dl_t mod) __attribute__ ((used)); \
+void grub_##name##_init (void); \
+void \
+grub_##name##_init (void) { grub_mod_init (0); } \
static void \
grub_mod_init (grub_dl_t mod)
-#define GRUB_MOD_FINI \
+#define GRUB_MOD_FINI(name) \
static void grub_mod_fini (void) __attribute__ ((used)); \
+void grub_##name##_fini (void); \
+void \
+grub_##name##_fini (void) { grub_mod_fini (); } \
static void \
grub_mod_fini (void)
static const char loader_name[] = "chainloader";
-GRUB_MOD_INIT
+GRUB_MOD_INIT(chainloader)
{
grub_rescue_register_command (loader_name,
grub_rescue_cmd_chainloader,
my_mod = mod;
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(chainloader)
{
grub_rescue_unregister_command (loader_name);
}
return grub_errno;
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(chainloader_normal)
{
(void) mod; /* To stop warning. */
grub_register_command ("chainloader", chainloader_command,
"Prepare to boot another boot loader.", options);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(chainloader_normal)
{
grub_unregister_command ("chainloader");
}
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(linux)
{
grub_rescue_register_command ("linux",
grub_rescue_cmd_linux,
my_mod = mod;
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(linux)
{
grub_rescue_unregister_command ("linux");
grub_rescue_unregister_command ("initrd");
return grub_errno;
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(linux_normal)
{
(void) mod; /* To stop warning. */
grub_register_command ("linux", grub_normal_linux_command,
"Load an initrd.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(linux_normal)
{
grub_unregister_command ("linux");
grub_unregister_command ("initrd");
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(multiboot)
{
grub_rescue_register_command ("multiboot", grub_rescue_cmd_multiboot,
"load a multiboot kernel");
my_mod = mod;
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(multiboot)
{
grub_rescue_unregister_command ("multiboot");
grub_rescue_unregister_command ("module");
return grub_errno;
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(multiboot_normal)
{
(void) mod; /* To stop warning. */
grub_register_command ("multiboot", grub_normal_cmd_multiboot,
"Load a Multiboot module.", 0);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(multiboot_normal)
{
grub_unregister_command ("multiboot");
grub_unregister_command ("module");
\f
-GRUB_MOD_INIT
+GRUB_MOD_INIT(linux)
{
grub_rescue_register_command ("linux", grub_rescue_cmd_linux,
"load a linux kernel");
my_mod = mod;
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(linux)
{
grub_rescue_unregister_command ("linux");
grub_rescue_unregister_command ("initrd");
return GRUB_ERR_NONE;
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(linux_normal)
{
(void) mod;
grub_register_command ("linux", grub_cmd_linux, GRUB_COMMAND_FLAG_BOTH,
"Loads initrd", options);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(linux_normal)
{
grub_unregister_command ("linux");
grub_unregister_command ("initrd");
grub_enter_normal_mode (argv[0]);
}
-#ifdef GRUB_UTIL
-void
-grub_normal_init (void)
-{
- grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
-
- /* Register a command "normal" for the rescue mode. */
- grub_rescue_register_command ("normal", grub_rescue_cmd_normal,
- "enter normal mode");
-
- /* This registers some built-in commands. */
- grub_command_init ();
-
-}
-
-void
-grub_normal_fini (void)
-{
- grub_set_history (0);
- grub_rescue_unregister_command ("normal");
-
-}
-#else /* ! GRUB_UTIL */
-GRUB_MOD_INIT
+GRUB_MOD_INIT(normal)
{
/* Normal mode shouldn't be unloaded. */
- grub_dl_ref (mod);
+ if (mod)
+ grub_dl_ref (mod);
grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
grub_command_init ();
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(normal)
{
grub_set_history (0);
grub_rescue_unregister_command ("normal");
}
-#endif /* ! GRUB_UTIL */
+
/* amiga.c - Read amiga partition tables (RDB). */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ * Copyright (C) 2002, 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
.get_name = amiga_partition_map_get_name
};
-#ifdef GRUB_UTIL
-void
-grub_amiga_partition_map_init (void)
-{
- grub_partition_map_register (&grub_amiga_partition_map);
-}
-
-void
-grub_amiga_partition_map_fini (void)
-{
- grub_partition_map_unregister (&grub_amiga_partition_map);
-}
-#else
-GRUB_MOD_INIT
+GRUB_MOD_INIT(amiga_partition_map)
{
grub_partition_map_register (&grub_amiga_partition_map);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(amiga_partition_map)
{
grub_partition_map_unregister (&grub_amiga_partition_map);
}
-#endif
/* apple.c - Read macintosh partition tables. */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ * Copyright (C) 2002, 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
.get_name = apple_partition_map_get_name
};
-#ifdef GRUB_UTIL
-void
-grub_apple_partition_map_init (void)
-{
- grub_partition_map_register (&grub_apple_partition_map);
-}
-
-void
-grub_apple_partition_map_fini (void)
-{
- grub_partition_map_unregister (&grub_apple_partition_map);
-}
-#else
-GRUB_MOD_INIT
+GRUB_MOD_INIT(apple_partition_map)
{
grub_partition_map_register (&grub_apple_partition_map);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(apple_partition_map)
{
grub_partition_map_unregister (&grub_apple_partition_map);
}
-#endif
+
.get_name = pc_partition_map_get_name
};
-#ifdef GRUB_UTIL
-void
-grub_pc_partition_map_init (void)
-{
- grub_partition_map_register (&grub_pc_partition_map);
-}
-
-void
-grub_pc_partition_map_fini (void)
-{
- grub_partition_map_unregister (&grub_pc_partition_map);
-}
-#else
-GRUB_MOD_INIT
+GRUB_MOD_INIT(pc_partition_map)
{
grub_partition_map_register (&grub_pc_partition_map);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(pc_partition_map)
{
grub_partition_map_unregister (&grub_pc_partition_map);
}
-#endif
.get_name = sun_partition_map_get_name
};
-#ifdef GRUB_UTIL
-void
-grub_sun_partition_map_init (void)
-{
- grub_partition_map_register (&grub_sun_partition_map);
-}
-
-void
-grub_sun_partition_map_fini (void)
-{
- grub_partition_map_unregister (&grub_sun_partition_map);
-}
-#else
-GRUB_MOD_INIT
+GRUB_MOD_INIT(sun_partition_map)
{
grub_partition_map_register (&grub_sun_partition_map);
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(sun_partition_map)
{
grub_partition_map_unregister (&grub_sun_partition_map);
}
-#endif
+
return hwiniterr;
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(serial)
{
(void) mod; /* To stop warning. */
grub_register_command ("serial", grub_cmd_serial, GRUB_COMMAND_FLAG_BOTH,
serial_settings.stop_bits = UART_1_STOP_BIT;
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(serial)
{
grub_unregister_command ("serial");
if (registered == 1) /* Unregister terminal only if registered. */
}
static grub_err_t
-grub_vesafb_init (void)
+grub_vesafb_mod_init (void)
{
grub_uint32_t use_mode = GRUB_VBE_DEFAULT_VIDEO_MODE;
struct grub_vbe_info_block controller_info;
}
static grub_err_t
-grub_vesafb_fini (void)
+grub_vesafb_mod_fini (void)
{
grub_virtual_screen_free ();
static struct grub_term grub_vesafb_term =
{
.name = "vesafb",
- .init = grub_vesafb_init,
- .fini = grub_vesafb_fini,
+ .init = grub_vesafb_mod_init,
+ .fini = grub_vesafb_mod_fini,
.putchar = grub_vesafb_putchar,
.getcharwidth = grub_vesafb_getcharwidth,
.checkkey = grub_console_checkkey,
.next = 0
};
-GRUB_MOD_INIT
+GRUB_MOD_INIT(vesafb)
{
my_mod = mod;
grub_term_register (&grub_vesafb_term);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(vesafb)
{
grub_term_unregister (&grub_vesafb_term);
}
}
static grub_err_t
-grub_vga_init (void)
+grub_vga_mod_init (void)
{
vga_font = grub_vga_get_font ();
text_mode = grub_vga_set_mode (0x10);
}
static grub_err_t
-grub_vga_fini (void)
+grub_vga_mod_fini (void)
{
set_map_mask (saved_map_mask);
grub_vga_set_mode (text_mode);
static struct grub_term grub_vga_term =
{
.name = "vga",
- .init = grub_vga_init,
- .fini = grub_vga_fini,
+ .init = grub_vga_mod_init,
+ .fini = grub_vga_mod_fini,
.putchar = grub_vga_putchar,
.getcharwidth = grub_vga_getcharwidth,
.checkkey = grub_console_checkkey,
.next = 0
};
-GRUB_MOD_INIT
+GRUB_MOD_INIT(vga)
{
+#ifndef GRUB_UTIL
my_mod = mod;
+#endif
grub_term_register (&grub_vga_term);
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(vga)
{
grub_term_unregister (&grub_vga_term);
}
return grub_terminfo_set_current (args[0]);
}
-GRUB_MOD_INIT
+GRUB_MOD_INIT(terminfo)
{
(void) mod; /* To stop warning. */
grub_register_command ("terminfo", grub_cmd_terminfo, GRUB_COMMAND_FLAG_BOTH,
grub_terminfo_set_current ("vt100");
}
-GRUB_MOD_FINI
+GRUB_MOD_FINI(terminfo)
{
grub_unregister_command ("terminfo");
}
#include <grub/env.h>
#include <grub/partition.h>
+#include <grub_modules_init.h>
+
#ifdef __NetBSD__
/* NetBSD uses /boot for its boot block. */
# define DEFAULT_DIRECTORY "/grub"
/* XXX: This is a bit unportable. */
grub_util_biosdisk_init (args.dev_map);
- grub_pc_partition_map_init ();
- grub_amiga_partition_map_init ();
- grub_apple_partition_map_init ();
- grub_sun_partition_map_init ();
- /* Initialize the default modules. */
- grub_iso9660_init ();
- grub_xfs_init ();
- grub_fat_init ();
- grub_ext2_init ();
- grub_ufs_init ();
- grub_minix_init ();
- grub_hfs_init ();
- grub_jfs_init ();
- grub_xfs_init ();
- grub_sfs_init ();
- grub_affs_init ();
- grub_ls_init ();
- grub_boot_init ();
- grub_cmp_init ();
- grub_cat_init ();
- grub_terminal_init ();
- grub_loop_init ();
- grub_help_init ();
- grub_halt_init ();
- grub_reboot_init ();
- grub_default_init ();
- grub_timeout_init ();
- grub_configfile_init ();
- grub_search_init ();
- grub_test_init ();
-
- /* XXX: Should normal mode be started by default? */
- grub_normal_init ();
+ grub_init_all ();
/* Start GRUB! */
if (setjmp (main_env) == 0)
grub_main ();
- grub_test_fini ();
- grub_search_fini ();
- grub_configfile_fini ();
- grub_timeout_fini ();
- grub_default_fini ();
- grub_reboot_fini ();
- grub_halt_fini ();
- grub_help_fini ();
- grub_loop_fini ();
- grub_util_biosdisk_fini ();
- grub_normal_fini ();
- grub_affs_fini ();
- grub_sfs_fini ();
- grub_xfs_fini ();
- grub_ufs_fini ();
- grub_ext2_fini ();
- grub_minix_fini ();
- grub_hfs_fini ();
- grub_jfs_fini ();
- grub_fat_fini ();
- grub_xfs_fini ();
- grub_boot_fini ();
- grub_cmp_fini ();
- grub_cat_fini ();
- grub_terminal_fini ();
- grub_amiga_partition_map_fini ();
- grub_pc_partition_map_fini ();
- grub_apple_partition_map_fini ();
- grub_sun_partition_map_fini ();
+ grub_fini_all ();
grub_machine_fini ();