这个编译环境是不能编译for开源无线路由器的程序的,因为内核是2.6的,建议参考这篇: http://www.felix021.com/blog/read.php?1467 felix021@felix021-Intrepid:/cross/buildroot/dl$ ls -al
总用量 131M drwxr-xr-x 2 root root 4.0K 2009-01-24 14:58 . drwxr-xr-x 14 root root 4.0K 2009-01-24 20:39 .. -rw-r--r-- 1 root root 16M 2009-01-24 14:58 binutils-2.19.tar.bz2 -rw-r--r-- 1 root root 2.0M 2009-01-24 14:58 busybox-1.13.2.tar.bz2 -rw-r--r-- 1 root root 387K 2009-01-24 14:58 fakeroot_1.9.5.tar.gz -rw-r--r-- 1 root root 57M 2009-01-24 14:58 gcc-4.3.2.tar.bz2 -rw-r--r-- 1 root root 100K 2009-01-24 14:58 genext2fs-1.4.tar.gz -rw-r--r-- 1 root root 1.7M 2009-01-24 14:58 gmp-4.2.2.tar.bz2 -rw-r--r-- 1 root root 51M 2009-01-24 14:58 linux-2.6.28.1.tar.bz2 -rw-r--r-- 1 root root 612K 2009-01-24 14:58 lzo-2.03.tar.gz -rw-r--r-- 1 root root 22K 2009-01-24 14:58 mpfr-2.3.0.patch -rw-r--r-- 1 root root 853K 2009-01-24 14:58 mpfr-2.3.0.tar.bz2 -rw-r--r-- 1 root root 222K 2009-01-24 14:58 mtd-utils-1.1.0.tar.bz2 -rw-r--r-- 1 root root 2.2M 2009-01-24 14:58 uClibc-0.9.30.tar.bz2 -rw-r--r-- 1 root root 416K 2009-01-24 14:58 zlib-1.2.3.tar.bz2
然后就是漫长的下载和编译。。。
5. 如果出了意外。。。那你自己baidu或者google一下。。。
然后你不出意外的话就到这一步了,嗯。
# cd /cross/buildroot/build_mips/staging_dir/usr/bin
# ls
然后看到这些好东西了没?
felix021@felix021-Intrepid:/cross/buildroot/build_mips/staging_dir/usr/bin$ ls
cc mips-linux-ld mips-linux-uclibc-g++ faked mips-linux-ldconfig mips-linux-uclibc-gcc fakeroot mips-linux-ldd mips-linux-uclibc-gcc-4.3.2 ldconfig mips-linux-nm mips-linux-uclibc-gccbug ldd mips-linux-objcopy mips-linux-uclibc-gcov mips-linux-addr2line mips-linux-objdump mips-linux-uclibc-gprof mips-linux-ar mips-linux-ranlib mips-linux-uclibc-ld mips-linux-as mips-linux-readelf mips-linux-uclibc-ldconfig mips-linux-c++ mips-linux-size mips-linux-uclibc-ldd mips-linux-cc mips-linux-strings mips-linux-uclibc-nm mips-linux-c++filt mips-linux-strip mips-linux-uclibc-objcopy mips-linux-cpp mips-linux-uclibc-addr2line mips-linux-uclibc-objdump mips-linux-g++ mips-linux-uclibc-ar mips-linux-uclibc-ranlib mips-linux-gcc mips-linux-uclibc-as mips-linux-uclibc-readelf mips-linux-gcc-4.3.2 mips-linux-uclibc-c++ mips-linux-uclibc-size mips-linux-gccbug mips-linux-uclibc-cc mips-linux-uclibc-strings mips-linux-gcov mips-linux-uclibc-c++filt mips-linux-uclibc-strip mips-linux-gprof mips-linux-uclibc-cpp
6. 加入环境变量
# vim /etc/profile
加入下面这一行:
export PATH=$PATH:/cross/buildroot/build_mips/staging_dir/usr/bin
# source /etc/profile //在重启之前,每次打开一个终端都要再运行一次这个
# mips-linux-gcc --version
如果看到下面这个,恭喜你,可以编译喽~~~~!
引用
mips-linux-g++ (GCC) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
如果没看到,额,那个。。建议学习一下RP学导论以及Google的使用方法。
7. 修正一个小Bug
在编译newstar的时候遇到这个问题:
引用
/cross/buildroot/build_mips/staging_dir/usr/include/bits/socket.h:272: error: expected initializer before 'throw'
Google之,发现是socket.h代码的BUG,修正一下就好了
参考 http://www.nabble.com/include-bits-socket.h-td20795290.html # vim /cross/buildroot/build_mips/staging_dir/usr/include/bits/socket.h
在第271行有一个Macro:
extern struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr,
struct cmsghdr *__cmsg)) __THROW;
这个宏有点错,注释掉就可以了,如果不放心,就加入下面这个宏,替换它:
extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
struct cmsghdr *__cmsg) __THROW;
存盘退出,然后就可以用 mips-linux-gcc 或者 mips-linux-g++ 来编译拉,挖哈哈哈~~~ =========华丽的分割线=========== 由于netgear的flash才只有2M,所以决定回武汉去买一个更好的无线路由器,4M flash的,到时候再刷 现在呢,就先把newstar的源码(包括修改过的Makefile),编译好的newstar,以及 libpcap_0.9.4-1_mipsel.ipk 附上提供下载: 点击这里下载文件: newstar_mips.tar.gz
回武汉以后一定要把它搞定,这样宿舍一个月可以省下来几十块上网费,一年下来也很可观的哦~~~~ (秩名) |