當前位置:首頁 » 文件管理 » 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軟體包依賴其他的軟體才能運行,需要先解決軟體依賴問題才能繼續安裝(也就是先安裝依賴的軟體)。

熱點內容
安卓如何遠程簽到 發布:2024-10-05 14:11:11 瀏覽:299
阿里雲伺服器控制面板 發布:2024-10-05 13:57:48 瀏覽:816
涉法涉訴信訪問題意見 發布:2024-10-05 13:56:23 瀏覽:893
華為路由器配置導出的方法有哪些 發布:2024-10-05 13:55:36 瀏覽:161
我的世界好玩伺服器拍視頻 發布:2024-10-05 13:23:19 瀏覽:553
穿越火線掛機腳本 發布:2024-10-05 13:05:44 瀏覽:33
分解質因數c語言 發布:2024-10-05 12:15:53 瀏覽:779
mysql存儲過程字元編碼 發布:2024-10-05 12:05:48 瀏覽:183
c語言命名 發布:2024-10-05 11:56:38 瀏覽:617
編程哪個好學習 發布:2024-10-05 11:50:59 瀏覽:1000