構成ファイルを変更し、カスタムボード情報を追加します
。openwrtバージョン19.07.04に適用可能
- デフォルトのボード構成で、現在選択されているボードは[MediaTek LinkIt Smart7688]です。
.config - OpenWrt Configuration
──────────────────────────────────────────────────────────────────────────────────
┌─────────────────────── Target Profile ────────────────────────┐
│ Use the arrow keys to navigate this window or press the │
│ hotkey of the item you wish to select followed by the <SPACE │
│ BAR>. Press <?> for additional information about this │
│ ┌─────────────^(-)──────────────────────────────────────────┐ │
│ │ ( ) HILINK HLK7628N │ │
│ │ ( ) HiWiFi HC5661A │ │
│ │ ( ) HiWiFi HC5861B │ │
│ │ (X) MediaTek LinkIt Smart 7688 │ │
│ │ ( ) MediaTek MT7628 EVB │ │
│ │ ( ) Mercury MAC1200R v2.0 │ │
│ └─────────────v(+)──────────────────────────────────────────┘ │
├───────────────────────────────────────────────────────────────┤
│ <Select> < Help > │
└───────────────────────────────────────────────────────────────┘
- target / linux / ramips / image / mt76x8.mkファイルを変更し、[LinkIt7688]構成ファイルを参照し、カスタムボード情報を追加します[LinkIt7688-eric]
define Device/LinkIt7688
DTS := LINKIT7688
IMAGE_SIZE := $(ralink_default_fw_size_32M)
SUPPORTED_DEVICES := linkits7688 linkits7688d
DEVICE_TITLE := MediaTek LinkIt Smart 7688
DEVICE_PACKAGES:= kmod-usb2 kmod-usb-ohci uboot-envtools
endef
TARGET_DEVICES += LinkIt7688
# eric++ 新增自定义板卡配置
define Device/LinkIt7688-eric
DTS := LINKIT7688-eric
IMAGE_SIZE := $(ralink_default_fw_size_32M)
SUPPORTED_DEVICES := linkits7688-eric linkits7688d
DEVICE_TITLE := MediaTek LinkIt Smart 7688 eric
DEVICE_PACKAGES:= kmod-usb2 kmod-usb-ohci uboot-envtools
endef
TARGET_DEVICES += LinkIt7688-eric
この構成オプション、デフォルトの対応するデバイスツリーファイル:LINKIT7688-eric.dts
(SUPPORTED_DEVICES:= LinkIt7688-eric、名前が間違っています。luciアップグレードモジュールのファームウェア検出メカニズムに影響します)
- このとき、新しく追加されたボードデバイスはmenuconfigで選択できます
.config - OpenWrt Configuration
──────────────────────────────────────────────────────────────────────────────────
┌─────────────────────── Target Profile ────────────────────────┐
│ Use the arrow keys to navigate this window or press the │
│ hotkey of the item you wish to select followed by the <SPACE │
│ BAR>. Press <?> for additional information about this │
│ ┌─────────────^(-)──────────────────────────────────────────┐ │
│ │ ( ) HiWiFi HC5661A │ │
│ │ ( ) HiWiFi HC5861B │ │
│ │ ( ) MediaTek LinkIt Smart 7688 │ │
│ │ (X) MediaTek LinkIt Smart 7688 eric │ │
│ │ ( ) MediaTek MT7628 EVB │ │
│ │ ( ) Mercury MAC1200R v2.0 │ │
│ └─────────────v(+)──────────────────────────────────────────┘ │
├───────────────────────────────────────────────────────────────┤
│ <Select> < Help > │
└───────────────────────────────────────────────────────────────┘
- デバイスツリーファイルを追加し、target / linux / ramips / dts / LINKIT7688.dtsをコピーして、新しいLINKIT7688-eric.dtsを作成します。
eric@eric-PC:~/Documents/work/openwrt_1907/target/linux/ramips/dts$ ls *7688*
LINKIT7688.dts
eric@eric-PC:~/Documents/work/openwrt_1907/target/linux/ramips/dts$ cp LINKIT7688.dts LINKIT7688-eric.dts
eric@eric-PC:~/Documents/work/openwrt_1907/target/linux/ramips/dts$ ls *7688*
LINKIT7688.dts LINKIT7688-eric.dts
eric@eric-PC:~/Documents/work/openwrt_1907/target/linux/ramips/dts$
- 対応するtarget / linux / ramips / base-files / etc / board.d / 01_ledsおよび02_network、package / boot / uboot-envtools / files / ramipsおよびその他のファイルは変更しないでおくことができます。判断ブランチはラベル[board_name = linkits7688]に基づいているため
target / linux / ramips / base-files / etc / board.d / 01_leds:
linkits7688)
ucidef_set_led_wlan "wifi" "wifi" "linkit-smart-7688:orange:wifi" "phy0tpt"
;;
target / linux / ramips / base-files / etc / board.d / 02_network:
linkits7688)
wan_mac=$(mtd_get_mac_binary factory 4)
lan_mac=$(mtd_get_mac_binary factory 46)
package / boot / uboot-envtools / files / ramips:
linkits7688|\
miwifi-nano|\
sk-wb8|\
wsr-1166|\
wsr-600|\
zbt-wg2626)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
;;
- もともとtarget / linux / ramips / base-files / lib / ramips.shからのラベルlinkits7688は、「MediaTek LinkIt Smart 7688、デバイスツリーによって決定される」に基づいています。
target / linux / ramips / base-files / lib / ramips.sh:
machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
*"MediaTek LinkIt Smart 7688")
name="linkits7688"
;;
echo "$name" > /tmp/sysinfo/board_name
echo "$machine" > /tmp/sysinfo/model
cpuinfoを表示:
root@OpenWrt:/# cat /proc/cpuinfo
system type : MediaTek MT7688 ver:1 eco:2
machine : MediaTek LinkIt Smart 7688
processor : 0
cpu model : MIPS 24KEc V5.5
BogoMIPS : 380.92
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16 dsp
Options implemented : tlb 4kex 4k_cache prefetch mcheck ejtag llsc pindexed_dcache userlocal vint perf_cntr_intr_bit nan_legacy nan_2008 perf
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
- マシン:MediaTek LinkIt Smart 7688、デバイスツリーによって決定
model = "MediaTek LinkIt Smart 7688";
- 上記のロジックから、board_name = linkits7688である
ことがわかります。ラベルブランチを再定義する必要がある場合は、ramips.shを変更してツリーモードを設定し、独自のラベルブランチを追加します。注:対応する01_leds、02_network、ramipsなど依存ファイル、タグブランチを同期的に追加する必要があります。
target / linux / ramips / dts / LINKIT7688-eric.dts:
model = "Eric board V3.0";
target / linux / ramips / base-files / lib / ramips.sh:
*"MediaTek LinkIt Smart 7688")
name="linkits7688"
;;
*"Eric board V3.0")
name="linkits7688-eric"
;;
target / linux / ramips / base-files / etc / board.d / 01_leds:
linkits7688)
ucidef_set_led_wlan "wifi" "wifi" "linkit-smart-7688:orange:wifi" "phy0tpt"
;;
linkits7688-eric)
# eric++
# ucidef_set_led_wlan "wifi" "wifi" "led-wifi" "phy0tpt"
ucidef_set_led_netdev "wifi" "wifi" "linkit-smart-7688:orange:wifi" "wlan0"
ucidef_set_led_netdev "lan" "lan" "linkit-smart-7688:orange:usb" "eth0"
;;
target / linux / ramips / base-files / etc / board.d / 02_network:
linkits7688 | \
....此处省略n行
zte-q7)
ucidef_add_switch "switch0"
ucidef_add_switch_attr "switch0" "enable" "false"
ucidef_set_interface_lan "eth0"
;;
linkits7688-eric)
# 单网口
# ucidef_add_switch "switch0"
# ucidef_add_switch_attr "switch0" "enable" "false"
# ucidef_set_interface_lan "eth0"
# usb网卡
# ucidef_set_interface_wan "eth1"
# 多网口
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "6t@eth0"
ucidef_set_interface_wan "eth1"
;;
linkits7688-eric|\
linkits7688)
wan_mac=$(mtd_get_mac_binary factory 4)
lan_mac=$(mtd_get_mac_binary factory 46)
;;
package / boot / uboot-envtools / files / ramips:
linkits7688|\
linkits7688-eric|\
miwifi-nano|\
sk-wb8|\
wsr-1166|\
wsr-600|\
zbt-wg2626)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
;;