Remove -DGRUB_UTIL when compiling grub-emu

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-07 04:23:44 +01:00
parent 1eebb21608
commit 2083672af1
14 changed files with 24 additions and 134 deletions

View file

@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
} }
/* Load modules. */ /* Load modules. */
#ifndef GRUB_UTIL #if GRUB_NO_MODULES
{ {
const char *prefix; const char *prefix;
prefix = grub_env_get ("prefix"); prefix = grub_env_get ("prefix");

View file

@ -1,7 +1,7 @@
# -*- makefile -*- # -*- makefile -*-
COMMON_LDFLAGS += -nostdlib COMMON_LDFLAGS += -nostdlib
COMMON_CFLAGS += -DGRUB_UTIL=1 COMMON_CFLAGS +=
# Used by various components. These rules need to precede them. # Used by various components. These rules need to precede them.
script/lexer.c_DEPENDENCIES = grub_script.tab.h script/lexer.c_DEPENDENCIES = grub_script.tab.h
@ -21,7 +21,7 @@ kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
util/hostdisk.c util/getroot.c \ util/hostdisk.c util/getroot.c \
\ \
grub_emu_init.c gnulib/progname.c grub_emu_init.c gnulib/progname.c
kernel_img_CFLAGS = $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 kernel_img_CFLAGS = $(CPPFLAGS) $(CFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
TARGET_NO_STRIP = yes TARGET_NO_STRIP = yes
TARGET_NO_DYNAMIC_MODULES = yes TARGET_NO_DYNAMIC_MODULES = yes

View file

@ -265,7 +265,7 @@ grub_efiemu_autocore (void)
grub_free (filename); grub_free (filename);
if (err) if (err)
return err; return err;
#ifndef GRUB_UTIL #ifndef GRUB_MACHINE_EMU
err = grub_machine_efiemu_init_tables (); err = grub_machine_efiemu_init_tables ();
if (err) if (err)
return err; return err;
@ -313,7 +313,7 @@ grub_cmd_efiemu_load (grub_command_t cmd __attribute__ ((unused)),
err = grub_efiemu_load_file (args[0]); err = grub_efiemu_load_file (args[0]);
if (err) if (err)
return err; return err;
#ifndef GRUB_UTIL #ifndef GRUB_MACHINE_EMU
err = grub_machine_efiemu_init_tables (); err = grub_machine_efiemu_init_tables ();
if (err) if (err)
return err; return err;

View file

@ -281,7 +281,7 @@ grub_efiemu_mmap_init (void)
// the place for memory used by efiemu itself // the place for memory used by efiemu itself
mmap_reserved_size = GRUB_EFI_MAX_MEMORY_TYPE + 1; mmap_reserved_size = GRUB_EFI_MAX_MEMORY_TYPE + 1;
#ifndef GRUB_UTIL #ifndef GRUB_MACHINE_EMU
grub_machine_mmap_iterate (bounds_hook); grub_machine_mmap_iterate (bounds_hook);
#endif #endif
@ -394,7 +394,7 @@ grub_efiemu_mmap_fill (void)
} }
} }
#ifndef GRUB_UTIL #ifndef GRUB_MACHINE_EMU
grub_machine_mmap_iterate (fill_hook); grub_machine_mmap_iterate (fill_hook);
#endif #endif

View file

