Merge emu-mod into emu-modload

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-07 17:52:11 +01:00
commit b77ab1aaa9
8 changed files with 82 additions and 9 deletions

View file

@ -1,3 +1,13 @@
2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/multiboot2.h: Remove leftover file.
* include/grub/normal.h [GRUB_UTIL]: Remove leftover declarations.
* include/grub/partition.h [GRUB_UTIL]: Likewise.
2010-02-07 Yves Blusseau <blusseau@zetam.org>
* gnulib/getdelim.c: add missing header (type ssize_t must be defined).
2010-02-07 Vladimir Serbinenko <phcoder@gmail.com> 2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
Fix warnings in grub-emu when compiling with maximum warning options. Fix warnings in grub-emu when compiling with maximum warning options.

57
ChangeLog.emu-mod Normal file
View file

@ -0,0 +1,57 @@
2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
Compile parts of grub-emu as modules.
* Makefile.in (TARGET_CPPFLAGS) [emu]: Remove -nostdinc -isystem.
(pkglib_DATA) [emu]: Remove moddep.lst command.lst fs.lst
partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst.
(all-local): Add $(GRUB_EMU).
(install-local): Install $(GRUB_EMU).
(uninstall): Uninstall $(GRUB_EMU).
* commands/parttool.c: Replace GRUB_UTIL with GRUB_NO_MODULES.
* kern/dl.c: Likewise.
* commands/sleep.c: Not include machine/time.h.
* conf/any-emu.rmk (COMMON_LDFLAGS): New variable.
(COMMON_CFLAGS): Likewise.
(sbin_UTILITIES): Remove grub-emu.
(grub_emu_SOURCES): Removed.
(kernel_img_RELOCATABLE): New variable.
(pkglib_PROGRAMS): Add kernel.img.
(kernel_img_SOURCES): New variable
(kernel_img_CFLAGS): Likewise.
(kernel_img_LDFLAGS): Likewise.
(TARGET_NO_STRIP): Likewise.
(TARGET_NO_DYNAMIC_MODULES): Likewise.
(pkglib_MODULES): Add progname.mod, hostfs.mod, host.mod, reboot.mod,
halt.mod, cpuid.mod, usb.mod, sdl.mod and pci.mod.
(grub-emu): New target.
(GRUB_EMU): New variable.
* configure.ac: Whitelist -emu as possible x86_64 architecture.
* efiemu/main.c: Replace GRUB_UTIL with GRUB_MACHINE_EMU.
* loader/xnu.c: Likewise.
* include/grub/pci.h: Likewise.
* genemuinit.sh: New file.
* genemuinitheader.sh: Likewise.
* genmk.rb: Don't strip if TARGET_NO_STRIP is yes.
Support TARGET_NO_DYNAMIC_MODULES.
* include/grub/dl.h (GRUB_NO_MODULES): New variable.
* commands/search.c: Fix GRUB_MOD_INIT and GRUB_MOD_FINI arguments.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* partmap/acorn.c: Likewise.
* partmap/amiga.c: Likewise.
* partmap/apple.c: Likewise.
* partmap/gpt.c: Likewise.
* partmap/msdos.c: Likewise.
* partmap/sun.c: Likewise.
* parttool/msdospart.c: Likewise.
* term/gfxterm.c: Likewise.
* video/bitmap.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* video/video.c: Likewise.
* util/grub-emu.c (read_command_list): Removed.
(main): Don't call util_init_nls.
* util/misc.c (grub_err_printf) [!GRUB_UTIL]: Removed.
(grub_util_init_nls) [!GRUB_UTIL]: Likewise.

View file

