This shows you the differences between two versions of the page.

Link to this comparison view

building [2014/09/17 15:03] (current)
archmobile created
Line 1: Line 1:
 +Note: This page should mention that it describes an alternative method. For the official method see the Build Environment page.
 +Building Arch Linux for Openmoko
 +This is a suggestion on how to build arch pkgs on your host machine. It will use a chrooted arm environment which is emulated using qemu. Since doing compilation with a emulated gcc will take a long time, we will instead use the cross compiler. For this you need to things:
 +qemu-static-arm - a static qemu build
 +an installed cross toolchain
 +A PKGBUILD for qemu-static-arm together with a needed patch is attached to this page. Instructions on how to build the cross toolchain is available  here.
 +Creating the chroot environment
 +Get the current package release and install them to a directory of your choice. For example assuming that the package repository has been copied to pkgs/ and the chroot will be under arm-root/ :
 +mkdir arm-root
 +cd arm-root   
 +for x in ../pkgs/*;
 + do                
 +  echo $x;         
 +  sudo tar xzf $x; 
 + done;             
 +Copy over the qemu emulator to the croot:
 +cp /usr/bin/qemu-static-arm arm-root/usr/bin/
 +Tell the kernel to use qemu-static-arm to execute arm executables:
 +sudo mount -t binfmt_misc none /proc/sys/fs/binfmt_misc           
 +sudo bash -c 'echo ":arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-static-arm:" > /proc/sys/fs/binfmt_misc/register'
 +Installing the cross compiler
 +Assuming the cross compiler has been installed to /usr/arm-uknown-linux-gnueabi/ do this
 +cp -r /usr/arm-uknown-linux-gnueabi/ arm-root/usr
 +Since the cross compiler is not statically linked we need to provide the native dynamic loader and native libs in the chroot (This is only possible since the arm gnueabi dynamic loader is called ld-linux.so.3, while on x86 the dynamic loader is called ld-linux.so.2). Do this
 +cp /lib/ld-linux.so.2 arm-root/lib
 +mkdir arm-root/lib/i686
 +cp /lib/libc.so.6 arm-root/lib/i686
 +To make libtool happy we need to link the cross-compiler exec to their native names, i.e.
 +cd arm-root/usr/arm-unknown-linux-gnueabi/bin
 +for i in arm-unknown-linux-gnueabi-*; do ln -s $i ${i/arm-unknown-linux-gnueabi-/}; done
 +Now you are ready to compile in the chroot with native compilation speed. To further increase compilation speed (for example in the configure step) you can also copy the native bsdtar, sed, awk and other coreutils to the chroot. You just have to make sure that their needed libraries are installed at lib/i686.
 +Change to the arm-root, reset the PATH to use the cross compiler and use the standard makepkg and makeworld stuff.
 +sudo chroot arm-root /bin/bash
 +export PATH=/usr/arm-uknown-linux-gnueabi/bin:$PATH
 +cd /var/abs/core/glib2/
building.txt · Last modified: 2014/09/17 15:03 by archmobile
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki