openWRT各功能软件包及其依赖库配置选项

来源:互联网 发布:数据库管理员怎么样 编辑:程序博客网 时间:2024/06/04 19:40
1.访问路由器的网页:除了需要uhttpd Web服务器外,还需luci这一网页GUI(feeds/luci,一般也都在该目录下开发,最终编译的内容在rootfs的/usr/lib/lua目录下)。
安装luci网页GUI:
./scripts/feeds update packages luci
./scripts/feeds install -a -p luci

LUCI --->
    2.Modules ---> <*> luci-mod-admin-full. LuCI Administration - full-featured for full control 
注:选中luci-mod-admin-full后会默认选中luci-mod-admin-core、Themes-->luci-theme-openwrt、Themes-->luci-theme-base、Translations-->luci-i18n-english
(若想用中文web界面则手动选luci-i18n-chinese)、Protocols-->luci-proto-core、Server Interfaces-->luci-sgi-cgi、
Libraries-->luci-lib-core、Libraries-->luci-lib-ipkg、Libraries-->luci-lib-nixio、Libraries-->luci-lib-sys、Libraries-->luci-lib-web。

安装Web服务器并为uhttpd服务器添加一个lua运行时接口(cgi-bin):
 Network  ---> 
   <*> uhttpd........................ uHTTPd - tiny, single threaded HTTP server ---> 
   <*>   uhttpd-mod-lua... uHTTPd - tiny, single threaded HTTP server (Lua plugin) 

安装统一配置接口工具UCI:openWRT中的很多配置均是通过uci工具命令来完成(包括luci中的lua脚本也调用uci命令来实现系统配置)。
Base system  ---> <*> uci................ Utility for the Unified Configuration Interfa
注:若此时依旧无法访问路由器的web页面,则安装iptables工具删除防火墙的所有过滤规则;或者/etc/init.d/firewall stop关闭防火墙;或者编译固件时不要勾选Base System-->firewall。

2.添加iptables
1.安装防火墙Firewall:
Base System-->firewall、Librarys-->FireWall-->(libip4tc/libip6tc/libxtables)
选中Base System-->firewall时后面的几个库文件会自动选中。

2.安装iptables工具:
Network-->Firewall-->iptables(IPv4的iptable)、IPv6-->Firewall-->iptables(IPv6的iptable)



==============================================================================================
1.1为路由设备替换网页:将其他设备rootfs中/usr/lib/lua内容全部拷贝到build_dir对应rootfs的usr/lib/lua即可;为防止每次编译时修改的内容被覆盖故应修改feed/luci/modules目录下内容,主要替换目录为feeds\luci\modules\admin-full\luasrc和feeds\luci\modules\base\luasrc的controller、tools目录。
1.2htm连接Web前台和后台的交互:htm即PC浏览器来解析和呈现画面,在浏览器页面上点击鼠标即会触发htm代码中的lua脚本(htm中各个按钮或图片处的lua脚本将
鼠标动作转换成某按钮数据提交给后台(如通过uci工具命令将数据保存到/etc/config配置文件中),  并将是否设置成功的结果返回到htm并由htm中的function来呈现返回结果).

ick(function(){
var disabled = "1";
if($("#switch").is(":checked"))
disabled = "0";
else
disabled = "1";

var request_date = { "disabled" : disabled };
$("#loading").show();
$.getJSON("<%=luci.dispatcher.build_url("api", "wlwireless","setWirelessSwitch")%>",request_date,function(rsp) 
//调用lua库函数luci.dispatcher.build_url即可调用到controller目录下自己编写的用于响应前台动作的lua脚本(该lua脚本将前台动作转化成数据提交给后台),后台
//完成数据处理后做一回复(htm中必须有函数function(rsp),该函数的具体内容紧跟如下即{}中用于提示WIFI是否开启)
"#loading").hide(); 
if(rsp.code == 0){
if (disabled == 0) {
art.dialog({icon:"succeed",title:false,content:"WIFI成功开启!"}).lock().time(4);
}
else{
art.dialog({icon:"succeed",title:false,content:"WIFI成功关闭!"}).lock().time(4);
}
} else {
art.dialog({icon:"error",title:false,content:rsp.msg}).lock().time(4);

}) 
});

0 0
原创粉丝点击