##1.准备linux下编译环境
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils git libncurses5-dev ncurses-term zlib1g-dev gawk libssl-dev python wget subversion xz-utils
64位系统还需
sudo apt-get install lib32gcc1 libc6-dev-i386
##2.下载源码
- trunk (开发版):
git clone git://git.openwrt.org/openwrt.git trunk
cd trunk
./scripts/feeds update -a
./scripts/feeds install -a
##3.检查编译环境
make defconfig
若提示缺少软件包或编译库等依赖,则按提示安装所缺软件包或库等即可 ##4.选择组件
make menuconfig
注意: *号是编译进固件,M 是编译但是不编译进固件,生成 ipkg 文件
,路由器 flash 不够大的话要考虑尽量编译成模块
- 选择Target System
- 选择Target Profile
- LuCI->Collections->luci(可以通过网页设置路由器)
- LuCI->Translations->luci-i18n-chinese(中文界面)
- 其余设置自行决定 #####界面说明:
- luci:WEB界面
- LuCI ->Applications:应用软件的WEB界面、
- Base system:系统基础,里面有USB挂载 block-mount
- Kernel modules:内核模块,内容很多,不如文件系统等等按照自己需要的选吧
- Utilities:一些实用工具,比如自动挂载选项,无线开关等
##5.编译
make V=99 j=处理器数目+1
也可以直接
make V=99
##以下杂记
- 编译自己的openwrt (很全)
- 如何编译OpenWrt-Jiker4836-ChinaUnix博客 (基本翻译自英文官网)
- openwrt编译基本教程 (DREAMBOX wiki)
- how to build (openwrt 官网 wiki)
- OpenWrt source repository downloads
- OpenWrt-Dreambox
- 搭建OpenWrt开发环境(包括编译过程)
- openWrt软件开发教程1(交叉编译和ipk包生成)
- openwrt SDK, 利用SDK生成自己的ipk安装包
- 【整理】如何在OpenWRT环境下做开发
- OpenWRT Build Guide: Start To Finish
- OpenWrt Buildroot – 使用说明
- 使用SDK
- Using the SDK
- Kernel modules -> USB Support -> <*> kmod-usb-ohci SUB1.1驱动
- Kernel modules -> USB Support -> <*> kmod-usb2 USB2.0驱动根据硬件选择
- Base system -> <*>block-mount
- Kernel modules -> Filesystems -> <*> kmod-fs-ext4
- Kernel modules -> USB Support -> <*> kmod-usb-storage-extras.
- Utilities -> Filesystem -> <*> badblocks
- 选择CPU型号 Target System—–Atheros AR71xx/AR7240/AR913x/AR934x
- 选择路由型号 Target Profile—-TP-LINK TL-MR3420 v1
- 添加luci LuCI—>Collections—– <*> luci
- 添加luci的中文语言包 LuCI—>Translations—- <*> luci-i18n-chinese
- 添加DDNS LuCI—>Applications —> <*>luci-app-ddns.
- 添加USB挂载 Base system —> <*>block-mount
- 添加硬盘格式支持 Kernel modules —> Filesystems —> <*> kmod-fs-ext4
- 添加UTF8编码 Kernel modules —> Native Language Support —> <*> kmod-nls-utf8
- 添加USB扩展支持 Kernel modules —> USB Support —> <*> kmod-usb-storage-extras.
- 添加自动挂载工具 Utilities —> Filesystem —> <*> badblocks
- 添加复位键支持 Utilities —> <*> restorefactory
- 添加一键开关无线 Utilities —> <*> wifitoggle
openwrt修改出厂默认语言 http://www.right.com.cn/forum/thread-100338-1-1.html
make 命令简单说明 make V=99 V=99表示输出详细的debug信息
make world 表示编译所有
make j=2 V=99 如是多核CPU,加j=2 选项理论上能加快编译速度 make -j 2 V=99可加快编译速度(不推荐使用)
只清除某个模块 make package/qos/clean
只编译某个模块 make package/qos/clean make package/qos/compile make package/qos/install
make V=99 | tee compile_v1.0.0.log 混合 tee 命令将编译信息放到compile_v1.0.0.log文件中方便查看。
留几个链接