Running Tor on chumby One

From Chumby Wiki
Revision as of 19:25, 29 December 2009 by Bunnie (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here's a HOWTO on building and running Tor on chumby One.

Building Tor

Let's assume you have access to a Linux machine. This procedure was executed on an Ubuntu 9.04 image.

First, you will need download and install a cross-compiling toolchain. Instructions on how to do this can be found here: http://wiki.chumby.com/mediawiki/index.php/GNU_Toolchain.

Then, grab the tor source: https://www.torproject.org/dist/tor-0.2.1.21.tar.gz

Tar and unzip. Before you can compile Tor, you're going to need to build some of your own dependencies too. In particular, you need libevent, openssl, and zlib.

libevent: http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
openssl: http://www.openssl.org/source/openssl-0.9.8l.tar.gz
zlib: http://www.zlib.net/zlib-1.2.3.tar.gz

Before proceeding, I suggest building a simple hello world program and verifying that arm-linux-gcc is working correctly.

Building libevent

This one is fairly easy. Just run this command inside the libevent source root:

./configure --host=arm-linux

And then run

make

The libraries don't need to be installed, since you will bundle them up with the tor binary anyways. They are held in .libs.

Building zlib

This one is a little bit trickier. It doesn't really have cross-compilation support built into the configure script. So, first, run

./configure

In the zlib source root, and then you need to hand-edit the Makefile. You need to add the "arm-linux-" prefix for the following variables:

  • LDFLAGS
  • CPP
  • AR
  • RANLIB

The top few lines of the Makefile will look a bit like this:

CC=arm-linux-gcc

CFLAGS=-O3 -DUSE_MMAP

LDFLAGS=-L. libz.a
LDSHARED=arm-linux-gcc
CPP=arm-linux-gcc -E

LIBS=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.3
SHAREDLIBM=libz.so.1

AR=arm-linux-ar rc
RANLIB=arm-linux-ranlib

Now you can run "make" and a libz.a should appear in the source root.

Building open SSL

This one is also a little bit tricky. You can find a guide to cross-compiling open SSL here, but basically, the steps are outlined below.

First, configure open SSL for linux-generic32:

./Configure linux-generic32

Then, patch the Makefile to add the arm-linux- prefix to all the key programs and paths:

29c29
< INSTALLTOP=/usr/local/ssl
---
> INSTALLTOP=/usr/arm-linux/local/ssl
32c32
< OPENSSLDIR=/usr/local/ssl
---
> OPENSSLDIR=/usr/arm-linux/local/ssl
62c62
< CC= gcc
---
> CC= arm-linux-gcc
69,71c69,71
< AR=ar $(ARFLAGS) r
< ARD=ar $(ARFLAGS) d
< RANLIB= /usr/bin/ranlib
---
> AR=arm-linux-ar $(ARFLAGS) r
> ARD=arm-linux-ar $(ARFLAGS) d
> RANLIB= /usr/arm-linux/bin/ranlib
75c75
< MAKEDEPPROG= gcc
---
> MAKEDEPPROG= arm-linux-gcc

Now you can run "make".

Building Tor

Now that you've got all your dependent libraries, you can finally build Tor.


Installing Tor