@ -90,8 +90,10 @@ TARGET_ASFLAGS = @TARGET_ASFLAGS@
TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@ TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
TARGET_APPLE_CC = @TARGET_APPLE_CC@ TARGET_APPLE_CC = @TARGET_APPLE_CC@
OBJCONV = @OBJCONV@ OBJCONV = @OBJCONV@
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \ TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include -Wall -W
-Wall -W ifneq ($(platform), emu)
TARGET_CPPFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include)
endif
TARGET_LDFLAGS = @TARGET_LDFLAGS@ TARGET_LDFLAGS = @TARGET_LDFLAGS@
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@ TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
TARGET_IMG_LDFLAGS = @TARGET_IMG_LDFLAGS@ TARGET_IMG_LDFLAGS = @TARGET_IMG_LDFLAGS@

View file

@ -1,12 +1,11 @@
# -*- makefile -*- # -*- makefile -*-
COMMON_LDFLAGS += -nostdlib COMMON_LDFLAGS += -nostdlib
COMMON_CFLAGS += COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) -fno-builtin
# 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
#sbin_UTILITIES += grub-emu
kernel_img_RELOCATABLE = yes kernel_img_RELOCATABLE = yes
pkglib_PROGRAMS = kernel.img pkglib_PROGRAMS = kernel.img
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \ kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
@ -37,7 +36,6 @@ endif
endif endif
else else
kernel_img_SOURCES += grub_emu_init.c kernel_img_SOURCES += grub_emu_init.c
grub_emu_init.c_DEPENDENCIES = grub_emu_init.h
endif endif
# For boot.mod. # For boot.mod.
@ -79,7 +77,7 @@ endif
ifeq ($(enable_grub_emu_sdl), yes) ifeq ($(enable_grub_emu_sdl), yes)
pkglib_MODULES += sdl.mod pkglib_MODULES += sdl.mod
sdl_mod_SOURCES = util/sdl.c sdl_mod_SOURCES = util/sdl.c
sdl_mod_CFLAGS = $(COMMON_CFLAGS) sdl_mod_CFLAGS =
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS) sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
grub_emu_LDFLAGS += $(LIBSDL) grub_emu_LDFLAGS += $(LIBSDL)
kernel_img_HEADERS += sdl.h kernel_img_HEADERS += sdl.h
@ -106,7 +104,7 @@ grub_emu_init.h: genemuinitheader.sh $(pkglib_MODULES)
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@ rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
DISTCLEANFILES += grub_emu_init.h DISTCLEANFILES += grub_emu_init.h
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES) grub_emu_init.c: genemuinit.sh $(pkglib_MODULES) grub_emu_init.h
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@ rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
DISTCLEANFILES += grub_emu_init.c DISTCLEANFILES += grub_emu_init.c

View file

@ -27,6 +27,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <unistd.h>
#ifndef SSIZE_MAX #ifndef SSIZE_MAX
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))

View file

@ -150,6 +150,10 @@ void grub_hostfs_init (void);
void grub_hostfs_fini (void); void grub_hostfs_fini (void);
void grub_host_init (void); void grub_host_init (void);
void grub_host_fini (void); void grub_host_fini (void);
#if GRUB_NO_MODULES
void grub_init_all (void);
void grub_fini_all (void);
#endif
int int
main (int argc, char *argv[]) main (int argc, char *argv[])

View file

@ -198,7 +198,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
fd = open (map[drive].device, O_RDONLY); fd = open (map[drive].device, O_RDONLY);
if (fd == -1) 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 defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
if (fstat (fd, &st) < 0 || ! S_ISCHR (st.st_mode)) if (fstat (fd, &st) < 0 || ! S_ISCHR (st.st_mode))
@ -244,7 +244,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
# warning "No special routine to get the size of a block device is implemented for your OS. This is not possibly fatal." # warning "No special routine to get the size of a block device is implemented for your OS. This is not possibly fatal."
#endif #endif
if (stat (map[drive].device, &st) < 0) 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; disk->total_sectors = st.st_size >> GRUB_DISK_SECTOR_BITS;

View file

@ -35,6 +35,7 @@
#endif #endif
#include <grub/kernel.h> #include <grub/kernel.h>
#include <grub/dl.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/cache.h> #include <grub/cache.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>