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,3 +1,31 @@
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
* util/grub-script-check.c (main): Ensure defined behaviour on empty
input files (in which case exit zero).
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
* kern/emu/misc.c (canonicalize_file_name): realpath can still
return NULL for various reasons even if it has a maximum-length
buffer: for example, there might be a symlink loop, or the path
might exceed PATH_MAX. If this happens, return NULL.
2010-05-27 Robert Millan <rmh@gnu.org>
* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Insert
partmap module to handle cross-partmap setups.
Reported by Orestes Mas. Gràcies!
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkrescue.in: Initialise override_dir rather than
assuming that it's unset or empty in the environment.
2010-05-26 Grégoire Sutre <gregoire.sutre@gmail.com>
* kern/emu/hostdisk.c (find_partition_start) [__NetBSD__]: Renamed
variable index into p_index to suppress a warning with -Wshadow.
2010-05-25 BVK Chaitanya <bvk.groups@gmail.com>
* INSTALL: Added flex >= 2.5.35 requirement.

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)))

View file

@ -129,7 +129,7 @@ rootdir=`mktemp -d`
isofile=`mktemp`
sh @abs_top_builddir@/grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage \
--override-directory=${builddir}/grub-core --output=${isofile} \
--root-directory=${rootdir} /boot/grub/grub.cfg=${cfgfile} \
boot/grub/grub.cfg=${cfgfile} \
/boot/grub/testcase.cfg=${source} >/dev/null 2>&1
rm -rf $rootdir

View file

@ -105,6 +105,11 @@ prepare_grub_to_access_device ()
echo "insmod ${module}"
done
partmap="`${grub_probe} --device ${device} --target=partmap`"
for module in ${partmap} ; do
echo "insmod ${module}"
done
fs="`${grub_probe} --device ${device} --target=fs`"
for module in ${fs} ; do
echo "insmod ${module}"

View file

@ -37,6 +37,7 @@ pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc
efi32_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi
efi64_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi
rom_directory=
override_dir=
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
# Usage: usage

View file

@ -75,7 +75,8 @@ main (int argc, char *argv[])
char *input;
FILE *file = 0;
int verbose = 0;
struct grub_script *script = 0;
int found_input = 0;
struct grub_script *script = NULL;
auto grub_err_t get_config_line (char **line, int cont);
grub_err_t get_config_line (char **line, int cont __attribute__ ((unused)))
@ -177,6 +178,7 @@ main (int argc, char *argv[])
get_config_line(&input, 0);
if (! input)
break;
found_input = 1;
script = grub_script_parse (input, get_config_line);
if (script)
@ -192,5 +194,5 @@ main (int argc, char *argv[])
grub_fini_all ();
if (file) fclose (file);
return (script == 0);
return (found_input && script == 0);
}