今天编译了iptables着实令我郁闷了一下。
我们的kernel用的是linux-2.6.36-rc2。由于历史原因,客户应用层使用的编译器和我们编译kernel的编译器不一样。
结果就很悲摧:
iptables v1.4.12.1: can’t initialize iptables table `filter’: Invalid argument
Perhaps iptables or your kernel needs to be upgraded.
查了一下bing,从什么大之前开始google就一直在抽风。
找到了一个更加令人悲摧的地方:http://www.iptables.info/en/iptables-problems.html
This is a bit more serious since it points out that we, first of all, do not have the functionality compiled into the kernel, and second, that the module is not possible to find in our normal module paths. This may either mean that you have forgotten to install your modules, you have forgotten to run depmod -a to update your module databases, or you have not compiled the functionality as either module or statically into the kernel. There may of course be other reasons for the module not to be loaded, but these are the main reasons. Most of these problems are easily solved. The first problem would simply be solved by running make modules_install in the kernel source directory (if the source has already been compiled and the modules have already been built). The second problem is solved by simply running depmod -a once and see if it works afterward. The third problem is a bit out of the league for this explanation, and you are more or less left to your own wits here. You will most probably find more information about this on the Linux Documentation Project homepage.
估计我就是第三种情况了。
第一个想法是不是因为客户的编译器和我们的编译器不一样。我把rootfs更换为我的编译器。发现问题还是一样的。
会不会是因为kernel和iptables的版本不一样造成的呢。于是我下载了和2.6.36-rc2配合的1.4.10版本的iptables。编译进去发现还是不对。
会不会是因为这个版本的kernel问题。于是git checkout到2.6.36版本的内核。ok了。看来以后kernel的start point不能随便用rc的。还是要用稳定版本的。
最后说服客户使用我们的编译器编译应用层程序。
iptables编译顺序如下:
1 2 3 4 5 |
./configure --host=arm-linux --with-ksource=/data/kernel/.kb/build-2.6-arm \ --enable-static --disable-shared make |
这样编译出来的是不需要额外动态链接库的。