Patchwork [07/12] linux-user: AArch64 requires at least 3.8.0

login
register
mail settings
Submitter Alexander Graf
Date March 6, 2013, 2:01 a.m.
Message ID <1362535280-5068-8-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/225244/
State New
Headers show

Comments

Alexander Graf - March 6, 2013, 2:01 a.m.
Glibc 1.17 checks for the host kernel version on startup. Unfortunately,
it also checks whether the host kernel version is recent enough for the
target to run at all.

Since AArch64 support only got introduced in 3.8.0, that means that glibc
refuses to run on any older kernel version than that.

To allow for execution of linux-user guests even on older host kernels,
let's always fake the kernel version to 3.8.0 on AArch64 guests.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 linux-user/syscall.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Riku Voipio - March 6, 2013, 7:04 a.m.
Hi,

Cool work and thanks for early sharing.

On Wed, Mar 06, 2013 at 03:01:15AM +0100, Alexander Graf wrote:
> Glibc 1.17 checks for the host kernel version on startup. Unfortunately,
> it also checks whether the host kernel version is recent enough for the
> target to run at all.
> 
> Since AArch64 support only got introduced in 3.8.0, that means that glibc
> refuses to run on any older kernel version than that.
> 
> To allow for execution of linux-user guests even on older host kernels,
> let's always fake the kernel version to 3.8.0 on AArch64 guests.

We already allow setting uname version at command line (-r) and with
./configure . A better place to hardcode this would be linux-user/main.c
where qemu_uname_release is set. Or even just setting
CONFIG_UNAME_RELEASE to the aarch64 config-target.mak 

Riku

> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  linux-user/syscall.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 19630ea..38c0711 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -313,7 +313,12 @@ static int sys_uname(struct new_utsname *buf)
>    memset(buf, 0, sizeof(*buf));
>    COPY_UTSNAME_FIELD(buf->sysname, uts_buf.sysname);
>    COPY_UTSNAME_FIELD(buf->nodename, uts_buf.nodename);
> +#ifdef TARGET_ARM64
> +  /* glibc refuses to run on older kernels */
> +  COPY_UTSNAME_FIELD(buf->release, "3.8.0");
> +#else
>    COPY_UTSNAME_FIELD(buf->release, uts_buf.release);
> +#endif
>    COPY_UTSNAME_FIELD(buf->version, uts_buf.version);
>    COPY_UTSNAME_FIELD(buf->machine, uts_buf.machine);
>  #ifdef _GNU_SOURCE
> -- 
> 1.6.0.2

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 19630ea..38c0711 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -313,7 +313,12 @@  static int sys_uname(struct new_utsname *buf)
   memset(buf, 0, sizeof(*buf));
   COPY_UTSNAME_FIELD(buf->sysname, uts_buf.sysname);
   COPY_UTSNAME_FIELD(buf->nodename, uts_buf.nodename);
+#ifdef TARGET_ARM64
+  /* glibc refuses to run on older kernels */
+  COPY_UTSNAME_FIELD(buf->release, "3.8.0");
+#else
   COPY_UTSNAME_FIELD(buf->release, uts_buf.release);
+#endif
   COPY_UTSNAME_FIELD(buf->version, uts_buf.version);
   COPY_UTSNAME_FIELD(buf->machine, uts_buf.machine);
 #ifdef _GNU_SOURCE