编译的源码:linux-2.6-router-5.110.27.7.tar.gz
解压交叉编译工具linux26-external-router-toolchains-gcc-4.2.3.tar.gz
解压交叉编译工具,并在etc/bashrc文件中设置好编译工具路径
解压源码包,创建BS_router目录将源码解压在BS_router目录下:
然后进入解压后源码包BS_router/src/下,执行
[just@localhost src]$ make LINUX_VERSION=2_6
编译过程中产生如下错误:
make[1]: Entering directory `/home/just/femto/BS_router/src/router/shared'
mipsel-uclibc-linux26-gcc -Os -DBCMWPA2 -DBCMWPS -DPLC -I. -I../httpd -I/home/just/femto/BS_router/src/include -Wall -I/home/just/femto/BS_router/src/linux/linux-2.6/include -DLINUX26 -s -Os -c -o nvparse.o nvparse.c
In file included from nvparse.c:34:
./netconf.h:32:23: error: bcmconfig.h: No such file or directory
make[1]: *** [nvparse.o] 错误 1
make[1]: Leaving directory `/home/just/femto/BS_router/src/router/shared'
make: *** [shared] 错误 2
修改,进入源码包根目录下BS_router/
cp include/bcm_cfg.h include/bcmconfig.h 估计是版本变动带来的文件名异同
再次进入源码包BS_router/src/下执行:make LINUX_VERSION=2_6
再次出错如下:
S_router/src/linux/linux-2.6/include -I/home/just/femto/BS_router/src/router/busybox-1.x -s -Os -c -o firewall.o firewall.c
firewall.c:77:20: error: macro "start_firewall" passed 1 arguments, but takes just 0
firewall.c:78: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
firewall.c:358: error: expected identifier or '(' before 'do'
firewall.c:358: error: expected identifier or '(' before 'while'
make[2]: *** [firewall.o] 错误 1
这个应该是存在的BUG,我没有深研,这里我直接去掉了对它的支持,如有需要再做修改,具体解决方法:进入根目录router目录下执行make menuconfig,在弹出的配置菜单中
Base Features --->
[*] Router control (rc) 去掉该选项的选择
然后保存退出,再次回到根目录make LINUX_VERSION=2_6,此时编译OK
编译好后安装执行:make LINUX_VERSION=2_6 install
注意如果提示trx命令找不到,那是没有将tools中的trx放到bin目录下:
cp ../tools/trx /sbin/
关于映像文件说明:
这里用到的配置文件来自(可参看src/router/Makefile文件):
521 # Default configurations
522 ifneq ("$(LINUX_VERSION)","2_6")
523 .config:
524 cp config/defconfig $@
525 $(MAKE) oldconfig
526 else
527 .config:
528 cp config/defconfig-2.6 $@
529 echo "config/defconfig-2.6" 这里用到的
530 $(MAKE) oldconfig
531 endif
532
533 ifneq ("$(LINUX_VERSION)","2_6")
534 $(LINUXDIR)/.config:
535 cp $(LINUXDIR)/arch/mips/defconfig-bcm947xx $@
536 else
537 $(LINUXDIR)/.config:
538 cp $(LINUXDIR)/arch/mips/defconfig-bcm947xx-$(if $(CPU),$(CPU)-,)slimrtr $@
539 echo "arch/mips/defconfig-bcm947xx-"
540 endif
交叉工具的确认:
57 # uClibc wrapper
58 ifeq ($(CONFIG_UCLIBC),y)
59 export PLATFORM := $(PLATFORM)-uclibc
60 endif
61
62 ifeq ($(PLATFORM),mipsel)
63 export CROSS_COMPILE := mipsel-linux-
64 export CONFIGURE := ./configure mipsel-linux --build=$(BUILD)
65 export TOOLCHAIN := $(shell cd $(dir $(shell which $(CROSS_COMPILE)gcc))/../mipsel-linux && pwd -P)
66 endif
67
68 ifeq ($(PLATFORM),mipsel-uclibc)
69 ifeq ($(LINUX_VERSION),2_6)
70 export CROSS_COMPILE := mipsel-uclibc-linux26-
71 else
72 export CROSS_COMPILE := mipsel-uclibc-
73 endif
74 export CONFIGURE := ./configure mipsel-linux --build=$(BUILD)
75 export TOOLCHAIN := $(shell cd $(dir $(shell which $(CROSS_COMPILE)gcc))/.. && pwd -P)
76 endif
阅读(1322) | 评论(0) | 转发(0) |