On Thu, Oct 3, 2019 at 1:36 PM Michal Suchánek <
address@hidden> wrote:
On Thu, Oct 03, 2019 at 10:48:46AM -0700, Mauricio Galindo wrote:
> Hi,
>
> I'm running QEMU in user mode and I'm running into issues when trying
> to exec binaries within the emulated process given that binaries are
> expected to run in the native architecture. Would it be useful to have
> an option to rewrite execve(/bin/some_binary, ...) to
> execve(qemu-$arch-static, [/bin/some_binary, ...], ...)?
>
This is handled in kernel by binfmt-misc.
Debian has nice packaging for the required configuration. They use it to
create non-native installation images.
FreeBSD also uses bsd-user (admittedly a much changed one from what's upstream[*]) to build non-native packages. It uses the same binfmt stuff in a chroot.
Warner
[*] I've rebased our work forward up through 3.1 release and hope to have it rebased through the top of the tree shortly and have it ready for upstreaming soon.