当前位置:首页 » 文件管理 » openwrt上传ipk

openwrt上传ipk

发布时间: 2022-11-26 19:09:48

‘壹’ openwrt怎么进行mysql第三方库生成ipk

openwrt怎么进行mysql第三方库生成ipk
1. 用opkg安装myserver及其依赖包
opkg update
opkg install libpthread libncurses libreadline mysql-server

2. 创建mysql数据目录
mkdir -p /home/data/mysql
mkdir -p /home/data/tmp

‘贰’ hiwifi里更新了openwrt的刷机包,刷完了怎样安装goagent等

1、安装python
下载本页附件libopenssl_1.0.1c-1_brcm63xx.zip,解压后将libopenssl_1.0.1c-1_brcm63xx.ipk上传到路由器/tmp目录

如果你的路由器是Atheros AR7161,请下载libopenssl_1.0.1c-1_ar71xx.zip

官方libopenssl的安全线程支持上有问题,会出现“ssleay_rand_add: Assertion `md_c[1] ==
md_count[1]' failed”这样错误,用这个libopenssl就没有问题了。用ssh或者telnet登录到路由器运行如下命令:
cd /tmp

opkg update

opkg install libopenssl_1.0.1c-1_brcm63xx.ipk

opkg install python

opkg install pyopenssl python-openssl
复制代码
2、在OpenWrt上安装goagent
GoAgent是一个基于Google Appengine,因此你必须在app engine上部署goagent的服务端。关于goagent部署请看这里,很详细:http://blog.chinaunix.net/uid-191945-id-3383080.html或者http://www.360doc.com/content/11/1108/14/7917215_162778496.shtml

现假定你的goagent服务端已经部署了
下载goagent:https://nodeload.github.com/goagent/goagent/legacy.zip/3.0,解压出来,修改/local/proxy.ini
将ip改成0.0.0.0
[listen]

ip = 0.0.0.0
复制代码
将appid改成你的appid,多个appid用“|”分隔
[gae]

appid = myvpn|myvpn2
复制代码
用ssh或者telnet登录到路由器运行如下命令:
mkdir -p /app/goagent/local
复制代码
将certs目录、CA.crt、proxy.ini、proxy.py上传到路由器/app/goagent/local目录下。

3、启动goagent
python /app/goagent/local/proxy.py
复制代码
先不要关闭ssh控制台,使用chrome的SwitchySharp插件测试一下代理是否成功。将其中“HTTP 代理”地址改成路由器地址,我这里是192.168.11.1

使用SwitchySharp访问一下twitter.com或者facebook.com看看是否成功:

如果成功,ssh控制台也会滚屏显示日志:

4、设置开机启动goagent
将下面代码加入到/etc/rc.local(或者直接在luci界面,系统>启动项>本地启动脚本 中添加)中
python /app/goagent/local/proxy.py
复制代码
重启路由看看是否正常。

5、PAC文件利用
利用PAC文件可以实现自动代理。
打开SwitchySharp》导入/导出》导出PAC文件,将导出SwitchyPac.pac文件上传到路由器/www目录中。根据这个文件浏览器就能确定哪些网址需要使用代理,哪些直接连接就可以了。

或者,打开proxxy.ini修改[pac]中的ip地址为0.0.0.0,将SwitchyPac.pac放入proxy.ini相同目录中,此时pac访问地址为http://192.168.11.1:8086/SwitchyPac.pac。

pac在chrome、ie、firefox等上都支持的(有的要插件),包括ios平台也可以使用pac文件。上传几张图,大家一看就明白了:
IE中自动代理设置:

ios中自动代理设置:

我的rg100a-aa刷完Attitude Adjustment 12.09后,装了一些常用的软件,再装python、goagent,空间基本够用了。
root@OpenWrt:~# df -h

Filesystem Size Used Available Use% Mounted on

rootfs 13.0M 11.1M 1.9M 86% /

/dev/root 1.8M 1.8M 0 100% /rom

tmpfs 14.3M 476.0K 13.8M 3% /tmp

tmpfs 512.0K 0 512.0K 0% /dev

/dev/mtdblock3 13.0M 11.1M 1.9M 86% /overlay

overlayfs:/overlay 13.0M 11.1M 1.9M 86% /
复制代码
如果你刷了那些大而全的版本,空间不够的话可以装在U盘上了。

‘叁’ 如何将openwrt ipk包直接编译到固件

如果你只是要编译一个自定义的固件(默认带什么软件,不带什么软件,自定义默认的配置等等),那推荐你用ImageBuilder,简单快速,省心省力 你要是需要自己开发软件包,用OpenWRT的SDK,直接出ipk文件 要完全重写就buildroot

‘肆’ 【路由器】OpenWrt 手动编译 ipk

.ipk 文件是可以通过 OpenWrt 的包管理软件 opkg 直接安装,好比 .deb 文件与 apt 的关系。虽然官方的软件仓库已经很丰富了,但是有时仍然需要从源码编译一些第三方的软件使用,例如锐捷认证等

但是由于路由器平台通常与常用的服务器或者个人 PC 的处理器架构不同,并且路由器的处理器本身性能较弱,几乎不可能直接在路由器上进行编译生成 .ipk 文件,因此需要交叉编译来实现

而官方的 OpenWrt 仓库就提供了一个方便使用的交叉编译环境

以 Debian / Ubuntu 为例,参考 官网给出的要求 ,可以通过下面命令来进行安装依赖包

安装/更新好这些依赖之后,就可以通过 git 拉取 OpenWrt 仓库了

通常由于仓库较大以及网速问题,可能会需要很久,其实可以通过 --depth 来限制拉取的仓库深度,或者通过镜像站来加速拉取,当然也可以两者同时采用

进入 openwrt 仓库后,首先需要更新软件包列表 feeds ,它是在 OpenWrt 中共用位置的包的集合。运行以下命令即可更新内置软件包列表并链接到编译工具中:

通常使用图形化菜单界面来进行配置编译选项,依次配置处理器架构、具体的处理器型号以及设备

以小米 mini 路由器为例,应该将他们配置成如下图所示

这一步就是获取对应设备交叉编译所需的编译链

可以先搜索有没有已经配置好的含有 Makefile 的仓库,有了适配过的 Makefile 文件就可以很方便的来编译源码生成 .ipk 文件了

以 minieap 为例, github 上有已经完成的仓库,依次可以直接拉取来编译

在拉取完成仓库后,就可以再次配置编译选项,将需要编译成 .ipk 的功能配置成模块编译,也就是标记成 M

对于 minieap 来说,在 Network 找到对应选项并配置成 M 即可,如下图

配置完成后就可以进行编译了,编译命令也很简单,以 minieap 为例如下所示

编译完成后, .ipk 文件会生成在 ./bin/packages/<YourArchitecture>/base 目录下,将其拷贝到路由器上就可以通过 opkg 进行安装使用了

‘伍’ 如何将一个现成的ipk加入到openwrt编译出的固件中

(!文末附加戏写编译OPENWRTTXT内容直接跳至末尾例)
Openwrt 官式发行版已编译映像文件(缀名bin或trx、trx2)映像文件Openwrt官网站载页面轻松获取连接址 OpenWrt官网站些编译映像文件基于默认配置设置且针受支持平台或设备要打造自映像文件理由四点:
您想拥性化配置OpenWrt(彰显性朋友圈显摆显摆玩笑);
您想实验性平台测试OpenWrt;
您参与测试或参与发OpenWrt工作;
或者简单目保持自Openwrt新版本;
若想实现述目其实简单按述文字即功编译您Openwrt
准备工作
始编译Openwrt前需要您做些准备工作;与其编译程类似编译工具编译环境必少:
构建OpenWrt映像系统平台简单说准备操作系统(比Ubuntu、Debian等);
确保安装所需依赖关系库 (debian系统安装各种需要软件包)
OpenWrt源代码副本
首先 机登陆支持编译Openwrt操作系统(废)实体机或者虚拟机(Vmware 或者 Qemu)操作系统都行推荐使用Linux系统 bsdmac osx系统编推荐且未验证否编译功文假定您使用Debian操作系统使用 apt-get 管理包. 替代选择 Ubuntu (支 Kubuntu, Xubuntu 等即)
第二步, 安装所需要各种软件包, 包括编译器,解压工具,特定库等. 些工作简单通键入命令 (通需要root 或者 sudo 权限)root权限安装列软件包(能并完整提示提示缺少即装):
32位(x86)请执行列命令:
# apt-get install build-essential asciidoc binutils bzip2 gawk gettext \
git libncurses5-dev libz-dev patch unzip zlib1g-dev

64位(x86_64)请执行列命令(装哪些库或软件包呢请您仔细看看哦):
# apt-get install build-essential asciidoc binutils bzip2 gawk gettext \
git libncurses5-dev libz-dev patch unzip zlib1g-dev ia32-libs \
lib32gcc1 libc6-dev-i386

参考 本列表 所列编译环境所需要软件包或库
某些依赖库或软件包许操作系统已经安装apt-get作提示(提示您忽略或重新安装)别紧张放轻松些编译Openwrt像编译DD-WRT难(至少本体编译DD-WRT难)
载份完整 Openwrt 源码编译环境关于Openwrt源代码载途径二通 svn 通 git建议使用 svn Openwrt主要 svn 维护Openwrt系统版本另外请注意Openwrt同支版本用较发快照俗称 trunk二稳定版俗称 backfire
安装Subversion
若想通svn载源代码,需安装 SubversionSubversion,或称SVN, OpenWrtproject用控制版本系统,非类似 CVS界面使用条款 执行述命令即安装SVN容易:
# apt-get install subversion

Subversion安装完毕通SVN命令获取份OpenWrt纯净源代码您创建目录便存放获取Openwrt源代码要获取源代码输入subversion命令获取 (svn种操作称'check out') 命令简单继续看能见别着急耐点
编译流程
编译专属于您设备特定Openwrt固件五步骤:
通Subversion命令获源代码;
更新(或安装) package feeds[package feeds确切翻译待译吧);
创建默认配置检查编译环境否搭建 (假需要);
用Menuconfig配置即编译固件映像文件配置项;
始编译固件;
载源代码
载份完整OpenWrt源代码选择:
载稳定发行版或
载发版 (俗称"trunk"版)
使用发行版源码
截止本文, Openwrt公发行稳定版 OpenWrt 10.03 "backfire"版本稳定许包括新更新补丁或新编写新功能
述代码即举例说明通svnbrandkfire获backfire源代码(版本意思trunk支补丁backfire版本即包含修复补丁):
# mkdir OpenWrt/
# cd OpenWrt/
# svn co svn://svn.openwrt.org/openwrt/branches/backfire

注解: 述svn命令前目录创建 OpenWrt/backfire/ 目录目录包含命令获取源代码
您通述命令载含修复补丁backfire原版源码:
# svn co svn://svn.openwrt.org/openwrt/tags/backfire_10.03

使用发版源代码
前发版本支(trunk)已包含新实验补丁支或许突破Openwrt原所支持硬件设备限制哦惊喜同风险存编译trunk版慎~
# mkdir OpenWrt/
# cd OpenWrt/
# svn co svn://svn.openwrt.org/openwrt/trunk/

更详细资料详见:
跟进并更新源代码
Openwrt源代码随都变故命令确保您所获取源码新性述假设您用backfire版本源码:
## Here, backfire is the directory name of the current release branch you're tracking
# cd OpenWrt/backfire/
# svn up

'svn up' 命令用于更新SVN更新本尚未更新部源代码(本实践证明命令本源码与SVN源码先比较若SVN更新才载更新部实用命令)未指定目标路径则命令更新前目录及前目录目录内源码
Feeds载
Feeds即包含OpenWrt环境额外软件包索引类(feed译名莫衷至2008底止没十通用备受认文译名;所文我用英文feed称呼) 主要Feeds三:
'packages' - 路由基本功能,
'LuCI' - OpenWrt默认GUI(WEB管理界面), 及
'Xwrt' - 其GUI
般情况至少需要含 'packages' 'LuCI'两Feeds
载完feeds (编译OpenWrtrecipies额外预定义包) 您检查哪些feeds要包括内编辑编译环境根目录'feeds.conf.default'文件
使用列命令始载(注:能需要先运行cd trunk进入trunk目录才能功执行列命令):
# ./scripts/feeds update -a

载软件包需要安装亦即指边命令啦若路边install命令则续make menuconfig功执行(注:能需要先运行cd trunk进入trunk目录才能功执行列命令):
# ./scripts/feeds install -a

需编辑Feeds配置文件或运行更新命令即便更新或添加新实验性packages源码并编译OpenWrt固件
注意:请坛友及旧新闻组员注意步取代创建符号链接symlinks办哦
更新Feeds
诸类源码,定期更新Feeds 通相同命令:
# ./scripts/feeds update -a
# ./scripts/feeds install -a

注意:若清楚知道需添加新packagesmenuconfig更新Feeds跳步
配置
You may not have to make configration always after updating sources and feeds, but making it ensures that all packages from source and feeds are correctly included in your build configuration.
Defconfig
步检查编译环境若进行编译则默认配置:
# make defconfig

若defconfig显提示缺少软件包或编译库等依赖则按提示安装所缺软件包或库等即难细点行
Menuconfig
menuconfig基于文本工具处理选择目标(需要需要)、编译软件包(openwrtIPKG格式)及内核选项(编译模块内核)等等
# make menuconfig

离并保存配置文件(默认都.config)自配置依赖关系让着手编译更新固件
众通'menuconfig'简单图形化配置环境非轻松编译专属您本OpenWrt固件
用'menuconfig'发意图编译OpenWrt固件自()创造结构简单功能强环境(句实难翻译能意译并且请家都习编译OP固件让OP固件盈利丢掉肮脏饭碗)
Menuconfig或或少些难说明即使专业配置寻求帮助并加解决 需要指定何种目标平台要包含package软件包内核模块等均需要指定配置标准程包括修改:
目标平台(即路由器何种架构BCM呢AR均选择)
选择要包含package软件包
构建系统设置
内核模块
Target system is selected from the extensive list of supported platforms, with the numerous target profiles – ranging from specific devices to generic profiles, all depending on the particular device at hand. Package selection has the option of either 'selecting all package', which might be un-practical in certain situation, or relying on the default set of packages will be adequate or make an indivial selection. It is here needed to mention that some package combinations might break the build process, so it can take some experimentation before the expected result is reached. Added to this, the OpenWrt developers are themselves only maintaining a smaller set of packages – which includes all default packages – but, the feeds-script makes it very simple to handle a locally maintained set of packages and integrate them in the build-process.
假需要LuCI, 要Administration 菜单,LuCI组件菜单, 并选择: luci-admin-core, luci-admin-full, and luci-admin-mini组件包
假需要PPP,Network菜单取消选择便编译包含组件
Menuconfig用: 确保些组件包 '*'星号标记 'M'标记
星号 '*'标记该组件包, 则该组件包编译进终OpenWrt固件
仅 'M'标记该组件包, 则该组件包编译进终OpenWrt固件
The final step before the process of compiling the intended image(s) is to exit 'menuconfig' – this also includes the option to save a specific configuration or load an already existing, and pre-configured, version.
Exit and save.
Source Mirrors
The 'Build system settings' include some efficient options for changing package locations which makes it easy to handle a local package set:
Local mirror for source packages
Download folder
In the case of the first option, you simply enter a full URL to the web or ftp server on which the package sources are hosted. Download folder would in the same way be the path to a local folder on the build system (or network). If you have a web/ftp-server hosting the tarballs, the OpenWrt build system will try this one before trying to download from the location(s) mentioned in the Makefiles . Similar if a local 'download folder', residing on the build system, has been specified. The 'Kernel moles' option is required if you need specific (non-standard) drivers and so forth – this would typically be things like moles for USB or particular network interface drivers etc.
编译固件
万事具备欠东风,通面简单make命令编译:
# make

核电脑编译
具核CPU处理器电脑进行编译使用述参数令编译程加速 规用 – 例使用3进程编译 (即双核CPU), 命令及参数:
# make -j 3

台编译
若系统内编译OpenWrt同处理其让闲置I/O及CPU台编译固件 (双核CPU):
# ionice -c 3 nice -n 20 make -j 2

编译简单基本软件包
OpenWrt发或打包软件包,编译简单基本软件包轻易编译该软件包 (例 软件包cups):
# make package/cups/compile V=99

Feeds软件包约:
# make package/feeds/packages/ndyndns/compile V=99

编译错误
某种知道原编译失败,面种简单知编译底错哪:
# make V=99 2>&1 |tee build.log |grep -i error

述编译命令意:V99参数错信息保存build.log输完整详细副本(with stdout piped to stderr)屏幕显示错误
举例说明:
# ionice -c 3 nice -n 20 make -j 2 V=99 CONFIG_DEBUG_SECTION_MISMATCH=y 2>&1 \
|tee build.log |egrep -i '(warn|error)'

The above saves a full verbose of the build output (with stdout piped to stderr) in build.log and outputs only warnings and errors while building using only background resources on a al core CPU.

‘陆’ openwrt安装ipk包求助

有两种方式安装: 登录路由web界面(一般是192.168.1.1),在openwrt的软件安装界面上选择上传安装。 登录openwrt控制台,可用ssh登录或通过路由的TTL接口在控制台用命令进行安装:用winscp将下载的ipk安装包上传到路由器中

‘柒’ openwrt怎么上传文件

将网线连至路由器的lan口,本机网卡ip设置成和路由器同网段,一般为192.168.1.x然后ping192.168.1.1可以ping通说明连接成功。
上传文件使用一款名为WinSCP的软件,打开软件,在会话中填入以下信息,主机名是:192.168.1.1用户名密码就是路由器的登录密码注意:协议选择scp。
连接后可能会提示错误,不用理会确定即可。
连接成功就有类似资源管理器的界面了,可以上传,修改,删除文件。
要在路由器终端执行命令,可以在winscp中找到命令。打开即可。

‘捌’ 小白求教,关于openwrt的Makefile

1、搭建开发环境
首先,在执行make menuconfig后,

其中,图中红框部分是我定制路由器的系统版本,大家可以根据不同的路由器进行不同的选择;绿框部分表示我们需要编译一个SDK开发环境(默认情况下,此项未勾选)。
编译过程中需要通过官网下载很多相关的软件包,所以必须保证能够顺利连上外网。由于下载速度的限制,编译过程大概需要数小时。编译结束后,所有的产品都会放在编译根目录下的bin/yourtarget/. 例如:我所编译的产物都放在./bin/brcm47xx/下,其中文件主要有几类:
(1).bin/.trx 文件: 这些都是在我们所选的target-system的类别之下,针对不同路由器型号、版本编译的路由器固件。这些不同路由器的型号和版本是openwrt预先设置好的,我们不需要更改。至于.bin和.trx的区别,一种说法是,第一次刷路由器的时候,需要用.bin文件,如果需要再升级,则不能再使用.bin文件,而需要用.trx文件。原因是,.bin是将路由器的相关配置信息和.trx封装在一起而生成的封包,也就是说是包含路由器版本信息的.trx。在第一次刷固件的时候,我们需要提供这样的信息,而在后续升级时,则不再需要,用.trx文件即可。
(2)packages文件夹: 里面包含了我们在配置文件里设定的所有编译好的软件包。默认情况下,会有默认选择的软件包。
(3)OpenWrt-SDK.**.tar.bz2: 这个也就是我们定制编译好的OpenWRT SDK环境。我们将用这个来进行OpenWrt软件包的开发。例如,我所编译好的SDK环境包为:/bin/brcm47xx/OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2
可以从名称上看出,target system是brcm47xx,host system是Linux-x86_64,使用的编译工具以及库是4.3.3+cs_uClibc-0.9.30.1。
(4)md5sums 文件: 这个文件记录了所有我们编译好的文件的MD5值,来保证文件的完整性。因为文件的不完整,很容易将路由器变成“砖头”。
需要主要的是,编译完成后,一定要将编译好的bin目录进行备份(如果里面东西对你很重要的话),因为在下次编译之前,执行make clean 会将bin目录下的所有文件给清除掉!!
2、 更改原有packages
在编译根目录下会有一个dl的目录,这个目录其实是“download”的简写,在编译前期,需要从网络下载的数据包都会放在这个目录下,这些软件包的一个特点就是,会自动安装在所编译的固件中,也就是我们make menuconfig的时候,为固件配置的一些软件包。如果我们需要更改这些源码包,只需要将更改好的源码包打包成相同的名字放在这个目录下,然后开始编译即可。编译时,会将软件包解压到build_dir目录下。
当然,你也可以自己在dl里面创建自己的软件包,然后更改相关的配置文件,让openwrt可以识别这个文件包。
由于我的项目更改的内容是底层的,需要跟固件一起安装。所以,我使用的方法就是直接更改dl目录下软件包,然后重新进行固件编译。感觉类似于Linux的内核编译。反复编过十多次,没有任何问题。
3、 新建自己的packages
对于自己新建的package,而这个package又不需要随固件一起安装,换句话说,就是可以当做一个可选软件包的话。我们可以利用我们的SDK环境来单独编译,编译后会生成一个ipk的文件包。然后利用 opkg install xxx.ipk 来安装这个软件。
下面具体说下,如何编译一个helloword的软件包。
(1)首先,编写helloworld程序
编写helloworld.c
/****************
* Helloworld.c
* The most simplistic C program ever written.
* An epileptic monkey on crack could write this code.
*****************/
#include <stdio.h>
#include <unistd.h>
int main(void)
{
printf("Hell! O' world, why won't my code compile?\n\n");
return 0;
}
编写Makefile文件
# build helloworld executable when user executes "make"
helloworld: helloworld.o
$(CC) $(LDFLAGS) helloworld.o -o helloworld
helloworld.o: helloworld.c
$(CC) $(CFLAGS) -c helloworld.c
# remove object files and executable when user executes "make clean"
clean:
rm *.o helloworld
在这两个文件的目录下,执行make 应该可以生成helloworld的可执行文件。执行helloworld后,能够打印出“Hell! O' world, why won't my code compile?”。 这一步,主要保证我们的源程序是可以正常编译的。下面我们将其移植到OpenWRT上。
(2)将OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2解压
tar –xvf OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2
(3)进入SDK
cd OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1
可以看到里面的目录结构跟我们之前source的目录结构基本相同,所需要编译的软件包,需要放置在package目录下
(4)在package目录下创建helloworld目录
cd package
mkdir helloworld
cd helloworld
(5)创建src目录,拷贝 helloworld文件
mkdir src
cp /home/wrt/test/helloworld.c src
cp /home/wrt/test/Makefile src
(6)在helloworld目录下创建Makefile文件
这个Makefile文件是给OpenWRT读的,而之前写的那个Makefile文件是针对helloworld给编译其读的。两个Makefile不在同一层目录下。
touch Makefile
vim Makefile
Makefile文件模板内容如下:
##############################################
# OpenWrt Makefile for helloworld program
#
#
# Most of the variables used here are defined in
# the include directives below. We just need to
# specify a basic description of the package,
# where to build our program, where to find
# the source files, and where to install the
# compiled program on the router.
#
# Be very careful of spacing in this file.
# Indents should be tabs, not spaces, and
# there should be no trailing whitespace in
# lines that are not commented.
#
##############################################
include $(TOPDIR)/rules.mk
# Name and release number of this package
PKG_NAME:=helloworld
PKG_RELEASE:=1
# This specifies the directory where we're going to build the program.
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
# directory in your OpenWrt SDK directory
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
# Specify package information for this program.
# The variables defined here should be self explanatory.
# If you are running Kamikaze, delete the DESCRIPTION
# variable below and uncomment the Kamikaze define
# directive for the description below
define Package/helloworld
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Helloworld -- prints a snarky message
endef
# Uncomment portion below for Kamikaze and delete DESCRIPTION variable above
define Package/helloworld/description
If you can't figure out what this program does, you're probably
brain-dead and need immediate medical attention.
endef
# Specify what needs to be done to prepare for building the package.
# In our case, we need to the source files to the build directory.
# This is NOT the default. The default uses the PKG_SOURCE_URL and the
# PKG_SOURCE which is not defined here to download the source from the web.
# In order to just build a simple program that we have just written, it is
# much easier to do it this way.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
# We do not need to define Build/Configure or Build/Compile directives
# The defaults are appropriate for compiling a simple program such as this one
# Specify where and how to install the program. Since we only have one file,
# the helloworld executable, install it by ing it to the /bin directory on
# the router. The $(1) variable represents the root directory on the router running
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
# directory if it does not already exist. Likewise $(INSTALL_BIN) contains the
# command to the binary file from its current location (in our case the build
# directory) to the install directory.
define Package/helloworld/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/
endef
# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,helloworld))
(7)返回到SDK的根目录
执行make进行编译
编译过程会在build_dir目录下完成
编译结果会放在 bin/[yourtarget]/package目录下helloworld_1_bcm47xx.ipk
(8)上传helloworld_1_bcm47xx.ipk
使用sftp软件上传helloworld_1_bcm47xx.ipk至路由器
执行 opkg install helloworld_1_bcm47xx.ipk
输入hello然后按Tab键,发现openwrt中已经有helloworld可执行命令。
执行 helloworld 查看程序的效果。

‘玖’ 求助,极2刷openwrt装ipk软件报错

首先,用ssh登录路由(可用putty等软件)。确保路由连上网。——————————配置PPPOE上网————————————参考:openwrt命令行配置PPPOE上网的方法: .vi/etc/config/network .如果无法编辑,按a进入编辑模式。 .输入以下内容:config'interface''wan'optionifname'wan'optionproto'pppoe'optionusername'xxxxxxx'(xxxxxxx表示是你的pppoe帐号)optionpassword'xxxxxx'(xxxxxx表示是你的密码)optionpeerdns' 'optiondefaultroute' ' .按:(冒号)退出编辑模式,再输入x,然后回车,保存文件。 .输入/etc/init.d/networkstart并回车。配置PPPOE上网完毕。——————————配置PPPOE上网————————————输入opkgupdate并回车。(更新软件包列表)输入opkginstallluci并回车。(安装Web管理软件luci)待完成,输入/etc/init.d/uhttpdstart并回车。(启动Web服务)输入/etc/init.d/uhttpdenable并回车。(设为开机自动启动)好了,完成,可以通过浏览器访问你的路由器并进行配置了。补充一下:如果你需要中文界面,可以opkginstallluci-i n-chinese安装中文语言包。本文地址:(如转载,需注明本原文地址)

‘拾’ 求助,openwrt安装ipk软件报错

安装ipk软件时报错,大多有两种情况:一是ipk包的硬件架构信息不符。说明你下载的ipk包不符合你的openwrt路由器,如果你确定你的ipk包的确符合你路由器的硬件,可以加上--force-install参数强制安装,不过一般不推荐这样做。
还有一种情况就是这个ipk软件包依赖其他的软件才能运行,需要先解决软件依赖问题才能继续安装(也就是先安装依赖的软件)。

热点内容
c可以用来编译系统软件吗 发布:2024-10-05 16:22:26 浏览:17
U盘和存储器 发布:2024-10-05 16:22:04 浏览:896
cmdc语言 发布:2024-10-05 15:58:32 浏览:550
服务器怎么弄公网ip 发布:2024-10-05 15:57:02 浏览:640
设备配置在什么地方 发布:2024-10-05 15:44:59 浏览:249
matlab外部接口编程 发布:2024-10-05 15:36:58 浏览:365
C事件编程 发布:2024-10-05 15:15:43 浏览:639
一台服务器出现两IP 发布:2024-10-05 15:10:05 浏览:925
md5加密算法c 发布:2024-10-05 15:05:40 浏览:761
如何重设控制器密码 发布:2024-10-05 14:19:13 浏览:441