Ubuntu安装编译环境:
1 2 | apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils\
subversion libncurses5-dev ncurses-term zlib1g-dev
|
CentOS安装编译环境:
1 2 | yum install autoconf binutils bison bzip2 flex gawk gcc gcc -c++ gettext make ncurses-devel patch \
unzip wget zlib-devel
|
编译以非root用户运行,新建用户:
1 2 | useradd -m openwrt
su -l openwrt
|
获取源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 | svn co svn: //svn .openwrt.org /openwrt/branches/barrier_breaker
svn co svn: //svn .openwrt.org /openwrt/branches/barrier_breaker -r 42625
cd barrier_breaker
. /scripts/feeds update -a
. /scripts/feeds install -a
|
或Git获取源码:
1 2 3 4 | git clone git: //git .openwrt.org /openwrt .git
git clone git: //git .openwrt.org /14 .07 /openwrt .git
|
更多见:
http://wiki.openwrt.org/doc/howto/buildroot.exigence#trunk_main_development_tree
https://dev.openwrt.org/wiki/GetSource
进入编译选项:
可以在编译前添加/修改配置文件,所在目录:
1 | package/base-files/files/
|
编译固件,编译成功后固件在当前目录bin目录下,可以先编译x86使用vmware测试openwrt固件。
编译单个软件,进入编译选项选择要编译的软件后,如果没有make需执行以下:
1 2 | make tools /install
make toolchain /install
|
然后编译指定的软件:
1 | make package /name/compile
|
遇到的问题:
/target-i386_i486_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyyynyyyyyyyynyyyynyyyynnyynnnyyyy] Error 2
自编译gcc的问题,使用系统自带gcc正常,见https://dev.openwrt.org/ticket/17805
然后又遇到barrier_breaker/include/toplevel.mk:171: recipe for target 'world' failed
删除之前gcc编译生成的文件,见https://dev.openwrt.org/ticket/11175