Skip to contentSkip to conversation

add QEMU_LD_PREFIX environment variable

PATCH New Johannes Schauer 1 participant 2 messages Jul 6, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add QEMU_LD_PREFIX environment variable

Hi,

qemu allows to specify the elf interpreter prefix with the -L option. When using qemu user mode emulation through the binfmt mechanism, it is not possible to pass any commandline arguments to qemu. Having qemu evaluate an environment variable makes it possible to still supply a custom elf interpreter prefix, even if qemu is executed by the binfmt mechanism.

My motivation is an emdebian project which creates foreign debian bootstraps. Since foreign binaries are executed without an explicit qemu-user call but by the binfmt mechanism, it relied on having appropriate content in /etc/qemu-binfmt/$arch/ which is the default elf interpreter prefix path on debian. The downside currently is, that the shared libraries in /etc/qemu-binfmt/$arch/ have to be adapted very often for different debian systems running on the same qemu $arch. This could be avoided by setting the proposed environment variable QEMU_LD_PREFIX to the just created debian rootfs. As mentioned earlier, the usage of the -L option is not possible in this scenario because qemu-user is only implicitly called by the binfmt mechanism.

Hopefully this change can be applied.

thanks!

cheers, josch

Johannes Schauer (1):
add QEMU_LD_PREFIX environment variable

 linux-user/main.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 add QEMU_LD_PREFIX environment variable

---
 linux-user/main.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
linux-user/main.c +5 -0
index 289054b..b590aa7 100644
@@ -2891,6 +2891,11 @@ int main(int argc, char **argv, char **envp)
     cpudef_setup(); /* parse cpu definitions in target config file (TBD) */
 #endif
 
+    /* read interp_prefix from environment variable */
+    if (getenv("QEMU_LD_PREFIX") != NULL) {
+        interp_prefix = getenv("QEMU_LD_PREFIX");
+    }
+
     optind = 1;
     for(;;) {
         if (optind >= argc)
Signature · 1 line
1.7.5.4