{"id":1021,"date":"2013-01-25T15:37:53","date_gmt":"2013-01-25T07:37:53","guid":{"rendered":"http:\/\/kaoru.tech\/?p=1021"},"modified":"2013-01-30T17:22:45","modified_gmt":"2013-01-30T09:22:45","slug":"cross-compile-iptables","status":"publish","type":"post","link":"http:\/\/kaoru.tech:7000\/wordpress\/?p=1021","title":{"rendered":"Cross-compile iptables"},"content":{"rendered":"<p>\u4eca\u5929\u7f16\u8bd1\u4e86iptables\u7740\u5b9e\u4ee4\u6211\u90c1\u95f7\u4e86\u4e00\u4e0b\u3002<\/p>\n<p>\u6211\u4eec\u7684kernel\u7528\u7684\u662flinux-2.6.36-rc2\u3002\u7531\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u5ba2\u6237\u5e94\u7528\u5c42\u4f7f\u7528\u7684\u7f16\u8bd1\u5668\u548c\u6211\u4eec\u7f16\u8bd1kernel\u7684\u7f16\u8bd1\u5668\u4e0d\u4e00\u6837\u3002<\/p>\n<p>\u7ed3\u679c\u5c31\u5f88\u60b2\u6467\uff1a<\/p>\n<blockquote><p>iptables v1.4.12.1: can&#8217;t initialize iptables table `filter&#8217;: Invalid argument<br \/>\nPerhaps iptables or your kernel needs to be upgraded.<\/p><\/blockquote>\n<p>\u67e5\u4e86\u4e00\u4e0bbing\uff0c\u4ece\u4ec0\u4e48\u5927\u4e4b\u524d\u5f00\u59cbgoogle\u5c31\u4e00\u76f4\u5728\u62bd\u98ce\u3002<\/p>\n<p>\u627e\u5230\u4e86\u4e00\u4e2a\u66f4\u52a0\u4ee4\u4eba\u60b2\u6467\u7684\u5730\u65b9\uff1ahttp:\/\/www.iptables.info\/en\/iptables-problems.html<\/p>\n<blockquote><p>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 <a href=\"http:\/\/www.iptables.info\/en\/links.html#TLDP\"><em>Linux Documentation Project<\/em><\/a> homepage.<\/p><\/blockquote>\n<p>\u4f30\u8ba1\u6211\u5c31\u662f\u7b2c\u4e09\u79cd\u60c5\u51b5\u4e86\u3002<\/p>\n<p>\u7b2c\u4e00\u4e2a\u60f3\u6cd5\u662f\u4e0d\u662f\u56e0\u4e3a\u5ba2\u6237\u7684\u7f16\u8bd1\u5668\u548c\u6211\u4eec\u7684\u7f16\u8bd1\u5668\u4e0d\u4e00\u6837\u3002\u6211\u628arootfs\u66f4\u6362\u4e3a\u6211\u7684\u7f16\u8bd1\u5668\u3002\u53d1\u73b0\u95ee\u9898\u8fd8\u662f\u4e00\u6837\u7684\u3002<\/p>\n<p>\u4f1a\u4e0d\u4f1a\u662f\u56e0\u4e3akernel\u548ciptables\u7684\u7248\u672c\u4e0d\u4e00\u6837\u9020\u6210\u7684\u5462\u3002\u4e8e\u662f\u6211\u4e0b\u8f7d\u4e86\u548c2.6.36-rc2\u914d\u5408\u76841.4.10\u7248\u672c\u7684iptables\u3002\u7f16\u8bd1\u8fdb\u53bb\u53d1\u73b0\u8fd8\u662f\u4e0d\u5bf9\u3002<\/p>\n<p>\u4f1a\u4e0d\u4f1a\u662f\u56e0\u4e3a\u8fd9\u4e2a\u7248\u672c\u7684kernel\u95ee\u9898\u3002\u4e8e\u662fgit checkout\u52302.6.36\u7248\u672c\u7684\u5185\u6838\u3002ok\u4e86\u3002\u770b\u6765\u4ee5\u540ekernel\u7684start point\u4e0d\u80fd\u968f\u4fbf\u7528rc\u7684\u3002\u8fd8\u662f\u8981\u7528\u7a33\u5b9a\u7248\u672c\u7684\u3002<\/p>\n<p>\u6700\u540e\u8bf4\u670d\u5ba2\u6237\u4f7f\u7528\u6211\u4eec\u7684\u7f16\u8bd1\u5668\u7f16\u8bd1\u5e94\u7528\u5c42\u7a0b\u5e8f\u3002<\/p>\n<p>iptables\u7f16\u8bd1\u987a\u5e8f\u5982\u4e0b\uff1a<\/p>\n<pre lang=\"bash\">.\/configure --host=arm-linux --with-ksource=\/data\/kernel\/.kb\/build-2.6-arm \\\r\n            --enable-static --disable-shared\r\nmake<\/pre>\n<p>\u8fd9\u6837\u7f16\u8bd1\u51fa\u6765\u7684\u662f\u4e0d\u9700\u8981\u989d\u5916\u52a8\u6001\u94fe\u63a5\u5e93\u7684\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u7f16\u8bd1\u4e86iptables\u7740\u5b9e\u4ee4\u6211\u90c1\u95f7\u4e86\u4e00\u4e0b\u3002 \u6211\u4eec\u7684kernel\u7528\u7684\u662flinux-2.6.36-rc2\u3002\u7531\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u5ba2\u6237\u5e94\u7528\u5c42\u4f7f\u7528\u7684\u7f16\u8bd1\u5668\u548c\u6211\u4eec\u7f16\u8bd1kernel\u7684\u7f16\u8bd1\u5668\u4e0d\u4e00\u6837\u3002 \u7ed3\u679c\u5c31\u5f88\u60b2\u6467\uff1a iptables v1.4.12.1: can&#8217;t initialize iptables table `filter&#8217;: Invalid argument Perhaps iptables or your kernel needs to be upgraded. \u67e5\u4e86\u4e00\u4e0bbing\uff0c\u4ece\u4ec0\u4e48\u5927\u4e4b\u524d\u5f00\u59cbgoogle\u5c31\u4e00\u76f4\u5728\u62bd\u98ce\u3002 \u627e\u5230\u4e86\u4e00\u4e2a\u66f4\u52a0\u4ee4\u4eba\u60b2\u6467\u7684\u5730\u65b9\uff1ahttp:\/\/www.iptables.info\/en\/iptables-problems.html This is a bit more serious since&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[16],"tags":[208,74],"class_list":["post-1021","post","type-post","status-publish","format-standard","hentry","category-crosscompile","tag-crosscompile","tag-iptables"],"_links":{"self":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1021"}],"version-history":[{"count":8,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1021\/revisions"}],"predecessor-version":[{"id":1027,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1021\/revisions\/1027"}],"wp:attachment":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1021"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}