http://www.batbox.org/wrt54g.html
Only problem with his compile of Snort is it only does local logging. I want it to be able to log to a MySQL server just like I do with Snort on my other IDS systems. So I followed the instructions on Jim's page and got the cross compiler tools downloaded, built and installed (the LinkSys uses a MIPS processor). I downloaded the latest libpcap and snort source and successfully built Snort for the MIPS. I uploaded it and verified that it runs. Now I have pretty much what Jim offers, except I have the latest version.
Now I decided to try and get MySQL logging support built in so I downloaded the latest MySQL source but I can not get the configure script to generate a Makefile. I give it the appropriate --host=mips parameter and it knows it is supposed to cross compile targeting the MIPS but it errors out with this error message:
Code: Select all
checking "return type of sprintf"... configure: error: cannot run test program while cross compiling
make: *** No targets specified and no makefile found. Stop.
http://voidmain.is-a-geek.net/files/scr ... snort.mips
The script assumes you have the source tarballs for libpcap, mysql, and snort extracted under the /usr/src/wrt54g base directory. It also assumes you have the cross compiler tools installed in their default location of /opt/crosstool/mipsel-unknown-linux-gnu (I just built the mips tools following the directions on the page Jim links to for the cross compiler script).
If anyone has any help, ideas, or is interested in helping in this little project I would certainly appreciate it. If I am successful I would like to write a detailed HOWTO page for building a WIRELESS IDS system using this device and Snort. In fact I would like to build a custom firmware package and add to the LinkSys web interface configuration for Snort (rules, MySQL server, etc). I am reasonably sure it can be done and I believe I am very close. Just don't have a lot of cross compiling experience. Of course all of this depends on being able to build a snort binary small enough with MySQL support to not use up the limited resources available on the Linksys unit.
It appears to want to compile a piece of code to check how a return code is handled. Well, of course it can't run MIPS compiled code on an x86 so it fails. But I would think it should know this since it knows it is cross compiling. I'm sure if I keep digging I should be able to figure it out but it doesn't look like an easy one. I'm hoping I can just solve the problem with proper configure arguments or cache settings.
The full output of the MySQL ./configure:
Code: Select all
$ ./buildsnort.mips
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... ./config.guess: line 891: ./dummy-25506: cannot execute binary file
i686-pc-linux
checking host system type... mips-mips-elf
checking target system type... mips-mips-elf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets ${MAKE}... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... (cached) yes
checking for gawk... (cached) gawk
checking for mips-gcc... /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc --static
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc --static accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc --static... gcc3
checking for mips-g++... no
checking for mips-c++... no
checking for mips-gpp... no
checking for mips-aCC... no
checking for mips-CC... no
checking for mips-cxx... no
checking for mips-cc++... no
checking for mips-cl... no
checking for mips-FCC... no
checking for mips-KCC... no
checking for mips-RCC... no
checking for mips-xlC_r... no
checking for mips-xlC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C preprocessor... /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc --static -E
checking "C Compiler version"... "/opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc --static mipsel-unknown-linux-gnu-gcc (GCC) 3.2.3"
checking "C++ compiler version"... "g++ g++ (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1)"
checking for mips-ranlib... no
checking for ranlib... ranlib
checking for ld used by GCC... /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-ld -static
checking if the linker (/opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-ld -static) is GNU ld... yes
checking for /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-ld -static option to reload object files... -r
checking for BSD-compatible nm... nm
checking whether ln -s works... yes
checking how to recognise dependant libraries... unknown
checking command to parse nm output... ok
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for mips-ranlib... ranlib
checking for mips-strip... no
checking for strip... strip
checking for objdir... .libs
checking for /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc option to produce PIC... -fPIC
checking if /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc PIC flag -fPIC works... yes
checking if /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc static flag -static works... yes
checking if /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc supports -c -o file.o... yes
checking if /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc supports -c -o file.lo... yes
checking if /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (/opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/bin/mipsel-unknown-linux-gnu-ld -static) supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... no
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
creating libtool
checking for a BSD-compatible install... /usr/bin/install -c
checking for bison... bison -y
checking for pdftex... no
checking for tex... no
checking "return type of sprintf"... configure: error: cannot run test program while cross compiling
make: *** No targets specified and no makefile found. Stop.