Re: [Qemu-devel] [PATCH] add QEMU_LD_PREFIX environment variable
On 28.07.2011, at 18:50, Geert Stappers wrote: > On Thu, Jul 28, 2011 at 01:24:47PM +0200, Johannes Schauer wrote: >> >> @Geert Stappers: >> >> you are patching bsd-user/main.c and darwin-user/main.c as well. I take >> it that you did test your changes on those platforms? does it work there >> as well? I have no clue of darwin but is it really useful there? > > They only check I did, > was checking if BSD and Darwing have getenv(), they do. > > I consider the > +/* read interp_prefix from environment variable */ > +if (getenv("QEMU_LD_PREFIX") != NULL) { > +interp_prefix = getenv("QEMU_LD_PREFIX"); > to Darwin and BSD as harmless. In fact only reason for those additional > lines were to bring attention to those operating systems. It's called DYLD_PRELOAD on Darwin :). However, I do think that if anything this should be an alias, so you can set either of the two. If anyone cares about darwin-user at all. Alex
Re: [Qemu-devel] [PATCH] add QEMU_LD_PREFIX environment variable
On Thu, Jul 28, 2011 at 01:24:47PM +0200, Johannes Schauer wrote: > > @Geert Stappers: > > you are patching bsd-user/main.c and darwin-user/main.c as well. I take > it that you did test your changes on those platforms? does it work there > as well? I have no clue of darwin but is it really useful there? They only check I did, was checking if BSD and Darwing have getenv(), they do. I consider the +/* read interp_prefix from environment variable */ +if (getenv("QEMU_LD_PREFIX") != NULL) { +interp_prefix = getenv("QEMU_LD_PREFIX"); to Darwin and BSD as harmless. In fact only reason for those additional lines were to bring attention to those operating systems. With the idea^Whope of better acception from upstream. Cheers Geert Stappers
Re: [Qemu-devel] [PATCH] add QEMU_LD_PREFIX environment variable
Hi, On Thu, Jul 28, 2011 at 11:41:09AM +0300, Riku Voipio wrote: > On Sat, Jul 23, 2011 at 07:47:49AM +0200, josch wrote: > > 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. > > What worries me here is that we are beginning to add a enviroment > variable for each and every command line option of qemu linux-user. Are there other environment variables? I didnt see any? (well besides QEMU_STRACE that is) > I think it would be better to have a wrapper binary to be registered > as the binfmt runner. If you need help with writing something - dont hesitate to ask for help. I'm very interested in having this functionality working because of the reasons I gave in my initial mail. [1] > Alternatively we should have a generic setup for mapping enviroment > variables to command line options. Now we get special per-option code > every time someone needs to setup a command line option from binfmt. What other options are there that would be interesting for binfmt? I was also sending this patch to qemu-devel list a month ago but got no reply. [2] As I said - if you would like a wrapper or a generic setup for mapping env variables to commandline parameters and dont have time to do it yourself, dont hesitate to delegate some work to me :) @Geert Stappers: you are patching bsd-user/main.c and darwin-user/main.c as well. I take it that you did test your changes on those platforms? does it work there as well? I have no clue of darwin but is it really useful there? cheers, josch [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632192#5 [2] http://lists.nongnu.org/archive/html/qemu-devel/2011-07/msg00459.html
Re: [Qemu-devel] [PATCH] add QEMU_LD_PREFIX environment variable
On Sat, Jul 23, 2011 at 07:47:49AM +0200, josch wrote: > 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. What worries me here is that we are beginning to add a enviroment variable for each and every command line option of qemu linux-user. I think it would be better to have a wrapper binary to be registered as the binfmt runner. Alternatively we should have a generic setup for mapping enviroment variables to command line options. Now we get special per-option code every time someone needs to setup a command line option from binfmt. Riku
[Qemu-devel] [PATCH] add QEMU_LD_PREFIX environment variable
From: Johannes Schauer 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(-) -- 1.7.5.4
[Qemu-devel] [PATCH] add QEMU_LD_PREFIX environment variable
From: Johannes Schauer Signed-off-by: Johannes Schauer --- linux-user/main.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 289054b..b590aa7 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -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) -- 1.7.5.4
[Qemu-devel] [PATCH] 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(-) -- 1.7.5.4
[Qemu-devel] [PATCH] add QEMU_LD_PREFIX environment variable
Signed-off-by: Johannes Schauer --- linux-user/main.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 289054b..b590aa7 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -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) -- 1.7.5.4