openWRT学习

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

openwrt学习

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

Creating binary packages

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

第 5 页 共 29 页

openwrt学习

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 [\ # Section

option \ # Option

每一参数应当是单一字符串,is formatted exactly like a parameter for a shell function。引号及特殊字符规则仍然适用,他们将被shell解释。

Parsing configuration files in custom scripts

为了load configuration files,必须包含通用功能脚本: . /etc/functions.sh

这样就可以使用config_load来加载配置文件,功能会首先以作为文件名来检查,并从/etc/config中加载。(这是最通用的使用方式)

If you want to use special callbacks for sections and/or options, you need to define the

第 6 页 共 29 页

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

openwrt学习

following shell functions before running \\texttt{config\\_load} (after including

\\texttt{/etc/functions.sh}): config_cb() {

local type=\ local name=\

# commands to be run for every section }

option_cb() {

# commands to be run for every option }

wireless.tex文档部分学习

WiFi配置文件为/etc/config/wireless。当前支持broadcom、atheros、mac80211。 设备首次启动会检测无线卡类型,并创建一个默认配置文件(sample configuration file)。

每一无线驱动都有自己的配置脚本(/lib/wifi/driver_name.sh),用来处理驱动特定的选项及配置,脚本也会调用驱动特定的二进制如适用于broadcom的wlc,适用于atheros、mac80211的hostapd和wpa_supplicant。 这种结构(architecture)抽象了驱动配置。

通用的broadcom无线配置(略): 通用的mac80211无线配置(略):

通用的atheros无线配置:

config wifi-device \ option type \ option channel \ option hwmode \

config wifi-iface

option device \# option network lan

option mode \ option ssid \ option hidden \

option encryption \

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

第 7 页 共 29 页

openwrt学习

通用的多radio atheros无线配置:

config wifi-device wifi0 option type atheros option channel 1

config wifi-iface

option device wifi0

# option network lan option mode ap

option ssid OpenWrt_private option hidden 0 option encryption none

config wifi-device wifi1 option type atheros option channel 11

config wifi-iface

option device wifi1 # option network lan option mode ap

option ssid OpenWrt_public option hidden 1 option encryption none

配置文件详述

配置文件有两部分,一是wifi-device,指的是物理wifi接口,而wifi-iface指的是其上的虚拟接口,即VAP。

整个的配置文件如下:

config wifi-device wifi device name

option type broadcom, atheros, mac80211 所支持的驱动类型 option country us, uk, fr, de, etc. 国家码 option channel 1-14 wifi信道,依赖于国家码

option maxassoc 1-128 (broadcom only) 关联的最大client数目,仅broadcom支持。

option distance 1-n (meters) AP与最远的client的距离,仅atheros芯片支持 option hwmode 11b, 11g, 11a, 11bg (atheros, mac80211) 频率带宽,仅atheros支持。

option rxantenna 0,1,2 (atheros, broadcom) 接收端天线标识 (Antenna identifier)

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

联系合同范文客服:xxxxx#qq.com(#替换为@)