[or-cvs] r16934: {torvm} Win32 kernel driver build integration of Tap-Win32 and WinPc (in torvm/trunk/build/win32: . files)

coderman at seul.org coderman at seul.org
Tue Sep 23 06:27:26 UTC 2008


Author: coderman
Date: 2008-09-23 02:27:25 -0400 (Tue, 23 Sep 2008)
New Revision: 16934

Removed:
   torvm/trunk/build/win32/files/run.bat
Modified:
   torvm/trunk/build/win32/Makefile
   torvm/trunk/build/win32/files/buildall.sh
Log:
Win32 kernel driver build integration of Tap-Win32 and WinPcap parts, other misc clearing of commit code jams.

Modified: torvm/trunk/build/win32/Makefile
===================================================================
--- torvm/trunk/build/win32/Makefile	2008-09-22 20:06:25 UTC (rev 16933)
+++ torvm/trunk/build/win32/Makefile	2008-09-23 06:27:25 UTC (rev 16934)
@@ -102,6 +102,18 @@
 PTHREADS_URL=ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz
 PTHREADS_SUM=da8371cb20e8e238f96a1d0651212f154d84a9ac
 
+ACONF_F=autoconf2.5-2.61-1-bin.tar.bz2
+ACONF_URL=http://downloads.sourceforge.net/mingw/autoconf2.5-2.61-1-bin.tar.bz2?modtime=1190249465&big_mirror=1
+ACONF_SUM=7f05699dfeb0fea12b490da7204eeb89644a3bf7
+
+AMAKE_F=automake1.9-1.9.6-2-bin.tar.bz2
+AMAKE_URL=http://downloads.sourceforge.net/mingw/automake1.9-1.9.6-2-bin.tar.bz2?modtime=1190249841&big_mirror=1
+AMAKE_SUM=685dd354868ebb6fca148a300f20b55e1c036fca
+
+PERL_F=perl-5.6.1-MSYS-1.0.11-1.tar.bz2
+PERL_URL=http://downloads.sourceforge.net/mingw/perl-5.6.1-MSYS-1.0.11-1.tar.bz2?modtime=1206455338&big_mirror=1
+PERL_SUM=ff1f07a061c7958bc9043f0085a55ff0101b1be4
+
 SDL_F=SDL-1.2.13.tar.gz
 SDL_URL=http://www.libsdl.org/release/SDL-1.2.13.tar.gz
 SDL_SUM=51fcaa3e1d5c01fd813ea08688780f86b19cf539
@@ -114,6 +126,10 @@
 WPCAPRT_URL=http://peertech.org/files/WinPcap-4.1-files.tar.gz
 WPCAPRT_SUM=57d2eab8b1afcfdf65101849cfe4e4110ee3f121
 
+WPCAPSRC_F=WpcapSrc_4_1_beta4.zip
+WPCAPSRC_URL=http://www.winpcap.org/install/bin/WpcapSrc_4_1_beta4.zip
+WPCAPSRC_SUM=1450c4d293a38c25ec8cd8a9be30e04858df36d9
+
 WPD_F=WpdPack_4_1_beta4.zip
 WPD_URL=http://www.winpcap.org/install/bin/WpdPack_4_1_beta4.zip
 WPD_SUM=fa5255dc1a36ff47999d5b60aeadcf8ff9fb44cd
@@ -122,9 +138,16 @@
 QEMU_URL=http://bellard.org/qemu/qemu-0.9.1.tar.gz
 QEMU_SUM=630ea20b5989f0df00128de7f7be661c573ed041
 
+OVPN_F=openvpn-2.1_rc10.tar.gz
+OVPN_URL=http://openvpn.net/release/openvpn-2.1_rc10.tar.gz
+OVPN_SUM=b7f4af94704caa8aa3279ccbc391b98cf7ed953e
 
