2018-10-24 Widora MT7688/26 openwrt 編譯自己的軟件加入menuconfig

https://github.com/CyC2018/CS-Notes

? ? ? ? 在枯燥的程序工作激勵(lì)我們直面一次一次挫敗,繼續(xù)鼓足勇氣探究的原因是成就感驻襟。經(jīng)歷一次一次為什么憨募,百度薯鳍,谷歌出來(lái)的碎片拼接,最終實(shí)現(xiàn)一個(gè)小小目標(biāo)的成就感居然有如此大的力量月而,感謝互聯(lián)網(wǎng)知識(shí)時(shí)代汗洒,感謝那些知識(shí)的貢獻(xiàn)者,無(wú)論是原創(chuàng)還是轉(zhuǎn)發(fā)父款,都是線索溢谤,都最終幫助迷茫者走過(guò)一程。我寫下我的微小收獲铛漓,無(wú)論對(duì)錯(cuò)溯香,也希望更多地人記錄自己的經(jīng)歷,共同豐富知識(shí)寶庫(kù)浓恶。

? ? ? ?廢話多說(shuō)了。知識(shí)太多结笨,詳細(xì)了解可以慢慢來(lái)包晰。先操刀開干。

第一步肯定是需要假定你已經(jīng)編譯過(guò)一個(gè)能運(yùn)行的Widora openwrt 平臺(tái)了炕吸。漫長(zhǎng)的編譯時(shí)間讓墻內(nèi)人痛苦不堪伐憾,那么醫(yī)IPX插件的方式將會(huì)極大縮短時(shí)間,提高開發(fā)效率....所有的開發(fā)起步都是一個(gè)HELLOWORLD赫模。那么我就來(lái)弄一個(gè)树肃,能被widora openwrt運(yùn)行的helloworld :

? ? ? ? 有1點(diǎn)非常重要,ubantu 14.04平臺(tái)與widows不同瀑罗,大小寫敏感 胸嘴,所以坑里很多一字之差的謬誤。

由于后期開發(fā)以插件形式運(yùn)行斩祭,不整體編譯openwrt 那么我就需要 SDK的配合劣像。

openwrt解壓的 GIT 目錄下 執(zhí)行: make menuconfig

選擇上面的 build the openwrt SDK? 和 Package the OpenWrt-based Toolchain

然后save

執(zhí)行 make V=99

等候幾分鐘后會(huì)再 bin/ramips 目錄里生成一個(gè)超級(jí)長(zhǎng)的名字的壓縮包

cd bin/ramips

ls


解壓這個(gè)SDK 名字的文件。toolchain 暫時(shí)不用摧玫。
tar -xvf OpenWrt-SDK-ramips-mt7688_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2

cd OpenWrt-SDK-ramips-mt7688_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64

ls 一下看看

package 目錄就是我們寫自己插件的地方耳奕。

cd package

mkdir helloworld

cd hellowrold

mkdir src

cd src

vim helloworld.c

抄了這個(gè)兄弟幾句,哈哈



https://blog.csdn.net/hui523hui523hui523/article/details/38366427?utm_source=blogxgwz0



保存诬像,然后再? vim 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 一下,然后運(yùn)行一下

./helloworld

make clean 防止意外坏挠。

cd .. 回到helloworld 目錄創(chuàng)建一個(gè)可以被 SDK識(shí)別的 Makefile 文件芍躏。

vim Makefile

##################https://blog.csdn.net/icy_river/article/details/48260859

# OpenWrt MakefileforHelloWorld program

#

#

# Most of the variables used here are defined in

# theincludedirectives 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 inthisfile.

# Indents should be tabs,notspaces,and

# there should be no trailing whitespace in

# lines that are not commented.

#

##############################################

include$(TOPDIR)/rules.mk

# Nameandrelease number ofthispackage

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 bydefaultthe build_mipsel

# directory in your OpenWrt SDK directory

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

# Specify package informationforthisprogram.

