On 29/06/2016 16:27, Simo Sorce wrote:
> > symlink: /usr/lib/qemu-user-root -> /
> > dir: /usr/lib/qemu-user-host-lib
> > symlink: /usr/lib/qemu-user-host-lib/libc.so ->
/usr/lib/qemu-user-root/lib/libc.so
> >
> > And build qemu-$ARCH with rpath to /usr/lib/qemu-user-root/lib.
> >
> > Then in the chroot you would need to bind mount the host root into
> > /usr/lib/qemu-user-root, to override the symlink that would otherwise
> > point back to /
Why do you need 2 symlinks ?
I was thinking you'd have
symlink: /usr/lib/qemu-user-lib-x86_64/ -> /usr/lib
In the chroot you just bind mount the host's /usr/lib
as /usr/lib/qemu-user-lib-x86_64
This assuming x86-64, you can bind mount in the appropriate arch-target
dir on other arches.
This only works if all symlinks in /usr/lib are relative. Even then,
there are some cases where /usr/lib/foo.so symlinks to
../../lib/foo.so.1, so you'd need to:
1) bind-mount /usr/lib into /usr/lib/qemu-user-root/usr/lib
2) create a symlink /usr/lib/qemu-user-root/lib to
/usr/lib/qemu-user-root/usr/lib.
It seems a bit brittle.