]> git.proxmox.com Git - grub2.git/commitdiff
2005-11-13 Marco Gerards <mgerards@xs4all.nl>
authormarco_g <marco_g@localhost>
Sun, 13 Nov 2005 15:47:09 +0000 (15:47 +0000)
committermarco_g <marco_g@localhost>
Sun, 13 Nov 2005 15:47:09 +0000 (15:47 +0000)
* 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.

57 files changed:
ChangeLog
commands/boot.c
commands/cat.c
commands/cmp.c
commands/configfile.c
commands/default.c
commands/help.c
commands/i386/pc/halt.c
commands/i386/pc/reboot.c
commands/i386/pc/vbeinfo.c
commands/i386/pc/vbetest.c
commands/ieee1275/halt.c
commands/ieee1275/reboot.c
commands/ieee1275/suspend.c
commands/ls.c
commands/search.c
commands/terminal.c
commands/test.c
commands/timeout.c
conf/i386-pc.mk
conf/i386-pc.rmk
conf/powerpc-ieee1275.mk
conf/powerpc-ieee1275.rmk
disk/loopback.c
font/manager.c
fs/affs.c
fs/ext2.c
fs/fat.c
fs/hfs.c
fs/iso9660.c
fs/jfs.c
fs/minix.c
fs/sfs.c
fs/ufs.c
fs/xfs.c
geninit.sh [new file with mode: 0644]
geninitheader.sh [new file with mode: 0644]
hello/hello.c
include/grub/dl.h
loader/i386/pc/chainloader.c
loader/i386/pc/chainloader_normal.c
loader/i386/pc/linux.c
loader/i386/pc/linux_normal.c
loader/i386/pc/multiboot.c
loader/i386/pc/multiboot_normal.c
loader/powerpc/ieee1275/linux.c
loader/powerpc/ieee1275/linux_normal.c
normal/main.c
partmap/amiga.c
partmap/apple.c
partmap/pc.c
partmap/sun.c
term/i386/pc/serial.c
term/i386/pc/vesafb.c
term/i386/pc/vga.c
term/terminfo.c
util/grub-emu.c

index 6dc676827d8d09f2382001284d432363d0e1d3f8..05fdd9ed802c288fd4b157d21412662569a9634d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,76 @@
+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
index 317af3672473411fb8965ef60b3ee6e6edac1e49..12cbef7182c3af753257e19278a6e2fb359d80da 100644 (file)
@@ -38,29 +38,14 @@ grub_cmd_boot (struct grub_arg_list *state __attribute__ ((unused)),
 
 \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 */
index 0c3a2dda34936ae5f82be0b2c6c87388e4f6c53c..562d7790c083f2bcd85e4d8b88b317e5f28b4ebb 100644 (file)
@@ -70,29 +70,14 @@ grub_cmd_cat (struct grub_arg_list *state __attribute__ ((unused)),
 }
 
 \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 */
index 05b5582bbc25e3754ffb07860947661c5e485a2e..4bc420c4e8adbafbb36c7a74c4fbbfa3bfaaa19e 100644 (file)
@@ -102,29 +102,14 @@ cleanup:
 }
 
 \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 */
index 6b46f2368364054fafe2ab6d9b7d036f236c072f..2561cd127a664e76e45e994f9261844dea2be9a1 100644 (file)
@@ -39,22 +39,7 @@ grub_cmd_configfile (struct grub_arg_list *state __attribute__ ((unused)),
 }
 
 \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,
@@ -62,8 +47,7 @@ GRUB_MOD_INIT
                         "Load another config file.", 0);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(configfile)
 {
   grub_unregister_command ("configfile");
 }
