總結一下OpenWRT編譯經驗

1.如何爲固件增長軟件包
軟件包索引存儲在feeds文件夾中,luci.index packages.index以及xwrt.index就是幾乎全部軟件包的索引


實例:從Openwrt trunk 移植 aria2 到 Openwrt backfire
察看trunk源碼,在packages.index文件中搜索關鍵字"aria2",發現aria2軟件包的描述
  1. Source-Makefile: feeds/packages/net/aria2/Makefile
  2. Package: aria2
  3. Submenu: File Transfer
  4. Version: 1.15.1-1
  5. Depends: +libc +USE_EGLIBC:librt +USE_EGLIBC:libpthread +libopenssl +zlib +libxml2 +libstdcpp
  6. Menu-Depends:
  7. Provides:
  8. Section: net
  9. Category: Network
  10. Title: lightweight download utility
  11. Maintainer: OpenWrt Developers Team <openwrt-devel@openwrt.org>
  12. Source: aria2-1.15.1.tar.bz2
  13. Type: ipkg
  14. Description:  aria2 is a lightweight multi-protocol & multi-source command-line download
  15. utility
  16. http://aria2.sourceforge.net/
  17. OpenWrt Developers Team <openwrt-devel@openwrt.org>
  18. @@
複製該段,粘貼到backfire固件源碼的package.index文件中。
觀察以上字段,有Source-Makefile: feeds/packages/net/aria2/Makefile 
所以,該軟件的makefile就存放在feeds/packages/net/aria2中,將該文件夾複製到backfire固件的feeds/packages/net中
而後在終端中執行
  1. scripts/feeds install -a
  2. make menuconfig
若是沒有問題,你應該能夠發如今Network -> File Transfer分類中出現了aria2,選中它,編譯就能夠了

實例:從Openwrt trunk 移植 Transmission的Luci界面 到 Openwrt backfire
這個軟件包是Luci軟件包,所以,它的索引在luci.index中
在trunk源代碼的luci.index中搜索關鍵字"Transmission",有
  1. Package: luci-app-transmissio
  2. Submenu: 3. Applications
  3. Version: 1
  4. Depends: +libc +USE_EGLIBC:librt +USE_EGLIBC:libpthread +PACKAGE_luci-app-transmission:transmission-daemon
  5. Menu-Depends:
  6. Provides:
  7. Build-Depends: lua/host
  8. Section: luci
  9. Category: LuCI
  10. Title: LuCI Support for Transmission
  11. Maintainer: LuCI Development Team <luci@lists.subsignal.org>
  12. Source: luci-.tar.gz
  13. Type: ipkg
  14. Description: LuCI Support for Transmission
  15. http://luci.subsignal.org/
  16. LuCI Development Team <luci@lists.subsignal.org>
  17. @@
將該段複製粘貼至backfire的luci.index中
察看trunk固件的feeds/luci/luci/Makefile,搜索關鍵字"transmission",有

  1. $(eval $(call application,transmission,LuCI Support for Transmission,\
  2.     +PACKAGE_luci-app-transmission:transmission-daemon))
將這段複製到backfire源代碼的相同文件中
進入backfire源代碼的dl文件夾中,解壓luci的源代碼包
一樣解壓trunk版的luci源代碼包
從trunk版luci源代碼包中將applications/luci-transmission文件夾複製到backfire版luci代碼中
一樣的,po文件夾中的是對應各個頁面的翻譯,咱們須要從trunk版luci代碼的po/zh_cn文件夾裏,將transmission.po複製過來,這是一個文本文件,有必要能夠對其進行翻譯。
從新打包源代碼從而覆蓋舊的版本便可


2.修改默認中文界面
從Openwrt源代碼的dl文件中找到luci源碼包,解壓它
進入該源碼包的libs/web/root/etc/config,修改luci

  1. option lang auto
修改成
  1. option lang zh_cn
從新打包源碼,覆蓋原有的源碼包


3.修改默認開啓無線、修改無線名
打開package/mac80211/files/lib/wifi/mac80211.sh
在該文件的最下面,將
  1. option disabled 1
改成
  1. option disabled 0

另外,修改option ssid後的內容能夠修改無線名稱

4.爲固件增長fullflash分區
打開target/linux/ar71xx/files/drivers/mtd/tplinkpart.c

  1. #define TPLINK_NUM_PARTS      5
改成
  1. #define TPLINK_NUM_PARTS    6
(即在原有的數值上加1)


而後在文件中找到如下內容
  1. parts[0].name = "u-boot";
  2.     parts[0].offset = 0;
  3.     parts[0].size = offset;
  4.     parts[0].mask_flags = MTD_WRITEABLE;
  5.     parts[1].name = "kernel";
  6.     parts[1].offset = offset;
  7.     parts[1].size = rootfs_offset - offset;
  8.     parts[2].name = "rootfs";
  9.     parts[2].offset = rootfs_offset;
  10.     parts[2].size = art_offset - rootfs_offset;
  11.     parts[3].name = "art";
  12.     parts[3].offset = art_offset;
  13.     parts[3].size = TPLINK_ART_LEN;
  14.     parts[3].mask_flags = MTD_WRITEABLE;
  15.     parts[4].name = "firmware";
  16.     parts[4].offset = offset;
  17.     parts[4].size = art_offset - offset;
在 parts[4].size = art_offset - offset 後面換一行,添加這段
  1. parts[5].name = "fullflash";
  2. parts[5].offset = 0;
  3. parts[5].size = master->size;

5.修改默認主機名
打開package/base-files/files/etc/config/system
修改option hostname後面的內容
時區和LED設置也在這個文件中




作完以上操做後,須要刪除bin和bulid_dir來從新編譯
相關文章
相關標籤/搜索