Kernel compilation fails when netfilter is enabled under Cygwin, how do I get this to compile?

Problem: Kernel compilation fails when netfilter is enabled in Cygwin, with messages similar to the following:
CC [M]  net/ipv4/netfilter/ipt_ecn.o
net/ipv4/netfilter/ipt_ecn.c:24: warning: "struct ipt_ecn_info" declared
inside parameter list

...

net/ipv4/netfilter/ipt_ecn.c:103: error: `IPT_ECN_OP_MATCH_CWR'
undeclared (first use in this function)
make[3]: *** [net/ipv4/netfilter/ipt_ecn.o] Error 1
make[2]: *** [net/ipv4/netfilter] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2
Cause:

The netfilter directory contains two filenames that differ only in their case; for example, ipt_ecn.c and ipt_ECN.c. Since Windows considers these to be the same filename, they overwrite each other when they are extracted.

Solution:

The easiest solution is to turn off netfilter support in your kernel configuration if you do not need it. If you need netfilter support, you can use a Cygwin “managed mount”, which allows case-sensitive filenames. Then, you need to re-extract the kernel source.

Note

Cygwin allows case-sensitivity through the use of managed mounts, which is an experimental option that tricks Windows into differentiating files of the same name with different cases. It is not foolproof. For more details regarding managed mounts, refer to the Cygwin FAQ at: http://cygwin.com/faq/faq.using.html


  1. Create a new, empty directory, and mount it as managed.
  2. $ mkdir kernel
    $ mount -o managed e:/cygwin/tmp/kernel /tmp/kernel
  3. Extract the kernel source into the managed mount directory and change to that directory.
  4. $ tar -C kernel -xzf
    /cygdrive/e/download/timesys-i686-x86-p3-basic--std-21-install/TARS/linux-x86-p3-basic.tgz
    $ cd kernel/usr/src/kernel-x86-p3-2.6.11-timesys.1/kernel/
  5. Compile the kernel inside this directory.

Your kernel with netfilter support should now compile correctly.