總結一下OpenWRT編譯經驗
1.如何爲固件增長軟件包
軟件包索引存儲在feeds文件夾中,luci.index packages.index以及xwrt.index就是幾乎全部軟件包的索引
實例:從Openwrt trunk 移植 aria2 到 Openwrt backfire
察看trunk源碼,在packages.index文件中搜索關鍵字"aria2",發現aria2軟件包的描述
- Source-Makefile: feeds/packages/net/aria2/Makefile
- Package: aria2
- Submenu: File Transfer
- Version: 1.15.1-1
- Depends: +libc +USE_EGLIBC:librt +USE_EGLIBC:libpthread +libopenssl +zlib +libxml2 +libstdcpp
- Menu-Depends:
- Provides:
- Section: net
- Category: Network
- Title: lightweight download utility
- Maintainer: OpenWrt Developers Team <openwrt-devel@openwrt.org>
- Source: aria2-1.15.1.tar.bz2
- Type: ipkg
- Description: aria2 is a lightweight multi-protocol & multi-source command-line download
- utility
- http://aria2.sourceforge.net/
- OpenWrt Developers Team <openwrt-devel@openwrt.org>
- @@
複製該段,粘貼到backfire固件源碼的package.index文件中。
觀察以上字段,有Source-Makefile: feeds/packages/net/aria2/Makefile
所以,該軟件的makefile就存放在feeds/packages/net/aria2中,將該文件夾複製到backfire固件的feeds/packages/net中
而後在終端中執行
- scripts/feeds install -a
- make menuconfig
若是沒有問題,你應該能夠發如今Network -> File Transfer分類中出現了aria2,選中它,編譯就能夠了
實例:從Openwrt trunk 移植 Transmission的Luci界面 到 Openwrt backfire
這個軟件包是Luci軟件包,所以,它的索引在luci.index中
在trunk源代碼的luci.index中搜索關鍵字"Transmission",有
- Package: luci-app-transmissio
- Submenu: 3. Applications
- Version: 1
- Depends: +libc +USE_EGLIBC:librt +USE_EGLIBC:libpthread +PACKAGE_luci-app-transmission:transmission-daemon
- Menu-Depends:
- Provides:
- Build-Depends: lua/host
- Section: luci
- Category: LuCI
- Title: LuCI Support for Transmission
- Maintainer: LuCI Development Team <luci@lists.subsignal.org>
- Source: luci-.tar.gz
- Type: ipkg
- Description: LuCI Support for Transmission
- http://luci.subsignal.org/
- LuCI Development Team <luci@lists.subsignal.org>
- @@
將該段複製粘貼至backfire的luci.index中
察看trunk固件的feeds/luci/luci/Makefile,搜索關鍵字"transmission",有
- $(eval $(call application,transmission,LuCI Support for Transmission,\
- +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
將
修改成
從新打包源碼,覆蓋原有的源碼包
3.修改默認開啓無線、修改無線名
打開package/mac80211/files/lib/wifi/mac80211.sh
在該文件的最下面,將
改成
另外,修改option ssid後的內容能夠修改無線名稱
4.爲固件增長fullflash分區
打開target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
將
- #define TPLINK_NUM_PARTS 5
改成
- #define TPLINK_NUM_PARTS 6
(即在原有的數值上加1)
而後在文件中找到如下內容
- parts[0].name = "u-boot";
- parts[0].offset = 0;
- parts[0].size = offset;
- parts[0].mask_flags = MTD_WRITEABLE;
-
- parts[1].name = "kernel";
- parts[1].offset = offset;
- parts[1].size = rootfs_offset - offset;
-
- parts[2].name = "rootfs";
- parts[2].offset = rootfs_offset;
- parts[2].size = art_offset - rootfs_offset;
-
- parts[3].name = "art";
- parts[3].offset = art_offset;
- parts[3].size = TPLINK_ART_LEN;
- parts[3].mask_flags = MTD_WRITEABLE;
-
- parts[4].name = "firmware";
- parts[4].offset = offset;
- parts[4].size = art_offset - offset;
在 parts[4].size = art_offset - offset 後面換一行,添加這段
- parts[5].name = "fullflash";
- parts[5].offset = 0;
- parts[5].size = master->size;
5.修改默認主機名
打開package/base-files/files/etc/config/system
修改option hostname後面的內容
時區和LED設置也在這個文件中
作完以上操做後,須要刪除bin和bulid_dir來從新編譯
歡迎關注本站公眾號,獲取更多信息