# The variables defined here should be self explanatory.

# If you are running Kamikaze,deletethe DESCRIPTION

# variable belowanduncomment the Kamikaze define

# directiveforthe description below

define Package/helloworld

SECTION:=utils

CATEGORY:=Utilities

TITLE:=HelloWorld -- prints a snarky message

endef

# Uncomment portion belowforKamikazeanddeleteDESCRIPTION variable above

define Package/HelloWorld/description

If you can't figure out whatthisprogram does, you're probably brain-deadandneed immediate medical attention.

endef

# Specify what needs to be done to prepareforbuilding the package.

# In ourcase, we need to copy the source files to the build directory.

# This is NOT thedefault.? Thedefaultuses the PKG_SOURCE_URLandthe

# PKG_SOURCE which isnotdefined 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 todoitthisway.

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 copying 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 copy 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))


復(fù)制以上內(nèi)容存進(jìn)Makefile 里。注意大小寫癞揉。 以后用其他名稱的時(shí)候 將helloworld 換掉即可纸肉。

好了溺欧,退回到?OpenWrt-SDK-ramips-mt7688_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64 目錄

make?

cd bin/ramips/packages/base

ls

簡(jiǎn)單吧!

將 這個(gè)ipx 復(fù)制到openwrt板子上

到opkg 發(fā)揮作用了
opkg install HelloWorld_1_ramips_24kec.ipk

執(zhí)行一下helloworld?

成功0胤尽姐刁!此圖有爛尾樓重建的嫌疑。不要疑惑烦味。




https://blog.csdn.net/lingyizhangfankai/article/details/47007811




http://archive.openwrt.org/chaos_calmer/15.05.1/ramips/mt7688/packages/packages/

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末聂使,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子谬俄,更是在濱河造成了極大的恐慌柏靶,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,525評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件溃论,死亡現(xiàn)場(chǎng)離奇詭異屎蜓,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)钥勋,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,203評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門炬转,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人算灸,你說(shuō)我怎么就攤上這事扼劈。” “怎么了菲驴?”我有些...
    開封第一講書人閱讀 164,862評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵荐吵,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我赊瞬,道長(zhǎng)先煎,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,728評(píng)論 1 294
  • 正文 為了忘掉前任森逮,我火速辦了婚禮榨婆,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘褒侧。我一直安慰自己良风,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,743評(píng)論 6 392
  • 文/花漫 我一把揭開白布闷供。 她就那樣靜靜地躺著烟央,像睡著了一般。 火紅的嫁衣襯著肌膚如雪歪脏。 梳的紋絲不亂的頭發(fā)上疑俭,一...
    開封第一講書人閱讀 51,590評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音婿失,去河邊找鬼钞艇。 笑死啄寡,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的哩照。 我是一名探鬼主播挺物,決...
    沈念sama閱讀 40,330評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼飘弧!你這毒婦竟也來(lái)了识藤?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,244評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤次伶,失蹤者是張志新(化名)和其女友劉穎痴昧,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體冠王,經(jīng)...
    沈念sama閱讀 45,693評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡赶撰,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,885評(píng)論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了柱彻。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片扣囊。...
    茶點(diǎn)故事閱讀 40,001評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖绒疗,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情骂澄,我是刑警寧澤吓蘑,帶...
    沈念sama閱讀 35,723評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站坟冲,受9級(jí)特大地震影響磨镶,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜健提,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,343評(píng)論 3 330
  • 文/蒙蒙 一琳猫、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧私痹,春花似錦脐嫂、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,919評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至暗膜,卻和暖如春匀奏,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背学搜。 一陣腳步聲響...
    開封第一講書人閱讀 33,042評(píng)論 1 270
  • 我被黑心中介騙來(lái)泰國(guó)打工娃善, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留论衍,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,191評(píng)論 3 370
  • 正文 我出身青樓聚磺,卻偏偏與公主長(zhǎng)得像坯台,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子咧最,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,955評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容