1

Following the tutorial on http://www.waitingforthefuture.org/2009/12/25/compiling-tcpdump-for-tomato-firmware/, I tried to compile tcpdump. I did the compilation on an Intel Pentium 4 2.26Ghz computer running Ubuntu 10.04.

My router uses a BCM3302 V2.9 CPU. However, when I run tcpdump on it, it says "Illegal instruction".

Why does this happen? What other configuration must I do before compilation?

Dave
  • 225
  • 3
  • 8
  • Did you setup the crosscompile environment correctly? What out produces a "file tcpdump" on the PC? – Lairsdragon Jan 23 '12 at 07:50
  • The output is "tcpdump: ELF 32-bit LSB executable, MIPS, MIPS32 version 1, statically linked, with unknown capability 0xf41 = 0x756e6700, not stripped". – Dave Jan 23 '12 at 08:08
  • Since MIPS can be big endian or little endian, check if endianess is the same for tcpdump and the other binaries on the system... – Lairsdragon Jan 23 '12 at 10:51
  • Unfortunately, I can't determine the endianess of the OS. The router is using Tomato. However, I tried checking the build of the "vi" command on the router. The output is "vi: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), stripped". Does this help? – Dave Jan 23 '12 at 11:35

1 Answers1

2

You need to compile for the platform you plan to run things on. This might be possible with GCC Cross compilation, but only if you can get the descriptions and symbol tables for the target processor.

You're getting "illegal instruction" because the software is looking for an x86 instruction on a decidedly non x86 chip

BCM3302 appears to be a MIPS32 architecture chip. There are some toolchains available.

Tom O'Connor
  • 27,480
  • 10
  • 73
  • 148