BuildEABIChroot

Differences between revisions 5 and 11 (spanning 6 versions)
Revision 5 as of 2009-07-18 09:18:14
Size: 2754
Editor: p5098ed03
Comment:
Revision 11 as of 2012-06-10 23:14:37
Size: 2261
Comment: Update for newer ubuntu versions
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
The binfmt-misc module in the kernel makes it possible to execute binaries of foreign arches under linux.
Qemu uses this fact to enable several architecture specific execution environments in userspace without the need to run a kernel of the target architecture. Sadly arm EABI support is not among them in the 0.10.5 release used in ubuntu today.
The binfmt-misc module in the kernel makes it possible to execute binaries of foreign architectures by using a binary translator such as qemu.
Qemu can run execution environments in userspace without running a kernel of the target architecture (e.g., a virtual machine). Qemu supports several architectures in this way, including ARM.
Line 4: Line 4:
A patch for qemu exists at http://qemu-arm-eabi.sourceforge.net/ to enable EABI support in qemu-arm.
Line 6: Line 5:
A binary package called qemu-arm-eabi exists in the PPA below that contains such a static binary, automatically enables the binfmt configuration and ships a wrapper script to debootstrap called build-arm-eabi-chroot. A binary package called qemu-user-static exists that contains such a static qemu binary, automatically enables the binfmt configuration, sets the proper sysctl variables and ships a wrapper script to debootstrap called qemu-debootstrap.
Line 10: Line 9:
A sanitized version of the mentioned patchset that cleanly applies to qemu-0.10.5 can be found in the source package in the debian directory in case you want to develop it further.

/!\ Note that the way the qemu userspace emulation is implemented makes it act like a translation layer for syscalls, the syscalls between ARM and x86 systems do not match 1:1 so you still might see some that are not properly translated by the patches. While the setup below works fine, it should not be trusted for critical work (do not use it to implement a buildd if you plan to rebuild the whole distro for example, its fine for home use to do testbuilds of packages or rolling chroots for creating root filesystems that you want to run on real hardware later on though)
 /!\ Note that the way the qemu userspace emulation is implemented makes it act like a translation layer for syscalls, the syscalls between ARM and x86 systems do not match 1:1 so you still might see some that are not properly translated by the patches ('''mono packages specifically do not work here'''). While the setup below works fine, it should not be trusted for critical work (do not use it to implement a buildd if you plan to rebuild the whole distro for example, its fine for home use to do testbuilds of packages or rolling chroots for creating root filesystems that you want to run on real hardware later on though)
Line 16: Line 13:
To use an arm eabi enabled chroot on your i386/amd64 system, add the entry below to /etc/apt/sources.list ...

{{{
deb http://ppa.launchpad.net/ogra/ppa/ubuntu karmic main
}}}

Install qemu-arm-eabi ...
To use an arm eabi enabled chroot on your i386 system, install the qemu-user-static package.
Line 26: Line 17:
sudo apt-get install qemu-arm-eabi sudo apt-get install qemu-user-static
Line 28: Line 19:
''(consider disabling the sources.list entry again after you installed the package, the PPA might contain other experimental packages you dont want on your system)''
Line 33: Line 23:
ogra@osiris:~$ build-arm-eabi-chroot karmic eabi-chroot ogra@osiris:~$ sudo qemu-debootstrap --arch armel precise eabi-chroot
Line 47: Line 37:
Now you can build/test packages etc, the chroot works like any other x86 chroot on your system as long as you have the qemu-arm-eabi package installed with the advantage that you can make use of all resources your host system provides (CPU speed, RAM, diskspeed etc) Now you can build/test packages etc, the chroot works like any other x86 chroot on your system as long as you have the qemu-arm-static package installed with the advantage that you can make use of all resources your host system provides (CPU speed, RAM, diskspeed etc)

The binfmt-misc module in the kernel makes it possible to execute binaries of foreign architectures by using a binary translator such as qemu. Qemu can run execution environments in userspace without running a kernel of the target architecture (e.g., a virtual machine). Qemu supports several architectures in this way, including ARM.

To make use of this feature to build chroots, qemu needs to be build as a static binary. A binary package called qemu-user-static exists that contains such a static qemu binary, automatically enables the binfmt configuration, sets the proper sysctl variables and ships a wrapper script to debootstrap called qemu-debootstrap.


  • Warning /!\ Note that the way the qemu userspace emulation is implemented makes it act like a translation layer for syscalls, the syscalls between ARM and x86 systems do not match 1:1 so you still might see some that are not properly translated by the patches (mono packages specifically do not work here). While the setup below works fine, it should not be trusted for critical work (do not use it to implement a buildd if you plan to rebuild the whole distro for example, its fine for home use to do testbuilds of packages or rolling chroots for creating root filesystems that you want to run on real hardware later on though)

Setting up an ARM chroot on your x86 machine

To use an arm eabi enabled chroot on your i386 system, install the qemu-user-static package.

sudo apt-get update
sudo apt-get install qemu-user-static

And create the chroot with the included debootstrap wrapper script (it takes/requires the same options debootstrap uses)

ogra@osiris:~$ sudo qemu-debootstrap --arch armel precise eabi-chroot
[sudo] password for ogra: 
I: Retrieving Release
I: Retrieving Packages

...

I: Base system installed successfully.
arm-eabi chroot successfully created in eabi-chroot
ogra@osiris:~$ sudo chroot eabi-chroot
root@osiris:/# uname -m
armv5tel

Now you can build/test packages etc, the chroot works like any other x86 chroot on your system as long as you have the qemu-arm-static package installed with the advantage that you can make use of all resources your host system provides (CPU speed, RAM, diskspeed etc)

ARM/BuildEABIChroot (last edited 2016-08-17 22:35:01 by mariogrip)