openwrt学习:make menuconfig的一些笔记

- 日理万妓 2023-10-18 13:04 260阅读 0赞

由于公司对于新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 —->
  7. Freifunk —->
    12.1、综合
  8. Collections —->
    -*- luci
    <*> luci-ssl……………………. Standard OpenWrt set with HTTPS support

12.2、模块
LuCI基本模块在此配置。包含各种语言支持。

  1. 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同步,等。

  1. 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。

  1. 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。
  2. 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、库
  3. 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

targetsystem选择x86,target img选择生成 vbox或者vmware镜像文件,这样生成镜像用于虚拟机
这里写图片描述
-——————————
作者:李迟
来源:CSDN
原文:https://blog.csdn.net/subfate/article/details/49532145
版权声明:本文为博主原创文章,转载请附上博文链接!

发表评论

表情:
评论列表 (有 0 条评论,260人围观)

还没有评论,来说两句吧...

相关阅读