-#endif /* ! GRUB_UTIL */
index 880a0a85c4e8c0394b6f515115395a266f41ac66..43a95a0a771dae9ecdf1abd90a6da8578587bf61 100644 (file)
@@ -44,29 +44,14 @@ grub_cmd_default (struct grub_arg_list *state __attribute__ ((unused)),
 
 \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 */
index cd937755111e626491531e100363e2f9d943e707..ab128a4314851277748c0acf4300b9f00ddf0680 100644 (file)
@@ -94,29 +94,14 @@ grub_cmd_help (struct grub_arg_list *state __attribute__ ((unused)), int argc,
 
 
 \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 */
index c559ed3ad12719a594ece4c4e9a78c7a5759ace6..fe8019030fcb43ee5decd160c6cdfc6af4069e6d 100644 (file)
@@ -44,22 +44,7 @@ grub_cmd_halt (struct grub_arg_list *state,
 
 
 \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,
@@ -67,8 +52,7 @@ GRUB_MOD_INIT
                         "Halt the system, if possible using APM", options);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(halt)
 {
   grub_unregister_command ("halt");
 }
-#endif /* ! GRUB_UTIL */
index 27ed192ea79f86e32fa4df5b8c1b3f259447fa78..22cb8ae36d0b24534fb231f167388ca4f3b3b3c1 100644 (file)
@@ -35,29 +35,14 @@ grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
 
 
 \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 */
index 06b9b320042c0e11983029b2fd37b120581ca484..c87e8674667b388bc502a7231bc9b9a4aa2fd161 100644 (file)
@@ -146,7 +146,7 @@ grub_cmd_vbeinfo (struct grub_arg_list *state __attribute__ ((unused)),
   return 0;
 }
 
-GRUB_MOD_INIT
+GRUB_MOD_INIT(vbeinfo)
 {
   (void) mod;                  /* To stop warning.  */
   grub_register_command ("vbeinfo",
@@ -157,7 +157,7 @@ GRUB_MOD_INIT
                          0);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(vbeinfo)
 {
   grub_unregister_command ("vbeinfo");
 }
index 8e0a246b45a7ce46cda05d52ff8144bbc234d27f..cef6789428529f1e3c9e979be02301f98067bf05 100644 (file)
@@ -163,7 +163,7 @@ grub_cmd_vbetest (struct grub_arg_list *state __attribute__ ((unused)),
   return grub_errno;
 }
 
-GRUB_MOD_INIT
+GRUB_MOD_INIT(vbetest)
 {
   (void) mod;                  /* To stop warning.  */
   grub_register_command ("vbetest",
@@ -174,7 +174,7 @@ GRUB_MOD_INIT
                          0);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(vbetest)
 {
   grub_unregister_command ("vbetest");
 }
index 004acc16bf9637ba1d32e64c1c7b54b5ec9979d0..c0a02e4a0223e1f1c75daf8888de169b475df16c 100644 (file)
@@ -33,22 +33,7 @@ grub_cmd_halt (struct grub_arg_list *state __attribute__ ((unused)),
 }
 
 \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,
@@ -56,8 +41,7 @@ GRUB_MOD_INIT
                         " work on all firmware.", 0);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(ieee1275_halt)
 {
   grub_unregister_command ("halt");
 }
-#endif
index 90447703b9ab3a8dd0a5e4a217aaf0f93fc9bf34..10b3efbdcc1e38503a8c6a3c5b0d75f13be03a8a 100644 (file)
@@ -33,29 +33,14 @@ grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
 }
 
 \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
index ba7e4740e5dd3e1382da0a0ca737a0c4a692d7c6..4d30c9d9926aa5a2d88914dc54b3147294c546e0 100644 (file)
@@ -36,14 +36,14 @@ grub_cmd_suspend (struct grub_arg_list *state  __attribute__ ((unused)),
 }
 
 \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");
 }
index 96ac299a12cbb39366b65d31a18d25b468555f11..547e4b3252bee78a5655e5b41e2dd77e019d12a3 100644 (file)
@@ -228,22 +228,7 @@ grub_cmd_ls (struct grub_arg_list *state, int argc, char **args)
   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,
@@ -251,8 +236,7 @@ GRUB_MOD_INIT
                         "List devices and files.", options);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(ls)
 {
   grub_unregister_command ("ls");
 }
-#endif /* ! GRUB_UTIL */
index e07f13799540c5415d311a798b2f02a6a00efeac..19c239e5b74b5be2efce04ead4d1b7d1631e9e24 100644 (file)
@@ -148,26 +148,7 @@ grub_cmd_search (struct grub_arg_list *state, int argc, char **args)
   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,
@@ -179,8 +160,7 @@ GRUB_MOD_INIT
                         options);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(search)
 {
   grub_unregister_command ("search");
 }
-#endif /* ! GRUB_UTIL */
index b75fa65b142082a8ffec0a3a7fe333d3e74c34ff..8253edf2e239713afb5626032203464939e7626f 100644 (file)
@@ -1,7 +1,7 @@
 /* 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
@@ -71,29 +71,14 @@ grub_cmd_terminal (struct grub_arg_list *state __attribute__ ((unused)),
 }
 
 \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 */
