Re: [xfstests-bld PATCH] gen-image: fix running in a foreign build chroot

Eric Biggers
2018-04-16T22:08:05Z

On Tue, Apr 03, 2018 at 05:14:21PM -0700, Eric Biggers wrote:
> Building an android-xfstests test appliance on x86_64 with the
> documented command (e.g. './do-all --chroot=stretch-arm64 --out-tar') no
> longer works. The problem is that when the gen-image script is run in a
> foreign build chroot, it incorrectly considers the root_fs's chroot to
> be a "native" chroot and doesn't copy the needed /usr/bin/qemu-*-static
> binary into it. This is because both 'uname -m' and 'dpkg
> --print-architecture' will return the same architecture (the foreign
> one), so is_native_chroot() returns true.
>
> This did used to work, but I think it stopped working with 5c76a88c0e57
> ("test-appliance: improve image generation for chroot tar files")
> because previously it was using 'fakechroot' which doesn't actually
> change the real root directory, so the /usr/bin directory stayed the
> same from the kernel's perspective. But now it uses real chroot.
>
> Fix this by detecting a foreign build chroot by instead mounting
> binfmt_misc and checking whether there is an entry for qemu-$(uname -m).
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> kvm-xfstests/test-appliance/gen-image | 58 +++++++++++++++------------
> 1 file changed, 32 insertions(+), 26 deletions(-)
>

Ping.