Open GoogleCodeExporter opened 9 years ago
我没弄过openwrt,只在tomato上编译成功。
tomato上的编译方法,先修改完tomato固件源码编译一个tomato固��
�(需要的是此时内核目录下的配置文件已经被自动生成)
修改napt66的Makefile:
KVER?=你的内核版本号
KDIR:=你内核的源代码的主目录
然后再make一下napt66:
make ARCH=mips CROSS_COMPILE=mips-linux-
如果没出错的话,napt66目录下ko文件就出现了
Original comment by q741...@gmail.com
on 24 Sep 2011 at 6:22
我没有修改openwrt源码(不知道需不需要修改)
编译一次openwrt
修改napt66:
KVER?=2.6.39.4
KDIR:=/home/bbs111/src/linux-2.6.39.4
然后make ARCH=mips
CROSS_COMPILE=/home/bbs111/backfire/trunk/build_dir/target-mips_r2_uClibc-0.9.32
/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.5-linaro_uClibc-0.9.32/toolchain-mip
s_r2_gcc-4.5-linaro_uClibc-0.9.32/bin/mips-openwrt-linux-
仍然出错:bbs111@ubuntu:~/src/napt66-0.2$ make ARCH=mips
CROSS_COMPILE=/home/bbs111/backfire/trunk/build_dir/target-mips_r2_uClibc-0.9.32
/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.5-linaro_uClibc-0.9.32/toolchain-mip
s_r2_gcc-4.5-linaro_uClibc-0.9.32/bin/mips-openwrt-linux-
make -C /home/bbs111/src/linux-2.6.39.4 M=/home/bbs111/src/napt66-0.2 modules
make[1]: Entering directory `/home/bbs111/src/linux-2.6.39.4'
ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /home/bbs111/src/linux-2.6.39.4/Module.symvers
is missing; modules will have no dependencies and modversions.
Building modules, stage 2.
/home/bbs111/src/linux-2.6.39.4/scripts/Makefile.modpost:42:
include/config/auto.conf: No such file or directory
make[2]: *** No rule to make target `include/config/auto.conf'. Stop.
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/home/bbs111/src/linux-2.6.39.4'
make: *** [all] Error 2
Original comment by yunhai1...@gmail.com
on 24 Sep 2011 at 10:44
Kernel configuration is
invalid,很明显你的内核配置文件不在,所以可能是你没有先编
译一次openwrt固件,一般先编译一次固件,内核配置文件就会�
��自动配置上去,我不懂openwrt的编译流程,只知道这些了
Original comment by q741...@gmail.com
on 24 Sep 2011 at 11:20
我确实已经编译一次openwrt了。估计是应为我是把linux的源文��
�,解压到新目录下然后在make napt66的原因。。。。
我找了下 trunk/build dir目录下有linux-2.6.93.4问价夹 我把 KDIR
改了一下
然后是以下错误,难道是不兼容?
bbs111@ubuntu:~/src/napt66-0.2$ make
make -C
/home/bbs111/backfire/trunk/build_dir/linux-ar71xx_generic/linux-2.6.39.4
M=/home/bbs111/src/napt66-0.2 modules ARCH=mips
CROSS_COMPILE=/home/bbs111/backfire/trunk/build_dir/target-mips_r2_uClibc-0.9.32
/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.5-linaro_uClibc-0.9.32/toolchain-mip
s_r2_gcc-4.5-linaro_uClibc-0.9.32/bin/mips-openwrt-linux-
make[1]: Entering directory
`/home/bbs111/backfire/trunk/build_dir/linux-ar71xx_generic/linux-2.6.39.4'
CC [M] /home/bbs111/src/napt66-0.2/napt66_conntrack.o
/home/bbs111/src/napt66-0.2/napt66_conntrack.c: In function 'get_ip6_by_name':
/home/bbs111/src/napt66-0.2/napt66_conntrack.c:265:11: error: incompatible
types when assigning to type 'struct inet6_ifaddr *' from type 'struct
list_head'
/home/bbs111/src/napt66-0.2/napt66_conntrack.c:272:21: error: 'struct
inet6_ifaddr' has no member named 'if_next'
make[2]: *** [/home/bbs111/src/napt66-0.2/napt66_conntrack.o] Error 1
make[1]: *** [_module_/home/bbs111/src/napt66-0.2] Error 2
make[1]: Leaving directory
`/home/bbs111/backfire/trunk/build_dir/linux-ar71xx_generic/linux-2.6.39.4'
make: *** [all] Error 2
Original comment by yunhai1...@gmail.com
on 24 Sep 2011 at 2:51
下面到考你修改源代码的能力了,折腾无极限,找到错误位��
� 修改 尝试 修改 尝试,
我的环境和你不一样,不能帮你调试了
Original comment by q741...@gmail.com
on 24 Sep 2011 at 4:28
http://115.com/file/e6kl9kfk#
编译问题.exe
我把我编译的过程做了个视频
Original comment by shc...@gmail.com
on 25 Sep 2011 at 1:52
需要先编译一次固件才会生成需要的toolchain和相应的内核。��
�是按照issue26的方法来编译的吧,但是没有自行下载linux内核�
��而是在openwrt
trunk的目录下面找到相应的内核源码解压出来再挂上工具链来
编译内核,然后再编译napt66.ko——其实不用这样,我说说我��
�做法(我按照issue26的方法编译了x86的napt66.ko):
1/编译一次trunk,编译后生成/trunk/build_dir/(相应的平台目录��
�/linux-2.6.39.4,这个才是KDIR
:=后面应该填的路径!就是说你上面的makefile是不对的~
2/trunk/staging_dir/(相应的平台)/bin/xxxxx-openwrt-linux-这个就是��
�具链,也就是ARCH=xxxx
CROSS_COMPILE=后面应该填写的路径(你的makefile这里是对的)。
3/按照上面得到的路径,修改napt66的makefile,然后make就可以了
!
我的makefile(编译openwrt-x86平台的napt66.ko)
# Makefile under 2.6.25
ifneq ($(KERNELRELEASE),)
#kbuild syntax. dependency relationshsip of files and target modules are listed
here.
obj-m := napt66.o
napt66-objs := napt66_main.o napt66_conntrack.o napt66_nat.o
napt66_hash_table.o napt66_ftp_alg.o
else
PWD := $(shell pwd)
KVER ?= $(shell uname -r)
KDIR := /media/STsuse/openwrt/trunk/build_dir/linux-x86_generic/linux-2.6.39.4
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules ARCH=x86 CROSS_COMPILE=/media/STsuse/openwrt/trunk/staging_dir/toolchain-i386_gcc-4.5-linaro_uClibc-0.9.32/bin/i486-openwrt-linux-
clean:
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions *.symvers *.order
endif
================================================================================
===
只要你步骤正确,这样肯定可以得到ko,而且可以insmod,不过
在我的实践中,insmod后会死机……可能有其他原因,也可能��
�种做法不正确,你自己试试吧~成功了记得告诉我……
Original comment by aurora6...@gmail.com
on 25 Sep 2011 at 5:46
Original issue reported on code.google.com by
yunhai1...@gmail.com
on 24 Sep 2011 at 2:41