openWRT学习 联系客服

发布时间 : 星期六 文章openWRT学习更新完毕开始阅读

openwrt学习

OPENWRT学习总结

版本信息

版本 1.0 修订日期 修订人员 2012-3-3 初始版本 修订内容 审核人/日期/意见

版权所有?2012 成都科技有限公司

第 1 页 共 29 页

openwrt学习

目录

Openwrt编译及烧写 ......................................................................................................... 4 Build.tex........................................................................................................................... 4

Building an image ....................................................................................................... 4 Download OpenWrt .................................................................................................... 4 The directory structure................................................................................................. 4

tools和toolchain................................................................................................. 4 Package .............................................................................................................. 5 Target ................................................................................................................. 5 Building OpenWrt....................................................................................................... 5 Creating packages ....................................................................................................... 5 Creating binary packages ............................................................................................. 5 Creating kernel modules packages ................................................................................ 6 Conventions ............................................................................................................... 6 Troubleshooting.......................................................................................................... 6 Using build environments ............................................................................................ 6 Config.tex......................................................................................................................... 6

配置文件结构............................................................................................................ 6 Parsing configuration files in custom scripts ................................................................... 6 wireless.tex文档部分学习 ................................................................................................. 7

通用的atheros无线配置:......................................................................................... 7

通用的多radio atheros无线配置: ............................................................................. 8 配置文件详述............................................................................................................ 8 Mesh Point................................................................................................................. 9 WDS ....................................................................................................................... 10

Unencrypted WDS connections ........................................................................... 10 Encrypted WDS connections ............................................................................... 10 802.1x configurations .................................................................................................11 EAP-PEAP ...............................................................................................................11 限制说明..................................................................................................................11 Adding a new driver configuration ...............................................................................11 Network-scripts.tex .......................................................................................................... 12

Using the network scripts........................................................................................... 12

Writing protocol handers............................................................................................ 12 Network.tex .................................................................................................................... 12

网络接口配置.......................................................................................................... 12

Static................................................................................................................ 13 DHCP .............................................................................................................. 13

版权所有?2012 成都科技有限公司

第 2 页 共 29 页

openwrt学习

PPPOE ............................................................................................................. 13 MTU设置 ........................................................................................................ 14 设置静态路由.......................................................................................................... 14 设置交换机 ............................................................................................................. 14 IPV6设置 ............................................................................................................... 14 Init_script.tex .................................................................................................................. 15

功能脚本................................................................................................................. 15

etc/rc.common说明 .................................................................................................. 15 重载初始化脚本函数 ............................................................................................... 17 定制脚本命令.......................................................................................................... 18 Iw .................................................................................................................................. 18

Iw命令行................................................................................................................ 18

iw说明 ................................................................................................................... 20

列出所有命令行 ............................................................................................... 21

列出所有命令及帮助 ........................................................................................ 21 列出设备支持能力,如带宽信息、802.11n信息 ................................................ 21 扫描................................................................................................................. 21 监听事件,调试目的 ........................................................................................ 21 获取链路状态(STA适用) ............................................................................. 21 建立连接.......................................................................................................... 21 获取STA统计信息........................................................................................... 22 获取特定STA的统计 ....................................................................................... 22 修改transmit bitrates ......................................................................................... 22 设置txpower .................................................................................................... 22 省电模式.......................................................................................................... 22 添加接口.......................................................................................................... 22 删除接口.......................................................................................................... 23 设置频率.......................................................................................................... 23 设置信道.......................................................................................................... 23 设置RTS.......................................................................................................... 23 设置FRAG ...................................................................................................... 23 修改monitor接口标识 ...................................................................................... 24 更新regulatory domain (国家码???) ........................................................ 24 创建mesh 接口................................................................................................ 24 设置WDS peer ................................................................................................. 24 AP和client模式使用4-address ......................................................................... 24

wifi启动 ........................................................................................................................ 25 WEB设置 ...................................................................................................................... 27

LuCI(Lua Configuration Interface) ......................................................................... 27

Web设置 ................................................................................................................ 27 web小测试 ............................................................................................................. 28 频率信道转换函数.......................................................................................................... 28

版权所有?2012 成都科技有限公司 第 3 页 共 29 页

openwrt学习

Openwrt编译及烧写

Build.tex

Building an image

Openwrt采用不同的方式来build a firmware,从头开始来dowloading、patching、compiling一切,包括交叉编译器。也就是说,openwrt不包含任何可执行程序,甚至源代码,他自动下载源代码、打补丁来满足指定平台,并编译。通过修改template,我们就可以改变此过程中的任何步骤。

例如,如果一新的kernel发布了,只需要简单地修订其中的一个makefile文件就会download最新的kernel,patch,编译新的firmware映像。这不仅适用于kernel,也适用于openwrt的所有模块,包含openwrt。这使得openwrt保持最新的编译器、最新的内核及最新的应用。

Download OpenWrt

Openwrt的下载方式:

svn checkout svn://svn.openwrt.org/openwrt/trunk openwrt-trunk

在https://dev.openwrt.org/上有一个trac接口,可用来检视svn提交及浏览源代码仓库。

The directory structure

有四个关键目录:Tools、Toolchain、Package、Target。

tools和toolchain

其中tools和toolchain是通用工具,用来编译firmware image、编译器及C库。其编译结果是三个新的目录:build_dir/host,临时目录,用来build target独立的工具;build_dir/toolchain-,用来编译特定architecture的toolchain;staging_dir/toolchain-,toolchain编译结果的安装目录;对于toolchain目录不需要做任何事情,除非you intend to add a new version of one of the components above。

版权所有?2012 成都科技有限公司

第 4 页 共 29 页