WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

Re: [Xen-devel] Re: [Xen-ia64-devel] cross compiling xen/ia64

Hi Ian,

Sorry this took so long.  Xen Summit got in the way of work. ;-)

I've managed to get the cross-building working in an etch chroot.
I think the main difference between your build and mine is that
my build is running in a cron job, so stdin is /dev/null.  That
allows the kernel config to go through without prompting
(accepting defaults, which isn't necessarily ideal, but at least
it allows the automated build to progress).

If it's helpful, here are most of the steps I did after creating
the chroot with debootstrap, bind-mounting some dirs into it, and
installing sudo...

1. Move aside invoke-rc.d so that daemons aren't started in the
   chroot.  Using dpkg-divert makes it stick for future updates.
   See http://www.debian-administration.org/articles/118

   $ sudo dpkg-divert --add --rename --divert /usr/sbin/invoke-rc.d{.real,} 
   $ sudo ln -s /bin/true /usr/sbin/invoke-rc.d

2. Install most of the stuff we need for building the
   cross-compiler and xen.  The underscore on mawk_ causes it to
   be uninstalled so gawk can take its place.

   $ sudo aptitude install mawk_ gawk mercurial dpkg-cross fakeroot 
   $ sudo apt-get build-dep binutils gcc-4.1

3. Install the pre-built cross toolchain from the emdebian
   project.  Unfortunately the emdebian-provided toolchain
   doesn't use the sysroot, but installing it makes things easier
   since it fulfills some cross-deps...

   $ echo 'deb http://www.emdebian.org/debian/ stable main' | \
      sudo tee -a /etc/apt/sources.list
   $ wget -O- http://www.emdebian.org/0x97BB3B58.txt | sudo apt-key add -
   $ sudo aptitude update
   $ sudo aptitude install gcc-4.1-ia64-linux-gnu

4. Prepare to rebuild the toolchain.

   $ echo 'deb-src ftp://ftp.us.debian.org/debian/ stable main' | \
      sudo tee -a /etc/apt/sources.list
   $ sudo aptitude update
   $ mkdir cross-debs
   $ cd cross-debs

5. Rebuild binutils to use the sysroot.

   $ apt-get source binutils
   $ cd binutils-2.17/
   $ patch -p0 < binutils-debian-sysroot.patch  # see attachment
   $ TARGET=ia64 fakeroot debian/rules binary-cross  # see debian/README.cross
   $ cd ..
   $ sudo dpkg -i binutils-ia64-linux-gnu_2.17-3_amd64.deb

6. Unpack the chroot since it's required to build gcc with
   sysroot capability.

   $ wget http://free.linux.hp.com/~agriffis/cross/sys-roots/etch-ia64.tar.gz
   $ sudo tar xzf etch-ia64.tar.gz -C /usr/ia64-linux-gnu
   $ sudo ln -s etch-root /usr/ia64-linux-gnu/sys-root

7. Install another requirement for rebuilding gcc.

   $ wget 
ftp://ftp.us.debian.org/debian/pool/main/liba/libatomic-ops/libatomic-ops-dev_1.1-4_ia64.deb
   $ sudo dpkg-cross -i -a ia64 libatomic-ops-dev_1.1-4_ia64.deb 

8. Rebuild gcc-4.1 to use the sysroot.

   $ apt-get source gcc-4.1
   $ cd gcc-4.1_4.1.1ds2
   $ export GCC_TARGET=ia64 DEB_CROSS_INDEPENDENT=yes with_sysroot=yes
   $ debian/rules  # see debian/README.cross
   $ dpkg-buildpackage -rfakeroot
   $ cd ..
   $ sudo dpkg -i *amd64.deb *all.deb

9. Build xen.

   $ cd
   $ hg clone http://xenbits.xen.org/xen-unstable.hg
   $ hg clone http://xenbits.xen.org/linux-2.6.18-xen.hg
   $ cd xen-unstable.hg
   $ make XEN_TARGET_ARCH=ia64 CROSS_COMPILE=ia64-linux-gnu- world </dev/null

10. Profit!!!

I'll try to update the wiki to include both Fedora-based and
Debian-based setups.

Thanks,
Aron

Attachment: binutils-debian-sysroot.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel