1.OpenWRTå¼åä¹å建软件å
2.å¦ä½å¨OpenWRTç¯å¢ä¸åå¼å
3.openwrt编译流程
4.openwrt是源码element分页源码什么意思
5.å¦ä½ç¼è¯OpenWrt
OpenWRTå¼åä¹å建软件å
OpenWRTäºæ¬¡å¼åæ¶æ»å ä¸äºå¼åèªå·±ç软件å ãæ¬æä»ç»å¦ä½å¨OpenWRTä¸å建ä¸ä¸ªæ°ç软件å ã
é¦å å建软件å æå¨çç®å½ï¼å¨openwrtæ ¹ç®å½ä¸æ§è¡:
è¿éçmypackagesç®å½åhelloworldç®å½é½æ¯æ°å»ºçï¼helloworldå°±æ¯æ们æ¬æ¬¡æ°å»ºç软件å çå åãæ们åç»å¯ä»¥å°èªå·±å建çå é½æ¾å¨mypackagesç®å½ä¸ã
helloworldå çç®å½ç»æå¦ä¸ï¼
å³è½¯ä»¶å helloworldç®å½ä¸çMakefileæ件ãä¾å以å注éå¦ä¸ï¼
ä¸é¢çä¾åä¸æ²¡æå®ä¹ define Build/Compile ï¼è¡¨ç¤ºä½¿ç¨é»è®¤çCompileå½ä»¤ãé»è®¤çCompileè¡ä¸ºå°±æ¯å¨$(PKG_BUILD_DIR)ç®å½ä¸æ§è¡makeå½ä»¤ã
helloworld.cå 容å¦ä¸ï¼
ä¸helloworld.cåç®å½çMakefileå 容å¦ä¸ï¼
说æï¼è¿éç$(CC)ã$(CFLAGS)ã$(LDFLAGS)é½æ¯ç±OpenWRTçbuildç³»ç»èµå¼çï¼CCå°±æ¯ç®æ å¹³å°å¯¹åºç交åç¼è¯å·¥å ·é¾éçgccã
å¨OpenWRTæ ¹ç®å½ä¸è¿è¡make menuconfigï¼å¯ä»¥çå°å¤åºæ¥ä¸ä¸ªâExamples â>âèåï¼æå车è¿å»åå¯ä»¥çå°æ们æ°å»ºçâhelloworldâ å ã ï¼ä»è¿éä¹å¯ä»¥çåºï¼å¨æ§è¡make menuconfigæ¶ï¼OpenWRTä¼èªå¨æ«æpackageç®å½ä»¥åå ¶åç®å½ä¸ææçå ãï¼
éä¸è¿ä¸ªâhelloworldâå ãç¶ååOpenWRTæ ¹ç®å½ä¸æ§è¡ï¼
æ¤å½ä»¤å³ä¸ºOpenWRTåpackageç¼è¯å½ä»¤ã
éè¿logï¼å¯ä»¥çå°æ们çå ç¼è¯æåãç¼è¯ç®å½ä¸º build_dir/target-XXXX/helloworld-1.0
å¦æè¦å次ç¼è¯ï¼å¯ä»¥æ§è¡ï¼
æ¬ææºç è§ï¼ /jian-soft/openwrt-package-example
åèæç« ï¼
å¦ä½å¨OpenWRTç¯å¢ä¸åå¼å
1ãæ建å¼åç¯å¢é¦å ï¼å¨æ§è¡make menuconfigåï¼ä¼åºç°ä¸å¾ï¼
ããå ¶ä¸ï¼å¾ä¸çº¢æ¡é¨åæ¯æå®å¶è·¯ç±å¨çç³»ç»çæ¬ï¼å¤§å®¶å¯ä»¥æ ¹æ®ä¸åçè·¯ç±å¨è¿è¡ä¸åçéæ©ï¼ç»¿æ¡é¨å表示æ们éè¦ç¼è¯ä¸ä¸ªSDKå¼åç¯å¢ï¼é»è®¤æ åµä¸ï¼æ¤é¡¹æªå¾éï¼ã
ããç¼è¯è¿ç¨ä¸éè¦éè¿å®ç½ä¸è½½å¾å¤ç¸å ³ç软件å ï¼æä»¥å¿ é¡»ä¿è¯è½å¤é¡ºå©è¿ä¸å¤ç½ãç±äºä¸è½½é度çéå¶ï¼ç¼è¯è¿ç¨å¤§æ¦éè¦æ°å°æ¶ãç¼è¯ç»æåï¼ææç产åé½ä¼æ¾å¨ç¼è¯æ ¹ç®å½ä¸çbin/yourtarget/. ä¾å¦:ææç¼è¯ç产ç©é½æ¾å¨./bin/brcmxx/ä¸ï¼å ¶ä¸æ件主è¦æå ç±»ï¼
ããï¼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/brcmxx/OpenWrt-SDK-brcmxx-for-Linux-x_-gcc-4.3.3+cs_uClibc-0.9..1.tar.bz2
å¯ä»¥ä»å称ä¸çåºï¼target systemæ¯brcmxxï¼host systemæ¯Linux-x_ï¼ä½¿ç¨çç¼è¯å·¥å ·ä»¥ååºæ¯4.3.3+cs_uClibc-0.9..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
/