-ALLFILES=$(ZLIB_F) $(GZIP_F) $(BZIP2_F) $(LIBARCH_F) $(BINUTILS_F) $(GCCORE_F) $(GPP_F) $(MINGWRUN_F) $(MINGWUTIL_F) $(MAKE_F) $(W32API_F) $(MSYS_F) $(MSYSCORE_F) $(BASH_F) $(DIFFUTIL_F) $(LIBTOOL_F) $(MINIRES_F) $(MSYSZLIB_F) $(SSL_F) $(SSH_F) $(ZLIBSRC_F) $(PTHREADS_F) $(SDL_F) $(WPCAP_F) $(WPCAPRT_F) $(WPD_F) $(QEMU_F)
+WINDDK_F=1830_usa_ddk.iso
+WINDDK_URL=http://download.microsoft.com/download/9/0/f/90f019ac-8243-48d3-91cf-81fc4093ecfd/1830_usa_ddk.iso
+WINDDK_SUM=0d2154d88a5ee252cc908630c77863bb42777387
 
+ALLFILES=$(ZLIB_F) $(GZIP_F) $(BZIP2_F) $(LIBARCH_F) $(BINUTILS_F) $(GCCORE_F) $(GPP_F) $(MINGWRUN_F) $(MINGWUTIL_F) $(MAKE_F) $(W32API_F) $(MSYS_F) $(MSYSCORE_F) $(BASH_F) $(DIFFUTIL_F) $(LIBTOOL_F) $(MINIRES_F) $(MSYSZLIB_F) $(SSL_F) $(SSH_F) $(ZLIBSRC_F) $(PTHREADS_F) $(AMAKE_F) $(ACONF_F) $(PERL_F) $(SDL_F) $(WPCAP_F) $(WPCAPRT_F) $(WPCAPSRC_F) $(WPD_F) $(QEMU_F) $(OVPN_F)
+
 default all: downloads extract buildiso runinstall
 
 downloads: Makefile
@@ -151,10 +174,15 @@
 	@if [ ! -e $(WDLDIR)/$(SSH_F) ]; then $(DLCMD) "$(SSH_URL)" $(SSH_SUM) "$(WDLDIR)/$(SSH_F)"; fi
 	@if [ ! -e $(WDLDIR)/$(ZLIBSRC_F) ]; then $(DLCMD) "$(ZLIBSRC_URL)" $(ZLIBSRC_SUM) "$(WDLDIR)/$(ZLIBSRC_F)"; fi
 	@if [ ! -e $(WDLDIR)/$(PTHREADS_F) ]; then $(DLCMD) "$(PTHREADS_URL)" $(PTHREADS_SUM) "$(WDLDIR)/$(PTHREADS_F)"; fi
+	@if [ ! -e $(WDLDIR)/$(ACONF_F) ]; then $(DLCMD) "$(ACONF_URL)" $(ACONF_SUM) "$(WDLDIR)/$(ACONF_F)"; fi
+	@if [ ! -e $(WDLDIR)/$(AMAKE_F) ]; then $(DLCMD) "$(AMAKE_URL)" $(AMAKE_SUM) "$(WDLDIR)/$(AMAKE_F)"; fi
+	@if [ ! -e $(WDLDIR)/$(PERL_F) ]; then $(DLCMD) "$(PERL_URL)" $(PERL_SUM) "$(WDLDIR)/$(PERL_F)"; fi
 	@if [ ! -e $(WDLDIR)/$(SDL_F) ]; then $(DLCMD) "$(SDL_URL)" $(SDL_SUM) "$(WDLDIR)/$(SDL_F)"; fi
 	@if [ ! -e $(WDLDIR)/$(WPCAP_F) ]; then $(DLCMD) "$(WPCAP_URL)" $(WPCAP_SUM) "$(WDLDIR)/$(WPCAP_F)"; fi
 	@if [ ! -e $(WDLDIR)/$(WPCAPRT_F) ]; then $(DLCMD) "$(WPCAPRT_URL)" $(WPCAPRT_SUM) "$(WDLDIR)/$(WPCAPRT_F)"; fi
+	@if [ ! -e $(WDLDIR)/$(WPCAPSRC_F) ]; then $(DLCMD) "$(WPCAPSRC_URL)" $(WPCAPSRC_SUM) "$(WDLDIR)/$(WPCAPSRC_F)"; fi
 	@if [ ! -e $(WDLDIR)/$(WPD_F) ]; then $(DLCMD) "$(WPD_URL)" $(WPD_SUM) "$(WDLDIR)/$(WPD_F)"; fi
+	@if [ ! -e $(WDLDIR)/$(OVPN_F) ]; then $(DLCMD) "$(OVPN_URL)" $(OVPN_SUM) "$(WDLDIR)/$(OVPN_F)"; fi
 	@if [ ! -e $(WDLDIR)/$(QEMU_F) ]; then $(DLCMD) "$(QEMU_URL)" $(QEMU_SUM) "$(WDLDIR)/$(QEMU_F)"; fi
 
 extract: downloads $(addprefix $(WDLDIR)/, $(ALLFILES))
@@ -173,11 +201,11 @@
 	fi; \
 	cp files/autorun.inf files/install.bat $(ISODIR)/; \
 	cp files/hdd.img.gz $(ISODIR)/add/; \
-	cp files/run.bat $(ISODIR)/add/; \
 	gzip -d $(ISODIR)/add/hdd.img.gz; \
 	cp files/fstab $(ISODIR)/bin/; \
 	cp files/buildall.sh $(ISODIR)/dl/src; \
 	cp patches/* $(ISODIR)/dl/src; \
+	cp files/*.tgz $(ISODIR)/dl/src; \
 	unzip $(WDLDIR)/$(ZLIB_F) -d $(ISODIR)/ bin/zlib1.dll; \
 	unzip $(WDLDIR)/$(GZIP_F) -d $(ISODIR)/ bin/gzip.exe; \
 	unzip $(WDLDIR)/$(BZIP2_F) -d $(ISODIR)/ bin/bzip2.exe bin/bzip2.dll; \
@@ -186,10 +214,12 @@
 	unzip $(WDLDIR)/$(LIBARCH_F) -d $(ISODIR)/ bin/bsdtar.exe bin/libarchive2.dll; \
 	cp $(addprefix $(WDLDIR)/, $(ALLFILES)) $(ISODIR)/dl/; \
 	unzip $(WDLDIR)/$(WPD_F); tar cf $(ISODIR)/dl/src/WpdPack_4_1_beta4.tar WpdPack; gzip -9 $(ISODIR)/dl/src/WpdPack_4_1_beta4.tar; rm -rf WpdPack; \
+	unzip $(WDLDIR)/$(WPCAPSRC_F); mv winpcap WpcapSrc_4_1_beta4; tar cf $(ISODIR)/dl/src/WpcapSrc_4_1_beta4.tar WpcapSrc_4_1_beta4; gzip -9 $(ISODIR)/dl/src/WpcapSrc_4_1_beta4.tar; rm -rf WpcapSrc_4_1_beta4; \
 	mv $(ISODIR)/dl/$(WPCAPRT_F) $(ISODIR)/dl/src/; \
 	mv $(ISODIR)/dl/$(PTHREADS_F) $(ISODIR)/dl/src/; \
 	mv $(ISODIR)/dl/$(QEMU_F) $(ISODIR)/dl/src/; \
 	mv $(ISODIR)/dl/$(SDL_F) $(ISODIR)/dl/src/; \
+	mv $(ISODIR)/dl/$(OVPN_F) $(ISODIR)/dl/src/; \
 	mv $(ISODIR)/dl/$(ZLIBSRC_F) $(ISODIR)/dl/src/; \
 	touch $(ISODIR)/VMDEVISO.TXT
 

Modified: torvm/trunk/build/win32/files/buildall.sh
===================================================================
--- torvm/trunk/build/win32/files/buildall.sh	2008-09-22 20:06:25 UTC (rev 16933)
+++ torvm/trunk/build/win32/files/buildall.sh	2008-09-23 06:27:25 UTC (rev 16934)
@@ -2,11 +2,32 @@
 export PATH=.:/usr/local/bin:/usr/bin:/bin:/mingw/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem
 export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib:/mingw/lib
 export ddir=/c/Tor_VM
-mkdir $ddir
+export libdir="${ddir}/lib"
+export bindir="${ddir}/bin"
+export confdir="${ddir}/config"
+export statedir="${ddir}/state"
 
-cp /usr/bin/msys-z.dll $ddir/
-cp /usr/bin/msys-1.0.dll $ddir/
+foreach dir in $ddir $libdir $bindir $confdir $statedir; do
+  if [ ! -d $dir ]; then
+    mkdir $dir
+  fi
+done
 
+if [ -d /usr/usr ]; then
+  # ahh, gotta love the msys /usr <-> / equivalence hack...
+  cd /usr/usr
+  mv local ../
+  rmdir usr
+fi
+cp /usr/local/bin/aclocal-* /bin/aclocal
+cp /usr/local/bin/autoconf-* /bin/autoconf
+cp /usr/local/bin/autoheader-* /bin/autoheader
+cp /usr/local/bin/automake-* /bin/automake
+
+cp /bin/msys-z.dll $libdir/
+cp /bin/msys-1.0.dll $libdir/
+
+
 echo "Building pthreads-w32 ..."
 cd /usr/src
 tar zxvf pthreads-w32-2-8-0-release.tar.gz
@@ -17,7 +38,7 @@
   echo "ERROR: pthreads-32 build failed." >&2
   exit 1
 fi
-cp pthreadGC2.dll $ddir/
+cp pthreadGC2.dll $libdir/
 
 
 echo "Building SDL library ..."
@@ -36,19 +57,11 @@
   exit 1
 fi
 make install
-cp /usr/bin/SDL.dll $ddir/
+cp /usr/bin/SDL.dll $libdir/
 
 
-echo "Extracting WinPcap runtime files ..."
+echo "Building zlib ..."
 cd /usr/src
-tar zxvf WinPcap-4.1-files.tar.gz
-
-echo "Extracting WinPcap developer files ..."
-cd /usr/src
-tar zxvf WpdPack_4_1_beta4.tar.gz
-
-
-echo "Building zlib ..."
 tar zxvf zlib-1.2.3.tar.gz
 cd zlib-1.2.3
 ./configure --prefix=/usr
@@ -64,6 +77,91 @@
 make install
 
 
+echo "Locating Windows Driver Development Kit ..."
+# there has to be a better way to do this .... ugg
+found=0
+DDKNAME="WINDDK"
+DDKDIR=""
+DDKENV=""
+DDKVER=""
+DDKMAJORVER=""
+checkdirs="C D E F G H I J K L M N O P Q R S T U V W X Y Z"
+for cdir in $checkdirs; do
+  if (( $found == 0 )); then
+    if [ -d /$cdir/ ]; then
+      tddkdir="/$cdir/$DDKNAME"
+      if [ ! -d $tddkdir ]; then
+        tddkdir=`find /$cdir/ -type d -name $DDKNAME 2>/dev/null`
+      fi
+      if [ -d $tddkdir ]; then
+        envf=`find $tddkdir -type f -name setenv.bat 2>/dev/null`
+	if [ -f $envf ]; then
+	  ddkbase=`dirname $envf`
+	  ddkbase=`dirname $ddkbase`
+          wddkbase=`echo $ddkbase | sed 's/^...//' | sed 's/\//\\\/g'`
+	  DDKDIR="${cdir}:\\${wddkbase}"
+	  DDKENV="${DDKDIR}\bin\setenv.bat"
+	  DDKVER=`grep '^Build' "${ddkbase}/Uninstall/Uninstall.ini" | sed 's/.*=//'`
+	  DDKMAJORVER=`echo $DDKVER | sed 's/\..*//'`
+          echo "Found DDK install at $DDKDIR , using env script $DDKENV"
+	  cp "${$ddkbase}/tools/devcon/i386/devcon.exe" $bindir
+	  found=1
+	fi
+      fi
+    fi
+  fi
+done
+if (( $found == 0 )); then
+  echo "ERROR: Unable to locate the Windows Driver Development Kit." >&2
+  echo "       Please provide the correct location to configure or"  >&2
+  echo "       install the 1830_usa_ddk.iso software if needed." >&2
+  exit 1
+fi
+export DDKDIR
+export DDKENV
+export DDKVER
+export DDKMAJORVER
+
+
+echo "Building openvpn tap-win32 driver ..."
+cd /usr/src
+tar zxvf openvpn-2.1_rc10.tar.gz
+cd openvpn-2.1_rc10
+patch -p1 < ../openvpn-tor-tap-win32-driver.patch 2>/dev/null
+aclocal && autoheader && autoconf && automake --add-missing --copy
+if (( $? != 0 )); then
+  echo "ERROR: openvpn autotools update failed." >&2
+  exit 1
+fi
+MAN2HTML=/bin/true.exe ./configure --prefix=/usr \
+ --with-cygwin-native \
+ --disable-debug \
+ --disable-lzo \
+ --disable-ssl \
+ --disable-crypto 
+if (( $? != 0 )); then
+  echo "ERROR: openvpn configure failed." >&2
+  exit 1
+fi
+cd tap-win32
+echo "call $DDKENV $DDKDIR fre WXP" > dobuild.bat
+echo "build -cef" >> dobuild.bat
+echo "exit 0" >> dobuild.bat
+cmd.exe /k dobuild.bat
+if (( $? != 0 )); then
+  echo "ERROR: openvpn tap-win32 build failed." >&2
+  exit 1
+fi
+
+
+echo "Building WinPcap ..."
+cd /usr/src
+tar zxvf WpcapSrc_4_1_beta4.tar.gz
+cd WpcapSrc_4_1_beta4
+patch -p1 < ../winpcap-tor-device-mods.patch 2>/dev/null
+echo "KILL ME";sleep 3600
+
+
 echo "Building qemu ..."
 cd /usr/src
 tar zxvf qemu-0.9.1.tar.gz
@@ -91,15 +189,12 @@
   echo "ERROR: qemu build failed." >&2
   exit 1
 fi
-cp i386-softmmu/qemu.exe $ddir/
-cp pc-bios/bios.bin $ddir/
-cp pc-bios/vgabios.bin $ddir/
-cp pc-bios/vgabios-cirrus.bin $ddir/
-cp /usr/src/add/* $ddir/
+cp i386-softmmu/qemu.exe $bindir/
+cp pc-bios/bios.bin $bindir/
+cp pc-bios/vgabios.bin $bindir/
+cp pc-bios/vgabios-cirrus.bin $bindir/
+cp /usr/src/add/* $libdir/
+#cp /usr/src/WinPcap-4.1-files/* $ddir/
 
-# still need to handle WinPcap installation; perhaps include link to 4.1 installer exe
-# or wget it at runtime if not present.
-# cp /usr/src/WinPcap-4.1-files/* $ddir/
-
 echo "DONE."
 exit 0

Deleted: torvm/trunk/build/win32/files/run.bat
===================================================================
--- torvm/trunk/build/win32/files/run.bat	2008-09-22 20:06:25 UTC (rev 16933)
+++ torvm/trunk/build/win32/files/run.bat	2008-09-23 06:27:25 UTC (rev 16934)
@@ -1,16 +0,0 @@
-rem  Qemu Tor VM start script
-rem  Modify parameters for Qemu as desired.
-rem  Kernel parameters accepted via -append include:
-rem    TZ=<timezome>
-rem    PRIVIP=<tap32 IP address>
-rem    IP=<VM IP address>
-rem    MASK=<VM netmask>
-rem    GW=<default gateway>
-rem    MAC=<VM ethernet MAC address>
-rem    MTU=<max ether frame size>
-rem
-SET MAC=00:11:22:33:44:55
-SET DEVICE="Local Area Connection"
-SET RAMSZ=32
-
-echo quiet loglevel=1 | qemu.exe -name " Tor VM " -L . -kernel vmlinuz -appendstdin -hda hdd.img -m %RAMSZ% -std-vga -net nic,model=pcnet,macaddr=%MAC% -net pcap,devicename=%DEVICE%



More information about the tor-commits mailing list