index 9ee7abe6d2b772f29ea3840a1120f2f4ff3c4e0e..cb5061f1bb8cedf1d3276298d049be0f0b75e100 100644 (file)
@@ -55,24 +55,7 @@ grub_cmd_test (struct grub_arg_list *state __attribute__ ((unused)), int argc,
 
 
 \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,
@@ -81,9 +64,8 @@ GRUB_MOD_INIT
                         "test EXPRESSION", "Evaluate an expression", 0);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(test)
 {
   grub_unregister_command ("[");
   grub_unregister_command ("test");
 }
-#endif /* ! GRUB_UTIL */
index 6f80cb347f2eafac24c5ab6c03d4022ee7d1197a..c796aa8b08fbe9efd8d805304b292ccbf0203e4b 100644 (file)
@@ -42,29 +42,14 @@ grub_cmd_timeout (struct grub_arg_list *state __attribute__ ((unused)),
 
 \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 */
index 20afa077788f7306f7994e5cf1ecf5d531fe5bc6..2502019fcebba8e972a6313a3beffecde72e4485 100644 (file)
@@ -753,7 +753,7 @@ grub_probefs-fs_sfs.d: 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                            \
@@ -772,11 +772,11 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.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
@@ -1291,9 +1291,26 @@ grub_emu-util_i386_pc_misc.d: util/i386/pc/misc.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
index f2452668042746e04b16a535f091f2b874b2229e..7578ea4374101b73d1a3313c4a42606955e17c97 100644 (file)
@@ -85,7 +85,7 @@ grub_probefs_SOURCES = util/i386/pc/grub-probefs.c    \
        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                            \
@@ -104,10 +104,19 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.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
 
index c6396a45246fc3253d55d76162a1e1a3c8efca94..22161dd649afbb22bf86348ea21d9b034167a097 100644 (file)
@@ -89,11 +89,11 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.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
@@ -608,9 +608,26 @@ grub_emu-grub_script_tab.d: grub_script.tab.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          \
index b02cdee6ee8dde4579776d64bef772d9d0a0f97b..a121c921f38f52e3584374a700d65d23d1c9f83f 100644 (file)
@@ -59,10 +59,19 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.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          \
index ada10a752b957152b21c996fec5d5daeb1c5fb08..a19a83d565539c5c89b9e268b69ca6085ff05014 100644 (file)
@@ -240,24 +240,8 @@ static struct grub_disk_dev grub_loopback_dev =
   };
 
 \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,
@@ -266,9 +250,9 @@ GRUB_MOD_INIT
   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 */
+
index 22242b609023c9c46f814fa3f14d7927f032f0d2..a866116771df2de00f49beee3b78d299ed86970e 100644 (file)
@@ -232,7 +232,7 @@ font_command (struct grub_arg_list *state __attribute__ ((unused)),
   return 0;
 }
 
-GRUB_MOD_INIT
+GRUB_MOD_INIT(fontmanager)
 {
   (void) mod; /* Stop warning.  */
   grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH,
@@ -240,7 +240,7 @@ GRUB_MOD_INIT
                         "Specify one or more font files to display.", 0);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(fontmanager)
 {
   grub_unregister_command ("font");
 }
index e0adb2e5497bb46ad6d50bcfd19e224d87f62fac..de755ba99ba82768665e2548e52e9c9364c63543 100644 (file)
--- a/fs/affs.c
+++ b/fs/affs.c
@@ -553,27 +553,16 @@ static struct grub_fs grub_affs_fs =
     .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 */
+
index 56f583aada1350fa4bc37aa3d2729f88e3e0aeb5..842e87a2604177004a3fdb8a02c52d68a7650685 100644 (file)
--- a/fs/ext2.c
+++ b/fs/ext2.c
@@ -1,7 +1,7 @@
 /* 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
@@ -633,27 +633,15 @@ static struct grub_fs grub_ext2_fs =
     .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 */
index c3d04c30e2b081e9e612b54ecf516b76afb348ba..185d6d59132d988851ed4e5776c626cb257fefaa 100644 (file)
--- a/fs/fat.c
+++ b/fs/fat.c
@@ -808,27 +808,16 @@ static struct grub_fs grub_fat_fs =
     .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 */
