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 | 95 | softmmu="yes" |
96 | 96 | user="no" |
97 | 97 | build_docs="no" |
98 | +uname_release="" | |
98 | 99 | |
99 | 100 | # OS specific |
100 | 101 | targetos=`uname -s` |
... | ... | @@ -237,6 +238,8 @@ for opt do |
237 | 238 | ;; |
238 | 239 | --enable-user) user="yes" |
239 | 240 | ;; |
241 | + --enable-uname-release=*) uname_release="$optarg" | |
242 | + ;; | |
240 | 243 | esac |
241 | 244 | done |
242 | 245 | |
... | ... | @@ -284,6 +287,7 @@ echo " --enable-user enable all linux usermode emulation targets" |
284 | 287 | echo " --disable-user disable all linux usermode emulation targets" |
285 | 288 | echo " --fmod-lib path to FMOD library" |
286 | 289 | echo " --fmod-inc path to FMOD includes" |
290 | +echo " --enable-uname-release=R Return R for uname -r in usermode emulation" | |
287 | 291 | echo "" |
288 | 292 | echo "NOTE: The object files are build at the place where configure is launched" |
289 | 293 | exit 1 |
... | ... | @@ -553,6 +557,8 @@ fi |
553 | 557 | echo "FMOD support $fmod $fmod_support" |
554 | 558 | echo "kqemu support $kqemu" |
555 | 559 | echo "Documentation $build_docs" |
560 | +[ ! -z "$uname_release" ] && \ | |
561 | +echo "uname -r $uname_release" | |
556 | 562 | |
557 | 563 | if test $sdl_too_old = "yes"; then |
558 | 564 | echo "-> Your SDL version is too old - please upgrade to have SDL support" |
... | ... | @@ -711,6 +717,8 @@ if [ "$bsd" = "yes" ] ; then |
711 | 717 | echo "#define _BSD 1" >> $config_h |
712 | 718 | fi |
713 | 719 | |
720 | +echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h | |
721 | + | |
714 | 722 | for target in $target_list; do |
715 | 723 | target_dir="$target" |
716 | 724 | config_mak=$target_dir/config.mak | ... | ... |
linux-user/main.c
... | ... | @@ -34,6 +34,7 @@ |
34 | 34 | #endif |
35 | 35 | |
36 | 36 | static const char *interp_prefix = CONFIG_QEMU_PREFIX; |
37 | +const char *qemu_uname_release = CONFIG_UNAME_RELEASE; | |
37 | 38 | |
38 | 39 | #if defined(__i386__) && !defined(CONFIG_STATIC) |
39 | 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 | 1515 | } |
1515 | 1516 | } else if (!strcmp(r, "g")) { |
1516 | 1517 | gdbstub_port = atoi(argv[optind++]); |
1518 | + } else if (!strcmp(r, "r")) { | |
1519 | + qemu_uname_release = argv[optind++]; | |
1517 | 1520 | } else |
1518 | 1521 | #ifdef USE_CODE_COPY |
1519 | 1522 | if (!strcmp(r, "no-code-copy")) { | ... | ... |
linux-user/qemu.h
... | ... | @@ -80,6 +80,7 @@ typedef struct TaskState { |
80 | 80 | } __attribute__((aligned(16))) TaskState; |
81 | 81 | |
82 | 82 | extern TaskState *first_task_state; |
83 | +extern const char *qemu_uname_release; | |
83 | 84 | |
84 | 85 | int elf_exec(const char * filename, char ** argv, char ** envp, |
85 | 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 | 2861 | /* Overrite the native machine name with whatever is being |
2862 | 2862 | emulated. */ |
2863 | 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 | 2868 | unlock_user_struct(buf, arg1, 1); |
2866 | 2869 | } | ... | ... |