On 5/13/2015 9:35 PM, Wookey wrote:
+++ Ganesan, Aravind [2015-05-13 20:58 -0600]:
On 5/13/2015 7:12 PM, Wookey wrote:
+++ Ganesan, Aravind [2015-05-13 18:35 -0600]:
Hi Guys, I have two questions: (1) I have download gcc-4.9 tool chain from http://releases.linaro.org/14.08/components/toolchain/binaries. The kernel for the release (http://releases.linaro.org/14.08/components/kernel/linux-linaro) is 3.16. So can we assume the kernel headers found in the tool chain installation from the link above belongs to linux version 3.16?
(2) Also, I ubuntu wiki indicates that starting with Ubuntu 12.04 they are using linaro gcc packages for arm64
Not linaro packages directly, but the same source tree/patch set.
(https://wiki.ubuntu.com/ToolChain). Is there an easy way to find what linaro-release (for tool chain) will be compatible with Ubuntu 14.10 aarch64 image?
If building on Ubuntu it's much easier to use the ubuntu-packaged toolchains (or cross-toolchains) which should function just the same but have multiarch enabled and be properly packaged.
That should make your Q1 moot as you the kernel-headers are a separate package from the cross-toolchain and normal package-management tools will make it obvious what versions are available/installed.
You only want to try using a linaro toolchain release directly if there is some super-recent feature that you need, but which hasn't yet made it into the Ubuntu toolchain (they will always be somewhat behind 'current' especially if building on stable).
Thanks Wookey. I'm developing on a X86_64 machine runningUbuntu-12.04 (which, AFAIK, doesn't have aarch64 toolchain) .
Correct - that appeared in 14.04
I'm trying to find a cross-compilation tool-chain for building Linux kernel and applications targeting a qemu-aarch64 machine-emulation running Ubuntu 14.10.
Build in a 14.04 chroot, and thus use 14.04 toolchain, and libraries.
Use any of debootstrap, or sbuild-createchroot or the ubuntu-specific mksbuild to make at 14.04 chroot.
You can either make a qemu arm64 chroot and native-build in it, or make an amd64 chroot and cross-build in it.
This tells you how make a qemu-ready arm64 chroot (adjust instructions debian-> ubuntu) https://wiki.debian.org/Arm64Port#Debootstrap_arm64
This tells you how to make an amd64 chroot: https://help.ubuntu.com/community/DebootstrapChroot I prefer to use sbuild-createchroot because it does all those sbuild config runes for you (and can make a tarball chroot for clean builds every time).
sbuild-createchroot --components=main,universe --make-sbuild-tarball=/srv/chroots/precise-cross-buildd.tgz precise /srv/chroots/precise http://archive.ubuntu.com/ubuntu/ sbuild-adduser <your-username> Contents Cross Compiling using Multi-Arch Preparing multiarch chroot Manually preparing multiarch chroot Multiarch cross-building requirements Crossbuilding requirements Cross toolchain Cross pkg-config support dpkg-cross support Environment variables Adding qemu support Configuring dpkg Installing cross-build deps Running the build Cross Compiling examples Steps to proceed from here Cross Compiling using Multi-Arch This page details what is required to do multiarch crossbuilding. If you just want to use it then read 'Preparing multiarch chroot'. The building itself is trivial (sbuild does all the work), the intial chroot setup is most of it. You can do cross-builds without setting up a chroot, but it is not recommended because it puts a lot of guff in your system and mulitarch problems are much more likely on a more fully-populated system.
Preparing multiarch chroot
There is now a helper script to do the work dsescribed below (in xbuilder 0.8) so if you just want to make a cross-build chroot and use it this is the way to do it. This currently assumes Ubuntu, and would need some minor adjustements for Debian (changing the /etc/apt/sources in the chroot because of the different archive layout).
Install xbuilder 0.8 from the Linaro cross-tools PPA
apt-add-repository ppa:linaro-foundations/cross-build-tools apt-get update apt-get install xbuilder
Setup the chroot
xbuild-chroot-setup precise /srv/chroots/precise-cross
You can optionally specify a mirror with --mirror, and to set up qemu in the chroot using --with-qemu
xbuild-chroot-setup precise /srv/chroots/precise-cross --with-qemu --mirror=http://localhost:3142/ubuntu
That's it. Easy peasy.
Do builds in the chroot created with:
sbuild --host=<arch> -d <suite> -c <suite>-<build-arch>-sbuild <package>
e.g.
sbuild --host=armhf -d precise -c precise-amd64-sbuild <package>
(If you don't have lots of chroots already then you can skip the -c and sbuild will probably pick the right one)
Note that the chroots are set up with sbuild-createchroot so if you've already used that for this particular suite then you'll end up with two named the same and schroot will sulk. Just rename one in /etc/schroot/chroot.d/<suite>-amd64-sbuild-xxxxx (The name is the bit in square brackets on the top lione of the config).
Manually preparing multiarch chroot
Below full details are given of what is actually required. Here is the short version of what to type if you just want to set up a suitable environment and do manual builds. See CrossBuildd for setting up an automated system.
add-apt-repository deb http://ppa.launchpad.net/linaro-foundations/cross-build-tools/ubuntu precise main apt-get update apt-get install sbuild schroot qemu-user-static
For testing, you will want a precise or later (ubuntu) or wheezy or later (debian) chroot. Raring works best at the moment (May 2013).
sbuild-createchroot --components=main,universe --make-sbuild-tarball=/srv/chroots/trusty-cross-buildd.tgz trusty /srv/chroots/trusty http://archive.ubuntu.com/ubuntu/ sbuild-adduser <your-username> sbuild-update --keygen
more details on https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/UsingMultiArch#Man...
HTH
Wookey
I appreciate you taking the time, thank you Wookey.