+
index 0d8313b71f90a99082c7275377f9664fa7530c12..ac0c14a474f36a52ab96c23f83a6fabc3d4fb816 100644 (file)
--- a/fs/hfs.c
+++ b/fs/hfs.c
@@ -1,7 +1,7 @@
 /* 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
@@ -875,27 +875,15 @@ static struct grub_fs grub_hfs_fs =
     .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 */
index 6a2a1e3260943f8f1d358dfc4eb64a4f5de7ace6..1b49c238c1f0b1466e25b8e9e4e3344f781c8d54 100644 (file)
@@ -2,7 +2,7 @@
    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
@@ -764,27 +764,15 @@ static struct grub_fs grub_iso9660_fs =
     .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 */
index 0d9da5971dca2066d4ee858b33776fd707356278..a43eb6009e2ff61b1ccca029b471223fb1680a52 100644 (file)
--- a/fs/jfs.c
+++ b/fs/jfs.c
@@ -1,7 +1,7 @@
 /* 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
@@ -870,27 +870,15 @@ static struct grub_fs grub_jfs_fs =
     .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 */
index dc1489a0393b933beada8b3edaf79e2a44854045..e2112dd7ba0905ab5ec37cfaba70277c3d86a777 100644 (file)
@@ -597,27 +597,15 @@ static struct grub_fs grub_minix_fs =
     .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 */
index 23640e2d6aa6ecc7684df5baf1560addd850e8f7..ed68e08085cb068e4f26a4a9d9e6240605421eb8 100644 (file)
--- a/fs/sfs.c
+++ b/fs/sfs.c
@@ -605,27 +605,15 @@ static struct grub_fs grub_sfs_fs =
     .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 */
index 225b82c573fcae3dccfbd34509b71d5e4bac432f..0215d2c41fc26c90cbdb340d0deadc0faa346984 100644 (file)
--- a/fs/ufs.c
+++ b/fs/ufs.c
@@ -1,7 +1,7 @@
 /* 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
@@ -668,27 +668,16 @@ static struct grub_fs grub_ufs_fs =
     .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 */
+
index e7a1e7a946212da6300a189eb37bf7d047a77702..6992e662619706b55cd1e3499eced0d9c976bd45 100644 (file)
--- a/fs/xfs.c
+++ b/fs/xfs.c
@@ -689,27 +689,16 @@ static struct grub_fs grub_xfs_fs =
     .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 */
+
diff --git a/geninit.sh b/geninit.sh
new file mode 100644 (file)
index 0000000..8fc2148
--- /dev/null
@@ -0,0 +1,70 @@
+#! /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
diff --git a/geninitheader.sh b/geninitheader.sh
new file mode 100644 (file)
index 0000000..9e9f823
--- /dev/null
@@ -0,0 +1,43 @@
+#! /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;}'
index 32747344845fefd54a3f2c706163f73dab2a6adb..a0471383b22d543c981fca0896c92b84c99aad44 100644 (file)
@@ -35,14 +35,14 @@ grub_cmd_hello (struct grub_arg_list *state __attribute__ ((unused)),
   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");
 }
index aec2bd132b960dfdbaf84f2f0fd9940a128a717b..e2b7cbc6007f8db729f9fa703a2c6d2572440410 100644 (file)
 #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)
 
index ea2367c1a16b8396e978c89fb0d8fee95584e404..2ac94bf1de1ac43c8d7ff2fe90abc29785ea9099 100644 (file)
@@ -145,7 +145,7 @@ grub_rescue_cmd_chainloader (int argc, char *argv[])
 
 static const char loader_name[] = "chainloader";
 
