Cross-building mips binaries

Stacey Son sson at me.com
Wed Oct 22 22:27:53 UTC 2014


On Oct 20, 2014, at 7:31 PM, Ben Morrow <ben at morrow.me.uk> wrote:

> 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?


Hi Ben,

I have used an amd64 pkg-static to create indexes and such for FreeBSD/mips64 packages.  

With the impact_binmisc kernel module you can add statically linked amd64 binaries and the kernel will run them natively.   /rescue is a good source for these (e.g. tar).

Also, there are some of my (and others) notes at https://wiki.freebsd.org/QemuUserModeHowTo for the simple chroot case but also apply as well to a poudriere jail.

Best Regards,

-stacey.


More information about the freebsd-mips mailing list