Esther Fuhrmann: Difference between revisions

From
Jump to navigation Jump to search
Line 133: Line 133:
<pre>
<pre>
#!/bin/sh
#!/bin/sh
# Verzeichnis bestimmen, in dem Skript liegt (klappt nicht, wenn Aufruf ueber PATH-Variable

DIR=`dirname $0`
# Wlan-MAC bestimmen
# Wlan-MAC bestimmen
WLANMAC=`ifconfig -a | grep wlan0 | awk '{print $5}'`
WLANMAC=`ifconfig -a | grep wlan0 | awk '{print $5}'`
# IP fuer die MAC aus Datei bestimmen
# IP fuer die MAC aus Datei bestimmen
MYIP=`cat ipmac.txt | grep $WLANMAC | awk '{print $1}'`
MYIP=`cat $DIR/ipmac.txt | grep $WLANMAC | awk '{print $1}'`
# IP setzen
# IP setzen
ifconfig wlan0 add $MYIP netmask 255.255.255.0
ifconfig wlan0 add $MYIP netmask 255.255.255.0
</pre>

== Alles Click beenden ==

<pre>
#!/bin/sh
killall S90sdp
killall click
umount /tmp/click
rmmod click
rmmod proclikefs
echo done
</pre>

== Kernelclick mit brn_kernel_gateway.click starten ==

<pre>
#!/bin/sh
cd /tmp
rm -rf /tmp/expl
mkdir expl
cd expl
wget http://merkur/svn/brn/platform/wgt634u/brn/startup/iptables.sh
#cp /mnt/efuhrman/knoten/brn_kernel_gateway.click .
wget http://merkur/svn/brn/platform/wgt634u/brn/startup/brn_kernel_gateway.click
wget http://merkur/svn/brn/platform/wgt634u/brn/startup/startup.sh
#cp /tmp/sdp/current/click.ko.gz /tmp/expl # fuer version 22
cp /mnt/efuhrman/knoten/click.ko.gz /tmp/expl
cp /mnt/efuhrman/knoten/proclikefs.ko /tmp/expl
echo Copy beendet
gunzip click.ko.gz
insmod proclikefs.ko
echo proclikefs geladen
insmod click.ko
echo click geladen
mkdir /tmp/click
mount -t click none /tmp/click
echo /tmp/click gemountet
click-align brn_kernel_gateway.click > aligned.click
cat aligned.click > /tmp/click/config
echo fertig

</pre>
</pre>

Revision as of 16:34, 8 February 2006

Toolchain

Kernel

build.sh editieren
wichtig ist das "ccache\ "

#! /bin/sh

make CROSS_COMPILE=mipsel-linux- CC=ccache\ mipsel-linux-gcc

madwifi.stripped

  • build.sh
#!/bin/sh

make TARGET=mips-le-elf KERNELPATH=$HOME/projects/brn/madmax/mips/kernel CC=ccache\ mipsel-linux-gcc

Click Kernelmodul bauen

  • Kernel kompilieren (build.sh)
  • Click kompilieren (erst conf_mips.sh, Warning ignorieren, cd linuxmodule/, make)
  • im Verzeichnis linuxmodule: build.sh editieren
#! /bin/sh

make TARGET=mips-le-elf CROSS_COMPILE=mipsel-linux- CC=ccache\ mipsel-linux-gcc

Click Modular Router


Wer macht ähnliches?

checkout.sh

#!/bin/sh

path=$HOME

echo "Creating directories"
mkdir -p $path/projects/brn/openwrt
mkdir -p $path/projects/brn/madmax
mkdir -p $path/projects/brn/madmax/mips/click
mkdir -p $path/projects/brn/madmax/mips/kernel
mkdir -p $path/projects/brn/madmax/mips/madwifi
mkdir -p $path/projects/brn/madmax/mips/madwifi.stripped
mkdir -p $path/projects/brn/madmax/mips/brn
mkdir -p $path/projects/brn/madmax/x86

# checkout
echo "Checking out"
svn co svn://merkur/brn/archives/click-20051012/ $path/projects/brn/madmax/mips/click
svn co svn://merkur/brn/platform/wgt634u/brn/src $path/projects/brn/madmax/mips/click/elements/brn

svn co svn://merkur/brn/archives/madwifi-20051013/ $path/projects/brn/madmax/mips/madwifi

svn co svn://merkur/brn/archives/madwifi_stripped-20051015/ $path/projects/brn/madmax/mips/madwifi.stripped

svn co svn://merkur/brn/archives/linux-kernel-2.6.12-rc3/ $path/projects/brn/madmax/mips/kernel

svn co svn://merkur/brn/platform/wgt634u/brn/ $path/projects/brn/madmax/mips/brn

