# -*- makefile -*-
COMMON_LDFLAGS += -nostdlib
-COMMON_CFLAGS +=
+COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include)
# Used by various components. These rules need to precede them.
script/lexer.c_DEPENDENCIES = grub_script.tab.h
util/console.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
- grub_emu_init.c
-kernel_img_CFLAGS = $(CPPFLAGS) $(CFLAGS)
+ grub_emu_init.c gnulib/progname.c util/hostfs.c disk/host.c
+kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/gnulib
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
TARGET_NO_STRIP = yes
TARGET_NO_DYNAMIC_MODULES = yes
-# progname.c always has warnings. Compile it separately.
-pkglib_MODULES += progname.mod
-progname_mod_SOURCES = gnulib/progname.c
-progname_mod_CFLAGS = $(COMMON_CFLAGS) -Wno-error
-progname_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
-# For hostfs.mod.
-pkglib_MODULES += hostfs.mod
-hostfs_mod_SOURCES = util/hostfs.c
-hostfs_mod_CFLAGS = $(COMMON_CFLAGS)
-hostfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
-# For host.mod.
-pkglib_MODULES += host.mod
-host_mod_SOURCES = disk/host.c
-host_mod_CFLAGS = $(COMMON_CFLAGS)
-host_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
# For reboot.mod.
pkglib_MODULES += reboot.mod
reboot_mod_SOURCES = commands/reboot.c
ifeq ($(enable_grub_emu_sdl), yes)
pkglib_MODULES += sdl.mod
sdl_mod_SOURCES = util/sdl.c
+sdl_mod_CFLAGS =
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
grub_emu_LDFLAGS += $(LIBSDL)
endif
}
\f
+void grub_hostfs_init (void);
+void grub_hostfs_fini (void);
+void grub_host_init (void);
+void grub_host_fini (void);
+
int
main (int argc, char *argv[])
{
signal (SIGINT, SIG_IGN);
grub_console_init ();
+ grub_host_init ();
+ grub_hostfs_init ();
/* XXX: This is a bit unportable. */
grub_util_biosdisk_init (dev_map);
grub_main ();
grub_fini_all ();
+ grub_hostfs_fini ();
+ grub_host_fini ();
grub_machine_fini ();
drive = find_grub_drive (name);
if (drive < 0)
- return grub_error (GRUB_ERR_BAD_DEVICE,
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"no mapping exists for `%s'", name);
disk->has_partitions = 1;
fd = open (map[drive].device, O_RDONLY);
if (fd == -1)
- return grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' while attempting to get disk size", map[drive].device);
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot open `%s' while attempting to get disk size", map[drive].device);
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
if (fstat (fd, &st) < 0 || ! S_ISCHR (st.st_mode))
# warning "No special routine to get the size of a block device is implemented for your OS. This is not possibly fatal."
#endif
if (stat (map[drive].device, &st) < 0)
- return grub_error (GRUB_ERR_BAD_DEVICE, "cannot stat `%s'", map[drive].device);
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot stat `%s'", map[drive].device);
disk->total_sectors = st.st_size >> GRUB_DISK_SECTOR_BITS;