|
|
f96e0b |
From 02cf7c5e6af716ee3442d387780024c43cf84c5e Mon Sep 17 00:00:00 2001
|
|
|
f96e0b |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
Date: Sat, 27 Apr 2013 02:00:16 +0200
|
|
|
f96e0b |
Subject: [PATCH 360/482] Make 'make check' work on emu.
|
|
|
f96e0b |
|
|
|
f96e0b |
---
|
|
|
f96e0b |
ChangeLog | 4 +++
|
|
|
f96e0b |
grub-core/commands/parttool.c | 2 +-
|
|
|
f96e0b |
grub-core/gensymlist.sh | 2 +-
|
|
|
f96e0b |
grub-core/kern/dl.c | 3 +++
|
|
|
f96e0b |
grub-core/kern/emu/full.c | 12 ++-------
|
|
|
f96e0b |
grub-core/kern/emu/lite.c | 13 ++-------
|
|
|
f96e0b |
grub-core/kern/emu/main.c | 6 -----
|
|
|
f96e0b |
grub-core/normal/main.c | 2 +-
|
|
|
f96e0b |
include/grub/emu/misc.h | 2 --
|
|
|
f96e0b |
include/grub/misc.h | 6 ++---
|
|
|
f96e0b |
tests/cdboot_test.in | 2 ++
|
|
|
f96e0b |
tests/fddboot_test.in | 2 ++
|
|
|
f96e0b |
tests/hddboot_test.in | 2 ++
|
|
|
f96e0b |
tests/netboot_test.in | 2 ++
|
|
|
f96e0b |
tests/partmap_test.in | 8 +-----
|
|
|
f96e0b |
tests/util/grub-shell.in | 63 ++++++++++++++++++++++++++++++++++++++-----
|
|
|
f96e0b |
16 files changed, 82 insertions(+), 49 deletions(-)
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/ChangeLog b/ChangeLog
|
|
|
f96e0b |
index 237ca05..f4306c4 100644
|
|
|
f96e0b |
--- a/ChangeLog
|
|
|
f96e0b |
+++ b/ChangeLog
|
|
|
f96e0b |
@@ -1,5 +1,9 @@
|
|
|
f96e0b |
2013-04-26 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
|
|
|
f96e0b |
+ Make 'make check' work on emu.
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+2013-04-26 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
+
|
|
|
f96e0b |
Replace libcurses with our own vt100 handling for the ease of testing
|
|
|
f96e0b |
and decreasing prerequisites.
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/grub-core/commands/parttool.c b/grub-core/commands/parttool.c
|
|
|
f96e0b |
index 0f9b651..f144c51 100644
|
|
|
f96e0b |
--- a/grub-core/commands/parttool.c
|
|
|
f96e0b |
+++ b/grub-core/commands/parttool.c
|
|
|
f96e0b |
@@ -179,7 +179,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
/* Load modules. */
|
|
|
f96e0b |
- if (! grub_no_autoload)
|
|
|
f96e0b |
+ if (! grub_no_modules)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
const char *prefix;
|
|
|
f96e0b |
prefix = grub_env_get ("prefix");
|
|
|
f96e0b |
diff --git a/grub-core/gensymlist.sh b/grub-core/gensymlist.sh
|
|
|
f96e0b |
index a13d7cc..5beaabd 100644
|
|
|
f96e0b |
--- a/grub-core/gensymlist.sh
|
|
|
f96e0b |
+++ b/grub-core/gensymlist.sh
|
|
|
f96e0b |
@@ -59,7 +59,7 @@ EOF
|
|
|
f96e0b |
| grep -v '^#' \
|
|
|
f96e0b |
| sed -n \
|
|
|
f96e0b |
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/ {"\1", \1, 1},/;p;}' \
|
|
|
f96e0b |
- -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/ {"\1", \&\1, 0},/;p;}' \
|
|
|
f96e0b |
+ -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/ {"\1", (void *) \&\1, 0},/;p;}' \
|
|
|
f96e0b |
| sort -u
|
|
|
f96e0b |
|
|
|
f96e0b |
cat <
|
|
|
f96e0b |
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
|
|
|
f96e0b |
index c6d9ec9..641146d 100644
|
|
|
f96e0b |
--- a/grub-core/kern/dl.c
|
|
|
f96e0b |
+++ b/grub-core/kern/dl.c
|
|
|
f96e0b |
@@ -718,6 +718,9 @@ grub_dl_load (const char *name)
|
|
|
f96e0b |
if (mod)
|
|
|
f96e0b |
return mod;
|
|
|
f96e0b |
|
|
|
f96e0b |
+ if (grub_no_modules)
|
|
|
f96e0b |
+ return 0;
|
|
|
f96e0b |
+
|
|
|
f96e0b |
if (! grub_dl_dir) {
|
|
|
f96e0b |
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
|
|
|
f96e0b |
return 0;
|
|
|
f96e0b |
diff --git a/grub-core/kern/emu/full.c b/grub-core/kern/emu/full.c
|
|
|
f96e0b |
index b167a14..97d59fd 100644
|
|
|
f96e0b |
--- a/grub-core/kern/emu/full.c
|
|
|
f96e0b |
+++ b/grub-core/kern/emu/full.c
|
|
|
f96e0b |
@@ -24,6 +24,8 @@
|
|
|
f96e0b |
#include <grub/emu/misc.h>
|
|
|
f96e0b |
#include <grub/disk.h>
|
|
|
f96e0b |
|
|
|
f96e0b |
+const int grub_no_modules = 1;
|
|
|
f96e0b |
+
|
|
|
f96e0b |
void
|
|
|
f96e0b |
grub_register_exported_symbols (void)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
@@ -44,12 +46,6 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|
|
f96e0b |
return GRUB_ERR_BAD_MODULE;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
-void
|
|
|
f96e0b |
-grub_emu_init (void)
|
|
|
f96e0b |
-{
|
|
|
f96e0b |
- grub_no_autoload = 1;
|
|
|
f96e0b |
-}
|
|
|
f96e0b |
-
|
|
|
f96e0b |
#if defined (__ia64__) || defined (__powerpc__)
|
|
|
f96e0b |
void grub_arch_dl_get_tramp_got_size (const void *ehdr __attribute__ ((unused)),
|
|
|
f96e0b |
grub_size_t *tramp, grub_size_t *got)
|
|
|
f96e0b |
@@ -66,7 +62,3 @@ grub_arch_dl_init_linker (void)
|
|
|
f96e0b |
}
|
|
|
f96e0b |
#endif
|
|
|
f96e0b |
|
|
|
f96e0b |
-void
|
|
|
f96e0b |
-grub_emu_post_init (void)
|
|
|
f96e0b |
-{
|
|
|
f96e0b |
-}
|
|
|
f96e0b |
diff --git a/grub-core/kern/emu/lite.c b/grub-core/kern/emu/lite.c
|
|
|
f96e0b |
index 947c669..00b811b 100644
|
|
|
f96e0b |
--- a/grub-core/kern/emu/lite.c
|
|
|
f96e0b |
+++ b/grub-core/kern/emu/lite.c
|
|
|
f96e0b |
@@ -21,6 +21,8 @@
|
|
|
f96e0b |
#error "No target cpu type is defined"
|
|
|
f96e0b |
#endif
|
|
|
f96e0b |
|
|
|
f96e0b |
+const int grub_no_modules = 0;
|
|
|
f96e0b |
+
|
|
|
f96e0b |
/* grub-emu-lite supports dynamic module loading, so it won't have any
|
|
|
f96e0b |
embedded modules. */
|
|
|
f96e0b |
void
|
|
|
f96e0b |
@@ -34,14 +36,3 @@ grub_fini_all (void)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
return;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
-
|
|
|
f96e0b |
-void
|
|
|
f96e0b |
-grub_emu_init (void)
|
|
|
f96e0b |
-{
|
|
|
f96e0b |
- return;
|
|
|
f96e0b |
-}
|
|
|
f96e0b |
-
|
|
|
f96e0b |
-void
|
|
|
f96e0b |
-grub_emu_post_init (void)
|
|
|
f96e0b |
-{
|
|
|
f96e0b |
-}
|
|
|
f96e0b |
diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c
|
|
|
f96e0b |
index 4a88905..99ef90c 100644
|
|
|
f96e0b |
--- a/grub-core/kern/emu/main.c
|
|
|
f96e0b |
+++ b/grub-core/kern/emu/main.c
|
|
|
f96e0b |
@@ -55,8 +55,6 @@ static jmp_buf main_env;
|
|
|
f96e0b |
/* Store the prefix specified by an argument. */
|
|
|
f96e0b |
static char *root_dev = NULL, *dir = NULL;
|
|
|
f96e0b |
|
|
|
f96e0b |
-int grub_no_autoload;
|
|
|
f96e0b |
-
|
|
|
f96e0b |
grub_addr_t grub_modbase = 0;
|
|
|
f96e0b |
|
|
|
f96e0b |
void
|
|
|
f96e0b |
@@ -171,7 +169,6 @@ void grub_hostfs_init (void);
|
|
|
f96e0b |
void grub_hostfs_fini (void);
|
|
|
f96e0b |
void grub_host_init (void);
|
|
|
f96e0b |
void grub_host_fini (void);
|
|
|
f96e0b |
-void grub_emu_init (void);
|
|
|
f96e0b |
|
|
|
f96e0b |
int
|
|
|
f96e0b |
main (int argc, char *argv[])
|
|
|
f96e0b |
@@ -208,7 +205,6 @@ main (int argc, char *argv[])
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
signal (SIGINT, SIG_IGN);
|
|
|
f96e0b |
- grub_emu_init ();
|
|
|
f96e0b |
grub_console_init ();
|
|
|
f96e0b |
grub_host_init ();
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -219,8 +215,6 @@ main (int argc, char *argv[])
|
|
|
f96e0b |
|
|
|
f96e0b |
grub_hostfs_init ();
|
|
|
f96e0b |
|
|
|
f96e0b |
- grub_emu_post_init ();
|
|
|
f96e0b |
-
|
|
|
f96e0b |
/* Make sure that there is a root device. */
|
|
|
f96e0b |
if (! root_dev)
|
|
|
f96e0b |
root_dev = grub_strdup ("host");
|
|
|
f96e0b |
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
|
|
f96e0b |
index 9aaa3b2..2f203dd 100644
|
|
|
f96e0b |
--- a/grub-core/normal/main.c
|
|
|
f96e0b |
+++ b/grub-core/normal/main.c
|
|
|
f96e0b |
@@ -263,7 +263,7 @@ grub_normal_init_page (struct grub_term_output *term)
|
|
|
f96e0b |
static void
|
|
|
f96e0b |
read_lists (const char *val)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- if (! grub_no_autoload)
|
|
|
f96e0b |
+ if (! grub_no_modules)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
read_command_list (val);
|
|
|
f96e0b |
read_fs_list (val);
|
|
|
f96e0b |
diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
|
|
|
f96e0b |
index 6423eb9..3c9f07e 100644
|
|
|
f96e0b |
--- a/include/grub/emu/misc.h
|
|
|
f96e0b |
+++ b/include/grub/emu/misc.h
|
|
|
f96e0b |
@@ -44,10 +44,8 @@
|
|
|
f96e0b |
extern int verbosity;
|
|
|
f96e0b |
extern const char *program_name;
|
|
|
f96e0b |
|
|
|
f96e0b |
-void grub_emu_init (void);
|
|
|
f96e0b |
void grub_init_all (void);
|
|
|
f96e0b |
void grub_fini_all (void);
|
|
|
f96e0b |
-void grub_emu_post_init (void);
|
|
|
f96e0b |
|
|
|
f96e0b |
void grub_find_zpool_from_dir (const char *dir,
|
|
|
f96e0b |
char **poolname, char **poolfs);
|
|
|
f96e0b |
diff --git a/include/grub/misc.h b/include/grub/misc.h
|
|
|
f96e0b |
index c953a00..c191c1f 100644
|
|
|
f96e0b |
--- a/include/grub/misc.h
|
|
|
f96e0b |
+++ b/include/grub/misc.h
|
|
|
f96e0b |
@@ -437,10 +437,10 @@ void grub_halt (void) __attribute__ ((noreturn));
|
|
|
f96e0b |
#endif
|
|
|
f96e0b |
|
|
|
f96e0b |
#ifdef GRUB_MACHINE_EMU
|
|
|
f96e0b |
-/* Flag to control module autoloading in normal mode. */
|
|
|
f96e0b |
-extern int EXPORT_VAR(grub_no_autoload);
|
|
|
f96e0b |
+/* Flag to check if module loading is available. */
|
|
|
f96e0b |
+extern const int EXPORT_VAR(grub_no_modules);
|
|
|
f96e0b |
#else
|
|
|
f96e0b |
-#define grub_no_autoload 0
|
|
|
f96e0b |
+#define grub_no_modules 0
|
|
|
f96e0b |
#endif
|
|
|
f96e0b |
|
|
|
f96e0b |
static inline void
|
|
|
f96e0b |
diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in
|
|
|
f96e0b |
index d9a5fb8..097964f 100644
|
|
|
f96e0b |
--- a/tests/cdboot_test.in
|
|
|
f96e0b |
+++ b/tests/cdboot_test.in
|
|
|
f96e0b |
@@ -20,6 +20,8 @@ grubshell=@builddir@/grub-shell
|
|
|
f96e0b |
. "@builddir@/grub-core/modinfo.sh"
|
|
|
f96e0b |
|
|
|
f96e0b |
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
|
|
f96e0b |
+ *-emu)
|
|
|
f96e0b |
+ exit 0;;
|
|
|
f96e0b |
# Flash targets
|
|
|
f96e0b |
i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
|
|
|
f96e0b |
exit 0;;
|
|
|
f96e0b |
diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in
|
|
|
f96e0b |
index 7734025..0866fdc 100644
|
|
|
f96e0b |
--- a/tests/fddboot_test.in
|
|
|
f96e0b |
+++ b/tests/fddboot_test.in
|
|
|
f96e0b |
@@ -20,6 +20,8 @@ grubshell=@builddir@/grub-shell
|
|
|
f96e0b |
. "@builddir@/grub-core/modinfo.sh"
|
|
|
f96e0b |
|
|
|
f96e0b |
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
|
|
f96e0b |
+ *-emu)
|
|
|
f96e0b |
+ exit 0;;
|
|
|
f96e0b |
# Flash targets
|
|
|
f96e0b |
i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
|
|
|
f96e0b |
exit 0;;
|
|
|
f96e0b |
diff --git a/tests/hddboot_test.in b/tests/hddboot_test.in
|
|
|
f96e0b |
index e76f996..34257a3 100644
|
|
|
f96e0b |
--- a/tests/hddboot_test.in
|
|
|
f96e0b |
+++ b/tests/hddboot_test.in
|
|
|
f96e0b |
@@ -20,6 +20,8 @@ grubshell=@builddir@/grub-shell
|
|
|
f96e0b |
. "@builddir@/grub-core/modinfo.sh"
|
|
|
f96e0b |
|
|
|
f96e0b |
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
|
|
f96e0b |
+ *-emu)
|
|
|
f96e0b |
+ exit 0;;
|
|
|
f96e0b |
# Flash targets
|
|
|
f96e0b |
i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
|
|
|
f96e0b |
exit 0;;
|
|
|
f96e0b |
diff --git a/tests/netboot_test.in b/tests/netboot_test.in
|
|
|
f96e0b |
index 8e3f8c9..aeb1db0 100644
|
|
|
f96e0b |
--- a/tests/netboot_test.in
|
|
|
f96e0b |
+++ b/tests/netboot_test.in
|
|
|
f96e0b |
@@ -20,6 +20,8 @@ grubshell=@builddir@/grub-shell
|
|
|
f96e0b |
. "@builddir@/grub-core/modinfo.sh"
|
|
|
f96e0b |
|
|
|
f96e0b |
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
|
|
f96e0b |
+ *-emu)
|
|
|
f96e0b |
+ exit 0;;
|
|
|
f96e0b |
# Flash targets
|
|
|
f96e0b |
i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
|
|
|
f96e0b |
exit 0;;
|
|
|
f96e0b |
diff --git a/tests/partmap_test.in b/tests/partmap_test.in
|
|
|
f96e0b |
index b222fa1..2d4b54e 100644
|
|
|
f96e0b |
--- a/tests/partmap_test.in
|
|
|
f96e0b |
+++ b/tests/partmap_test.in
|
|
|
f96e0b |
@@ -49,7 +49,7 @@ list_parts () {
|
|
|
f96e0b |
outfile="$1"
|
|
|
f96e0b |
shift
|
|
|
f96e0b |
|
|
|
f96e0b |
- echo ls | "${grubshell}" --qemu-opts="-$qemudisk ${imgfile}" \
|
|
|
f96e0b |
+ echo ls | "${grubshell}" --disk="${imgfile}" \
|
|
|
f96e0b |
--modules=$mod | tr -d "\n\r" > "${outfile}"
|
|
|
f96e0b |
cat "${outfile}"
|
|
|
f96e0b |
echo
|
|
|
f96e0b |
@@ -58,23 +58,19 @@ list_parts () {
|
|
|
f96e0b |
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
|
|
f96e0b |
mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot | mipsel-loongson)
|
|
|
f96e0b |
disk=ata0
|
|
|
f96e0b |
- qemudisk=hda
|
|
|
f96e0b |
;;
|
|
|
f96e0b |
powerpc-ieee1275)
|
|
|
f96e0b |
disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0
|
|
|
f96e0b |
- qemudisk=hda
|
|
|
f96e0b |
# FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
|
|
|
f96e0b |
exit 0
|
|
|
f96e0b |
;;
|
|
|
f96e0b |
sparc64-ieee1275)
|
|
|
f96e0b |
disk=ieee1275//pci@1fe\,0/pci-ata@5/ide0@500/disk@0
|
|
|
f96e0b |
- qemudisk=hda
|
|
|
f96e0b |
# FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
|
|
|
f96e0b |
exit 0
|
|
|
f96e0b |
;;
|
|
|
f96e0b |
i386-ieee1275)
|
|
|
f96e0b |
disk=ieee1275/d
|
|
|
f96e0b |
- qemudisk=hdb
|
|
|
f96e0b |
# FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
|
|
|
f96e0b |
exit 0
|
|
|
f96e0b |
;;
|
|
|
f96e0b |
@@ -83,11 +79,9 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
|
|
f96e0b |
exit 0 ;;
|
|
|
f96e0b |
mipsel-arc)
|
|
|
f96e0b |
disk=arc/scsi0/disk0/rdisk0
|
|
|
f96e0b |
- qemudisk=hda
|
|
|
f96e0b |
;;
|
|
|
f96e0b |
*)
|
|
|
f96e0b |
disk=hd0
|
|
|
f96e0b |
- qemudisk=hda
|
|
|
f96e0b |
;;
|
|
|
f96e0b |
esac
|
|
|
f96e0b |
imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
|
f96e0b |
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
|
|
|
f96e0b |
index fc52e7b..7c88018 100644
|
|
|
f96e0b |
--- a/tests/util/grub-shell.in
|
|
|
f96e0b |
+++ b/tests/util/grub-shell.in
|
|
|
f96e0b |
@@ -44,6 +44,7 @@ Run GRUB script in a Qemu instance.
|
|
|
f96e0b |
--boot=[fd|hd|cd|net] boot method for Qemu instance
|
|
|
f96e0b |
--modules=MODULES pre-load specified modules MODULES
|
|
|
f96e0b |
--qemu=FILE Name of qemu binary
|
|
|
f96e0b |
+ --disk=FILE Attach FILE as a disk
|
|
|
f96e0b |
--qemu-opts=OPTIONS extra options to pass to Qemu instance
|
|
|
f96e0b |
--files=FILES add files to the image
|
|
|
f96e0b |
--mkrescue-arg=ARGS additional arguments to grub-mkrescue
|
|
|
f96e0b |
@@ -63,7 +64,16 @@ serial_port=com0
|
|
|
f96e0b |
serial_null=
|
|
|
f96e0b |
halt_cmd=halt
|
|
|
f96e0b |
pseries=n
|
|
|
f96e0b |
+disk=hda
|
|
|
f96e0b |
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
|
|
f96e0b |
+ *-emu)
|
|
|
f96e0b |
+ device_map=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
|
|
f96e0b |
+ boot=emu
|
|
|
f96e0b |
+ console=console
|
|
|
f96e0b |
+ disk=0
|
|
|
f96e0b |
+ # To skip "Welcome to GRUB" and color setttings
|
|
|
f96e0b |
+ trim=1
|
|
|
f96e0b |
+ ;;
|
|
|
f96e0b |
powerpc-ieee1275)
|
|
|
f96e0b |
boot=cd
|
|
|
f96e0b |
qemu=qemu-system-ppc
|
|
|
f96e0b |
@@ -134,6 +144,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
|
|
f96e0b |
qemu=qemu-system-i386
|
|
|
f96e0b |
console=console
|
|
|
f96e0b |
trim=1
|
|
|
f96e0b |
+ disk=hdb
|
|
|
f96e0b |
;;
|
|
|
f96e0b |
i386-qemu)
|
|
|
f96e0b |
boot=qemu
|
|
|
f96e0b |
@@ -200,6 +211,28 @@ for option in "$@"; do
|
|
|
f96e0b |
--qemu-opts=*)
|
|
|
f96e0b |
qs=`echo "$option" | sed -e 's/--qemu-opts=//'`
|
|
|
f96e0b |
qemuopts="$qemuopts $qs" ;;
|
|
|
f96e0b |
+ --disk=*)
|
|
|
f96e0b |
+ dsk=`echo "$option" | sed -e 's/--disk=//'`
|
|
|
f96e0b |
+ if [ ${grub_modinfo_platform} = emu ]; then
|
|
|
f96e0b |
+ echo "(hd$disk) $dsk" >> "$device_map"
|
|
|
f96e0b |
+ disk="$((disk+1))"
|
|
|
f96e0b |
+ else
|
|
|
f96e0b |
+ if [ $disk = error ]; then
|
|
|
f96e0b |
+ echo "Too many disks" 1>&2
|
|
|
f96e0b |
+ exit 1;
|
|
|
f96e0b |
+ fi
|
|
|
f96e0b |
+ qemuopts="$qemuopts -$disk $dsk"
|
|
|
f96e0b |
+ if [ "$disk" = hda ]; then
|
|
|
f96e0b |
+ disk=hdb;
|
|
|
f96e0b |
+ elif [ "$disk" = hdb ]; then
|
|
|
f96e0b |
+ # CDROM is hdc
|
|
|
f96e0b |
+ disk=hdd
|
|
|
f96e0b |
+ elif [ "$disk" = hdd ]; then
|
|
|
f96e0b |
+ # CDROM is hdc
|
|
|
f96e0b |
+ disk=error
|
|
|
f96e0b |
+ fi
|
|
|
f96e0b |
+ fi
|
|
|
f96e0b |
+ ;;
|
|
|
f96e0b |
--timeout=*)
|
|
|
f96e0b |
timeout=`echo "$option" | sed -e 's/--timeout=//'`
|
|
|
f96e0b |
;;
|
|
|
f96e0b |
@@ -244,16 +277,27 @@ fi
|
|
|
f96e0b |
cfgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
|
|
f96e0b |
cat <<EOF >${cfgfile}
|
|
|
f96e0b |
grubshell=yes
|
|
|
f96e0b |
-insmod serial
|
|
|
f96e0b |
EOF
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+if [ "${grub_modinfo_platform}" != emu ]; then
|
|
|
f96e0b |
+ echo insmod serial >>${cfgfile}
|
|
|
f96e0b |
+fi
|
|
|
f96e0b |
+
|
|
|
f96e0b |
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = powerpc-ieee1275 ]; then
|
|
|
f96e0b |
echo insmod escc >>${cfgfile}
|
|
|
f96e0b |
fi
|
|
|
f96e0b |
+if [ "${grub_modinfo_platform}" != emu ]; then
|
|
|
f96e0b |
+ echo "serial ${serial_port}" >>${cfgfile}
|
|
|
f96e0b |
+ term="serial_${serial_port}"
|
|
|
f96e0b |
+else
|
|
|
f96e0b |
+ term=console
|
|
|
f96e0b |
+fi
|
|
|
f96e0b |
+
|
|
|
f96e0b |
cat <<EOF >>${cfgfile}
|
|
|
f96e0b |
-serial ${serial_port}
|
|
|
f96e0b |
-terminfo -g 255x255 serial_${serial_port} dumb
|
|
|
f96e0b |
-terminal_input serial_${serial_port}
|
|
|
f96e0b |
-terminal_output serial_${serial_port}
|
|
|
f96e0b |
+terminfo -g 255x255 ${term} dumb
|
|
|
f96e0b |
+terminal_input ${term}
|
|
|
f96e0b |
+terminal_output ${term}
|
|
|
f96e0b |
EOF
|
|
|
f96e0b |
|
|
|
f96e0b |
trim_head=664cbea8-132f-4770-8aa4-1696d59ac35c
|
|
|
f96e0b |
@@ -270,7 +314,7 @@ do
|
|
|
f96e0b |
done
|
|
|
f96e0b |
|
|
|
f96e0b |
cat <<EOF >>${cfgfile}
|
|
|
f96e0b |
-source /boot/grub/testcase.cfg
|
|
|
f96e0b |
+source \$prefix/testcase.cfg
|
|
|
f96e0b |
# Stop serial output to suppress "ACPI shutdown failed" error.
|
|
|
f96e0b |
EOF
|
|
|
f96e0b |
if [ x$console != x ]; then
|
|
|
f96e0b |
@@ -279,7 +323,7 @@ fi
|
|
|
f96e0b |
echo "${halt_cmd}" >>${cfgfile}
|
|
|
f96e0b |
|
|
|
f96e0b |
isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
|
|
f96e0b |
-if [ x$boot != xnet ]; then
|
|
|
f96e0b |
+if [ x$boot != xnet ] && [ x$boot != xemu ]; then
|
|
|
f96e0b |
pkgdatadir="@builddir@" sh "@builddir@/grub-mkrescue" "--grub-mkimage=${builddir}/grub-mkimage" "--grub-render-label=${builddir}/grub-render-label" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \
|
|
|
f96e0b |
--rom-directory="${rom_directory}" ${mkrescue_args} \
|
|
|
f96e0b |
"/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \
|
|
|
f96e0b |
@@ -354,6 +398,11 @@ if [ x$boot = xnet ]; then
|
|
|
f96e0b |
cp "${cfgfile}" "$netdir/boot/grub/grub.cfg"
|
|
|
f96e0b |
cp "${source}" "$netdir/boot/grub/testcase.cfg"
|
|
|
f96e0b |
timeout -s KILL $timeout "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | do_trim
|
|
|
f96e0b |
+elif [ x$boot = xemu ]; then
|
|
|
f96e0b |
+ grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")"
|
|
|
f96e0b |
+ cp "${cfgfile}" "$grubdir/grub.cfg"
|
|
|
f96e0b |
+ cp "${source}" "$grubdir/testcase.cfg"
|
|
|
f96e0b |
+ @builddir@/grub-core/grub-emu -m "$device_map" -d "$grubdir" | tr -d "\r" | do_trim
|
|
|
f96e0b |
else
|
|
|
f96e0b |
timeout -s KILL $timeout "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r" | do_trim
|
|
|
f96e0b |
fi
|
|
|
f96e0b |
--
|
|
|
f96e0b |
1.8.2.1
|
|
|
f96e0b |
|