Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Did you setup the crosscompile environment correctly? What out produces a "file tcpdump" on the PC? –  Lairsdragon Jan 23 '12 at 7: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 8: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 Answer 1

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.

share|improve this answer
    
Thanks. However, if I do a "file tcpdump", 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 8:05
    
Huh. Buggered if i know then. –  Tom O'Connor Jan 23 '12 at 8:50
    
Do you know why it brings up that error? –  Dave Jan 23 '12 at 8:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.