Skip to content

Commit 84b5503

Browse files
committed
Add support for GainStrong Oolite-MT7981B V1
1 parent 566058d commit 84b5503

28 files changed

Lines changed: 898 additions & 10 deletions

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
/logs
1414
/feeds
1515
/feeds.conf
16-
/files
1716
/overlay
1817
/package/feeds
1918
/package/openwrt-packages

‎MT7981.config‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
CONFIG_TARGET_mediatek=y
2+
CONFIG_TARGET_mediatek_filogic=y
3+
CONFIG_TARGET_MULTI_PROFILE=y
4+
5+
CONFIG_IMAGEOPT=y
6+
CONFIG_VERSIONOPT=y
7+
CONFIG_VERSION_FILENAMES=y
8+
CONFIG_VERSION_CODE_FILENAMES=y
9+
10+
CONFIG_PACKAGE_kmod-mmc=y
11+
CONFIG_PACKAGE_kmod-usb3=y
12+
CONFIG_PACKAGE_kmod-usb-storage=y
13+
14+
CONFIG_PACKAGE_kmod-oolite-v7=y
15+
CONFIG_PACKAGE_oolite-v7-tools=y
16+
17+
CONFIG_PACKAGE_luci=y
18+
CONFIG_LUCI_LANG_en=y
19+
CONFIG_LUCI_LANG_zh_Hans=y
20+
CONFIG_PACKAGE_luci-app-ttyd=y
21+
CONFIG_PACKAGE_luci-app-ser2net=y
22+
23+
CONFIG_PACKAGE_uboot-envtools=y
24+
25+
CONFIG_PACKAGE_mdio-tools=y
26+
CONFIG_PACKAGE_ethtool=y
27+
CONFIG_PACKAGE_pciutils=y
28+
CONFIG_PACKAGE_usbutils=y
29+
30+
CONFIG_PACKAGE_nand-utils=y
31+
CONFIG_PACKAGE_ubi-utils=y
32+
CONFIG_PACKAGE_mmc-utils=y
33+
34+
CONFIG_PACKAGE_parted=y
35+
CONFIG_PACKAGE_cgdisk=y
36+
CONFIG_PACKAGE_gdisk=y
37+
CONFIG_PACKAGE_sgdisk=y
38+
CONFIG_PACKAGE_cfdisk=y
39+
CONFIG_PACKAGE_fdisk=y
40+
CONFIG_PACKAGE_sfdisk=y
41+
42+
CONFIG_PACKAGE_lsblk=y
43+
CONFIG_PACKAGE_losetup=y
44+
CONFIG_PACKAGE_blkid=y
45+
CONFIG_PACKAGE_blockdev=y
46+
47+
CONFIG_PACKAGE_kmod-fs-ext4=y
48+
CONFIG_PACKAGE_kmod-fs-exfat=y
49+
CONFIG_PACKAGE_kmod-fs-ntfs3=y
50+
CONFIG_PACKAGE_kmod-fs-vfat=y
51+
CONFIG_PACKAGE_e2fsprogs=y
52+
53+
CONFIG_PACKAGE_iperf3=y
54+
CONFIG_PACKAGE_memtester=y
55+
56+
CONFIG_PACKAGE_coreutils=y
57+
CONFIG_PACKAGE_coreutils-dd=y
58+
CONFIG_PACKAGE_coreutils-stty=y
59+
CONFIG_PACKAGE_diffutils=y
60+
61+
CONFIG_PACKAGE_lsof=y
62+
CONFIG_PACKAGE_dmesg=y
63+
64+
############### 4G LTE/5G support start ###############
65+
CONFIG_PACKAGE_luci-proto-qmi=y
66+
CONFIG_PACKAGE_luci-proto-3g=y
67+
CONFIG_PACKAGE_luci-proto-ncm=y
68+
CONFIG_PACKAGE_qmi-utils=y
69+
CONFIG_PACKAGE_mbim-utils=y
70+
CONFIG_PACKAGE_umbim=y
71+
72+
CONFIG_PACKAGE_luci-app-3ginfo-lite=y
73+
CONFIG_PACKAGE_luci-app-sms-tool=y
74+
CONFIG_PACKAGE_luci-compat=y
75+
############### 4G LTE/5G support end ###############
76+
77+
############### I2C support start ###############
78+
CONFIG_PACKAGE_i2c-tools=y
79+
CONFIG_PACKAGE_kmod-i2c-gpio=y
80+
CONFIG_PACKAGE_kmod-gpio-pca953x=y
81+
############### I2C support end ###############
82+
83+
CONFIG_KERNEL_FTRACE=y
84+
CONFIG_KERNEL_FTRACE_SYSCALLS=y
85+
CONFIG_KERNEL_ENABLE_DEFAULT_TRACERS=y
86+
CONFIG_KERNEL_FUNCTION_TRACER=y
87+
CONFIG_KERNEL_FUNCTION_GRAPH_TRACER=y
88+
CONFIG_KERNEL_DYNAMIC_FTRACE=y
89+
CONFIG_KERNEL_FUNCTION_PROFILER=y
90+
CONFIG_KERNEL_IRQSOFF_TRACER=y
91+
CONFIG_KERNEL_PREEMPT_TRACER=y
92+
CONFIG_KERNEL_HIST_TRIGGERS=y
93+
CONFIG_KERNEL_DEBUG_KERNEL=y
94+
CONFIG_KERNEL_DEBUG_INFO=y
95+
CONFIG_KERNEL_DEBUG_INFO_REDUCED=y
96+

