Yuhang Zheng

OpenWrt从零开发

N 人看过

这篇文章主要记录基于GitHub的OpenWRT19.02源码如何一步步配置,编译,得到适用于OK1046-C2的镜像。

在源码下执行make menuconfig之后的首选配置

首先是平台相关的必要配置:

Target System (NXP Layerscape)
Subtarget (ARMv8 64-bit based boards) 
Target Profile (NXP LS1046A-RDB Default)  

然后是启用LUCI web图形界面

-> LuCI
    -> 1. Collections
        <*> luci................... LuCI interface with Uhttpd as Webserver (default) 

内核模块打开ath10k和iwlwifi驱动的支持,其他的依赖项会自动选择

-> Kernel modules
    -> Wireless Drivers
        -*- kmod-ath...................................... Atheros common driver part  --->
        <*> kmod-ath10k...................... Atheros 802.11ac wireless cards support
        -*- kmod-cfg80211...................... cfg80211 - wireless configuration API
        <*> kmod-iwlwifi.................................. Intel AGN Wireless support  --->
        -*- kmod-mac80211..................... Linux 802.11 Wireless Networking Stack  --->

启用hostapd和wpa-supplicant,还有ethtool

-> Network
    <*> ethtool......................... Display or change ethernet card settings
    <*> iperf3........................ Internet Protocol bandwidth measuring tool
-> Network
    -> WirelessAPD
        <*> hostapd........................ IEEE 802.1x Authenticator (built-in full)
        -*- hostapd-common............... hostapd/wpa_supplicant common support files
        <*> wpa-supplicant............................................ WPA Supplicant

增加QCA988x和iwlwifi固件的选择

-> Firmware
    <*> ath10k-firmware-qca988x.............. ath10k firmware for QCA988x devices
    <*> iwlwifi-firmware-iwl3168.................... Intel Wireless 3168 firmware
    <*> iwlwifi-firmware-iwl8260c.......... Intel Wireless 8260 and 4165 firmware
    <*> iwlwifi-firmware-iwl9260.................... Intel Wireless 9260 firmware

添加对gpio-leds的支持,支持控制灯或者上电引脚

-> Kernel modules
   -> LED modules
       <*> kmod-leds-gpio.......................................... GPIO LED support

选择一些我们常用的命令

-> Base system
    -> busybox................................ Core utilities for embedded Linux (PACKAGE_busybox [=y])
    -> Linux Module Utilities
        [*] insmod
        [*] lsmod
        [*] rmmod
    -> Linux System Utilities
        [*] lspci
        [*] lsusb

再安装一个docker

-> Utilities
    <*> docker-compose............................................ Docker Compose
    <*> dockerd.................................. Docker Community Edition Daemon  --->
        [*]   Enable available kernel support for CGroupsV1
        [*]   Enable optional kernel support for Docker
             Network  --->
             下面的全选
             Storage  --->
             下面的全选

设置OpenWRT的系统语言支持

LuCI  ---> 
    2. Modules  --->
        Translations  --->
            <*> English (en)
            <*> Chinese Simplified (zh_Hans)

安装一些luci app

LuCI  ---> 
    3. Applications  --->
        <*> luci-app-aria2.................................... LuCI Support for Aria2
        <*> luci-app-dockerman............................... LuCI Support for docker
        <*> luci-app-samba4............. Network Shares - Samba 4 SMB/CIFS fileserver
        <*> luci-app-ttyd. ttyd - Command-line tool for sharing terminal over the web 

使OpenWRT系统支持qmi协议,以便支持移远5G模块通讯

LuCI  ---> 
    5. Protocols  --->
        <*> luci-proto-qmi........................................... Support for QMI

配置mwan3,使其支持配置vlan

LuCI  ---> 
    3. Applications  --->
        <*> luci-app-mwan3........ LuCI support for the MWAN3 multiwan hotplug script

这时.config配置文件中会自动配置上

CONFIG_PACKAGE_kmod-ipt-conntrack-extra=y
CONFIG_PACKAGE_kmod-ipt-ipopt=y
CONFIG_PACKAGE_kmod-ipt-ipset=y
CONFIG_PACKAGE_libmnl=y
CONFIG_PACKAGE_libuci-lua=y
CONFIG_PACKAGE_luci-app-mwan3=y
CONFIG_PACKAGE_luci-i18n-mwan3-en=y
CONFIG_PACKAGE_luci-i18n-mwan3-zh-cn=y
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
CONFIG_PACKAGE_iptables-mod-ipopt=y
CONFIG_PACKAGE_ip-tiny=y
CONFIG_PACKAGE_mwan3=y
CONFIG_PACKAGE_ipset=y
CONFIG_PACKAGE_libipset=y

配置内核make kernel_menuconfig

编译RTC_RX8010的支持

-> Device Drivers                                                                                                          x
    [*] Real Time Clock  --->
        <*>   Epson RX8010SJ

编译对NVME协议硬盘的支持

-> Device Drivers
    -> NVME Support
        <*> NVM Express block device