[Arm-dev] How to chroot from x86 to arm?

Tue Dec 27 15:21:02 UTC 2016
Christopher Covington <cov at codeaurora.org>

On 12/23/2016 02:35 AM, mo.ucina wrote:
> Hello Guys,
> 
> I have been doing centos package compiling on arm hardware for a
> while now , and it has been going OK . One drawback is that some
> bigger packages would run for 10hrs to compile . I would like to
> speed up that process , and compile on a much more powerful machine .
> I tried cross-compiling but ended up with issues when the arm package
> got contaminated with i386 libraries no matter what I tired .

The most elegant solution I've seen to this problem is multiarch:

https://wiki.debian.org/Multiarch/LibraryPathOverview

I've also seen cross-compilation toolchain wrappers that seem to make
things work.

But .rpm distributions don't seem to be adopting multiarch and even
it doesn't make the stubborn packages like Perl any easier to
cross-compile.

> I also tried qemu VM running on my core2duo 4 core desktop machine .
> This worked OK as packages were perfect , but it was slower to
> compile than using arm hardware . Same package that took 10 hrs on
> arm hw , compiled for 3 and a half days on the desktop .

There may be performance tuning and enhancements such as
Multi-Threaded TCG that would improve the speed of this approach.

> My question is if I used a chroot approach to run the emulation will
> this be quicker than a qemu VM . If so can anyone please share their
> instructions on how to configure a chroot to run a centos 7 arm image
> on a x86 desktop.

I haven't done exactly what you're asking before, but I've read of others doing
similar things:

https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/LLGAX7T2DNR44INA3OHEXMHDIDC2ALQL/

https://rwmj.wordpress.com/2013/12/22/how-to-run-aarch64-binaries-on-an-x86-64-host-using-qemu-userspace-emulation/

http://blog.hansenpartnership.com/constructing-architecture-emulation-containers/
http://blog.hansenpartnership.com/unprivileged-build-containers/
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=948b701a607f123df92ed29084413e5dd8cda2ed
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4af75df6a410ce76d9f60f27b07e5645ecc2c5ed

https://wiki.debian.org/QemuUserEmulation

Cheers,
Cov

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code
Aurora Forum, a Linux Foundation Collaborative Project.