‎build.sh‎

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
3+
# Constants
4+
PRODUCT_NAME="Oolite-MT7981B"
5+
6+
if [ -z "$(grep 21.02 include/version.mk)" ]; then
7+
TARGET_NAME="filogic"
8+
else
9+
TARGET_NAME="mt7981"
10+
fi
11+
12+
DEVICE_PREFIX="CONFIG_TARGET_DEVICE_mediatek_${TARGET_NAME}_DEVICE_gainstrong_oolite-mt7981b"
13+
FLASH_TYPES=("nand" "emmc" "sdcard" "nor" "all")
14+
15+
# Function to validate the user input
16+
validate_input() {
17+
local input=$1
18+
for flash_type in "${FLASH_TYPES[@]}"; do
19+
if [ "$input" == "$flash_type" ]; then
20+
return 0
21+
fi
22+
done
23+
return 1
24+
}
25+
26+
# Check if the argument is valid
27+
if [[ $# -eq 1 ]]; then
28+
if validate_input "$1"; then
29+
user_input=$1
30+
else
31+
echo "Error: The input must be a valid flash type (nand, emmc, sdcard, nor, all)"
32+
exit 1
33+
fi
34+
else
35+
# Prompt user to choose flash_type
36+
echo "Please choose a flash type:"
37+
PS3="Enter the corresponding number (1-5) and press Enter: "
38+
select choice in "${FLASH_TYPES[@]}"; do
39+
if [ -n "$choice" ]; then
40+
user_input=$choice
41+
break
42+
else
43+
echo "Invalid selection, please try again."
44+
fi
45+
done
46+
fi
47+
48+
# Function to build for each flash type
49+
build_for_flash_type() {
50+
local flash_type=$1
51+
52+
cp MT7981.config .config
53+
54+
VERSION=$(./scripts/getver.sh)
55+
56+
cat << EOF >> .config
57+
# Add an empty line
58+
59+
CONFIG_KERNEL_BUILD_DOMAIN="$VERSION"
60+
CONFIG_KERNEL_BUILD_USER="$PRODUCT_NAME"
61+
CONFIG_VERSION_DIST="$PRODUCT_NAME"
62+
EOF
63+
64+
if [ "$flash_type" == "all" ]; then
65+
for flash_type_option in nand emmc sdcard nor; do
66+
echo "$DEVICE_PREFIX-dev-board-${flash_type_option}-boot=y" >> .config
67+
# echo "$DEVICE_PREFIX-module-${flash_type_option}-boot=y" >> .config
68+
done
69+
else
70+
echo "$DEVICE_PREFIX-dev-board-${flash_type}-boot=y" >> .config
71+
# echo "$DEVICE_PREFIX-module-${flash_type}-boot=y" >> .config
72+
fi
73+
74+
# Execute the build commands
75+
make package/symlinks
76+
make defconfig
77+
make -j8 V=sc
78+
}
79+
80+
build_for_flash_type "$user_input"

‎feeds.conf.default‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ src-git-full telephony https://git.openwrt.org/feed/telephony.git^afad179aaec9c1
66
#src-git-full targets https://github.com/openwrt/targets.git
77
#src-git-full oldpackages http://git.openwrt.org/packages.git
88
#src-link custom /usr/src/openwrt/custom-feed
9+
src-git 3ginfo https://github.com/4IceG/luci-app-3ginfo-lite.git^9f090caa04d7e4453201d27ed213ca0b96b9570c
10+
src-git smstool https://github.com/4IceG/luci-app-sms-tool.git^100707821a1a080a1348ea22f0605c3dc4dc7026

‎include/version.mk‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PKG_CONFIG_DEPENDS += \
2323
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
2424

2525
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
26-
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
26+
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05)
2727

2828
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
2929
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))

