Skip to content

Script to cross-compile Parrot with qemu #173

Closed
leto opened this Issue Oct 19, 2011 · 3 comments

2 participants

@leto
Parrot Virtual Machine member
leto commented Oct 19, 2011

This was originally: http://trac.parrot.org/parrot/ticket/610

May I suggest that we cheat a little and use qemu attain the goal of what we want from cross-compiling, without actually cross-compiling.

I stole this idea from how emacs is cross-compiled in OpenEmbedded. Here is the rough idea:

1) We add some arguments to Configure.pl to specify a target architechture 2) Our config subsystem learns how to detect if qemu is available 3) If qemu isn't available, die if attempting to cross compile 4) If qemu is available, start a qemu process of the wanted target architecture, then run the entire build process within qemu

The output of this will be binaries for architecture X, which are actually compiled, through the magic unicorn farts of qemu, for architecture Y.

I think that this is actually feasible in the short term, unlike actually modifying our config+build system to natively cross-compile, which I highly doubt will happen before the heat death of the universe.

To clarify, after qemu is started, another run of Configure.pl inside of qemu will be needed, and then a build.

@rurban
Parrot Virtual Machine member
rurban commented Dec 21, 2012

We should not care about qemu when trying to do remote "cross" compilation, as the qemu host might be running on real HW. No one cares if it's qemu, kvm, vmware, virtualbox or real HW, it just needs to be accessible, via network (sshd) or serial /dev/ttyS0.

I actually did a few qemu builds, and there was no need to teach Configure.PL anything,
as everything is done on the remote host.

scp bootstrap-parrot.sh crosshost:
ssh crosshost bootstrap-parrot.sh
ssh crosshost "cd parrot & perl Configure.PL & make & make smoke"

bootstrap-parrot.sh should check for git, perl, and download or update parrot.

This can be done form a simple bootstrap-qemu.sh script.
The setup of such a machine can be automated via poky/bitbake. See http://www.pokylinux.org/

I published some of my custom debian machines at http://perl514.cpanel.net/qemu/, and I'll provide some ARM machines also, built with poky.
To build a core-image-minimal-qemuarm and the default core-image-minimal-qemux86 I only needed 2hrs and temp. 50GB-100GB, final 30GB.
So it should be doable on a fresh SSD.

I'm happy to provide a tested bootstrap-qemu.sh script, which downloads poky, and sets up such an image automatically.
It needs python though :)

--cross=config_host.pir should be used for real native cross compilation, and I see no need for a configure probe. The user has to provide all the setup and information beforehand.
Native cross compilation via --cross would also need to cheat and either manually set mosty config values
or bypass our config probes, using an existing config_lib.pir.
From this information the makefiles need to be generated.

@leto
Parrot Virtual Machine member
leto commented Dec 21, 2012

@rurban : very interesting! I was thinking of the case where people have qemu locally and want to basically run Configure.pl under qemu. For example, I did something like that to get Parrot running on RTEMS with qemu.

Perhaps what we need is a nice document which describes how to go about using qemu+parrot to do cross builds.

Have you looked into creating a BitBake/Poky recipe for Parrot? I haven't looked at that stuff in about 2 years, when it used to be called OpenEmbedded. Now it seems that Poky is part of the Yocto project, which is developed by the Intel Open Technology Center.

@rurban
Parrot Virtual Machine member
rurban commented Feb 16, 2016

Some documentation is now at http://blogs.perl.org/users/rurban/2012/07/architecture-testing.html
I usie qemu images regularly to update native_pbc and for smoking

@rurban rurban closed this Feb 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.