Skip to content

Commit 8b9b630

Browse files
committed
Add support for GainStrong Oolite-MT7981B V1
1 parent 555af3d commit 8b9b630

23 files changed

+806
-2
lines changed

MT7981.config

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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_luci=y
15+
CONFIG_LUCI_LANG_en=y
16+
CONFIG_LUCI_LANG_zh_Hans=y
17+
18+
CONFIG_PACKAGE_uboot-envtools=y
19+
20+
CONFIG_PACKAGE_mdio-tools=y
21+
CONFIG_PACKAGE_ethtool=y
22+
CONFIG_PACKAGE_pciutils=y
23+
CONFIG_PACKAGE_usbutils=y
24+
25+
CONFIG_PACKAGE_nand-utils=y
26+
CONFIG_PACKAGE_ubi-utils=y
27+
CONFIG_PACKAGE_mmc-utils=y
28+
29+
CONFIG_PACKAGE_parted=y
30+
CONFIG_PACKAGE_cgdisk=y
31+
CONFIG_PACKAGE_gdisk=y
32+
CONFIG_PACKAGE_sgdisk=y
33+
34+
CONFIG_PACKAGE_lsblk=y
35+
CONFIG_PACKAGE_losetup=y
36+
CONFIG_PACKAGE_blkid=y
37+
CONFIG_PACKAGE_blockdev=y
38+
39+
CONFIG_PACKAGE_kmod-fs-exfat=y
40+
CONFIG_PACKAGE_kmod-fs-ntfs3=y
41+
CONFIG_PACKAGE_kmod-fs-vfat=y
42+
43+
CONFIG_PACKAGE_iperf3=y
44+
CONFIG_PACKAGE_memtester=y
45+
46+
CONFIG_PACKAGE_coreutils=y
47+
CONFIG_PACKAGE_coreutils-dd=y
48+
CONFIG_PACKAGE_coreutils-stty=y
49+
CONFIG_PACKAGE_diffutils=y
50+
51+
CONFIG_PACKAGE_lsof=y
52+
CONFIG_PACKAGE_dmesg=y
53+
54+
############### 4G LTE/5G support start ###############
55+
CONFIG_PACKAGE_luci-proto-qmi=y
56+
CONFIG_PACKAGE_luci-proto-3g=y
57+
CONFIG_PACKAGE_luci-proto-ncm=y
58+
CONFIG_PACKAGE_qmi-utils=y
59+
############### 4G LTE/5G support end ###############
60+
61+
############### I2C support start ###############
62+
CONFIG_PACKAGE_i2c-tools=y
63+
CONFIG_PACKAGE_kmod-i2c-gpio=y
64+
CONFIG_PACKAGE_kmod-gpio-pca953x=y
65+
CONFIG_PACKAGE_kmod-rtc-pcf8563=y
66+
############### I2C support end ###############

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-V1"
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-v1"
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-som-${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-som-${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"

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,20 +196,25 @@ 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+
board_name="MT7981B"
202+
mode_band_upper=$(echo $mode_band | awk '{print toupper($0)}')
203+
ssid="${board_name}_${last_4_mac}_${mode_band_upper}"
204+
199205
uci -q batch <<-EOF
200206
set wireless.${name}=wifi-device
201207
set wireless.${name}.type=mac80211
202208
${dev_id}
203209
set wireless.${name}.channel=${channel}
204210
set wireless.${name}.band=${mode_band}
205211
set wireless.${name}.htmode=$htmode
206-
set wireless.${name}.disabled=1
207212
208213
set wireless.default_${name}=wifi-iface
209214
set wireless.default_${name}.device=${name}
210215
set wireless.default_${name}.network=lan
211216
set wireless.default_${name}.mode=ap
212-
set wireless.default_${name}.ssid=OpenWrt
217+
set wireless.default_${name}.ssid=${ssid}
213218
set wireless.default_${name}.encryption=none
214219
EOF
215220
uci -q commit wireless
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/dts-v1/;
2+
3+
#include "mt7981b-gainstrong-oolite-mt7981b-v1.dtsi"
4+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-mmc.dtsi"
5+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-dev-board.dtsi"
6+
7+
/ {
8+
model = "GainStrong Oolite-MT7981B V1 Dev Board (eMMC boot)";
9+
compatible = "gainstrong,oolite-mt7981b-v1-dev-board-emmc-boot", "mediatek,mt7981";
10+
11+
chosen {
12+
bootargs = "rootwait root=PARTLABEL=rootfs rootfstype=squashfs,f2fs";
13+
};
14+
};
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-v1.dtsi"
4+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-nand.dtsi"
5+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-dev-board.dtsi"
6+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-mtd-macaddr.dtsi"
7+
8+
/ {
9+
model = "GainStrong Oolite-MT7981B V1 Dev Board (NAND boot)";
10+
compatible = "gainstrong,oolite-mt7981b-v1-dev-board-nand-boot", "mediatek,mt7981";
11+
};
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-v1.dtsi"
4+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-nor.dtsi"
5+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-dev-board.dtsi"
6+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-mtd-macaddr.dtsi"
7+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-mmc.dtsi"
8+
9+
/ {
10+
model = "GainStrong Oolite-MT7981B V1 Dev Board (NOR boot)";
11+
compatible = "gainstrong,oolite-mt7981b-v1-dev-board-nor-boot", "mediatek,mt7981";
12+
13+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/dts-v1/;
2+
3+
#include "mt7981b-gainstrong-oolite-mt7981b-v1.dtsi"
4+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-mmc.dtsi"
5+
#include "mt7981b-gainstrong-oolite-mt7981b-v1-dev-board.dtsi"
6+
7+
/ {
8+
model = "GainStrong Oolite-MT7981B V1 Dev Board (SD Card boot)";
9+
compatible = "gainstrong,oolite-mt7981b-v1-dev-board-sdcard-boot", "mediatek,mt7981";
10+
11+
chosen {
12+
bootargs = "rootwait root=PARTLABEL=rootfs rootfstype=squashfs,f2fs";
13+
};
14+
};
15+
16+
&mmc0 {
17+
bus-width = <4>;
18+
/delete-property/ non-removable;
19+
};

0 commit comments

Comments
 (0)