Commit c59372208a928828dd7d1cceaee78b48e5e03611
1 parent
00a9bf19
Teach usermode emulation how to lie about uname -r.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1920 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
4 changed files
with
15 additions
and
0 deletions
configure
@@ -95,6 +95,7 @@ check_gcc="yes" | @@ -95,6 +95,7 @@ check_gcc="yes" | ||
95 | softmmu="yes" | 95 | softmmu="yes" |
96 | user="no" | 96 | user="no" |
97 | build_docs="no" | 97 | build_docs="no" |
98 | +uname_release="" | ||
98 | 99 | ||
99 | # OS specific | 100 | # OS specific |
100 | targetos=`uname -s` | 101 | targetos=`uname -s` |
@@ -237,6 +238,8 @@ for opt do | @@ -237,6 +238,8 @@ for opt do | ||
237 | ;; | 238 | ;; |
238 | --enable-user) user="yes" | 239 | --enable-user) user="yes" |
239 | ;; | 240 | ;; |
241 | + --enable-uname-release=*) uname_release="$optarg" | ||
242 | + ;; | ||
240 | esac | 243 | esac |
241 | done | 244 | done |
242 | 245 | ||
@@ -284,6 +287,7 @@ echo " --enable-user enable all linux usermode emulation targets" | @@ -284,6 +287,7 @@ echo " --enable-user enable all linux usermode emulation targets" | ||
284 | echo " --disable-user disable all linux usermode emulation targets" | 287 | echo " --disable-user disable all linux usermode emulation targets" |
285 | echo " --fmod-lib path to FMOD library" | 288 | echo " --fmod-lib path to FMOD library" |
286 | echo " --fmod-inc path to FMOD includes" | 289 | echo " --fmod-inc path to FMOD includes" |
290 | +echo " --enable-uname-release=R Return R for uname -r in usermode emulation" | ||
287 | echo "" | 291 | echo "" |
288 | echo "NOTE: The object files are build at the place where configure is launched" | 292 | echo "NOTE: The object files are build at the place where configure is launched" |
289 | exit 1 | 293 | exit 1 |
@@ -553,6 +557,8 @@ fi | @@ -553,6 +557,8 @@ fi | ||
553 | echo "FMOD support $fmod $fmod_support" | 557 | echo "FMOD support $fmod $fmod_support" |
554 | echo "kqemu support $kqemu" | 558 | echo "kqemu support $kqemu" |
555 | echo "Documentation $build_docs" | 559 | echo "Documentation $build_docs" |
560 | +[ ! -z "$uname_release" ] && \ | ||
561 | +echo "uname -r $uname_release" | ||
556 | 562 | ||
557 | if test $sdl_too_old = "yes"; then | 563 | if test $sdl_too_old = "yes"; then |
558 | echo "-> Your SDL version is too old - please upgrade to have SDL support" | 564 | echo "-> Your SDL version is too old - please upgrade to have SDL support" |
@@ -711,6 +717,8 @@ if [ "$bsd" = "yes" ] ; then | @@ -711,6 +717,8 @@ if [ "$bsd" = "yes" ] ; then | ||
711 | echo "#define _BSD 1" >> $config_h | 717 | echo "#define _BSD 1" >> $config_h |
712 | fi | 718 | fi |
713 | 719 | ||
720 | +echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h | ||
721 | + | ||
714 | for target in $target_list; do | 722 | for target in $target_list; do |
715 | target_dir="$target" | 723 | target_dir="$target" |
716 | config_mak=$target_dir/config.mak | 724 | config_mak=$target_dir/config.mak |
linux-user/main.c
@@ -34,6 +34,7 @@ | @@ -34,6 +34,7 @@ | ||
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | static const char *interp_prefix = CONFIG_QEMU_PREFIX; | 36 | static const char *interp_prefix = CONFIG_QEMU_PREFIX; |
37 | +const char *qemu_uname_release = CONFIG_UNAME_RELEASE; | ||
37 | 38 | ||
38 | #if defined(__i386__) && !defined(CONFIG_STATIC) | 39 | #if defined(__i386__) && !defined(CONFIG_STATIC) |
39 | /* Force usage of an ELF interpreter even if it is an ELF shared | 40 | /* Force usage of an ELF interpreter even if it is an ELF shared |
@@ -1514,6 +1515,8 @@ int main(int argc, char **argv) | @@ -1514,6 +1515,8 @@ int main(int argc, char **argv) | ||
1514 | } | 1515 | } |
1515 | } else if (!strcmp(r, "g")) { | 1516 | } else if (!strcmp(r, "g")) { |
1516 | gdbstub_port = atoi(argv[optind++]); | 1517 | gdbstub_port = atoi(argv[optind++]); |
1518 | + } else if (!strcmp(r, "r")) { | ||
1519 | + qemu_uname_release = argv[optind++]; | ||
1517 | } else | 1520 | } else |
1518 | #ifdef USE_CODE_COPY | 1521 | #ifdef USE_CODE_COPY |
1519 | if (!strcmp(r, "no-code-copy")) { | 1522 | if (!strcmp(r, "no-code-copy")) { |
linux-user/qemu.h
@@ -80,6 +80,7 @@ typedef struct TaskState { | @@ -80,6 +80,7 @@ typedef struct TaskState { | ||
80 | } __attribute__((aligned(16))) TaskState; | 80 | } __attribute__((aligned(16))) TaskState; |
81 | 81 | ||
82 | extern TaskState *first_task_state; | 82 | extern TaskState *first_task_state; |
83 | +extern const char *qemu_uname_release; | ||
83 | 84 | ||
84 | int elf_exec(const char * filename, char ** argv, char ** envp, | 85 | int elf_exec(const char * filename, char ** argv, char ** envp, |
85 | struct target_pt_regs * regs, struct image_info *infop); | 86 | struct target_pt_regs * regs, struct image_info *infop); |
linux-user/syscall.c
@@ -2861,6 +2861,9 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | @@ -2861,6 +2861,9 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | ||
2861 | /* Overrite the native machine name with whatever is being | 2861 | /* Overrite the native machine name with whatever is being |
2862 | emulated. */ | 2862 | emulated. */ |
2863 | strcpy (buf->machine, UNAME_MACHINE); | 2863 | strcpy (buf->machine, UNAME_MACHINE); |
2864 | + /* Allow the user to override the reported release. */ | ||
2865 | + if (qemu_uname_release && *qemu_uname_release) | ||
2866 | + strcpy (buf->release, qemu_uname_release); | ||
2864 | } | 2867 | } |
2865 | unlock_user_struct(buf, arg1, 1); | 2868 | unlock_user_struct(buf, arg1, 1); |
2866 | } | 2869 | } |