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?
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.