openwrt学习
OPENWRT学习总结
目录
Openwrt编译及烧写 ........................................................................................................................ 3 Build.tex ............................................................................................................................................ 3
Building an image ..................................................................................................................... 3 Download OpenWrt .................................................................................................................. 3 The directory structure .............................................................................................................. 3
tools和toolchain .............................................................................................................. 3 Package ............................................................................................................................. 4 Target ................................................................................................................................ 4 Building OpenWrt ..................................................................................................................... 4 Creating packages ..................................................................................................................... 4 Creating binary packages .......................................................................................................... 5 Creating kernel modules packages ............................................................................................ 5 Conventions .............................................................................................................................. 5 Troubleshooting ........................................................................................................................ 5 Using build environments ......................................................................................................... 5 Config.tex.......................................................................................................................................... 5
配置文件结构 ........................................................................................................................... 5 Parsing configuration files in custom scripts ............................................................................ 5 wireless.tex文档部分学习 ............................................................................................................... 6
通用的atheros无线配置: ..................................................................................................... 6 通用的多radio atheros无线配置: ........................................................................................ 7 配置文件详述 ........................................................................................................................... 7 Mesh Point ................................................................................................................................ 8 WDS .......................................................................................................................................... 9
Unencrypted WDS connections ........................................................................................ 9 Encrypted WDS connections ............................................................................................ 9 802.1x configurations .............................................................................................................. 10 EAP-PEAP .............................................................................................................................. 10 限制说明 ................................................................................................................................. 10 Adding a new driver configuration ......................................................................................... 10 Network-scripts.tex ......................................................................................................................... 11
Using the network scripts ........................................................................................................ 11 Writing protocol handers ......................................................................................................... 11
第 1 页 共 28 页
openwrt学习
Network.tex ..................................................................................................................................... 11
网络接口配置 ......................................................................................................................... 11
Static................................................................................................................................ 12 DHCP .............................................................................................................................. 12 PPPOE ............................................................................................................................. 12 MTU设置 ....................................................................................................................... 13 设置静态路由 ......................................................................................................................... 13 设置交换机 ............................................................................................................................. 13 IPV6设置 ............................................................................................................................... 13 Init_script.tex .................................................................................................................................. 14
功能脚本 ................................................................................................................................. 14 etc/rc.common说明 ................................................................................................................ 14 重载初始化脚本函数 ............................................................................................................. 16 定制脚本命令 ......................................................................................................................... 17 Iw .................................................................................................................................................... 17
Iw命令行 ............................................................................................................................... 17 iw说明 .................................................................................................................................... 19
列出所有命令行 ............................................................................................................. 20 列出所有命令及帮助 ..................................................................................................... 20 列出设备支持能力,如带宽信息、802.11n信息 ....................................................... 20 扫描 ................................................................................................................................. 20 监听事件,调试目的 ..................................................................................................... 20 获取链路状态(STA适用)......................................................................................... 20 建立连接 ......................................................................................................................... 20 获取STA统计信息 ....................................................................................................... 21 获取特定STA的统计 ................................................................................................... 21 修改transmit bitrates ...................................................................................................... 21 设置txpower................................................................................................................... 21 省电模式 ......................................................................................................................... 21 添加接口 ......................................................................................................................... 21 删除接口 ......................................................................................................................... 22 设置频率 ......................................................................................................................... 22 设置信道 ......................................................................................................................... 22 设置RTS......................................................................................................................... 22 设置FRAG ..................................................................................................................... 22 修改monitor接口标识 .................................................................................................. 23 更新regulatory domain (国家码???) ................................................................ 23 创建mesh 接口 ............................................................................................................. 23 设置WDS peer ............................................................................................................... 23 AP和client模式使用4-address ................................................................................... 23
wifi启动 ......................................................................................................................................... 24 WEB设置 ....................................................................................................................................... 26
LuCI(Lua Configuration Interface).................................................................................... 26 Web设置 ................................................................................................................................ 26
第 2 页 共 28 页
openwrt学习
web小测试 ............................................................................................................................. 27 频率信道转换函数 ......................................................................................................................... 27
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目录不需要做任
第 3 页 共 28 页
openwrt学习
何事情,除非you intend to add a new version of one of the components above。
Package
Package包目录,在openwrt firmware中,所有模块均是.ipk,这种软件包可用来add to iremware中来提供新的特性或去除以节省空间。这些软件包也是在主干外维护的,并可通过package feed系统来获取到。 ./scripts/feeds update
Those packages can be used to extend the functionality of the build system and need to be symlinked into the main trunk. Once you do that, the packages will show up in the menu for configuration. You would do something like this: ./scripts/feeds search nmap
Search results in feed 'packages':
nmap Network exploration and/or security auditing utility
$ ./scripts/feeds install nmap
To include all packages, issue the following command: $ make package/symlinks
Target
Target指的是嵌入式平台,包括特定嵌入式平台的内容。其中target/linux目录,which is broken down by platform ,包含了特定平台的kernel patch 、profile config。Target/image目录描述了怎么为特定平台打包firmware。
Target和package步骤均会使用build_dir/作为临时目录来编译,另外,toolchain、target、package步骤所下载的内容均会放到dl目录下。
Building OpenWrt
略
Creating packages
略
第 4 页 共 28 页
openwrt学习
Creating binary packages
略
Creating kernel modules packages
略
Conventions
略
Troubleshooting
略
Using build environments
略
Config.tex
配置文件结构
Structure of the configuration files
配置文件分为sections和options/values对。每一section有一type,但不一定需要name。每一option有一个name和value,写在其所属于的section中。 语法如下:
config
每一参数应当是单一字符串,is formatted exactly like a parameter for a shell function。引号及特殊字符规则仍然适用,他们将被shell解释。
Parsing configuration files in custom scripts
为了load configuration files,必须包含通用功能脚本:
第 5 页 共 28 页
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库openWRT学习心得在线全文阅读。
相关推荐: