Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Wiki / Crosscompiling

Crosscompiling

Cross Compiling

Cross Compiling

These are some quick notes on cross-compiling the testbed tree for the stargates on the garcia. Autoconf generates some of the necessary code for dealing with this stuff, you just need the necessary magic to turn it on. In this case, running the following command line on the RHL90-XSCALE-CROSS disk image should do the trick:

  $ ../testbed/configure --host=arm-linux --build=i686-linux \
	--with-brainstem=/proj/testbed/src/brainstem

The "--host" argument tells configure what CPU/OS we want the code to run on and the "--build" argument tells it what CPU/OS we are building on. Both arguments must be given for this to work.

XXX ... more junk ... clean up later ... can't talk in detail now ...

The magic incantations needed to build the testbed client side for the stargates. I've put most of the results in:

  /proj/testbed/src/

To do it from scratch, you'll need to allocate a node with the RHL90-XSCALE-CROSS images. I went after libelvin and elvind first, they needed a quick hack on their configure scripts to ignore some tests...

libelvin: (not sure if the without/disable flags are all right...)

  env PATH=/usr/local/arm/3.4.1/bin:${PATH} \
      CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib \
      ./configure --prefix=/tmp/elvin-install \
      --without-x --without-xt --without-gtk --disable-http \
      --disable-cluster --disable-mgmt

!! Note the elvin-install dir for the prefix, we need to use this because that is what elvin-config will report, and we don't want it talking about the x86 config !!

  env PATH=/usr/local/arm/3.4.1/bin:${PATH} gmake

  env PATH=/usr/local/arm/3.4.1/bin:${PATH} gmake install

elvind: (not sure if the without/disable flags are all right...)

  env PATH=/usr/local/arm/3.4.1/bin:${PATH} \
      CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib \
      ./configure --with-elvin=/tmp/elvin-install/ \
      --disable-mgmt --disable-cluster

  env PATH=/usr/local/arm/3.4.1/bin:${PATH} gmake

  env PATH=/usr/local/arm/3.4.1/bin:${PATH} gmake install \
      DESTDIR=/tmp/stargate-install

Cross-compiling openssl for arm:

  http://dudu.dyn.2-h.org/nist/qt-notes.php#ccSsl

  env PATH=/usr/local/arm/3.4.1/bin:${PATH} gmake install_sw \
      INSTALL_PREFIX=/tmp/stargate-install

      gmake install_sw INSTALL_PREFIX=/tmp/stargate-install \
	    SHARED_ILBS="libssl.so.0.9.7 libcrypto.so.0.9.7"

Finally, build the testbed tree:

  env ELVIN_CONFIG=/tmp/elvin-install/bin/elvin-config \
      LDFLAGS=-L/tmp/stargate-install/usr/lib \
      CFLAGS=-I/tmp/stargate-install/usr/include \
      ../testbed/configure --host=arm-linux --build=i686-linux \
      --with-brainstem=/proj/testbed/src/brainstem

!! Add LDFLAGS and CPPFLAGS to pickup openssl !!

  gmake client

  gmake client-install DESTDIR=/tmp/stargate-install

  env CC=arm-linux-gcc LDSHARED="arm-linux-gcc -shared -Wl,-soname,libz.so.1" \
      ./configure --prefix=/usr --shared

Random notes:

hostname isn't set right, it's always "stargate" instead of the emulab one, have to run sethostname.dhclient manually.

had to build, statically link, and install mktemp since its missing and needed by install-tarfile.

made a fake /sbin/consoletype

copied /etc/sysconfig/network from a pc

added /var/tmp, /var/db to /etc/rcS.d/S05mountall.sh for install-tarfile

openssh:

  ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-libs="-lresolv" --disable-strip

  gmake CC=arm-linux-gcc \
	LDFLAGS="-L/tmp/stargate-install/usr/lib -L. -Lopenbsd-compat" \
	CFLAGS="-I/tmp/stargate-install/usr/include -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -std=gnu99" RANLIB=arm-linux-ranlib \
	AR=arm-linux-ar LD=arm-linux-gcc

  gmake install CC=arm-linux-gcc \
	LDFLAGS="-L/tmp/stargate-install/usr/lib -L. -Lopenbsd-compat" \
	CFLAGS=-I/tmp/stargate-install/usr/include RANLIB=arm-linux-ranlib \
	AR=arm-linux-ar LD=arm-linux-gcc DESTDIR=/tmp/stargate-install/

rsync flags: -avzpog --exclude-from=garcia.exclude

contents of garcia.exclude:

/proj/*
/share/*
/var/*
/proc/*
/users/*
/dev/*
/tmp/*
/mnt/*