@ -91,7 +91,12 @@ grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod); int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
void grub_dl_unload_unneeded (void); void grub_dl_unload_unneeded (void);
void grub_dl_unload_all (void); void grub_dl_unload_all (void);
#ifdef GRUB_UTIL #if defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
#define GRUB_NO_MODULES 1
#else
#define GRUB_NO_MODULES 0
#endif
#if GRUB_NO_MODULES
static inline int static inline int
grub_dl_ref (grub_dl_t mod) grub_dl_ref (grub_dl_t mod)
{ {
@ -116,7 +121,7 @@ grub_err_t grub_dl_register_symbol (const char *name, void *addr,
grub_err_t grub_arch_dl_check_header (void *ehdr); grub_err_t grub_arch_dl_check_header (void *ehdr);
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr); grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
#if defined (_mips) && ! defined (GRUB_UTIL) #if defined (_mips) && ! defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
#define GRUB_LINKER_HAVE_INIT 1 #define GRUB_LINKER_HAVE_INIT 1
void grub_arch_dl_init_linker (void); void grub_arch_dl_init_linker (void);
#endif #endif

View file

@ -36,7 +36,7 @@ void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size); void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
/* For debugging. */ /* For debugging. */
#if defined(MM_DEBUG) && !defined(GRUB_UTIL) #if defined(MM_DEBUG) && !defined(GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
/* Set this variable to 1 when you want to trace all memory function calls. */ /* Set this variable to 1 when you want to trace all memory function calls. */
extern int EXPORT_VAR(grub_mm_debug); extern int EXPORT_VAR(grub_mm_debug);

View file

@ -1,70 +0,0 @@
/* multiboot2.h - multiboot2 header file with grub definitions. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2007 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 3 of the License, or
* (at your option) any later version.
*
* GRUB 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MULTIBOOT2_HEADER
#define GRUB_MULTIBOOT2_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
#include <grub/elf.h>
#ifndef GRUB_UTIL
typedef grub_uint32_t uint32_t;
typedef grub_uint64_t uint64_t;
#define __WORDSIZE GRUB_TARGET_WORDSIZE
#endif
struct multiboot2_tag_header;
grub_err_t
grub_mb2_tag_alloc (grub_addr_t *addr, int key, grub_size_t len);
grub_err_t
grub_mb2_tags_arch_create (void);
void
grub_mb2_arch_boot (grub_addr_t entry, void *tags);
void
grub_mb2_arch_unload (struct multiboot2_tag_header *tags);
grub_err_t
grub_mb2_arch_elf32_hook (Elf32_Phdr *phdr, grub_addr_t *addr, int *do_load);
grub_err_t
grub_mb2_arch_elf64_hook (Elf64_Phdr *phdr, grub_addr_t *addr, int *do_load);
grub_err_t
grub_mb2_arch_module_alloc (grub_size_t size, grub_addr_t *addr);
grub_err_t
grub_mb2_arch_module_free (grub_addr_t addr, grub_size_t size);
void
grub_multiboot2 (int argc, char *argv[]);
void
grub_module2 (int argc, char *argv[]);
#define for_each_tag(tag, tags) \
for (tag = tags; \
tag && tag->key != MULTIBOOT2_TAG_END; \
tag = (struct multiboot2_tag_header *)((char *)tag + tag->len))
#endif /* ! GRUB_MULTIBOOT2_HEADER */

View file

@ -110,37 +110,4 @@ void read_terminal_list (void);
void grub_set_more (int onoff); void grub_set_more (int onoff);
#ifdef GRUB_UTIL
void grub_normal_init (void);
void grub_normal_fini (void);
void grub_hello_init (void);
void grub_hello_fini (void);
void grub_ls_init (void);
void grub_ls_fini (void);
void grub_cat_init (void);
void grub_cat_fini (void);
void grub_boot_init (void);
void grub_boot_fini (void);
void grub_cmp_init (void);
void grub_cmp_fini (void);
void grub_terminal_init (void);
void grub_terminal_fini (void);
void grub_loop_init (void);
void grub_loop_fini (void);
void grub_help_init (void);
void grub_help_fini (void);
void grub_halt_init (void);
void grub_halt_fini (void);
void grub_reboot_init (void);
void grub_reboot_fini (void);
void grub_configfile_init (void);
void grub_configfile_fini (void);
void grub_search_init (void);
void grub_search_fini (void);
void grub_test_init (void);
void grub_test_fini (void);
void grub_blocklist_init (void);
void grub_blocklist_fini (void);
#endif
#endif /* ! GRUB_NORMAL_HEADER */ #endif /* ! GRUB_NORMAL_HEADER */

View file

@ -83,20 +83,6 @@ void EXPORT_FUNC(grub_partition_map_register) (grub_partition_map_t partmap);
void EXPORT_FUNC(grub_partition_map_unregister) (grub_partition_map_t partmap); void EXPORT_FUNC(grub_partition_map_unregister) (grub_partition_map_t partmap);
#ifdef GRUB_UTIL
void grub_msdos_partition_map_init (void);
void grub_msdos_partition_map_fini (void);
void grub_amiga_partition_map_init (void);
void grub_amiga_partition_map_fini (void);
void grub_apple_partition_map_init (void);
void grub_apple_partition_map_fini (void);
void grub_sun_partition_map_init (void);
void grub_sun_partition_map_fini (void);
void grub_gpt_partition_map_init (void);
void grub_gpt_partition_map_fini (void);
void grub_apple_partition_map_init (void);
void grub_apple_partition_map_fini (void);
#endif
static inline grub_disk_addr_t static inline grub_disk_addr_t
grub_partition_get_start (const grub_partition_t p) grub_partition_get_start (const grub_partition_t p)

View file

@ -68,7 +68,7 @@
typedef grub_uint32_t grub_pci_id_t; typedef grub_uint32_t grub_pci_id_t;
#ifdef GRUB_UTIL #ifdef GRUB_MACHINE_EMU
#include <grub/pciutils.h> #include <grub/pciutils.h>
#else #else
typedef grub_uint32_t grub_pci_address_t; typedef grub_uint32_t grub_pci_address_t;

View file

@ -469,7 +469,7 @@ grub_dl_resolve_dependencies (grub_dl_t mod, Elf_Ehdr *e)
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
#ifndef GRUB_UTIL #if !GRUB_NO_MODULES
int int
grub_dl_ref (grub_dl_t mod) grub_dl_ref (grub_dl_t mod)
{ {

View file

@ -1390,7 +1390,7 @@ grub_cmd_xnu_splash (grub_extcmd_t cmd,
} }
#ifndef GRUB_UTIL #ifndef GRUB_MACHINE_EMU
static grub_err_t static grub_err_t
grub_cmd_xnu_resume (grub_command_t cmd __attribute__ ((unused)), grub_cmd_xnu_resume (grub_command_t cmd __attribute__ ((unused)),
int argc, char *args[]) int argc, char *args[])
@ -1444,7 +1444,7 @@ GRUB_MOD_INIT(xnu)
N_("Load a splash image for XNU."), N_("Load a splash image for XNU."),
xnu_splash_cmd_options); xnu_splash_cmd_options);
#ifndef GRUB_UTIL #ifndef GRUB_MACHINE_EMU
cmd_resume = grub_register_command ("xnu_resume", grub_cmd_xnu_resume, cmd_resume = grub_register_command ("xnu_resume", grub_cmd_xnu_resume,
0, N_("Load XNU hibernate image.")); 0, N_("Load XNU hibernate image."));
#endif #endif
@ -1456,7 +1456,7 @@ GRUB_MOD_INIT(xnu)
GRUB_MOD_FINI(xnu) GRUB_MOD_FINI(xnu)
{ {
#ifndef GRUB_UTIL #ifndef GRUB_MACHINE_EMU
grub_unregister_command (cmd_resume); grub_unregister_command (cmd_resume);
#endif #endif
grub_unregister_command (cmd_mkext); grub_unregister_command (cmd_mkext);

View file

@ -157,8 +157,6 @@ main (int argc, char *argv[])
set_program_name (argv[0]); set_program_name (argv[0]);
grub_util_init_nls ();
while ((opt = getopt_long (argc, argv, "r:d:m:vH:hV", options, 0)) != -1) while ((opt = getopt_long (argc, argv, "r:d:m:vH:hV", options, 0)) != -1)
switch (opt) switch (opt)
{ {

View file

@ -104,6 +104,7 @@ grub_util_error (const char *fmt, ...)
exit (1); exit (1);
} }
#ifdef GRUB_UTIL
int int
grub_err_printf (const char *fmt, ...) grub_err_printf (const char *fmt, ...)
{ {
@ -116,6 +117,7 @@ grub_err_printf (const char *fmt, ...)
return ret; return ret;
} }
#endif
void * void *
xmalloc (size_t size) xmalloc (size_t size)
@ -598,6 +600,7 @@ make_system_path_relative_to_its_root (const char *path)
return buf3; return buf3;
} }
#ifdef GRUB_UTIL
void void
grub_util_init_nls (void) grub_util_init_nls (void)
{ {
@ -607,3 +610,4 @@ grub_util_init_nls (void)
textdomain (PACKAGE); textdomain (PACKAGE);
#endif /* ENABLE_NLS */ #endif /* ENABLE_NLS */
} }
#endif