echo "Copying sources to x86 directory"
cp -a $path/projects/brn/madmax/mips/click/ $path/projects/brn/madmax/x86/
#cp -a $path/projects/brn/madmax/mips/kernel $path/projects/brn/madmax/x86/
cp -a $path/projects/brn/madmax/mips/madwifi/ $path/projects/brn/madmax/x86/
cp -a $path/projects/brn/madmax/mips/madwifi.stripped/ $path/projects/brn/madmax/x86/
cp -a $path/projects/brn/madmax/mips/brn/ $path/projects/brn/madmax/x86/

How to (temporarily) set up a SDP independent from the running one

  • First build everything for the new SDP. To do so, follow Bernhard's description, BUT there are two important differences:
    • Change BRN_NEIGHBOR_BEACON_MAGIC in <YOUR_BUILD_DIR>/click/include/clicknet/brn.h to a unique value. (Otherwise there will be problems with an existing SDP!)
    • Don't deploy your new package in the last step
  • Then the following has to be done for every node that is part of the new SDP infrastructure

Put the new software onto the WGT

scp -r <YOUR_BUILD_DIR>/sdp/package/library/0 root@<wgt_to_be_changed>:/tmp/sdp/library/

Then telnet to the WGT and execute the following commands

cd /tmp/sdp
killall S90sdp
/usr/sbin/rcclick stop
killall click
echo 0 > /tmp/sdp/current_id
rm /tmp/sdp/current
ln -s /tmp/sdp/library/0 /tmp/sdp/current
/usr/sbin/rcclick start /tmp/sdp

For convenience we took all these steps using a (strange) script

ssh -XT localhost "/bin/bash -c 'SSH_ASKPASS=/home/brn/brn/unserpassword.sh \
  scp -r ~/brn/sdp/openwrt/sdp/package/library/0 root@wgt24:/tmp/sdp/library/'"

ssh -XT localhost "/bin/bash -c \"SSH_ASKPASS=/home/brn/brn/unserpassword.sh ssh -n root@wgt24 '\
killall S90sdp ;\
/usr/sbin/rcclick stop ;\
killall click; \
echo 0 > /tmp/sdp/current_id ;\
rm /tmp/sdp/current ;\
ln -s /tmp/sdp/library/0 /tmp/sdp/current; \
/usr/sbin/rcclick start /tmp/sdp '\""

where unserpassword.sh is another script, that outputs the password for the WGT (for obvious reasons not recommended if anyone else has access to the script!) and returns 0.


Now the new SDP should be running and you should be able to deploy software on "your" nodes without affecting the other ones. To get rid of it and restore the original SDP (the SDP the rest of the testbed is running) just reboot the WGT.

IP auf WGT setzen

Mit diesem Skript erzeugt man aus dem Edit-Abschnitt im Wiki eine IP-Liste, die auf die Knoten verteilt wird.

#!/bin/sh
# https://sarwiki.informatik.hu-berlin.de/wiki/index.php?title=BerlinRoofNet&action=edit&section=2
sed  's/\s//g' | sed -n '/^|wgt/p' | awk -F'|' '{print $22, $10}' > ipmac.txt

Dieses Skript bestimmt die wlan-mac eines bestimmten Knotens und setzt eine IP auf dem wlan-interface (die zu setzende IP wird aus der IP-List geholt, die von obigem Skript erzeugt wurde).

#!/bin/sh
# Verzeichnis bestimmen, in dem Skript liegt (klappt nicht, wenn Aufruf ueber PATH-Variable
DIR=`dirname $0`
# Wlan-MAC bestimmen
WLANMAC=`ifconfig -a | grep wlan0 | awk '{print $5}'`
# IP fuer die MAC aus Datei bestimmen
MYIP=`cat $DIR/ipmac.txt | grep $WLANMAC | awk '{print $1}'`
# IP setzen
ifconfig wlan0 add $MYIP netmask 255.255.255.0

Alles Click beenden

#!/bin/sh
killall S90sdp
killall click
umount /tmp/click
rmmod click
rmmod proclikefs
echo done

Kernelclick mit brn_kernel_gateway.click starten

#!/bin/sh
cd /tmp
rm -rf /tmp/expl
mkdir expl
cd expl
wget http://merkur/svn/brn/platform/wgt634u/brn/startup/iptables.sh
#cp /mnt/efuhrman/knoten/brn_kernel_gateway.click .
wget http://merkur/svn/brn/platform/wgt634u/brn/startup/brn_kernel_gateway.click
wget http://merkur/svn/brn/platform/wgt634u/brn/startup/startup.sh
#cp /tmp/sdp/current/click.ko.gz /tmp/expl # fuer version 22
cp /mnt/efuhrman/knoten/click.ko.gz /tmp/expl
cp /mnt/efuhrman/knoten/proclikefs.ko /tmp/expl
echo Copy beendet
gunzip click.ko.gz
insmod proclikefs.ko
echo proclikefs geladen
insmod click.ko
echo click geladen
mkdir /tmp/click
mount -t click none /tmp/click
echo /tmp/click gemountet
click-align brn_kernel_gateway.click > aligned.click
cat aligned.click > /tmp/click/config
echo fertig