以编译ipk包方式修改openwrt web界面。
2016-03-30 15:26
537 查看
一.在/home/wfly/mt7620/op/openwrt/package/下 建立/test/files目录。
二.
1.进入/test/files目录建立test.lua文件,如下:
2.建立testconfig.lua文件,如下:
3.建立test文件,如下:
三.进入test目录,建立Makefile文件,如下:
四:进入openwrt根目录(我的是/home/wfly/mt7620/op/openwrt)
make package/test/compile 编译ipk包。
find -name test*.ipk 查看是否生成包。
scp ./bin/ramips/packages/base/test_1_ramips_24kec.ipk root@192.168.1.1:~/ 将生成的包上传到路由器。
opkg install test_1_ramips_24kec.ipk 安装ipk包。
效果如下:test管理即为添加模块。
二.
1.进入/test/files目录建立test.lua文件,如下:
module("luci.controller.admin.test", package.seeall) function index() local page entry({"admin", "test"}, alias("admin", "test", "testconfig"), _("test 管理"), 35).index = true entry({"admin", "test", "testconfig"}, cbi("admin_test/testconfig"), _("test 管理"), 1) end
2.建立testconfig.lua文件,如下:
local fs = require "nixio.fs" if fs.access("/etc/config/test") then m2 = Map("test", translate("test 管理"), translate("test 管理!")) s = m2:section(TypedSection, "test", translate("test 管理")) s.anonymous = true s.addremove = false ts = s:option(Value, "time", translate("探针数据回传服务器间隔"), translate("探针数据回传服务器间隔")) us = s:option(Value, "url", translate("探针数据回传服务器地址"), translate("探针数据回传服务器地址")) ps = s:option(Value, "power", translate("探针探测范围"), translate("探针探测范围")) function m2.on_commit(map) end end return m2
3.建立test文件,如下:
config test test option time 35 option url yk.shang-wifi.com option power -68
三.进入test目录,建立Makefile文件,如下:
include $(TOPDIR)/rules.mk # Name and release number of this package PKG_NAME:=test PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(INCLUDE_DIR)/package.mk define Package/test SECTION:=utils CATEGORY:=Utilities TITLE:=test -- prints a snarky message endef define Package/test/description If you can't figure out what this program does, you're probably brain-dead and need immediate medical attention. endef define Build/Prepare endef define Build/Configure endef define Build/Compile endef define Package/test/install $(INSTALL_DIR) $(1)/usr/lib/lua mkdir -p $(1)/usr/lib/lua/test $(INSTALL_DIR) $(1)/usr/lib/lua/test $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/admin cp ./files/test.lua $(1)/usr/lib/lua/luci/controller/admin $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi mkdir -p $(1)/usr/lib/lua/luci/model/cbi/admin_test cp ./files/testconfig.lua $(1)/usr/lib/lua/luci/model/cbi/admin_test $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/etc/config cp ./files/test $(1)/etc/config endef $(eval $(call BuildPackage,test))
四:进入openwrt根目录(我的是/home/wfly/mt7620/op/openwrt)
make package/test/compile 编译ipk包。
find -name test*.ipk 查看是否生成包。
scp ./bin/ramips/packages/base/test_1_ramips_24kec.ipk root@192.168.1.1:~/ 将生成的包上传到路由器。
opkg install test_1_ramips_24kec.ipk 安装ipk包。
效果如下:test管理即为添加模块。
相关文章推荐
- 网站运维工具使用iis日志分析工具分析iis日志(iis日志的配置)
- 【转】总结oninput、onchange与onpropertychange事件的用法和区别
- 希尔排序(shellsort)
- Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be r
- 图像的几何矩
- linux如何生成xorg.conf
- openssl生成csr文件,将crt和key文件转换成tomcat下的jks文件
- linux打包与解压问题集锦
- adb shell input text 输入特殊字符 &
- 【转】有关onpropertychange事件
- centos7基本环境搭建
- HBase 系统架构
- 一个解决OpenCV ffmpeg的链接错误的解决方法
- Linux中的内存管理
- svn
- 虚拟机中PXE-MOF:Exiting intel PXE ROM.Operating system not found
- linux动态库编译和使用
- ubuntu14.04 + opencv3.1 + contrib modules
- aop自定义切面
- Linux(2):Linux系统关闭与重启