* conf/Makefile.common (CPPFLAGS_KERNEL): Add -DGRUB_KERNEL=1.
* include/grub/dl.h (GRUB_MOD_INIT), (GRUB_MOD_FINI): Define functions when compiling for kernel.
This commit is contained in:
parent
ea899a5760
commit
af81ed880d
13 changed files with 27 additions and 93 deletions
|
@ -1,3 +1,9 @@
|
|||
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* conf/Makefile.common (CPPFLAGS_KERNEL): Add -DGRUB_KERNEL=1.
|
||||
* include/grub/dl.h (GRUB_MOD_INIT), (GRUB_MOD_FINI): Define
|
||||
functions when compiling for kernel.
|
||||
|
||||
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/lib/progress.c (grub_file_progress_hook_real): Cast to
|
||||
|
|
|
@ -74,7 +74,7 @@ endif
|
|||
|
||||
CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
||||
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -static-libgcc
|
||||
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
||||
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
|
||||
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
||||
if COND_CYGWIN
|
||||
STRIPFLAGS_KERNEL = -F elf32-i386 -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version
|
||||
|
|
|
@ -183,22 +183,14 @@ grub_cmd_boot (struct grub_command *cmd __attribute__ ((unused)),
|
|||
|
||||
static grub_command_t cmd_boot;
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
|
||||
void grub_boot_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(boot)
|
||||
#endif
|
||||
{
|
||||
cmd_boot =
|
||||
grub_register_command ("boot", grub_cmd_boot,
|
||||
0, N_("Boot an operating system."));
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
|
||||
void grub_boot_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(boot)
|
||||
#endif
|
||||
{
|
||||
grub_unregister_command (cmd_boot);
|
||||
}
|
||||
|
|
|
@ -293,21 +293,13 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
|
|||
|
||||
static grub_command_t cmd;
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
|
||||
void grub_keylayouts_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(keylayouts)
|
||||
#endif
|
||||
{
|
||||
cmd = grub_register_command ("keymap", grub_cmd_keymap,
|
||||
0, N_("Load a keyboard layout."));
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
|
||||
void grub_keylayouts_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(keylayouts)
|
||||
#endif
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
@ -646,22 +646,14 @@ static struct grub_term_input grub_at_keyboard_term =
|
|||
.getkey = grub_at_keyboard_getkey
|
||||
};
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
|
||||
void grub_at_keyboard_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(at_keyboard)
|
||||
#endif
|
||||
{
|
||||
grub_term_register_input ("at_keyboard", &grub_at_keyboard_term);
|
||||
grub_loader_register_preboot_hook (grub_at_fini_hw, grub_at_restore_hw,
|
||||
GRUB_LOADER_PREBOOT_HOOK_PRIO_CONSOLE);
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
|
||||
void grub_at_keyboard_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(at_keyboard)
|
||||
#endif
|
||||
{
|
||||
grub_keyboard_controller_fini (NULL);
|
||||
grub_term_unregister_input (&grub_at_keyboard_term);
|
||||
|
|
|
@ -1132,20 +1132,12 @@ grub_gfxterm_get_dimensions (unsigned *width, unsigned *height)
|
|||
*height = window.height;
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_COREBOOT)
|
||||
void grub_gfxterm_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(gfxterm)
|
||||
#endif
|
||||
{
|
||||
grub_term_register_output ("gfxterm", &grub_video_term);
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_COEBOOT)
|
||||
void grub_gfxterm_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(gfxterm)
|
||||
#endif
|
||||
{
|
||||
grub_term_unregister_output (&grub_video_term);
|
||||
}
|
||||
|
|
|
@ -270,15 +270,9 @@ static struct grub_term_output grub_vga_text_term =
|
|||
.progress_update_divisor = GRUB_PROGRESS_FAST
|
||||
};
|
||||
|
||||
/* FIXME: this is was too spaghetti. */
|
||||
|
||||
#ifndef MODE_MDA
|
||||
|
||||
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
|
||||
void grub_vga_text_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(vga_text)
|
||||
#endif
|
||||
{
|
||||
#ifdef GRUB_MACHINE_COREBOOT
|
||||
if (!grub_video_coreboot_fbtable)
|
||||
|
@ -286,11 +280,7 @@ GRUB_MOD_INIT(vga_text)
|
|||
grub_term_register_output ("vga_text", &grub_vga_text_term);
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
|
||||
void grub_vga_text_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(vga_text)
|
||||
#endif
|
||||
{
|
||||
grub_term_unregister_output (&grub_vga_text_term);
|
||||
}
|
||||
|
|
|
@ -379,11 +379,7 @@ grub_serial_unregister_driver (struct grub_serial_driver *driver)
|
|||
|
||||
static grub_extcmd_t cmd;
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
|
||||
void grub_serial_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(serial)
|
||||
#endif
|
||||
{
|
||||
cmd = grub_register_extcmd ("serial", grub_cmd_serial, 0,
|
||||
N_("[OPTIONS...]"),
|
||||
|
@ -410,11 +406,7 @@ GRUB_MOD_INIT(serial)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
|
||||
void grub_serial_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(serial)
|
||||
#endif
|
||||
{
|
||||
while (grub_serial_ports)
|
||||
grub_serial_unregister (grub_serial_ports);
|
||||
|
|
|
@ -763,13 +763,7 @@ grub_cmd_terminfo (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
|
||||
static grub_extcmd_t cmd;
|
||||
|
||||
#if defined (GRUB_MACHINE_IEEE1275) || defined (GRUB_MACHINE_MIPS_LOONGSON) \
|
||||
|| defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_ARC) \
|
||||
|| defined (GRUB_MACHINE_UBOOT)
|
||||
void grub_terminfo_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(terminfo)
|
||||
#endif
|
||||
{
|
||||
cmd = grub_register_extcmd ("terminfo", grub_cmd_terminfo, 0,
|
||||
N_("[[-a|-u|-v] [-g WxH] TERM [TYPE]]"),
|
||||
|
@ -777,11 +771,7 @@ GRUB_MOD_INIT(terminfo)
|
|||
options);
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_IEEE1275) || defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_ARC)
|
||||
void grub_terminfo_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(terminfo)
|
||||
#endif
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
@ -224,20 +224,12 @@ static struct grub_video_adapter grub_video_radeon_fuloong2e_adapter =
|
|||
.next = 0
|
||||
};
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
void grub_video_radeon_fuloong2e_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(video_radeon_fuloong2e)
|
||||
#endif
|
||||
{
|
||||
grub_video_register (&grub_video_radeon_fuloong2e_adapter);
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
void grub_video_radeon_fuloong2e_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(video_radeon_fuloong2e)
|
||||
#endif
|
||||
{
|
||||
grub_video_unregister (&grub_video_radeon_fuloong2e_adapter);
|
||||
}
|
||||
|
|
|
@ -437,20 +437,12 @@ static struct grub_video_adapter grub_video_sis315pro_adapter =
|
|||
.next = 0
|
||||
};
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
void grub_video_sis315pro_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(video_sis315pro)
|
||||
#endif
|
||||
{
|
||||
grub_video_register (&grub_video_sis315pro_adapter);
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
void grub_video_sis315pro_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(video_sis315pro)
|
||||
#endif
|
||||
{
|
||||
grub_video_unregister (&grub_video_sis315pro_adapter);
|
||||
}
|
||||
|
|
|
@ -796,20 +796,12 @@ static struct grub_video_adapter grub_video_sm712_adapter =
|
|||
.next = 0
|
||||
};
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
void grub_video_sm712_init (void)
|
||||
#else
|
||||
GRUB_MOD_INIT(video_sm712)
|
||||
#endif
|
||||
{
|
||||
grub_video_register (&grub_video_sm712_adapter);
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
void grub_video_sm712_fini (void)
|
||||
#else
|
||||
GRUB_MOD_FINI(video_sm712)
|
||||
#endif
|
||||
{
|
||||
grub_video_unregister (&grub_video_sm712_adapter);
|
||||
}
|
||||
|
|
|
@ -35,25 +35,38 @@
|
|||
*/
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#if !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
||||
|
||||
#ifndef GRUB_MOD_INIT
|
||||
|
||||
#if !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU) && !defined (GRUB_KERNEL)
|
||||
|
||||
#define GRUB_MOD_INIT(name) \
|
||||
static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
|
||||
static void \
|
||||
grub_mod_init (grub_dl_t mod __attribute__ ((unused)))
|
||||
#endif
|
||||
|
||||
#ifndef GRUB_MOD_FINI
|
||||
#define GRUB_MOD_FINI(name) \
|
||||
static void grub_mod_fini (void) __attribute__ ((used)); \
|
||||
static void \
|
||||
grub_mod_fini (void)
|
||||
#endif
|
||||
|
||||
#elif defined (GRUB_KERNEL)
|
||||
|
||||
#define GRUB_MOD_INIT(name) \
|
||||
static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
|
||||
void \
|
||||
grub_##name##_init (void) { grub_mod_init (0); } \
|
||||
static void \
|
||||
grub_mod_init (grub_dl_t mod __attribute__ ((unused)))
|
||||
|
||||
#define GRUB_MOD_FINI(name) \
|
||||
static void grub_mod_fini (void) __attribute__ ((used)); \
|
||||
void \
|
||||
grub_##name##_fini (void) { grub_mod_fini (); } \
|
||||
static void \
|
||||
grub_mod_fini (void)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef GRUB_MOD_INIT
|
||||
#define GRUB_MOD_INIT(name) \
|
||||
static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
|
||||
void grub_##name##_init (void); \
|
||||
|
@ -61,9 +74,7 @@ void \
|
|||
grub_##name##_init (void) { grub_mod_init (0); } \
|
||||
static void \
|
||||
grub_mod_init (grub_dl_t mod __attribute__ ((unused)))
|
||||
#endif
|
||||
|
||||
#ifndef GRUB_MOD_FINI
|
||||
#define GRUB_MOD_FINI(name) \
|
||||
static void grub_mod_fini (void) __attribute__ ((used)); \
|
||||
void grub_##name##_fini (void); \
|
||||
|
@ -71,6 +82,7 @@ void \
|
|||
grub_##name##_fini (void) { grub_mod_fini (); } \
|
||||
static void \
|
||||
grub_mod_fini (void)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue