————————————————
版權聲明:本文為CSDN部落客「李遲」的原創文章,遵循CC 4.0 BY-SA版權協定,轉載請附上原文出處連結及本聲明。
原文連結:https://blog.csdn.net/subfate/article/details/49532145
由于公司對于新CPU開發很着急,似乎明年2月份就能達到量産的目标。之前隻有2個人在做平台級的開發,于是就另外抽調人手,而我就在其中。我之所心搞openwrt是因為硬體部門的樣機一直未有時間表,而我總不能拿幾篇網絡搜尋到的文章交給上司說已經完成儲備了。鑒于事務的優先級,老大決定讓我月底完成手上的活。于是我也光榮地跳進新平台這個無底坑中。去年開始,我一直擔憂自己主攻方向的問題,從目前情況看,依然還是擔憂。我也看開了,一切聽從上司安排。而openwrt的學習,我不知道還會不會繼續下去,隻好盡量做點筆記,以備忘。本文記錄openwrt編譯配置的一些筆記,這些配置隻是筆者的一個實踐例子,當然,還有更多的配置選擇,那是諸君之事了。
一、介紹
make menuconfig不僅僅配置核心,還有rootfs(實際為busybox)、app(系統庫、界面工具。核心配置位于:chaos_calmer\package\kernel\linux。不同的驅動配置在不同的檔案,具體根據檔案名稱可識别出。
ls chaos_calmer/package/kernel/linux/modules/
001-depends.mk crypto.mk hwmon.mk leds.mk netfilter.mk other.mk spi.mk virtual.mk wpan.mk
block.mk firewire.mk i2c.mk lib.mk netsupport.mk pcmcia.mk usb.mk w1.mk
can.mk fs.mk input.mk netdevices.mk nls.mk sound.mk video.mk wireless.mk
二、配置
下面簡單列出筆記的配置的一部分内容。
1、平台類型
Target System (x86) --->
這裡隻選擇x86。根據平台類型的不同,後面的選項也有不同。
2、目标闆鏡像檔案
生成的鏡像檔案的相關配置。
Target Images --->
[*] tar.gz # 壓縮包格式
[*] ext4 ---> # 可選ext4的最大節點數以及block大小
[*] Build GRUB images (Linux x86 or x86_64 host only)
[*] Use Console Terminal (in addition to Serial) # 開啟序列槽調試終端
(ttyS0) Serial port device # 序列槽裝置名,一般為ttyS0
(115200) Serial port baud rate # 波特率,選擇的與序列槽工具設定的波特率必須一緻
(3) Seconds to wait before booting the default entry # grub倒計時,機關為秒
(4) Kernel partition size (in MB) # 核心的大小,機關為MB,一般3、4MB足夠
(64) Root filesystem partition size (in MB) # 根檔案系統大小,這個值越大,鏡像體積越大,一般路由系統幾十MB足夠
3、鏡像配置(系統腳本及IP配置)
[*] Image configuration --->
--- Preinit configuration options
[*] Suppress stderr messages during preinit
(2) Failsafe wait timeout
[ ] Show all preinit network messages
[ ] Suppress network message indicating failsafe
() Preinit network interface # 預設IP位址
(192.168.1.1) IP address for preinit network messages
(255.255.255.0) Netmask for preinit network messages
(192.168.1.255) Broadcast address for preinit network messages
4、基礎系統
本配置項為建構基本的檔案系統,基本工具,庫,等。預設即可。
Base system --->
<*> base-files................................... Base filesystem for OpenWrt # 基本檔案系統
<*> dropbear........................................ Small SSH2 client/server #ssh伺服器
-*- libc........................................................... C library # C庫
-*- libgcc............................................... GCC support library # gcc支援庫
-*- libpthread.......................................... POSIX thread library # 線程庫
-*- librt................................ POSIX.1b RealTime extension library# 運作時庫
5、root權限指令
如sudo等指令
Administration --->
6、Boot Loader
此項無内容
Boot Loaders ---->
7、開發相關
開發專用,會安裝如gcc、gdb、ar、patch、binutils等工具,普通使用者無須關注。
Development --->
8、固件
個别子產品的固件,如是,則要加入核心。X86平台,無須理會。
Firmware --->
9、核心子產品
真正的核心配置在此處。本子產品較重要,内容較多。但本文使用的X86平台上需要配置的東西不多。
Kernel modules --->
9.1、塊裝置
Block Devices --->
-*- kmod-scsi-core....................................... SCSI device support
9.2、檔案系統
本次移植使用的檔案系統為EXT4。其它不需要。
Filesystems --->
<*> kmod-fs-ext4..................................... EXT4 filesystem support
-*- kmod-fs-nfs....................................... NFS filesystem support
-*- kmod-fs-nfs-common......................... Common NFS filesystem modules
9.3、硬體監控子產品
如LM75,不使用。
Hardware Monitoring Support --->
9.4、I2C支援
該X86平台使用IGB網絡驅動,需要I2C的支援,故選擇。
I2C support --->
<*> kmod-i2c-core................................................ I2C support
9.5、輸入子產品
如USB滑鼠、鍵盤,等。
Input modules --->
-*- kmod-hid..................................................... HID Devices
<*> kmod-hid-generic.............................. Generic HID device support
-*- kmod-input-core........................................ Input device core
-*- kmod-input-evdev...................................... Input event device
9.6、本地語言支援
Native Language Support --->
-*- kmod-nls-base.................................... Native Language Support
9.7、netfilter擴充
iptables的選項需要核心的支援,在此進行選擇。文本使用預設值。
Netfilter Extensions --->
9.8、網絡裝置
該X86平台使用的網絡裝置驅動為IGB,其它不選。
Network Devices --->
-*- kmod-ifb........................... Intermediate Functional Block support
<*> kmod-igb....... Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support # IGB驅動
-*- kmod-libphy.................................................. PHY library # PHY庫,必須
-*- kmod-mii..................................................... MII library
9.9、網絡支援
對網絡的支援,比如8021q、DNS、ipv6。
Network Support --->
<*> kmod-8021q........................................... 802.1Q VLAN support
-*- kmod-dnsresolver.................................. In-kernel DNS Resolver
-*- kmod-ipv6................................................... IPv6 support
9.10、其它子產品
openwrt的menuconfig涉及大量其它東西,而核心隻是其中一部分,故不像真正的kernel的menuconfig那樣分類詳細。很多字元類裝置都在此選項。比如MMC、EEPROM、RTC、序列槽。
Other modules --->
<*> kmod-serial-8250.............................................. 8250 UARTs # 序列槽裝置
9.11、SPI支援
SPI驅動,不使用。
SPI Support --->
9.12、音頻支援
不使用音頻驅動。
Sound Support --->
9.13、USB支援
USB接口輸入裝置,U盤支援,在此處選擇。
USB Support --->
-*- kmod-usb-core............................................ Support for USB
<*> kmod-usb-ohci............................... Support for OHCI controllers
<*> kmod-usb-storage..................................... USB Storage support
9.14、視訊支援
不使用視訊功能。
Video Support --->
9.15、無線驅動
不使用無線驅動。
Wireless Drivers --->
10、程式設計語言
如Java、Lua、PHP、Perl、Python、Ruby。由于openwrt使用Lua,建議選上。
Languages --->
11、庫
常用庫。如壓縮為libbz2、SSL庫、libexif,等,使用預設選項。SSL建議選擇。
Libraries --->
12、界面選項配置
openwrt的界面使用LuCI,功能項、工具在此配置。内容較龐大、較重要。
LuCI --->
1. Collections --->
2. Modules --->
3. Applications --->
4. Themes --->
5. Protocols --->
6. Libraries --->
9. Freifunk --->
12.1、綜合
1. Collections --->
-*- luci
<*> luci-ssl......................... Standard OpenWrt set with HTTPS support
12.2、子產品
LuCI基本子產品在此配置。包含各種語言支援。
2. Modules --->
-*- luci-base............................................ LuCI core libraries
Translations --->
<*> Chinese (zh-cn) # 中文支援
-*- luci-mod-admin-full. LuCI Administration - full-featured for full control
12.3、應用程式
界面上的應用程式在此配置。如防火牆、QOS、NTP同步,等。
3. Applications --->
-*- luci-app-firewall................ Firewall and Portforwarding application
<*> luci-app-ntpc.............. NTP time synchronisation configuration module
<*> luci-app-qos..................... Quality of Service configuration module
<*> luci-app-vnstat.................................. LuCI Support for VnStat
12.4、主題
預設主題為luci-theme-bootstrap。
4. Themes --->
-*- luci-theme-bootstrap........................... Bootstrap Theme (default)
<*> luci-theme-freifunk-bno.................... Freifunk Berlin Nordost Theme
<*> luci-theme-freifunk-generic....................... Freifunk Generic Theme
<*> luci-theme-openwrt................................ LuCI OpenWrt.org theme
12.5、協定
如3G、ipv6、PPP。
5. Protocols --->
<*> luci-proto-3g............................................. Support for 3G
-*- luci-proto-ipv6........... Support for DHCPv6/6in4/6to4/6rd/DS-Lite/aiccu
-*- luci-proto-ppp.......................... Support for PPP/PPPoE/PPPoA/PPtP
12.6、庫
6. Libraries --->
-*- luci-lib-ip....... Lua library for IP calculation and routing information
-*- luci-lib-nixio....................................... NIXIO POSIX library
13、郵件
郵件服務。不使用。
Mail --->
14、多媒體
多媒體配置,如ffmpeg、流媒體播放工具。不使用。
Multimedia --->
15、網絡
本項為網絡相關工具、子產品的配置。内容較多,也較重要。
Network --->
SSH --->
-*- openssh-client............................................ OpenSSH client
-*- openssh-keygen............................................ OpenSSH keygen
<*> openssh-server............................................ OpenSSH server
Time Synchronization ---> # 時間同步
-*- ntpclient............................. NTP (Network Time Protocol) client
<*> ntpdate..................................................... ISC ntp date
VPN ---> # VPN,不使用
Web Servers/Proxies --->
-*- uhttpd........................ uHTTPd - tiny, single threaded HTTP server # 小型web伺服器
<*> ethtool......................... Display or change ethernet card settings
<*> iperf
<*> tcpdump..................... Network monitoring and data acquisition tool
16、音頻
不使用音頻相關工具、庫,不用配置。
Sound --->
17、其它工具
一些其它小工具在此。内容較雜。有的是boot loader,有的是壓縮庫,有的是編輯器(vim)。還有其它工具,如minicom、grep、tar、bash、file,等。根據實際選擇。
Utilities --->
Editors ---> # 編輯器
<*> vim.............................. Vi IMproved - enhanced vi editor (Tiny)
Terminal ---> # 終端工具
<*> minicom....................................... Terminal emulation program
database ---> # 資料庫,如mysql、sqlite
zoneinfo ---> # 時區資訊
<*> bash.......................................... The GNU Bourne Again Shell
<*> grep.................................. grep search utility - full version
<*> hwclock.................................. query or set the hardware clock
<*> tar.............................................................. GNU tar
————————————————
版權聲明:本文為CSDN部落客「李遲」的原創文章,遵循CC 4.0 BY-SA版權協定,轉載請附上原文出處連結及本聲明。
原文連結:https://blog.csdn.net/subfate/article/details/49532145