‎package/base-files/files/bin/config_generate‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,91 @@ generate_static_network() {
4444
set network.loopback.proto='static'
4545
set network.loopback.ipaddr='127.0.0.1'
4646
set network.loopback.netmask='255.0.0.0'
47+
48+
delete network.4G_QMI_1
49+
set network.4G_QMI_1=interface
50+
set network.4G_QMI_1.proto='qmi'
51+
set network.4G_QMI_1.device='/dev/cdc-wdm0'
52+
set network.4G_QMI_1.metric=11
53+
add_list firewall.cfg03dc81.network='4G_QMI_1'
54+
55+
delete network.4G_PPP_1
56+
set network.4G_PPP_1=interface
57+
set network.4G_PPP_1.proto='3g'
58+
set network.4G_PPP_1.device='/dev/ttyUSB2'
59+
set network.4G_PPP_1.metric=12
60+
add_list firewall.cfg03dc81.network='4G_PPP_1'
61+
62+
delete network.4G_ETH_1
63+
set network.4G_ETH_1=interface
64+
set network.4G_ETH_1.proto='dhcp'
65+
set network.4G_ETH_1.device='usb0'
66+
set network.4G_ETH_1.metric=13
67+
add_list firewall.cfg03dc81.network='4G_ETH_1'
68+
69+
delete network.4G_QMI_2
70+
set network.4G_QMI_2=interface
71+
set network.4G_QMI_2.proto='qmi'
72+
set network.4G_QMI_2.device='/dev/cdc-wdm1'
73+
set network.4G_QMI_2.metric=21
74+
add_list firewall.cfg03dc81.network='4G_QMI_2'
75+
76+
delete network.4G_PPP_2
77+
set network.4G_PPP_2=interface
78+
set network.4G_PPP_2.proto='3g'
79+
set network.4G_PPP_2.device='/dev/ttyUSB7'
80+
set network.4G_PPP_2.metric=22
81+
add_list firewall.cfg03dc81.network='4G_PPP_2'
82+
83+
delete network.4G_ETH_2
84+
set network.4G_ETH_2=interface
85+
set network.4G_ETH_2.proto='dhcp'
86+
set network.4G_ETH_2.device='usb1'
87+
set network.4G_ETH_2.metric=23
88+
add_list firewall.cfg03dc81.network='4G_ETH_2'
89+
90+
91+
######### Oolite V7 802.11ah config start #########
92+
# /etc/config/dhcp
93+
set dhcp.11AH_AP=dhcp
94+
set dhcp.11AH_AP.interface='11AH_AP'
95+
set dhcp.11AH_AP.start='1'
96+
set dhcp.11AH_AP.limit='9'
97+
set dhcp.11AH_AP.leasetime='2d'
98+
99+
set dhcp.@dnsmasq[-1].sequential_ip=1
100+
101+
# /etc/config/firewall
102+
add_list firewall.cfg02dc81.network='11AH_AP'
103+
104+
# /etc/config/network
105+
set network.11AH_AP=interface
106+
set network.11AH_AP.proto='static'
107+
set network.11AH_AP.device='hg0'
108+
set network.11AH_AP.ipaddr='10.10.10.10'
109+
set network.11AH_AP.netmask='255.255.255.0'
110+
111+
# /etc/config/firewall
112+
add_list firewall.cfg03dc81.network='11AH_STA'
113+
114+
# /etc/config/network
115+
set network.11AH_STA=interface
116+
set network.11AH_STA.proto='dhcp'
117+
set network.11AH_STA.device='hg0'
118+
set network.11AH_STA.auto='0'
119+
set network.11AH_STA.metric='77'
120+
121+
# /etc/config/firewall
122+
add firewall zone # =cfg0edc81
123+
set firewall.@zone[-1].name='bridge'
124+
set firewall.@zone[-1].input='ACCEPT'
125+
set firewall.@zone[-1].output='ACCEPT'
126+
set firewall.@zone[-1].forward='ACCEPT'
127+
add firewall forwarding # =cfg0fad58
128+
set firewall.@forwarding[-1].src='lan'
129+
set firewall.@forwarding[-1].dest='bridge'
130+
######### Oolite V7 802.11ah config end #########
131+
47132
EOF
48133
[ -e /proc/sys/net/ipv6 ] && {
49134
uci -q batch <<-EOF
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Put your custom commands here that should be executed once
22
# the system init finished. By default this file does nothing.
33

4+
iperf3 -s -D --logfile /tmp/iperf3.log
5+
46
exit 0

‎package/kernel/mac80211/files/lib/wifi/mac80211.sh‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,20 +196,24 @@ detect_mac80211() {
196196
;;
197197
esac
198198

199+
last_4_mac=$(echo $macaddr | awk -F ":" '{printf toupper($5$6)}')
200+
board_name=$(grep 'DISTRIB_ID' /etc/openwrt_release | awk -F "'" '{print $2}')
201+
mode_band_upper=$(echo $mode_band | awk '{print toupper($0)}')
202+
ssid="${board_name}_${last_4_mac}_${mode_band_upper}"
203+
199204
uci -q batch <<-EOF
200205
set wireless.${name}=wifi-device
201206
set wireless.${name}.type=mac80211
202207
${dev_id}
203208
set wireless.${name}.channel=${channel}
204209
set wireless.${name}.band=${mode_band}
205210
set wireless.${name}.htmode=$htmode
206-
set wireless.${name}.disabled=1
207211
208212
set wireless.default_${name}=wifi-iface
209213
set wireless.default_${name}.device=${name}
210214
set wireless.default_${name}.network=lan
211215
set wireless.default_${name}.mode=ap
212-
set wireless.default_${name}.ssid=OpenWrt
216+
set wireless.default_${name}.ssid=${ssid}
213217
set wireless.default_${name}.encryption=none
214218
EOF
215219
uci -q commit wireless
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/dts-v1/;
2+
3+
#include "mt7981b-gainstrong-oolite-mt7981b.dtsi"
4+
#include "mt7981b-gainstrong-oolite-mt7981b-dev-board.dtsi"
5+
6+
/ {
7+
model = "GainStrong Oolite-MT7981B V1 Dev Board (emmc boot)";
8+
compatible = "gainstrong,oolite-mt7981b-dev-board-emmc-boot", "mediatek,mt7981";
9+
10+
chosen {
11+
bootargs = "rootwait root=PARTLABEL=rootfs";
12+
};
13+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/dts-v1/;
2+
3+
#include "mt7981b-gainstrong-oolite-mt7981b.dtsi"
4+
#include "mt7981b-gainstrong-oolite-mt7981b-nand-boot.dtsi"
5+
#include "mt7981b-gainstrong-oolite-mt7981b-dev-board.dtsi"
6+
#include "mt7981b-gainstrong-oolite-mt7981b-mtd-macaddr.dtsi"
7+
8+
/ {
9+
model = "GainStrong Oolite-MT7981B V1 Dev Board (nand boot)";
10+
compatible = "gainstrong,oolite-mt7981b-dev-board-nand-boot", "mediatek,mt7981";
11+
};

0 commit comments

Comments
 (0)