linux内核移植手记

硬件平台:华恒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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值