cross-compiling.txt 4.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

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.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68


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

69 70
      gmake install_sw INSTALL_PREFIX=/tmp/stargate-install \
	    SHARED_ILBS="libssl.so.0.9.7 libcrypto.so.0.9.7"
71 72 73 74

Finally, build the testbed tree:

  env ELVIN_CONFIG=/tmp/elvin-install/bin/elvin-config \
75 76
      LDFLAGS=-L/tmp/stargate-install/usr/lib \
      CFLAGS=-I/tmp/stargate-install/usr/include \
77 78 79 80 81 82 83 84
      ../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
85

86 87
  env CC=arm-linux-gcc LDSHARED="arm-linux-gcc -shared -Wl,-soname,libz.so.1" \
      ./configure --prefix=/usr --shared
88 89 90 91 92 93 94 95 96 97 98 99 100 101

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
102

103 104 105 106 107 108 109 110 111 112 113 114 115 116
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/

117 118 119 120 121 122 123 124 125 126 127
rsync flags: -avzpog --exclude-from=garcia.exclude

contents of garcia.exclude:
/proj/*
/share/*
/var/*
/proc/*
/users/*
/dev/*
/tmp/*
/mnt/*