pull-in emu-lite

This commit is contained in:
BVK Chaitanya 2010-06-01 09:12:01 +05:30
commit fe16b84557
9 changed files with 66 additions and 20 deletions

View file

@ -1,6 +1,7 @@
# -*- makefile -*-
ifeq ($(target_cpu), sparc64)
COMMON_CFLAGS += -mno-app-regs
COMMON_LDFLAGS += -mno-relax
endif
@ -22,14 +23,6 @@ kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-char-subscripts -Wn
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
TARGET_NO_STRIP = yes
noinst_MODULES = emu-full.mod
emu_full_mod_SOURCES = kern/emu/full.c
emu_full_mod_CFLAGS = $(COMMON_CFLAGS)
noinst_MODULES = emu-lite.mod
emu_lite_mod_SOURCES = kern/emu/lite.c kern/emu/cache.S symlist.c
emu_lite_mod_CFLAGS = $(COMMON_CFLAGS)
# For halt.mod.
pkglib_MODULES += halt.mod
halt_mod_SOURCES = commands/halt.c
@ -45,7 +38,7 @@ endif
grub_emu_LDFLAGS = $(LIBCURSES)
ifeq ($(target_cpu), sparc64)
grub_emu_LDFLAGS += -m64 -mno-relax
grub_emu_LDFLAGS += -m64 -melf64_sparc -mno-relax
endif
ifeq ($(enable_grub_emu_usb), yes)
@ -108,12 +101,28 @@ grub_emu_init.o: grub_emu_init.c grub_emu_init.h
rm -f $@; $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"grub_init.c\" -c -o $@ $<
CLEANFILES += grub_emu_init.o
kern_emu_lite.o: kern/emu/lite.c
$(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/lite.c\" -c -o $@ $<
CLEANFILES += kern_emu_lite.o
kern_emu_full.o: kern/emu/full.c
$(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/full.c\" -c -o $@ $<
CLEANFILES += kern_emu_full.o
kern_emu_cache.o: kern/emu/cache.S
$(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(TARGET_ASFLAGS) -DGRUB_FILE=\"kern/emu/cache.S\" -c -o $@ $<
CLEANFILES += kern_emu_cache.o
symlist.o: symlist.c
$(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"symlist.c\" -c -o $@ $<
CLEANFILES += symlist.o
CLEANFILES += grub-emu-lite
grub-emu-lite: $(pkglib_PROGRAMS) emu-lite.mod
grub-emu-lite: kern_emu_lite.o kern_emu_cache.o symlist.o kernel.img
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
GRUB_EMU_LITE=grub-emu-lite
CLEANFILES += grub-emu
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS) emu-full.mod grub_emu_init.o
grub-emu: $(PREMODFILES) kern_emu_full.o grub_emu_init.o kernel.img
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
GRUB_EMU=grub-emu

View file

@ -338,7 +338,7 @@ find_partition_start (const char *dev)
struct hd_geometry hdg;
# else /* defined(__NetBSD__) */
struct disklabel label;
int index;
int p_index;
# endif /* !defined(__NetBSD__) */
# ifdef HAVE_DEVICE_MAPPER
@ -435,15 +435,15 @@ devmapper_fail:
# if !defined(__NetBSD__)
return hdg.start;
# else /* defined(__NetBSD__) */
index = dev[strlen(dev) - 1] - 'a';
p_index = dev[strlen(dev) - 1] - 'a';
if (index >= label.d_npartitions)
if (p_index >= label.d_npartitions)
{
grub_error (GRUB_ERR_BAD_DEVICE,
"no disk label entry for `%s'", dev);
return 0;
}
return (grub_disk_addr_t) label.d_partitions[index].p_offset;
return (grub_disk_addr_t) label.d_partitions[p_index].p_offset;
# endif /* !defined(__NetBSD__) */
}
#endif /* __linux__ || __CYGWIN__ */

View file

@ -185,7 +185,8 @@ canonicalize_file_name (const char *path)
char *ret;
#ifdef PATH_MAX
ret = xmalloc (PATH_MAX);
(void) realpath (path, ret);
if (!realpath (path, ret))
return NULL;
#else
ret = realpath (path, NULL);
#endif

View file

@ -1058,7 +1058,7 @@ grub_abort (void)
void abort (void) __attribute__ ((alias ("grub_abort")));
#endif
#if defined(NEED_ENABLE_EXECUTE_STACK) && !defined(GRUB_UTIL)
#if defined(NEED_ENABLE_EXECUTE_STACK) && !defined(GRUB_UTIL) && !defined(GRUB_MACHINE_EMU)
/* Some gcc versions generate a call to this function
in trampolines for nested functions. */
void __enable_execute_stack (void *addr __attribute__ ((unused)))