openwrt新增自定义板卡信息

修改配置文件,新增自定义板卡信息
适用openwrt 版本 19.07.04

  • 默认板卡配置,当前选择的是板卡为【MediaTek LinkIt Smart 7688】
 .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"
	;;
  • 标签linkits7688,原自target/linux/ramips/base-files/lib/ramips.sh中,判断依据"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

  • machine : MediaTek LinkIt Smart 7688,由设备树决定
model = "MediaTek LinkIt Smart 7688";
  • 由以上逻辑可以看出,board_name = linkits7688
    如果需要重新定义标签分支,则修改 ramips.sh 和设树mode,添加自己的标签分支即可,需要注意的是:对应的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"
	;;

OpenWRT 是一种开源的嵌入式操作系统,常用于路由器等网络设备中。通过配置自定义的DDNS(动态域名解析服务),可以实现远程访问路由器的功能。 首先,我们需要在路由器上安装相应的软件包。在OpenWRT的系统管理界面中,选择“软件包管理器”,并确保软件包列表已更新。然后搜索并安装“ddns-scripts”软件包。 安装完成后,我们需要在配置文件中设置DDNS相关的参数。在路由器的系统管理界面中,选择“文件浏览器”,找到“/etc/config/ddns”文件,并点击编辑。 在配置文件中,我们需要设置以下参数: 1. `option enabled '1'`:启用DDNS功能。 2. `option lookup_host 'yourdomain.com'`:设置需要解析的域名。 3. `option domain 'yourdomain.com'`:设置域名所在的顶级域。例如,如果是yourdomain.com,则此参数为`yourdomain.com`。 4. `option username 'yourusername'`:设置DDNS服务的用户名。 5. `option password 'yourpassword'`:设置DDNS服务的密码。 6. `option interface 'wan'`:设置使用的网络接口。 7. `option use_syslog '1'`:启用系统日志功能。 配置完成后,保存文件并重启路由器。系统会根据你的设置定期更新DDNS记录。 为了验证DDNS是否正确配置,可以通过远程访问路由器的方式来确认。在浏览器中输入你的域名,如果能够正确访问到路由器的管理界面,则说明DDNS已成功配置。 需要注意的是,自定义DDNS服务需要事先在域名注册商处设置正确的DNS记录,将域名解析服务器指向你的路由器的公共IP地址。 以上就是OpenWRT配置自定义DDNS的简要介绍。希望对你有所帮助。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值