How to redirect the loader to another directory ?

Goswin von Brederlow goswin-v-b@web.de
Fri May 14 04:34:00 GMT 2010


robert song <robertsong.japan@gmail.com> writes:

> Thank you very much, Goswin.
>
>> You would have to copy qemu and the required libs into the chroot and
>> call qemu in there or setup binfmt-misc for arm. Chroot on its own won't
>> work.
>
> the required libs may conflict with the target file. Now I build a
> static qemu-arm.

You can use the multiarch directory ([/usr]/lib/<triplet>/) to place
libraries into a unique location. Under debian this directory is
activated through /etc/ld.so.conf.d/<triplet>.conf provided by libc6.
But static building works too.

> Host> cd qemu-0.12.3
> Host> ./configure --target-list=arm-linux-user --static
> Host> make
> Host> sudo cp arm-linux-user/qemu-arm /target/bin/qemu-arm
> Host> sudo cd /target
> Host> sudo chroot . /bin/qemu-arm /bin/sh
> Host> /bin/qemu-arm /bin/ls
>
> Now, it can work.
> Regarding to binfmt-misc, I don't know it.

http://en.wikipedia.org/wiki/Binfmt_misc

  binfmt_misc is a capability of the Linux kernel which allows arbitrary
  executable file formats to be recognized and passed to certain user
  space applications, such as emulators and virtual machines.
  ...

Under Debian the qemu-arm package automatically registers qemu through
this so executing any arm binary will automatically invoke qemu
transparently.

MfG
        Goswin



More information about the Binutils mailing list