Cross-building mips binaries

Ben Morrow ben at morrow.me.uk
Tue Oct 21 00:31:11 UTC 2014


Warner Losh <imp at bsdimp.com> wrote:
> On Oct 19, 2014, at 4:34 PM, Ben Morrow <ben at morrow.me.uk> wrote:
> > 
[ mips64 under qemu ]
> >
> > Thank you, that works. (Good God, it's slow... I wonder how hard it
> > would be to replace cc with something that runs a cross-compiler on the
> > host? Maybe I can do something with distcc...)
> 
> I’ve been helping Sean Bruno do exactly this, but I think for mips32.
> You build a chroot with the full world, then you build x86 binaries to
> produce mips32/64 output and replace the cc, et al, in the chroot with
> those. Makes things quite a bit faster. Still not quite as fast as a
> full native cross build, but much faster than pure user mode and more
> reliable than the current state of the art in cross building.

This is a huge improvement (thank you to Juli and Alexander for pointing
me in the direction of qemu-user-static). I've now got a poudriere jail
with a mips64 world, amd64->mips64 cross-tools and imgact_binmisc to
invoke the emulator, and after a bit of fuss setting up the jail it all
appears to Just Work.

The new time hog seems to be xz and bz2 untarring distfiles and building
packages. Presumably a static amd64 tar binary would work without
problems; does anyone know if there are endianness issues with sqlite
which would upset an amd64 pkg-static binary?

Ben



More information about the freebsd-mips mailing list