-GRUB_MOD_INIT
+GRUB_MOD_INIT(chainloader)
 {
   grub_rescue_register_command (loader_name,
                                grub_rescue_cmd_chainloader,
@@ -153,7 +153,7 @@ GRUB_MOD_INIT
   my_mod = mod;
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(chainloader)
 {
   grub_rescue_unregister_command (loader_name);
 }
index 64542827e8f5759b6b573b23003e4f39cac1f403..9a83008527ed7e4d77309306a4f4a393b3ddcb1e 100644 (file)
@@ -42,7 +42,7 @@ chainloader_command (struct grub_arg_list *state,
   return grub_errno;
 }
 
-GRUB_MOD_INIT
+GRUB_MOD_INIT(chainloader_normal)
 {
   (void) mod; /* To stop warning.  */
   grub_register_command ("chainloader", chainloader_command,
@@ -51,7 +51,7 @@ GRUB_MOD_INIT
                         "Prepare to boot another boot loader.", options);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(chainloader_normal)
 {
   grub_unregister_command ("chainloader");
 }
index 48c59c79d344cbac15add55899e6d32f56f96716..eac0f1523679e1686d6af6926ac1c988beaef4dd 100644 (file)
@@ -368,7 +368,7 @@ grub_rescue_cmd_initrd (int argc, char *argv[])
 }
 
 
-GRUB_MOD_INIT
+GRUB_MOD_INIT(linux)
 {
   grub_rescue_register_command ("linux",
                                grub_rescue_cmd_linux,
@@ -379,7 +379,7 @@ GRUB_MOD_INIT
   my_mod = mod;
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(linux)
 {
   grub_rescue_unregister_command ("linux");
   grub_rescue_unregister_command ("initrd");
index 6207513db0d4a5aba258fe02251a9a8ca61671e3..6f08d0721846252acf7b0663861549b20c0670c2 100644 (file)
@@ -40,7 +40,7 @@ grub_normal_initrd_command (struct grub_arg_list *state __attribute__ ((unused))
   return grub_errno;
 }
 
-GRUB_MOD_INIT
+GRUB_MOD_INIT(linux_normal)
 {
   (void) mod; /* To stop warning.  */
   grub_register_command ("linux", grub_normal_linux_command,
@@ -54,7 +54,7 @@ GRUB_MOD_INIT
                         "Load an initrd.", 0);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(linux_normal)
 {
   grub_unregister_command ("linux");
   grub_unregister_command ("initrd");
index cdf3ba79831904d9818fdc69a4c0a8dc4057c7d7..114b27bb10c2b6576fb39e058fb99d05144a1948 100644 (file)
@@ -435,7 +435,7 @@ grub_rescue_cmd_module  (int argc, char *argv[])
 }
 
 
-GRUB_MOD_INIT
+GRUB_MOD_INIT(multiboot)
 {
   grub_rescue_register_command ("multiboot", grub_rescue_cmd_multiboot,
                                "load a multiboot kernel");
@@ -444,7 +444,7 @@ GRUB_MOD_INIT
   my_mod = mod;
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(multiboot)
 {
   grub_rescue_unregister_command ("multiboot");
   grub_rescue_unregister_command ("module");
index 9344b29960bcf4e9774a2b5937b21a814d198dca..d1f28eb5fa56d28b882acddcf2f103563e92ebd3 100644 (file)
@@ -40,7 +40,7 @@ grub_normal_cmd_module (struct grub_arg_list *state __attribute__ ((unused)),
   return grub_errno;
 }
 
-GRUB_MOD_INIT
+GRUB_MOD_INIT(multiboot_normal)
 {
   (void) mod; /* To stop warning.  */
   grub_register_command ("multiboot", grub_normal_cmd_multiboot,
@@ -54,7 +54,7 @@ GRUB_MOD_INIT
                         "Load a Multiboot module.", 0);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(multiboot_normal)
 {
   grub_unregister_command ("multiboot");
   grub_unregister_command ("module");
index 19a8cb5cd8eb42c9c05227e16517431da308b0a8..dd4cf3af5398c4ef81e320af48b19c21d64fb467 100644 (file)
@@ -307,7 +307,7 @@ grub_rescue_cmd_initrd (int argc, char *argv[])
 
 
 \f
-GRUB_MOD_INIT
+GRUB_MOD_INIT(linux)
 {
   grub_rescue_register_command ("linux", grub_rescue_cmd_linux,
                                "load a linux kernel");
@@ -316,7 +316,7 @@ GRUB_MOD_INIT
   my_mod = mod;
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(linux)
 {
   grub_rescue_unregister_command ("linux");
   grub_rescue_unregister_command ("initrd");
index 2f3623fe34f306d0d8e1b04b8d96cc8c91153f8f..d46b28a456d8206873a6d31dba294ccbb8717f4b 100644 (file)
@@ -43,7 +43,7 @@ grub_cmd_initrd (struct grub_arg_list *state  __attribute__ ((unused)),
   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,
@@ -54,7 +54,7 @@ GRUB_MOD_INIT
                         "Loads initrd", options);
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(linux_normal)
 {
   grub_unregister_command ("linux");
   grub_unregister_command ("initrd");
index 7ab178102aa50736c1b630c19ab71de7319cbdbf..a1b1a684b43eca56cafff7a6d01c9fa8e04466f2 100644 (file)
@@ -519,33 +519,11 @@ grub_rescue_cmd_normal (int argc, char *argv[])
     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);
 
@@ -557,9 +535,9 @@ GRUB_MOD_INIT
   grub_command_init ();
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(normal)
 {
   grub_set_history (0);
   grub_rescue_unregister_command ("normal");
 }
-#endif /* ! GRUB_UTIL */
+
index 90959449e873860475a91491a8df70a45890b403..98d67a7170e7a24d82beabd2ecc87b9fd791458c 100644 (file)
@@ -1,7 +1,7 @@
 /* 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
@@ -211,27 +211,15 @@ static struct grub_partition_map grub_amiga_partition_map =
     .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
index 8b934632b44fcb4dce08a056f9b03f910a575ecf..0cb83951c0a90e29c124a8852671aeb1338cbd87 100644 (file)
@@ -1,7 +1,7 @@
 /* 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
@@ -220,27 +220,16 @@ static struct grub_partition_map grub_apple_partition_map =
     .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
+
index abcd8df37482fedd34c2ce310aa5e9d68638f338..8a908b7dafcb10a706ae1819b67376c4eb1fde31 100644 (file)
@@ -296,27 +296,15 @@ static struct grub_partition_map grub_pc_partition_map =
     .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
index a65d4ff62f97bbe1ab5545e3f579672082530113..e2cde0a2e1ed413bf24b41487f79acc90434e6d6 100644 (file)
@@ -192,27 +192,16 @@ static struct grub_partition_map grub_sun_partition_map =
     .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
+
index 0f3f3dc2839e520e82ffbe35bf3c8ba40bf164c0..6558901bed2429d3a447338a892c7dd709b724c6 100644 (file)
@@ -616,7 +616,7 @@ grub_cmd_serial (struct grub_arg_list *state,
   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,
@@ -629,7 +629,7 @@ GRUB_MOD_INIT
   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. */
index b2f39d5688e5f9fb6d1a11f35b0b974792caf07c..9e1dab94c269931105e09d9869bfe8ccae52166c 100644 (file)
@@ -142,7 +142,7 @@ grub_virtual_screen_setup (grub_uint32_t width,
 }
 
 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;
@@ -200,7 +200,7 @@ grub_vesafb_init (void)
 }
 
 static grub_err_t
-grub_vesafb_fini (void)
+grub_vesafb_mod_fini (void)
 {
   grub_virtual_screen_free ();
 
@@ -589,8 +589,8 @@ grub_vesafb_setcursor (int on)
 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,
@@ -606,13 +606,13 @@ static struct grub_term grub_vesafb_term =
     .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);
 }
index a0b2b3c4583d760335caf2bf6259e04c361b7b4e..33a8f36b7ede8e18d95a0621281fe9e5a203fed1 100644 (file)
@@ -173,7 +173,7 @@ set_start_address (unsigned int start)
 }
 
 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);
@@ -188,7 +188,7 @@ grub_vga_init (void)
 }
 
 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);
@@ -578,8 +578,8 @@ grub_vga_setcursor (int on)
 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,
@@ -595,13 +595,15 @@ static struct grub_term grub_vga_term =
     .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);
 }
index c66a38d21616fa390946d65211f056ff48de1f07..87b17837130db0ab86b874bc10ba6f08efd2dd93 100644 (file)
@@ -174,7 +174,7 @@ grub_cmd_terminfo (struct grub_arg_list *state __attribute__ ((unused)),
     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,
@@ -182,7 +182,7 @@ GRUB_MOD_INIT
   grub_terminfo_set_current ("vt100");
 }
 
-GRUB_MOD_FINI
+GRUB_MOD_FINI(terminfo)
 {
   grub_unregister_command ("terminfo");
 }
index 193a28f2b1d20d5320bf9c78ac07f63274def776..99fc3d84385e2fd677d3acdbe083332ed513adab 100644 (file)
@@ -39,6 +39,8 @@
 #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"
@@ -189,74 +191,14 @@ main (int argc, char *argv[])
   
   /* 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 ();