硬件平台:华恒ixp425路由器开发板
linux版本:snapgear-3.5.0
下载以下文件
snapgear-3.5.0
snapgear-modules-20071004.sh 为针对ixp425平台的内置的网卡打补丁
地址:http://ftp.snapgear.org/pub/snapgear/src/
csr-2.4(BSD_ixp400AccessLibrary-2_4.zip, IPL_ixp400NpeLibrary-2_4.zip)非加密版 ixp425的固件
地址:www.intel.com.cn
安装必须软件
apt-get build-essential
apt-get ncurses-dev
zlib
下载zlib.tar.gz
./configure
make
make install
安装编译工具
(版本不要太高,最新的不一定是最好的)
arm-linux-tools-20061213.tar.gz
http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/arm-linux-tools-20061213.tar.gz
tar xzvf snapgear-3.5.0.tar.gz
在snapgear/linux-2.6.x/scripts/mod/sumversion.c中加入#include<limits.h>
./snapgear-modules-20071004.sh
生成一堆补丁文件
查看readme,按照说明打补丁
make menuconfig
vendor/product selection
select the vendor you wish to target
intel vendor
select the product you wish to target
ixpd425 intel products
kernel/library/default selection
uclibc
customize kernel settings
networking
networking options
network packet filtering
core netfilter config
Netfilter Xtables support
ip:netfilter config
Connection tracking
IP tables support
Packet filtering
Full NAT
MASQUERADE target support
再到bosybox里把iptables选上
make
生成的zImage和ramdisk.gz在snapgear/images目录下
下载zImage和ramdisk.gz到板子上
执行如下命令:
insmod /lib/modules/2.6.19-uc1/kernel/ixp425/ixp400-2.4/ixp400.ko
cat /etc/IxNpeMicrocode.dat > /dev/ixNpe
insmod /lib/modules/2.6.19-uc1/kernel/ixp425/net-2.4/ixp400_eth.ko
echo 1 > /proc/sys/net/ipv4/ip_forward
ifconfig eth0 192.168.2.4 broadcast 192.168.2.255 netmask 255.255.255.0 up
ifconfig eth1 192.168.1.18 broadcast 192.168.1.255 netmask 255.255.255.0 up
route add default gw 192.168.1.1
iptables -A FORWARD -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE
接上网线可以连通了
遇到的问题:
1、 启动到freeing init memory就卡住了
解决:换个低版本的编译器
2、iptables无法使用,或者不能加iptables规则
解决:确认busybox里选了iptables
确认
networking options
network packet filtering
core netfilter config
Netfilter Xtables support
ip:netfilter config
Connection tracking
IP tables support
Packet filtering
Full NAT
MASQUERADE target support
3、网络无法连通
解决:echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE