Difference between revisions of "HIP:TS-7000:dropbear"

From Earlham CS Department
Jump to navigation Jump to search
(booting)
(about)
Line 1: Line 1:
 
= about =
 
= about =
This page describes how to compile dropbear to run in Technologic System's TS-Linux distribution. We're using the TS-7260.
+
This page describes how to compile dropbear to run in Technologic System's TS-Linux distribution. We're using debian for development and a TS-7260 that's using the nfs redboot option.
  
 
= compiling =
 
= compiling =

Revision as of 17:56, 23 May 2007

about

This page describes how to compile dropbear to run in Technologic System's TS-Linux distribution. We're using debian for development and a TS-7260 that's using the nfs redboot option.

compiling

crosstool setup

download and setup ts crosstool package

  • At the time of this writing, I downloaded Linux Crosstool gcc-4.0.1-glibc-2.3.5 -- unknown (05-20-2006)
ftp://ftp.embeddedarm.com/ts-arm-linux-cd/cross-toolchains/crosstool-linux-gcc-4.0.1-glibc-2.3.5.tar.bz2

move it to / and unpack it

$ cd /
$ sudo tar -xf crosstool-linux-gcc-4.0.1-glibc-2.3.5.tar

add it to your path

$ cat ~/.bash_profile | grep cross
PATH=/opt/crosstool/gcc-4.0.1- glibc-2.3.5/arm-unknown-linux-gnu/bin:${PATH}

dropbear

download dropbear

$ wget http://matt.ucc.asn.au/dropbear/releases/dropbear-0.49.tar.bz2
$ cd dropbear-0.49/

configure/make

  • dropbear needs access to a good random pool in /dev/random, otherwise it will print this message while running:
Warning: Reading the random source seems to have blocked.
If you experience problems, you probably need to find a better entropy source. 
  • for some reason dropbear would always hang on /dev/random, so i edited options.h and changed the random device to be urandom for this error.
#define DROPBEAR_RANDOM_DEV "/dev/urandom"
  • the shell script i used to automate the build process
$ cat run.sh 
export CFLAGS="-Os -static -Wall"
export LDFLAGS="-static"
./configure --host=arm-unknown-linux-gnu --build=arm --disable-zlib --disable-syslog --disable-lastlog
make clean
make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" MULTI=1 STATIC=1

move files

  • relocate files to nfs directory
$ ln -s dropbearmulti ssh
$ mv dropbear ssh scp dropbearmulti dropbearkey dropbearconvert ../tslinux/usr/sbin/
$ mv dbclient ../tslinux/usr/bin

booting

disable ssh for inetd

$ cat etc/inetd.conf | grep ssh
#ssh    stream  tcp     nowait  root    /usr/sbin/dropbear      dropbear -i
$ kill -HUP <pid of inetd>

create init.d script

$ cat etc/init.d/dropbear  
OPTIONS="> /dev/null 2>&1"

case "$1" in
    start)
       echo "Starting dropbear..."
       /usr/sbin/dropbear $OPTIONS
    ;;
    stop)
        echo "Stopping dropbear..."
        pid=`pidof dropbear`
        if [ "$pid" != "" ]; then
           kill $pid
        fi 
    ;;                     
    restart)
        $0 stop 
        $0 start
    ;;
    *)
       echo "usage: start|stop|restart"
    ;;
esac

create rc link

$ cd etc/rc.d/rc3.d/
$ ln -s ../../init.d/dropbear S99dropbear

links