gl-mt6000: new device

```
python3 setup.py -c configs/config-mt798x.yml
cd mt798x
./scripts/gen_config.py target_mt7986_gl-mt6000 glinet_mt7986_wifi glinet_mt6000
make -j $(nproc)

```

Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
This commit is contained in:
Jianhui Zhao 2023-05-19 11:22:24 +08:00
parent 4089f1fb69
commit 15eee0e27c
31 changed files with 134655 additions and 0 deletions

View File

@ -0,0 +1,7 @@
repo: https://github.com/openwrt/openwrt.git
git_clone_dir: mt798x/
openwrt_root_dir: mt798x/
revision: 491b784141da22d01819196e748e955cf07fd56a
patch_folders:
- patches-mt798x

View File

@ -0,0 +1,131 @@
From 0af1d76c05f739dd4dbe090ac0d20e429b3c7869 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Fri, 19 Jun 2020 13:25:27 +0200
Subject: [PATCH 07/40] scripts: update feed script
gen_config.py requires the latest version of the feeds script.
Signed-off-by: John Crispin <john@phrozen.org>
---
scripts/feeds | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
diff --git a/scripts/feeds b/scripts/feeds
index 69ab60278a..46c5f5cb9f 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -644,6 +644,35 @@ sub refresh_config {
}
}
+sub install_profiles {
+ my $feed = shift;
+ my $dir = sprintf('feeds/%s/', $feed->[1]);
+
+ -d "./feeds/profiles" or mkdir "./feeds/profiles" or return 1;
+
+ opendir (DIR, $dir) or return 0;
+ while (my $file = readdir(DIR)) {
+ next unless (-f "$dir/$file");
+ next unless ($file =~ m/\.profile$/);
+ -e "./feeds/profiles/$file" or system("ln -s ../$feed->[1]/$file ./feeds/profiles/");
+ }
+ closedir(DIR);
+}
+
+sub install_dl {
+ my $feed = shift;
+ my $dir = sprintf('feeds/%s/dl/', $feed->[1]);
+
+ -d "./dl" or mkdir "./dl" or return 1;
+
+ opendir (DIR, $dir) or return 0;
+ while (my $file = readdir(DIR)) {
+ next unless (-f "$dir/$file");
+ -e "./dl/$file" or system("ln -s ../feeds/$feed->[1]/dl/$file ./dl/");
+ }
+ closedir(DIR);
+}
+
sub install {
my $name;
my %opts;
@@ -676,6 +705,8 @@ sub install {
install_src($feed, $name, exists($opts{f})) == 0 or $ret = 1;
get_feed($f->[1]);
}
+ install_profiles($f);
+ install_dl($f);
}
}
} else {
@@ -846,6 +877,47 @@ sub update {
return $failed;
}
+sub setup {
+ my %opts;
+
+ getopts('bh', \%opts);
+
+ if ($opts{h}) {
+ usage();
+ return 0;
+ }
+
+ if (-e "feeds.conf") {
+ warn "The file feeds.conf already exists.\n";
+ return 1;
+ }
+
+ open(my $fd, ">>feeds.conf");
+
+ if ($opts{b}) {
+ printf $fd "src-include defaults feeds.conf.default\n";
+ }
+
+ while (my $entry = shift @ARGV) {
+ my ($type, $name, $src) = split /,/, $entry;
+
+ $update_method{$type} or do {
+ warn "Unknown type '$type' in parameter $entry\n";
+ unlink "feeds.conf";
+ return 1;
+ };
+
+ if ($name =~ /[\s-]/) {
+ warn "Feed names or sources may not contain whitespace or - characters in parameter $entry\n";
+ unlink "feeds.conf";
+ return 1;
+ }
+ printf $fd "%s %s %s\n", $type, $name, $src;
+ }
+
+ return 0;
+}
+
sub feed_config() {
foreach my $feed (@feeds) {
my $installed = (-f "feeds/$feed->[1].index");
@@ -897,6 +969,10 @@ Commands:
-i : Recreate the index only. No feed update from repository is performed.
-f : Force updating feeds even if there are changed, uncommitted files.
+ setup [options] <type,name,link> <type,name,link> ...: generate feeds.conf
+ Options:
+ -b : Use feeds.conf.default as base for new feeds.conf.
+
clean: Remove downloaded/generated files.
EOF
@@ -910,6 +986,7 @@ my %commands = (
'search' => \&search,
'uninstall' => \&uninstall,
'feed_config' => \&feed_config,
+ 'setup' => \&setup,
'clean' => sub {
system("rm -rf ./feeds ./package/feeds");
}
--
2.25.1

View File

@ -0,0 +1,27 @@
From 0ac3cc97752b56509bb5e08fdf4807f0eca3110b Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 17 May 2023 11:38:59 +0800
Subject: [PATCH 1/9] feeds: lock hash from mtk-sdk-v7.6.7.0
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
feeds.conf.default | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/feeds.conf.default b/feeds.conf.default
index f1827a3661..928317fae5 100644
--- a/feeds.conf.default
+++ b/feeds.conf.default
@@ -1,5 +1,4 @@
-src-git-full packages https://git.openwrt.org/feed/packages.git;openwrt-21.02
-src-git-full luci https://git.openwrt.org/project/luci.git;openwrt-21.02
-src-git-full routing https://git.openwrt.org/feed/routing.git;openwrt-21.02
-src-git-full telephony https://git.openwrt.org/feed/telephony.git;openwrt-21.02
-#src-link custom /usr/src/openwrt/custom-feed
+src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds^91c043c
+src-git packages https://git.openwrt.org/feed/packages.git^c10f3e3
+src-git luci https://git.openwrt.org/project/luci.git^0ecaf74
+src-git routing https://git.openwrt.org/feed/routing.git^4e2bdb4
--
2.34.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,228 @@
From fa8801639123d9d2e650e3f2952288a4fd466528 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 17 May 2023 11:47:10 +0800
Subject: [PATCH 3/9] mkits.sh: add some features for mt7988
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
scripts/make-squashfs-hashed.sh | 23 +++++++
scripts/mkits.sh | 109 +++++++++++++++++++++++++++++---
2 files changed, 122 insertions(+), 10 deletions(-)
create mode 100755 scripts/make-squashfs-hashed.sh
diff --git a/scripts/make-squashfs-hashed.sh b/scripts/make-squashfs-hashed.sh
new file mode 100755
index 0000000000..a4b183e434
--- /dev/null
+++ b/scripts/make-squashfs-hashed.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# 1. Using veritysetup to append hash image into squashfs
+# 2. Parsing output of veritysetup to generate uboot script
+#
+SQUASHFS_FILE_PATH=$1
+STAGING_DIR_HOST=$2
+TOPDIR=$3
+SUMMARY_FILE=$4
+
+FILE_SIZE=`stat -c "%s" ${SQUASHFS_FILE_PATH}`
+BLOCK_SIZE=4096
+
+DATA_BLOCKS=$((${FILE_SIZE} / ${BLOCK_SIZE}))
+[ $((${FILE_SIZE} % ${BLOCK_SIZE})) -ne 0 ] && DATA_BLOCKS=$((${DATA_BLOCKS} + 1))
+
+HASH_OFFSET=$((${DATA_BLOCKS} * ${BLOCK_SIZE}))
+
+${STAGING_DIR_HOST}/bin/veritysetup format \
+ --data-blocks=${DATA_BLOCKS} \
+ --hash-offset=${HASH_OFFSET} \
+ ${SQUASHFS_FILE_PATH} ${SQUASHFS_FILE_PATH} \
+ > ${SUMMARY_FILE}
diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index bb629d6fca..1c7f292618 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -17,6 +17,7 @@
usage() {
printf "Usage: %s -A arch -C comp -a addr -e entry" "$(basename "$0")"
printf " -v version -k kernel [-D name -n address -d dtb] -o its_file"
+ printf " [-s script] [-S key_name_hint] [-r ar_ver] [-R rootfs]"
printf "\n\t-A ==> set architecture to 'arch'"
printf "\n\t-C ==> set compression type 'comp'"
@@ -28,13 +29,17 @@ usage() {
printf "\n\t-D ==> human friendly Device Tree Blob 'name'"
printf "\n\t-n ==> fdt unit-address 'address'"
printf "\n\t-d ==> include Device Tree Blob 'dtb'"
- printf "\n\t-o ==> create output file 'its_file'\n"
+ printf "\n\t-o ==> create output file 'its_file'"
+ printf "\n\t-s ==> include u-boot script 'script'"
+ printf "\n\t-S ==> add signature at configurations and assign its key_name_hint by 'key_name_hint'"
+ printf "\n\t-r ==> set anti-rollback version to 'fw_ar_ver' (dec)"
+ printf "\n\t-R ==> specify rootfs file for embedding hash\n"
exit 1
}
FDTNUM=1
-while getopts ":A:a:c:C:D:d:e:k:n:o:v:" OPTION
+while getopts ":A:a:c:C:D:d:e:k:n:o:v:s:S:r:R:" OPTION
do
case $OPTION in
A ) ARCH=$OPTARG;;
@@ -48,6 +53,10 @@ do
n ) FDTNUM=$OPTARG;;
o ) OUTPUT=$OPTARG;;
v ) VERSION=$OPTARG;;
+ s ) UBOOT_SCRIPT=$OPTARG;;
+ S ) KEY_NAME_HINT=$OPTARG;;
+ r ) AR_VER=$OPTARG;;
+ R ) ROOTFS_FILE=$OPTARG;;
* ) echo "Invalid option passed to '$0' (options:$*)"
usage;;
esac
@@ -65,21 +74,95 @@ ARCH_UPPER=$(echo "$ARCH" | tr '[:lower:]' '[:upper:]')
# Conditionally create fdt information
if [ -n "${DTB}" ]; then
FDT_NODE="
- fdt@$FDTNUM {
+ fdt-$FDTNUM {
description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\";
data = /incbin/(\"${DTB}\");
type = \"flat_dt\";
arch = \"${ARCH}\";
compression = \"none\";
- hash@1 {
+ hash-1 {
algo = \"crc32\";
};
- hash@2 {
+ hash-2 {
algo = \"sha1\";
};
};
"
- FDT_PROP="fdt = \"fdt@$FDTNUM\";"
+ FDT_PROP="fdt = \"fdt-$FDTNUM\";"
+fi
+
+# Conditionally create rootfs hash information
+if [ -f "${ROOTFS_FILE}" ]; then
+ ROOTFS_SIZE=$(stat -c %s ${ROOTFS_FILE})
+
+ ROOTFS_SHA1=$(sha1sum ${ROOTFS_FILE} | awk '{print "<0x"substr($0,1,8) " 0x"substr($0,9,8) " 0x"substr($0,17,8) " 0x"substr($0,25,8) " 0x"substr($0,33,8) ">"}')
+ ROOTFS_CRC32=$(crc32sum ${ROOTFS_FILE})
+
+ ROOTFS="
+ rootfs {
+ size = <${ROOTFS_SIZE}>;
+
+ hash-1 {
+ value = <0x${ROOTFS_CRC32}>;
+ algo = \"crc32\";
+ };
+
+ hash-2 {
+ value = ${ROOTFS_SHA1};
+ algo = \"sha1\";
+ };
+ };
+"
+fi
+
+# Conditionally create script information
+if [ -n "${UBOOT_SCRIPT}" ]; then
+ SCRIPT="\
+ script-1 {
+ description = \"U-Boot Script\";
+ data = /incbin/(\"${UBOOT_SCRIPT}\");
+ type = \"script\";
+ arch = \"${ARCH}\";
+ os = \"linux\";
+ load = <0>;
+ entry = <0>;
+ compression = \"none\";
+ hash-1 {
+ algo = \"crc32\";
+ };
+ hash-2 {
+ algo = \"sha1\";
+ };
+ };\
+"
+ LOADABLES="\
+ loadables = \"script-1\";\
+"
+ SIGN_IMAGES="\
+ sign-images = \"fdt\", \"kernel\", \"loadables\";\
+"
+else
+ SIGN_IMAGES="\
+ sign-images = \"fdt\", \"kernel\";\
+"
+fi
+
+# Conditionally create signature information
+if [ -n "${KEY_NAME_HINT}" ]; then
+ SIGNATURE="\
+ signature {
+ algo = \"sha1,rsa2048\";
+ key-name-hint = \"${KEY_NAME_HINT}\";
+${SIGN_IMAGES}
+ };\
+"
+fi
+
+# Conditionally create anti-rollback version information
+if [ -n "${AR_VER}" ]; then
+ FW_AR_VER="\
+ fw_ar_ver = <${AR_VER}>;\
+"
fi
# Create a default, fully populated DTS file
@@ -90,7 +173,7 @@ DATA="/dts-v1/;
#address-cells = <1>;
images {
- kernel@1 {
+ kernel-1 {
description = \"${ARCH_UPPER} OpenWrt Linux-${VERSION}\";
data = /incbin/(\"${KERNEL}\");
type = \"kernel\";
@@ -99,22 +182,28 @@ DATA="/dts-v1/;
compression = \"${COMPRESS}\";
load = <${LOAD_ADDR}>;
entry = <${ENTRY_ADDR}>;
- hash@1 {
+ hash-1 {
algo = \"crc32\";
};
- hash@2 {
+ hash-2 {
algo = \"sha1\";
};
};
${FDT_NODE}
+${SCRIPT}
};
+${ROOTFS}
+
configurations {
default = \"${CONFIG}\";
${CONFIG} {
description = \"OpenWrt\";
- kernel = \"kernel@1\";
+${FW_AR_VER}
+${LOADABLES}
+ kernel = \"kernel-1\";
${FDT_PROP}
+${SIGNATURE}
};
};
};"
--
2.34.1

View File

@ -0,0 +1,141 @@
From 5d264e369565b38ca3ac4be8dac7a40912ebff8e Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 17 May 2023 15:10:40 +0800
Subject: [PATCH 8/9] image: secure boot and anti rollback support
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
include/image-commands.mk | 7 +++---
include/image.mk | 48 ++++++++++++++++++++++++++++-----------
2 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 4d54a14ba4..8d77d5dc80 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -87,7 +87,7 @@ define Build/append-ubi
$(if $(UBOOTENV_IN_UBI),--uboot-env) \
$(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \
$(foreach part,$(UBINIZE_PARTS),--part $(part)) \
- $(IMAGE_ROOTFS) \
+ $(call param_get_default,rootfs,$(1),$(IMAGE_ROOTFS)) \
$@.tmp \
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
@@ -202,8 +202,9 @@ define Build/fit
$(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \
-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
- -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \
- -A $(LINUX_KARCH) -v $(LINUX_VERSION)
+ -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
+ -A $(LINUX_KARCH) -v $(LINUX_VERSION) \
+ $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),-R $(ROOTFS/squashfs/$(DEVICE_NAME)))
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
@mv $@.new $@
endef
diff --git a/include/image.mk b/include/image.mk
index b6e8ab3c84..92d343c6b7 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -227,8 +227,7 @@ $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S))
define Image/mkfs/squashfs-common
$(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
-nopad -noappend -root-owned \
- -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
- -processors 1
+ -comp $(SQUASHFSCOMP) $(SQUASHFSOPT)
endef
ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y)
@@ -441,6 +440,9 @@ else
DEVICE_CHECK_PROFILE = $(CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_$(1))
endif
+DEVICE_CHECK_FIT_KEY = $(if $(wildcard $(FIT_KEY_DIR)/$(FIT_KEY_NAME).key),install-images,install-disabled)
+DEVICE_CHECK_FIT_DIR = $(if $(FIT_KEY_DIR),$(DEVICE_CHECK_FIT_KEY),install-images)
+
DEVICE_EXTRA_PACKAGES = $(call qstrip,$(CONFIG_TARGET_DEVICE_PACKAGES_$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_DEVICE_$(1)))
define merge_packages
@@ -463,7 +465,7 @@ endef
define Device/Check
$(Device/Check/Common)
KDIR_KERNEL_IMAGE := $(KDIR)/$(1)$$(KERNEL_SUFFIX)
- _TARGET := $$(if $$(_PROFILE_SET),install-images,install-disabled)
+ _TARGET := $$(if $$(_PROFILE_SET),$$(DEVICE_CHECK_FIT_DIR),install-disabled)
ifndef IB
_COMPILE_TARGET := $$(if $(CONFIG_IB)$$(_PROFILE_SET),compile,compile-disabled)
endif
@@ -525,6 +527,21 @@ define Device/Build/compile
endef
+define Device/Build/per-device-fs
+ ROOTFS/$(1)/$(3) := \
+ $(KDIR)/root.$(1)$$(strip \
+ $$(if $$(FS_OPTIONS/$(1)),+fs=$$(call param_mangle,$$(FS_OPTIONS/$(1)))) \
+ )$$(strip \
+ $(if $(TARGET_PER_DEVICE_ROOTFS),+pkg=$$(ROOTFS_ID/$(3))) \
+ )
+ ifndef IB
+ $$(ROOTFS/$(1)/$(3)): $(if $(TARGET_PER_DEVICE_ROOTFS),target-dir-$$(ROOTFS_ID/$(3)))
+ endif
+
+ $$(KDIR_KERNEL_IMAGE): $$(ROOTFS/$(1)/$(3))
+
+endef
+
ifndef IB
define Device/Build/dtb
ifndef BUILD_DTS_$(1)
@@ -555,6 +572,16 @@ define Device/Build/kernel
ifdef CONFIG_IB
install: $$(KDIR_KERNEL_IMAGE)
endif
+ ifneq ($$(filter squashfs,$(2)),)
+ # Force squashfs to be built before generating kernel image
+ ROOTFS/squashfs/$(1) := \
+ $(KDIR)/root.squashfs$$(strip \
+ $$(if $$(FS_OPTIONS/squashfs),+fs=$$(call param_mangle,$$(FS_OPTIONS/squashfs))) \
+ )$$(strip \
+ $(if $(TARGET_PER_DEVICE_ROOTFS),+pkg=$$(ROOTFS_ID/$(1))) \
+ )
+ $$(KDIR_KERNEL_IMAGE): $$(ROOTFS/squashfs/$(1))
+ endif
$$(KDIR_KERNEL_IMAGE): $(KDIR)/$$(KERNEL_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
@rm -f $$@
$$(call concat_cmd,$$(KERNEL))
@@ -569,15 +596,6 @@ define Device/Build/image
$(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2))$$(GZ_SUFFIX))
$(eval $(call Device/Export,$(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2)),$(1)))
- ROOTFS/$(1)/$(3) := \
- $(KDIR)/root.$(1)$$(strip \
- $$(if $$(FS_OPTIONS/$(1)),+fs=$$(call param_mangle,$$(FS_OPTIONS/$(1)))) \
- )$$(strip \
- $(if $(TARGET_PER_DEVICE_ROOTFS),+pkg=$$(ROOTFS_ID/$(3))) \
- )
- ifndef IB
- $$(ROOTFS/$(1)/$(3)): $(if $(TARGET_PER_DEVICE_ROOTFS),target-dir-$$(ROOTFS_ID/$(3)))
- endif
$(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2)): $$(KDIR_KERNEL_IMAGE) $$(ROOTFS/$(1)/$(3))
@rm -f $$@
[ -f $$(word 1,$$^) -a -f $$(word 2,$$^) ]
@@ -638,8 +656,12 @@ define Device/Build/artifact
endef
define Device/Build
+ $$(eval $$(foreach image,$$(IMAGES), \
+ $$(foreach fs,$$(filter $(TARGET_FILESYSTEMS),$$(FILESYSTEMS)), \
+ $$(call Device/Build/per-device-fs,$$(fs),$$(image),$(1)))))
+
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Device/Build/initramfs,$(1)))
- $(call Device/Build/kernel,$(1))
+ $(call Device/Build/kernel,$(1),$$(filter $(TARGET_FILESYSTEMS),$$(FILESYSTEMS)))
$$(eval $$(foreach compile,$$(COMPILE), \
$$(call Device/Build/compile,$$(compile),$(1))))
--
2.34.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
From 07bb39c104a4515b8a25c067c77ff5d6fbed9ca2 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 13 Jul 2022 10:34:49 +0800
Subject: [PATCH] image: add "append-gl-metadata"
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
include/image-commands.mk | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 8d77d5dc80..585a734bfb 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -64,6 +64,37 @@ define Build/append-metadata
}
endef
+metadata_gl_json = \
+ '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
+ "metadata_version": "1.1", \
+ "compat_version": "$(call json_quote,$(compat_version))", \
+ $(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
+ $(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
+ [$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \
+ "supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
+ $(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \
+ "version": { \
+ "release": "$(shell cat $(TOPDIR)/release)", \
+ "date": "$(shell TZ='Asia/Chongqing' date '+%Y%m%d%H%M%S')", \
+ "dist": "$(call json_quote,$(VERSION_DIST))", \
+ "version": "$(call json_quote,$(VERSION_NUMBER))", \
+ "firmware_type": "$(shell cat $(TOPDIR)/files/etc/version.type)", \
+ "revision": "$(call json_quote,$(REVISION))", \
+ "target": "$(call json_quote,$(TARGETID))", \
+ "board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
+ }, \
+ "upgrade_control":"$(shell python3 $(TOPDIR)/make_gl_metadata.py)", \
+ "release_note":"$(shell sed ':a;N;s/\n/\\\\n/g;s/\r/\\\\r/g;ta' $(TOPDIR)/gl_release_note | sed "s/'/\\\047/g")" \
+ }'
+
+define Build/append-gl-metadata
+ $(if $(SUPPORTED_DEVICES),-echo -e $(call metadata_gl_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
+ [ ! -s "$(BUILD_KEY)" -o ! -s "$@" ] || { \
+ usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
+ fwtool -S "$@.sig" "$@" ;\
+ }
+endef
+
define Build/append-rootfs
dd if=$(IMAGE_ROOTFS) >> $@
endef
--
2.25.1

View File

@ -0,0 +1,28 @@
From a1644395234b57799a54d225c94e3251abb82b4c Mon Sep 17 00:00:00 2001
From: Luo Chongjun <luochongjun@gl-inet.com>
Date: Wed, 17 May 2023 18:19:32 +0800
Subject: [PATCH] image: mksquashfs4 add no-exports option
don't make the filesystem exportable via NFS.
Signed-off-by: Luo Chongjun <luochongjun@gl-inet.com>
---
include/image.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/image.mk b/include/image.mk
index 92d343c6b7..e85ff57df2 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -226,7 +226,7 @@ $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S))
define Image/mkfs/squashfs-common
$(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
- -nopad -noappend -root-owned \
+ -nopad -noappend -no-exports -root-owned \
-comp $(SQUASHFSCOMP) $(SQUASHFSOPT)
endef
--
2.34.1

View File

@ -0,0 +1,50 @@
From f0c18ddf8edfa8c38a2cc06cd3219fb9f6286084 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 13 Jul 2022 10:50:26 +0800
Subject: [PATCH] packages: support append glinet private packages
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
include/glinet.mk | 7 +++++++
package/Makefile | 4 +++-
2 files changed, 10 insertions(+), 1 deletion(-)
create mode 100644 include/glinet.mk
diff --git a/include/glinet.mk b/include/glinet.mk
new file mode 100644
index 0000000000..7501d73cfc
--- /dev/null
+++ b/include/glinet.mk
@@ -0,0 +1,7 @@
+GL_APPEND_IPKS :=
+ifneq ($(GL_PKGDIR),)
+ include $(GL_PKGDIR)/gl_pkg_config.mk
+ PACKAGE_SUBDIRS += $(GL_PKGDIR)
+ GL_APPEND_IPKS := $(foreach p,$(GL_INSTALL_IPKS),\
+ $(foreach pkg,$(shell ls $(GL_PKGDIR)/$(p)_*.ipk),$(pkg)$(call GetABISuffix,$(pkg))))
+endif
diff --git a/package/Makefile b/package/Makefile
index 209be34674..3b7d7ea892 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -9,6 +9,7 @@ curdir:=package
include $(INCLUDE_DIR)/feeds.mk
include $(INCLUDE_DIR)/rootfs.mk
+include $(INCLUDE_DIR)/glinet.mk
-include $(TMP_DIR)/.packagedeps
package-y += kernel/linux
@@ -69,7 +70,8 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(if $(CONFIG_TARGET_PER_DE
$(file >$(TMP_DIR)/opkg_install_list,\
$(call opkg_package_files,\
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg)))))
- $(call opkg,$(TARGET_DIR)) install $$(cat $(TMP_DIR)/opkg_install_list)
+ $(call opkg,$(TARGET_DIR)) install $$(cat $(TMP_DIR)/opkg_install_list) \
+ $(GL_APPEND_IPKS)
@for file in $(PACKAGE_INSTALL_FILES); do \
[ -s $$file.flags ] || continue; \
for flag in `cat $$file.flags`; do \
--
2.25.1

View File

@ -0,0 +1,25 @@
From b233038896c42288189b22525002350b29630c81 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 22 Jun 2022 18:30:11 +0800
Subject: [PATCH] gpio-button-hotplug: add name 'switch'
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
index fcaf7f59de..d3657a3da9 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -100,6 +100,7 @@ static struct bh_map button_map[] = {
BH_MAP(KEY_WIMAX, "wwan"),
BH_MAP(KEY_WLAN, "wlan"),
BH_MAP(KEY_WPS_BUTTON, "wps"),
+ BH_MAP(KEY_SETUP, "switch"),
};
/* -------------------------------------------------------------------------*/
--
2.25.1

View File

@ -0,0 +1,123 @@
From 764a90fac44f42014491a65d567389a7c2ab89f7 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 17 May 2023 11:53:58 +0800
Subject: [PATCH 5/9] package/uboot-envtools: support mediatek target
---
package/boot/uboot-envtools/files/mediatek | 104 +++++++++++++++++++++
1 file changed, 104 insertions(+)
create mode 100644 package/boot/uboot-envtools/files/mediatek
diff --git a/package/boot/uboot-envtools/files/mediatek b/package/boot/uboot-envtools/files/mediatek
new file mode 100644
index 0000000000..6102d9b867
--- /dev/null
+++ b/package/boot/uboot-envtools/files/mediatek
@@ -0,0 +1,104 @@
+#!/bin/sh
+#
+# Copyright (C) 2011-2012 OpenWrt.org
+#
+
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+CI_UBIPART=ubi
+
+block_dev_path() {
+ local dev_path
+
+ case "$1" in
+ /dev/mmcblk*)
+ dev_path="$1"
+ ;;
+ PARTLABEL=* | PARTUUID=*)
+ dev_path=$(blkid -t "$1" -o device)
+ [ -z "${dev_path}" -o $? -ne 0 ] && return 1
+ ;;
+ *)
+ return 1;
+ ;;
+ esac
+
+ echo "${dev_path}"
+ return 0
+}
+
+nand_find_volume() {
+ local ubidevdir ubivoldir
+ ubidevdir="/sys/devices/virtual/ubi/$1"
+ [ ! -d "$ubidevdir" ] && return 1
+ for ubivoldir in $ubidevdir/${1}_*; do
+ [ ! -d "$ubivoldir" ] && continue
+ if [ "$( cat $ubivoldir/name )" = "$2" ]; then
+ basename $ubivoldir
+ ubi_mknod "$ubivoldir"
+ return 0
+ fi
+ done
+}
+
+nand_find_ubi() {
+ local ubidevdir ubidev mtdnum
+ mtdnum="$( find_mtd_index $1 )"
+ [ ! "$mtdnum" ] && return 1
+ for ubidevdir in /sys/devices/virtual/ubi/ubi*; do
+ [ ! -d "$ubidevdir" ] && continue
+ cmtdnum="$( cat $ubidevdir/mtd_num )"
+ [ ! "$mtdnum" ] && continue
+ if [ "$mtdnum" = "$cmtdnum" ]; then
+ ubidev=$( basename $ubidevdir )
+ ubi_mknod "$ubidevdir"
+ echo $ubidev
+ return 0
+ fi
+ done
+}
+
+board=$(board_name)
+
+case "$board" in
+mediatek,*-emmc-rfb)
+ env_dev=$(cat /sys/module/boot_param/parameters/env_part 2>/dev/null)
+ [ -n "$env_dev" ] && env_dev=$(block_dev_path "${env_dev}")
+ [ -z "$env_dev" ] && env_dev=$(block_dev_path "PARTLABEL=u-boot-env")
+ [ -n "$env_dev" ] && \
+ ubootenv_add_uci_config "$env_dev" "0" "0x80000"
+ ;;
+
+mediatek,*-snand-rfb)
+ env_dev=$(cat /sys/module/boot_param/parameters/env_part 2>/dev/null)
+ if [ -n "$env_dev" ]; then
+ local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
+ if [ ! "$mtdnum" ]; then
+ echo "cannot find ubi mtd partition $CI_UBIPART"
+ return 1
+ fi
+
+ local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+ if [ ! "$ubidev" ]; then
+ ubiattach -m "$mtdnum"
+ sync
+ ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+ fi
+
+ local env_ubivol="$( nand_find_volume "${ubidev}" ${env_dev} )"
+ if [ -n "${env_ubivol}" ]; then
+ ubootenv_add_uci_config "/dev/$env_ubivol" "0" "0x80000" "0x80000" 1
+ fi
+ fi
+ ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0
--
2.34.1

View File

@ -0,0 +1,771 @@
From 708c112895f13999a930470976b0459f2ce10944 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Fri, 1 Jul 2022 11:27:42 +0800
Subject: [PATCH] iwinfo: support mtk private wifi driver
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
package/network/utils/iwinfo/Makefile | 2 +-
.../iwinfo/patches/0001-fix-wext-h.patch | 32 +
.../iwinfo/patches/0100-support-mtk.patch | 113 ++++
package/network/utils/iwinfo/src/iwinfo_mtk.c | 576 ++++++++++++++++++
4 files changed, 722 insertions(+), 1 deletion(-)
create mode 100644 package/network/utils/iwinfo/patches/0001-fix-wext-h.patch
create mode 100644 package/network/utils/iwinfo/patches/0100-support-mtk.patch
create mode 100644 package/network/utils/iwinfo/src/iwinfo_mtk.c
diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile
index 25cc210acb..e312ddd7df 100644
--- a/package/network/utils/iwinfo/Makefile
+++ b/package/network/utils/iwinfo/Makefile
@@ -80,7 +80,7 @@ MAKE_FLAGS += \
FPIC="$(FPIC)" \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
- BACKENDS="nl80211" \
+ BACKENDS="nl80211 mtk" \
SOVERSION="$(IWINFO_ABI_VERSION)"
define Build/InstallDev
diff --git a/package/network/utils/iwinfo/patches/0001-fix-wext-h.patch b/package/network/utils/iwinfo/patches/0001-fix-wext-h.patch
new file mode 100644
index 0000000000..be03cb5c26
--- /dev/null
+++ b/package/network/utils/iwinfo/patches/0001-fix-wext-h.patch
@@ -0,0 +1,32 @@
+Index: libiwinfo-2022-04-26-dc6847eb/api/wext.h
+===================================================================
+--- libiwinfo-2022-04-26-dc6847eb.orig/api/wext.h
++++ libiwinfo-2022-04-26-dc6847eb/api/wext.h
+@@ -677,7 +677,7 @@
+ */
+ struct iw_param
+ {
+- int32_t value; /* The value of the parameter itself */
++ int64_t value; /* The value of the parameter itself */
+ uint8_t fixed; /* Hardware should not use auto select */
+ uint8_t disabled; /* Disable the feature */
+ uint16_t flags; /* Various specifc flags (if any) */
+@@ -988,6 +988,9 @@ struct iw_range
+ uint16_t old_num_channels;
+ uint8_t old_num_frequency;
+
++ /* Scan capabilities */
++ uint8_t scan_capa; /* IW_SCAN_CAPA_* bit field */
++
+ /* Wireless event capability bitmasks */
+ uint32_t event_capa[6];
+
+@@ -1013,7 +1016,7 @@ struct iw_range
+
+ /* Rates */
+ uint8_t num_bitrates; /* Number of entries in the list */
+- int32_t bitrate[IW_MAX_BITRATES]; /* list, in bps */
++ int64_t bitrate[IW_MAX_BITRATES]; /* list, in bps */
+
+ /* RTS threshold */
+ int32_t min_rts; /* Minimal RTS threshold */
diff --git a/package/network/utils/iwinfo/patches/0100-support-mtk.patch b/package/network/utils/iwinfo/patches/0100-support-mtk.patch
new file mode 100644
index 0000000000..892e750d00
--- /dev/null
+++ b/package/network/utils/iwinfo/patches/0100-support-mtk.patch
@@ -0,0 +1,113 @@
+Index: libiwinfo-2022-04-26-dc6847eb/Makefile
+===================================================================
+--- libiwinfo-2022-04-26-dc6847eb.orig/Makefile
++++ libiwinfo-2022-04-26-dc6847eb/Makefile
+@@ -35,6 +35,11 @@ ifneq ($(filter nl80211,$(IWINFO_BACKEND
+ endif
+
+
++ifneq ($(filter mtk,$(IWINFO_BACKENDS)),)
++ IWINFO_CFLAGS += -DUSE_MTK
++ IWINFO_LIB_OBJ += iwinfo_mtk.o
++endif
++
+ compile: clean $(IWINFO_LIB) $(IWINFO_LUA) $(IWINFO_CLI)
+
+ %.o: %.c
+Index: libiwinfo-2022-04-26-dc6847eb/include/iwinfo.h
+===================================================================
+--- libiwinfo-2022-04-26-dc6847eb.orig/include/iwinfo.h
++++ libiwinfo-2022-04-26-dc6847eb/include/iwinfo.h
+@@ -311,6 +311,7 @@ extern const struct iwinfo_ops wext_ops;
+ extern const struct iwinfo_ops madwifi_ops;
+ extern const struct iwinfo_ops nl80211_ops;
+ extern const struct iwinfo_ops wl_ops;
++extern const struct iwinfo_ops mtk_ops;
+
+ #include "iwinfo/utils.h"
+
+Index: libiwinfo-2022-04-26-dc6847eb/iwinfo_lib.c
+===================================================================
+--- libiwinfo-2022-04-26-dc6847eb.orig/iwinfo_lib.c
++++ libiwinfo-2022-04-26-dc6847eb/iwinfo_lib.c
+@@ -339,6 +339,9 @@ static const struct iwinfo_ops *backends
+ #ifdef USE_WL
+ &wl_ops,
+ #endif
++#ifdef USE_MTK
++ &mtk_ops,
++#endif
+ &wext_ops,
+ };
+
+Index: libiwinfo-2022-04-26-dc6847eb/include/iwinfo/lua.h
+===================================================================
+--- libiwinfo-2022-04-26-dc6847eb.orig/include/iwinfo/lua.h
++++ libiwinfo-2022-04-26-dc6847eb/include/iwinfo/lua.h
+@@ -41,6 +41,9 @@
+ #define IWINFO_NL80211_META "iwinfo.nl80211"
+ #endif
+
++#ifdef USE_MTK
++#define IWINFO_MTK_META "iwinfo.mtk"
++#endif
+
+ #define LUA_REG(type,op) \
+ { #op, iwinfo_L_##type##_##op }
+Index: libiwinfo-2022-04-26-dc6847eb/iwinfo_lua.c
+===================================================================
+--- libiwinfo-2022-04-26-dc6847eb.orig/iwinfo_lua.c
++++ libiwinfo-2022-04-26-dc6847eb/iwinfo_lua.c
+@@ -769,6 +769,16 @@ LUA_WRAP_STRUCT_OP(nl80211,mbssid_suppor
+ LUA_WRAP_STRUCT_OP(nl80211,hardware_id)
+ #endif
+
++#ifdef USE_MTK
++LUA_WRAP_INT_OP(mtk,channel)
++LUA_WRAP_STRING_OP(mtk,ssid)
++LUA_WRAP_STRING_OP(mtk,bssid)
++LUA_WRAP_STRING_OP(mtk,phyname)
++LUA_WRAP_STRUCT_OP(mtk,mode)
++LUA_WRAP_STRUCT_OP(mtk,assoclist)
++LUA_WRAP_STRUCT_OP(mtk,freqlist)
++#endif
++
+ /* Wext */
+ LUA_WRAP_INT_OP(wext,channel)
+ LUA_WRAP_INT_OP(wext,frequency)
+@@ -896,6 +906,19 @@ static const luaL_reg R_nl80211[] = {
+ };
+ #endif
+
++#ifdef USE_MTK
++static const luaL_reg R_mtk[] = {
++ LUA_REG(mtk,channel),
++ LUA_REG(mtk,mode),
++ LUA_REG(mtk,ssid),
++ LUA_REG(mtk,bssid),
++ LUA_REG(mtk,assoclist),
++ LUA_REG(mtk,freqlist),
++ LUA_REG(mtk,phyname),
++ { NULL, NULL }
++};
++#endif
++
+ /* Wext table */
+ static const luaL_reg R_wext[] = {
+ LUA_REG(wext,channel),
+@@ -965,6 +988,15 @@ LUALIB_API int luaopen_iwinfo(lua_State
+ lua_setfield(L, -2, "nl80211");
+ #endif
+
++#ifdef USE_MTK
++ luaL_newmetatable(L, IWINFO_MTK_META);
++ luaL_register(L, NULL, R_common);
++ luaL_register(L, NULL, R_mtk);
++ lua_pushvalue(L, -1);
++ lua_setfield(L, -2, "__index");
++ lua_setfield(L, -2, "mtk");
++#endif
++
+ luaL_newmetatable(L, IWINFO_WEXT_META);
+ luaL_register(L, NULL, R_common);
+ luaL_register(L, NULL, R_wext);
diff --git a/package/network/utils/iwinfo/src/iwinfo_mtk.c b/package/network/utils/iwinfo/src/iwinfo_mtk.c
new file mode 100644
index 0000000000..5d212000b7
--- /dev/null
+++ b/package/network/utils/iwinfo/src/iwinfo_mtk.c
@@ -0,0 +1,576 @@
+#include "iwinfo.h"
+#include "iwinfo_wext.h"
+
+#include <inttypes.h>
+
+typedef union _MACHTTRANSMIT_SETTING {
+ struct {
+ unsigned short MCS:6; // MCS
+ unsigned short rsv:1;
+ unsigned short BW:2; //channel bandwidth 20MHz or 40 MHz
+ unsigned short ShortGI:1;
+ unsigned short STBC:1; //SPACE
+ unsigned short eTxBF:1;
+ unsigned short iTxBF:1;
+ unsigned short MODE:3; // Use definition MODE_xxx.
+ } field;
+ unsigned short word;
+} MACHTTRANSMIT_SETTING;
+
+typedef struct _RT_802_11_MAC_ENTRY {
+ unsigned char ApIdx;
+ unsigned char Addr[6];
+ unsigned char Aid;
+ unsigned char Psm; // 0:PWR_ACTIVE, 1:PWR_SAVE
+ unsigned char MimoPs; // 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled
+ signed char AvgRssi0;
+ signed char AvgRssi1;
+ signed char AvgRssi2;
+ signed char AvgRssi3;
+ unsigned int ConnectedTime;
+ MACHTTRANSMIT_SETTING TxRate;
+ unsigned int LastRxRate;
+ short StreamSnr[3];
+ short SoundingRespSnr[3];
+#if 0
+ short TxPER;
+ short reserved;
+#endif
+} RT_802_11_MAC_ENTRY;
+
+#define MAX_NUMBER_OF_MAC 554
+
+typedef struct _RT_802_11_MAC_TABLE {
+ unsigned long Num;
+ RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC]; //MAX_LEN_OF_MAC_TABLE = 32
+} RT_802_11_MAC_TABLE;
+
+#define SIOCIWFIRSTPRIV 0x8BE0
+#define RTPRIV_IOCTL_GET_MAC_TABLE_STRUCT (SIOCIWFIRSTPRIV + 0x1F)
+#define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02)
+#define RTPRIV_IOCTL_GSITESURVEY (SIOCIWFIRSTPRIV + 0x0D)
+
+struct mtk_phy_feature {
+ const char *name;
+ int hwmodelist;
+ int htmodelist;
+};
+
+static struct mtk_phy_feature mtk_phy_feature[7] = {};
+
+static inline int wext_ioctl(const char *ifname, int cmd, struct iwreq *wrq)
+{
+ strncpy(wrq->ifr_name, ifname, IFNAMSIZ);
+ return iwinfo_ioctl(cmd, wrq);
+}
+
+static int mtk_probe(const char *ifname)
+{
+ struct mtk_phy_feature *f = mtk_phy_feature;
+
+ while (f->name) {
+ if (strstr(ifname, f->name))
+ return true;
+ f++;
+ }
+
+ return false;
+}
+
+static void mtk_close(void)
+{
+ /* Nop */
+}
+
+static int mtk_get_mode(const char *ifname, int *buf)
+{
+ return wext_ops.mode(ifname, buf);
+}
+
+static int mtk_get_ssid(const char *ifname, char *buf)
+{
+ struct iwreq wrq = {};
+
+ wrq.u.essid.pointer = buf;
+ wrq.u.essid.length = IW_ESSID_MAX_SIZE;
+
+ if(wext_ioctl(ifname, SIOCGIWESSID, &wrq) >= 0)
+ return 0;
+
+ return -1;
+}
+
+static int mtk_get_bssid(const char *ifname, char *buf)
+{
+ return wext_ops.bssid(ifname, buf);
+}
+
+static int mtk_get_bitrate(const char *ifname, int *buf)
+{
+ return wext_ops.bitrate(ifname, buf);
+}
+
+static int mtk_get_channel(const char *ifname, int *buf)
+{
+ return wext_ops.channel(ifname, buf);
+}
+
+static int mtk_get_center_chan1(const char *ifname, int *buf)
+{
+ /* Not Supported */
+ return -1;
+}
+
+static int mtk_get_center_chan2(const char *ifname, int *buf)
+{
+ /* Not Supported */
+ return -1;
+}
+
+static int mtk_get_frequency(const char *ifname, int *buf)
+{
+ int channel;
+ int freq;
+
+ if (wext_ops.channel(ifname, &channel))
+ return -1;
+
+ if (channel < 36) {
+ if (channel == 14)
+ return 2484;
+ freq = 2407 + channel * 5;
+ } else {
+ if (channel >= 182 && channel <= 196)
+ freq = 4000 + channel * 5;
+ else
+ freq = 5000 + channel * 5;
+ }
+
+ *buf = freq;
+ return 0;
+}
+
+static int mtk_get_txpower(const char *ifname, int *buf)
+{
+ if (wext_ops.txpower(ifname, buf))
+ return -1;
+
+ *buf = iwinfo_mw2dbm(*buf);
+
+ return 0;
+}
+
+static int mtk_get_signal(const char *ifname, int *buf)
+{
+ return wext_ops.signal(ifname, buf);
+}
+
+static int mtk_get_noise(const char *ifname, int *buf)
+{
+ return wext_ops.noise(ifname, buf);
+}
+
+static int mtk_get_quality(const char *ifname, int *buf)
+{
+ return wext_ops.quality(ifname, buf);
+}
+
+static int mtk_get_quality_max(const char *ifname, int *buf)
+{
+ return wext_ops.quality_max(ifname, buf);
+}
+
+static int mtk_get_assoclist(const char *ifname, char *buf, int *len)
+{
+ struct iwreq wrq = {};
+ RT_802_11_MAC_TABLE *table;
+ int i;
+
+ table = calloc(1, sizeof(RT_802_11_MAC_TABLE));
+ if (!table)
+ return -1;
+
+ wrq.u.data.pointer = (caddr_t)table;
+ wrq.u.data.length = sizeof(RT_802_11_MAC_TABLE);
+
+ if (wext_ioctl(ifname, RTPRIV_IOCTL_GET_MAC_TABLE_STRUCT, &wrq) < 0) {
+ free(table);
+ return -1;
+ }
+
+ *len = 0;
+
+ for (i = 0; i < table->Num; i++) {
+ RT_802_11_MAC_ENTRY *pe = &(table->Entry[i]);
+ struct iwinfo_assoclist_entry *e = (struct iwinfo_assoclist_entry *)buf + i;
+
+ memcpy(e->mac, pe->Addr, 6);
+
+ *len += sizeof(struct iwinfo_assoclist_entry);
+ }
+
+ free(table);
+ return 0;
+}
+
+static int mtk_get_txpwrlist(const char *ifname, char *buf, int *len)
+{
+ struct iwinfo_txpwrlist_entry entry;
+ int i;
+
+ for(i = 0; i < 21; i++) {
+ entry.dbm = i;
+ entry.mw = iwinfo_mw2dbm(i);
+ memcpy(&buf[i * sizeof(entry)], &entry, sizeof(entry));
+ }
+
+ *len = i * sizeof(entry);
+
+ return 0;
+}
+
+static int mtk_get_scanlist_dump(const char *ifname, int index, char *data, size_t len)
+{
+ struct iwreq wrq = {};
+
+ snprintf(wrq.ifr_name, sizeof(wrq.ifr_name), "%s", ifname);
+ snprintf(data, len, "%d", index);
+
+ wrq.u.data.pointer = data;
+ wrq.u.data.length = len;
+
+ return iwinfo_ioctl(RTPRIV_IOCTL_GSITESURVEY, &wrq);
+}
+
+struct scan_data_offset {
+ int offset;
+ int width;
+};
+
+enum {
+ SCAN_DATA_CH,
+ SCAN_DATA_SSID,
+ SCAN_DATA_BSSID,
+ SCAN_DATA_SECURITY,
+ SCAN_DATA_RSSI,
+ SCAN_DATA_NT,
+ SCAN_DATA_SSID_LEN,
+ SCAN_DATA_MAX
+};
+
+static int mtk_get_scanlist(const char *ifname, char *buf, int *len)
+{
+ struct iwinfo_scanlist_entry *e = (struct iwinfo_scanlist_entry *)buf;
+ static char data[20 * 1024 + 1];
+ int offsets[SCAN_DATA_MAX];
+ char cmd[128];
+ int index = 0;
+ int total = -1;
+ char *pos;
+
+ *len = 0;
+
+ if (!strcmp(ifname, "mt798111") || !strcmp(ifname, "mt7628"))
+ ifname = "ra0";
+ else if (!strcmp(ifname, "mt798112"))
+ ifname = "rax0";
+
+ sprintf(cmd, "iwpriv %s set SiteSurvey=", ifname);
+ system(cmd);
+
+ sleep(8);
+
+ while (1) {
+ if (mtk_get_scanlist_dump(ifname, index, data, sizeof(data)))
+ return -1;
+
+ sscanf(data, "\nTotal=%d", &total);
+
+ strtok(data, "\n");
+ pos = strtok(NULL, "\n");
+
+ offsets[SCAN_DATA_CH] = strstr(pos, "Ch ") - pos;
+ offsets[SCAN_DATA_SSID] = strstr(pos, "SSID ") - pos;
+ offsets[SCAN_DATA_BSSID] = strstr(pos, "BSSID ") - pos;
+ offsets[SCAN_DATA_SECURITY] = strstr(pos, "Security ") - pos;
+ offsets[SCAN_DATA_RSSI] = strstr(pos, "Rssi") - pos;
+ offsets[SCAN_DATA_NT] = strstr(pos, "NT") - pos;
+ offsets[SCAN_DATA_SSID_LEN] = strstr(pos, "SSID_Len") - pos;
+
+ while (1) {
+ struct iwinfo_crypto_entry *crypto = &e->crypto;
+ const char *security;
+ uint8_t *mac = e->mac;
+ int signal;
+ int ssid_len;
+
+ pos = strtok(NULL, "\n");
+ if (!pos)
+ break;
+
+ sscanf(pos, "%d", &index);
+
+ if (strncmp(pos + offsets[SCAN_DATA_NT], "In", 2))
+ continue;;
+
+ security = pos + offsets[SCAN_DATA_SECURITY];
+ if (!strstr(security, "PSK") && !strstr(security, "OPEN"))
+ continue;
+
+ memset(crypto, 0, sizeof(struct iwinfo_crypto_entry));
+
+ if (strstr(security, "PSK")) {
+ crypto->enabled = true;
+
+ if (strstr(security, "WPAPSK")) {
+ crypto->wpa_version |= 1 << 0;
+ crypto->auth_suites |= IWINFO_KMGMT_PSK;
+ }
+
+ if (strstr(security, "WPA2PSK")) {
+ crypto->wpa_version |= 1 << 1;
+ crypto->auth_suites |= IWINFO_KMGMT_PSK;
+ }
+
+ if (strstr(security, "WPAP3SK")) {
+ crypto->wpa_version |= 1 << 2;
+ crypto->auth_suites |= IWINFO_KMGMT_SAE;
+ }
+ }
+
+ e->mode = IWINFO_OPMODE_MASTER;
+
+ sscanf(pos + offsets[SCAN_DATA_CH], "%"SCNu8, &e->channel);
+ sscanf(pos + offsets[SCAN_DATA_RSSI] + 1, "%d", &signal);
+ e->signal = -signal + 0x100;
+
+ sscanf(pos + offsets[SCAN_DATA_BSSID], "%02"SCNx8":%02"SCNx8":%02"SCNx8":%02"SCNx8":%02"SCNx8":%02"SCNx8"",
+ mac + 0, mac + 1, mac + 2, mac + 3, mac + 4, mac + 5);
+
+ sscanf(pos + offsets[SCAN_DATA_SSID_LEN], "%d", &ssid_len);
+ memcpy(e->ssid, pos + offsets[SCAN_DATA_SSID], ssid_len);
+
+ *len += sizeof(struct iwinfo_scanlist_entry);
+ e++;
+
+ if (index + 1 == total)
+ break;
+ }
+
+ if (index + 1 == total)
+ break;
+ }
+
+ return 0;
+}
+
+static int mtk_get_freqlist(const char *ifname, char *buf, int *len)
+{
+ if (!strcmp(ifname, "mt798111") || !strcmp(ifname, "mt7628"))
+ ifname = "ra0";
+ else if (!strcmp(ifname, "mt798112"))
+ ifname = "rax0";
+ return wext_ops.freqlist(ifname, buf, len);
+}
+
+static int mtk_get_country(const char *ifname, char *buf)
+{
+ sprintf(buf, "00");
+ return 0;
+}
+
+static int mtk_get_countrylist(const char *ifname, char *buf, int *len)
+{
+ /* Stub */
+ return -1;
+}
+
+static int mtk_get_hwmodelist(const char *ifname, int *buf)
+{
+ struct mtk_phy_feature *f = mtk_phy_feature;
+
+ while (f->name) {
+ if (strstr(ifname, f->name)) {
+ *buf = f->hwmodelist;
+ return 0;
+ }
+ f++;
+ }
+
+ return -1;
+}
+
+static int mtk_get_htmodelist(const char *ifname, int *buf)
+{
+ struct mtk_phy_feature *f = mtk_phy_feature;
+
+ while (f->name) {
+ if (strstr(ifname, f->name)) {
+ *buf = f->htmodelist;
+ return 0;
+ }
+ f++;
+ }
+
+ return -1;
+}
+
+static int mtk_get_htmode(const char *ifname, int *buf)
+{
+ return -1;
+}
+
+static int mtk_get_encryption(const char *ifname, char *buf)
+{
+ /* No reliable crypto info in wext */
+ return -1;
+}
+
+static int mtk_get_phyname(const char *ifname, char *buf)
+{
+ if (strstr(ifname, "rax") || strstr(ifname, "apclix"))
+ strcpy(buf, "rax0");
+ else if (strstr(ifname, "ra") || strstr(ifname, "apcli"))
+ strcpy(buf, "ra0");
+ else
+ return -1;
+
+ return 0;
+}
+
+static int mtk_get_mbssid_support(const char *ifname, int *buf)
+{
+ /* No multi bssid support atm */
+ return -1;
+}
+
+static int mtk_get_hardware_id(const char *ifname, char *buf)
+{
+ return wext_ops.hardware_id(ifname, buf);
+}
+
+static int mtk_get_hardware_name(const char *ifname, char *buf)
+{
+ sprintf(buf, "MediaTek");
+ return 0;
+}
+
+static int mtk_get_txpower_offset(const char *ifname, int *buf)
+{
+ /* Stub */
+ *buf = 0;
+ return -1;
+}
+
+static int mtk_get_frequency_offset(const char *ifname, int *buf)
+{
+ /* Stub */
+ *buf = 0;
+ return -1;
+}
+
+const struct iwinfo_ops mtk_ops = {
+ .name = "mtk",
+ .probe = mtk_probe,
+ .channel = mtk_get_channel,
+ .center_chan1 = mtk_get_center_chan1,
+ .center_chan2 = mtk_get_center_chan2,
+ .frequency = mtk_get_frequency,
+ .frequency_offset = mtk_get_frequency_offset,
+ .txpower = mtk_get_txpower,
+ .txpower_offset = mtk_get_txpower_offset,
+ .bitrate = mtk_get_bitrate,
+ .signal = mtk_get_signal,
+ .noise = mtk_get_noise,
+ .quality = mtk_get_quality,
+ .quality_max = mtk_get_quality_max,
+ .mbssid_support = mtk_get_mbssid_support,
+ .hwmodelist = mtk_get_hwmodelist,
+ .htmodelist = mtk_get_htmodelist,
+ .htmode = mtk_get_htmode,
+ .mode = mtk_get_mode,
+ .ssid = mtk_get_ssid,
+ .bssid = mtk_get_bssid,
+ .country = mtk_get_country,
+ .hardware_id = mtk_get_hardware_id,
+ .hardware_name = mtk_get_hardware_name,
+ .encryption = mtk_get_encryption,
+ .phyname = mtk_get_phyname,
+ .assoclist = mtk_get_assoclist,
+ .txpwrlist = mtk_get_txpwrlist,
+ .scanlist = mtk_get_scanlist,
+ .freqlist = mtk_get_freqlist,
+ .countrylist = mtk_get_countrylist,
+ .close = mtk_close
+};
+
+static void __attribute__((constructor)) init()
+{
+ char buf[100] = "";
+ FILE *fp;
+
+ fp = fopen("/etc/config/wireless", "r");
+ if (!fp)
+ return;
+
+ fread(buf, 1, sizeof(buf) - 1, fp);
+ fclose(fp);
+
+ if (strstr(buf, "mt7628")) {
+ int hwmodelist = IWINFO_80211_B | IWINFO_80211_G | IWINFO_80211_N;
+ int htmodelist = IWINFO_HTMODE_HT20 | IWINFO_HTMODE_HT40;
+
+ mtk_phy_feature[0].name = "mt7628";
+ mtk_phy_feature[0].hwmodelist = hwmodelist;
+ mtk_phy_feature[0].htmodelist = htmodelist;
+
+ mtk_phy_feature[1].name = "ra";
+ mtk_phy_feature[1].hwmodelist = hwmodelist;
+ mtk_phy_feature[1].htmodelist = htmodelist;
+
+ mtk_phy_feature[2].name = "apcli";
+ mtk_phy_feature[2].hwmodelist = hwmodelist;
+ mtk_phy_feature[2].htmodelist = htmodelist;
+ } else if (strstr(buf, "mt798111") || strstr(buf, "mt798611")) {
+ int hwmodelist = IWINFO_80211_A | IWINFO_80211_N | IWINFO_80211_AC | IWINFO_80211_AX;
+ int htmodelist = IWINFO_HTMODE_HT20 | IWINFO_HTMODE_HT40
+ | IWINFO_HTMODE_VHT20 | IWINFO_HTMODE_VHT40 | IWINFO_HTMODE_VHT80 | IWINFO_HTMODE_VHT160
+ | IWINFO_HTMODE_HE20 | IWINFO_HTMODE_HE40 | IWINFO_HTMODE_HE80 | IWINFO_HTMODE_HE160;
+
+ if (strstr(buf, "mt798111"))
+ mtk_phy_feature[0].name = "mt798112";
+ else
+ mtk_phy_feature[0].name = "mt798612";
+
+ mtk_phy_feature[0].hwmodelist = hwmodelist;
+ mtk_phy_feature[0].htmodelist = htmodelist;
+
+ mtk_phy_feature[1].name = "rax";
+ mtk_phy_feature[1].hwmodelist = hwmodelist;
+ mtk_phy_feature[1].htmodelist = htmodelist;
+
+ mtk_phy_feature[2].name = "apclix";
+ mtk_phy_feature[2].hwmodelist = hwmodelist;
+ mtk_phy_feature[2].htmodelist = htmodelist;
+
+ hwmodelist = IWINFO_80211_B | IWINFO_80211_G | IWINFO_80211_N | IWINFO_80211_AX;
+ htmodelist = IWINFO_HTMODE_HT20 | IWINFO_HTMODE_HT40
+ | IWINFO_HTMODE_HE20 | IWINFO_HTMODE_HE40;
+
+ if (strstr(buf, "mt798111"))
+ mtk_phy_feature[3].name = "mt798111";
+ else
+ mtk_phy_feature[3].name = "mt798611";
+
+ mtk_phy_feature[3].hwmodelist = hwmodelist;
+ mtk_phy_feature[3].htmodelist = htmodelist;
+
+ mtk_phy_feature[4].name = "ra";
+ mtk_phy_feature[4].hwmodelist = hwmodelist;
+ mtk_phy_feature[4].htmodelist = htmodelist;
+
+ mtk_phy_feature[5].name = "apcli";
+ mtk_phy_feature[5].hwmodelist = hwmodelist;
+ mtk_phy_feature[5].htmodelist = htmodelist;
+ }
+}
--
2.34.1

View File

@ -0,0 +1,65 @@
From 96bf38ef65b9f6385846384b8b9e2469d4f37ebd Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 17 May 2023 11:56:43 +0800
Subject: [PATCH 6/9] wireless-tools: fix iwconfig rate print format
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../006-fix-iwconfig-rate-print-format.patch | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 package/network/utils/wireless-tools/patches/006-fix-iwconfig-rate-print-format.patch
diff --git a/package/network/utils/wireless-tools/patches/006-fix-iwconfig-rate-print-format.patch b/package/network/utils/wireless-tools/patches/006-fix-iwconfig-rate-print-format.patch
new file mode 100644
index 0000000000..2a11adf0a1
--- /dev/null
+++ b/package/network/utils/wireless-tools/patches/006-fix-iwconfig-rate-print-format.patch
@@ -0,0 +1,45 @@
+Index: wireless_tools.29/iwlib.c
+===================================================================
+--- wireless_tools.29.orig/iwlib.c 2007-06-30 07:43:31.000000000 +0800
++++ wireless_tools.29/iwlib.c 2020-09-25 15:35:01.105434143 +0800
+@@ -1129,7 +1129,7 @@ iw_channel_to_freq(int channel,
+ void
+ iw_print_bitrate(char * buffer,
+ int buflen,
+- int bitrate)
++ unsigned long long bitrate)
+ {
+ double rate = bitrate;
+ char scale;
+--- wireless_tools.29.orig/iwlib.h
++++ wireless_tools.29.orig/iwlib.h
+@@ -346,7 +346,7 @@ int
+ void
+ iw_print_bitrate(char * buffer,
+ int buflen,
+- int bitrate);
++ unsigned long long bitrate);
+ /* ---------------------- POWER SUBROUTINES ----------------------- */
+ int
+ iw_dbm2mwatt(int in);
+--- wireless_tools.29.orig/wireless.21.h
++++ wireless_tools.29.orig/wireless.21.h
+@@ -669,7 +669,7 @@
+ */
+ struct iw_param
+ {
+- __s32 value; /* The value of the parameter itself */
++ __u64 value; /* The value of the parameter itself */
+ __u8 fixed; /* Hardware should not use auto select */
+ __u8 disabled; /* Disable the feature */
+ __u16 flags; /* Various specifc flags (if any) */
+@@ -1005,7 +1005,7 @@ struct iw_range
+
+ /* Rates */
+ __u8 num_bitrates; /* Number of entries in the list */
+- __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
++ __u64 bitrate[IW_MAX_BITRATES]; /* list, in bps */
+
+ /* RTS threshold */
+ __s32 min_rts; /* Minimal RTS threshold */
+
--
2.34.1

View File

@ -0,0 +1,25 @@
From 28dd27e933916445f3fbfb438f873eb01b4b9270 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 13 Jul 2022 10:10:52 +0800
Subject: [PATCH] package/ppp: fix ipv6
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
package/network/services/ppp/files/ppp.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/package/network/services/ppp/files/ppp.sh b/package/network/services/ppp/files/ppp.sh
index b553effd88..78a712b41a 100755
--- a/package/network/services/ppp/files/ppp.sh
+++ b/package/network/services/ppp/files/ppp.sh
@@ -140,6 +140,7 @@ ppp_generic_setup() {
${localip:+$localip:} \
${lcp_failure:+lcp-echo-interval $lcp_interval lcp-echo-failure $lcp_failure $lcp_adaptive} \
${ipv6:++ipv6} \
+ ${ipv6:-noipv6} \
${autoipv6:+set AUTOIPV6=1} \
${ip6table:+set IP6TABLE=$ip6table} \
${peerdns:+set PEERDNS=$peerdns} \
--
2.25.1

View File

@ -0,0 +1,33 @@
From f3a50d2b1d965abdd403c60c01fd5a89d188e37d Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 13 Jul 2022 10:56:49 +0800
Subject: [PATCH] package/dnsmasq: remove limit hostname
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../dnsmasq/patches/300-remove-limit-hostname.patch | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 package/network/services/dnsmasq/patches/300-remove-limit-hostname.patch
diff --git a/package/network/services/dnsmasq/patches/300-remove-limit-hostname.patch b/package/network/services/dnsmasq/patches/300-remove-limit-hostname.patch
new file mode 100644
index 0000000000..cf0086a19f
--- /dev/null
+++ b/package/network/services/dnsmasq/patches/300-remove-limit-hostname.patch
@@ -0,0 +1,13 @@
+Index: dnsmasq-2.85/src/rfc2131.c
+===================================================================
+--- dnsmasq-2.85.orig/src/rfc2131.c
++++ dnsmasq-2.85/src/rfc2131.c
+@@ -724,7 +724,7 @@ size_t dhcp_reply(struct dhcp_context *c
+ borken_opt = 1;
+ else
+ daemon->dhcp_buff[len] = 0;
+- if (legal_hostname(daemon->dhcp_buff))
++ // if (legal_hostname(daemon->dhcp_buff))
+ client_hostname = daemon->dhcp_buff;
+ }
+
--
2.25.1

View File

@ -0,0 +1,118 @@
From e3a5f05367ff7c8994b2b5c429bd06ef0751f473 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 13 Jul 2022 11:18:43 +0800
Subject: [PATCH] package/opkg: use db and standard output for conffile
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../system/opkg/patches/001-support-db.patch | 64 +++++++++++++++++++
.../002-conffile-use-standard-output.patch | 26 ++++++++
2 files changed, 90 insertions(+)
create mode 100644 package/system/opkg/patches/001-support-db.patch
create mode 100644 package/system/opkg/patches/002-conffile-use-standard-output.patch
diff --git a/package/system/opkg/patches/001-support-db.patch b/package/system/opkg/patches/001-support-db.patch
new file mode 100644
index 0000000000..ae8bfadc3f
--- /dev/null
+++ b/package/system/opkg/patches/001-support-db.patch
@@ -0,0 +1,64 @@
+Index: opkg-2021-06-13-1bf042dd/libopkg/opkg_cmd.c
+===================================================================
+--- opkg-2021-06-13-1bf042dd.orig/libopkg/opkg_cmd.c
++++ opkg-2021-06-13-1bf042dd/libopkg/opkg_cmd.c
+@@ -41,6 +41,29 @@
+ #include "opkg_configure.h"
+ #include "xsystem.h"
+
++int exec_command(const char *command)
++{
++ opkg_msg(NOTICE, "Updating database.\n");
++ remove("/var/lock/opkg.lock");
++
++ FILE *fp;
++
++ fp = popen(command, "r");
++ if (fp == NULL) {
++ return -1;
++ }
++ pclose(fp);
++
++ fp = fopen("/var/lock/opkg.lock", "w+");
++ if (fp != NULL) {
++ fclose(fp);
++ }
++
++ opkg_msg(NOTICE, "Database update completed.\n");
++
++ return 0;
++}
++
+ static void print_pkg(pkg_t * pkg)
+ {
+ char *version = pkg_version_str_alloc(pkg);
+@@ -201,6 +224,8 @@ static int opkg_update_cmd(int argc, cha
+ free(tmp);
+ free(lists_dir);
+
++ exec_command("update_plugins_db update");
++
+ return failures;
+ }
+
+@@ -487,6 +512,9 @@ static int opkg_install_cmd(int argc, ch
+
+ write_status_files_if_changed();
+
++ if (err == 0)
++ exec_command("update_plugins_db install");
++
+ return err;
+ }
+
+@@ -914,6 +942,10 @@ static int opkg_remove_cmd(int argc, cha
+ opkg_msg(NOTICE, "No packages removed.\n");
+
+ write_status_files_if_changed();
++
++ if (err == 0)
++ exec_command("update_plugins_db remove");
++
+ return err;
+ }
+
diff --git a/package/system/opkg/patches/002-conffile-use-standard-output.patch b/package/system/opkg/patches/002-conffile-use-standard-output.patch
new file mode 100644
index 0000000000..fbd5411f2f
--- /dev/null
+++ b/package/system/opkg/patches/002-conffile-use-standard-output.patch
@@ -0,0 +1,26 @@
+Index: opkg-2021-06-13-1bf042dd/libopkg/opkg_install.c
+===================================================================
+--- opkg-2021-06-13-1bf042dd.orig/libopkg/opkg_install.c
++++ opkg-2021-06-13-1bf042dd/libopkg/opkg_install.c
+@@ -1151,7 +1151,7 @@ static int resolve_conffiles(pkg_t * pkg
+ char *new_conffile;
+ sprintf_alloc(&new_conffile, "%s-opkg",
+ root_filename);
+- opkg_msg(ERROR,
++ opkg_msg(NOTICE,
+ "Existing conffile %s "
+ "is different from the conffile in the new package."
+ " The new conffile will be placed at %s.\n",
+Index: opkg-2021-06-13-1bf042dd/libopkg/pkg.c
+===================================================================
+--- opkg-2021-06-13-1bf042dd.orig/libopkg/pkg.c
++++ opkg-2021-06-13-1bf042dd/libopkg/pkg.c
+@@ -1409,7 +1409,7 @@ int pkg_run_script(pkg_t * pkg, const ch
+ return 0;
+ }
+
+- sprintf_alloc(&cmd, "%s %s", path, args);
++ sprintf_alloc(&cmd, "%s %s 2>&1", path, args);
+ free(path);
+ {
+ const char *argv[] = { "/bin/sh", "-c", cmd, NULL };
--
2.25.1

View File

@ -0,0 +1,97 @@
From bbd364177aa665041c09302c45a7d3a7ff4903a3 Mon Sep 17 00:00:00 2001
From: lincolnzh <hongjian.zhang@gl-inet.com>
Date: Mon, 17 Oct 2022 10:09:42 +0800
Subject: [PATCH] package/uclibc++: Fix the compilation error caused by the long road
---
...-buildsys-shorten-abi-deb-file-names.patch | 52 ++++++-------------
1 file changed, 15 insertions(+), 37 deletions(-)
diff --git a/package/libs/uclibc++/patches/006-buildsys-shorten-abi-deb-file-names.patch b/package/libs/uclibc++/patches/006-buildsys-shorten-abi-deb-file-names.patch
index 8a4677c709..5a4327fc2f 100644
--- a/package/libs/uclibc++/patches/006-buildsys-shorten-abi-deb-file-names.patch
+++ b/package/libs/uclibc++/patches/006-buildsys-shorten-abi-deb-file-names.patch
@@ -1,27 +1,7 @@
-From 6687fc9276fa52defaf8592f2001c19b826aec93 Mon Sep 17 00:00:00 2001
-From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-Date: Thu, 4 Jun 2020 10:21:43 +0200
-Subject: buildsys: shorten abi dep-file names
-
-certain crypto-layers encode required information in the
-filename hence crippling NAME_MAX from 255 down to about 143
-ascii chars.
-
-Since the dependency files of libgcc_eh and libsupc encode the full
-path to the corresponding libraries, the names of the dep files can
-get quite large. Shorten them by some (arbitrary, short) hash.
-
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
- Rules.mak | 2 ++
- src/abi/libgcc_eh/Makefile.in | 4 ++--
- src/abi/libsupc/Makefile.in | 4 ++--
- 3 files changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/Rules.mak b/Rules.mak
-index 1b5ed30..9162c64 100644
---- a/Rules.mak
-+++ b/Rules.mak
+Index: uClibc++-0.2.5/Rules.mak
+===================================================================
+--- uClibc++-0.2.5.orig/Rules.mak
++++ uClibc++-0.2.5/Rules.mak
@@ -50,6 +50,7 @@ RM = rm -f
TAR = tar
SED = sed
@@ -30,7 +10,7 @@ index 1b5ed30..9162c64 100644
ARFLAGS:= cr
-@@ -249,6 +250,7 @@ endif
+@@ -247,6 +248,7 @@ endif
list-archive-members = $(if $(1),$(shell $(AR) t $(1)))
variablify = $(strip $(subst /,_,$(subst :,_,$(subst ;,_,$(subst |,_,$(subst >,_,$(subst <,_,$(1))))))))
@@ -38,11 +18,11 @@ index 1b5ed30..9162c64 100644
GEN_LIBS:= -lc
ifneq ($(LIBGCC_DIR),$(UCLIBCXX_RUNTIME_LIBDIR))
-diff --git a/src/abi/libgcc_eh/Makefile.in b/src/abi/libgcc_eh/Makefile.in
-index 46b0017..1553b34 100644
---- a/src/abi/libgcc_eh/Makefile.in
-+++ b/src/abi/libgcc_eh/Makefile.in
-@@ -4,7 +4,7 @@ OBJS = $(call list-archive-members,$(LIBGCC_EH))
+Index: uClibc++-0.2.5/src/abi/libgcc_eh/Makefile.in
+===================================================================
+--- uClibc++-0.2.5.orig/src/abi/libgcc_eh/Makefile.in
++++ uClibc++-0.2.5/src/abi/libgcc_eh/Makefile.in
+@@ -4,7 +4,7 @@ OBJS = $(call list-archive-members,$(LIB
libgcc_eh-$(IMPORT_LIBGCC_EH) := $(OBJS)
LIBGCC_EH_VAR := $(call variablify,$(LIBGCC_EH))
@@ -60,11 +40,11 @@ index 46b0017..1553b34 100644
CLEAN_src/abi/libgcc_eh: ;
DISTCLEAN_src/abi/libgcc_eh:
-diff --git a/src/abi/libsupc/Makefile.in b/src/abi/libsupc/Makefile.in
-index 89e0e8a..9c00df0 100644
---- a/src/abi/libsupc/Makefile.in
-+++ b/src/abi/libsupc/Makefile.in
-@@ -5,7 +5,7 @@ OBJS-OMIT = $(filter new_op%.o del_op%.o pure.o new_handler.o eh_alloc.o eh_glob
+Index: uClibc++-0.2.5/src/abi/libsupc/Makefile.in
+===================================================================
+--- uClibc++-0.2.5.orig/src/abi/libsupc/Makefile.in
++++ uClibc++-0.2.5/src/abi/libsupc/Makefile.in
+@@ -5,7 +5,7 @@ OBJS-OMIT = $(filter new_op%.o del_op%.o
libsupc-$(IMPORT_LIBSUP) := $(filter-out $(OBJS-OMIT),$(OBJS))
LIBSUP_VAR := $(call variablify,$(LIBSUP))
@@ -82,5 +62,3 @@ index 89e0e8a..9c00df0 100644
CLEAN_src/abi/libsupc: ;
DISTCLEAN_src/abi/libsupc:
---
-cgit v1.2.3
--
2.17.1

View File

@ -0,0 +1,81 @@
From 89f43c62bfe56dd1c82508c54af5498a560f68c4 Mon Sep 17 00:00:00 2001
From: "GL.iNet-Po.Yang" <po.yang@gl-inet.com>
Date: Sat, 4 Feb 2023 10:05:06 +0800
Subject: [PATCH] dnsmasq supprot passthrough
---
.../patches/301-passthrough-dhcp.patch | 62 +++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 package/network/services/dnsmasq/patches/301-passthrough-dhcp.patch
diff --git a/package/network/services/dnsmasq/patches/301-passthrough-dhcp.patch b/package/network/services/dnsmasq/patches/301-passthrough-dhcp.patch
new file mode 100644
index 0000000000..ab8ccc27f4
--- /dev/null
+++ b/package/network/services/dnsmasq/patches/301-passthrough-dhcp.patch
@@ -0,0 +1,62 @@
+diff -Nur dnsmasq-origin/src/dnsmasq.h dnsmasq/src/dnsmasq.h
+--- dnsmasq-origin/src/dnsmasq.h 2023-01-30 17:49:13.377459744 +0800
++++ dnsmasq/src/dnsmasq.h 2023-01-30 17:56:57.036363102 +0800
+@@ -1183,6 +1183,7 @@
+ /* file for packet dumps. */
+ int dumpfd;
+ #endif
++ char *mode;
+ } *daemon;
+
+ /* cache.c */
+diff -Nur dnsmasq-origin/src/lease.c dnsmasq/src/lease.c
+--- dnsmasq-origin/src/lease.c 2023-01-30 17:49:13.369460136 +0800
++++ dnsmasq/src/lease.c 2023-01-30 17:56:57.032363215 +0800
+@@ -619,6 +619,10 @@
+ {
+ struct dhcp_lease *lease;
+
++ if((NULL != daemon->mode) && (0 == strcmp(daemon->mode,"passthrough"))){
++ return NULL;
++ }
++
+ for (lease = leases; lease; lease = lease->next)
+ {
+ #ifdef HAVE_DHCP6
+diff -Nur dnsmasq-origin/src/option.c dnsmasq/src/option.c
+--- dnsmasq-origin/src/option.c 2023-01-30 17:49:13.361460527 +0800
++++ dnsmasq/src/option.c 2023-01-30 17:56:57.032363215 +0800
+@@ -170,6 +170,7 @@
+ #define LOPT_PXE_VENDOR 361
+ #define LOPT_DYNHOST 362
+ #define LOPT_LOG_DEBUG 363
++#define LOPT_DHCP_MODE 364
+
+ #ifdef HAVE_GETOPT_LONG
+ static const struct option opts[] =
+@@ -345,6 +346,7 @@
+ { "dhcp-ignore-clid", 0, 0, LOPT_IGNORE_CLID },
+ { "dynamic-host", 1, 0, LOPT_DYNHOST },
+ { "log-debug", 0, 0, LOPT_LOG_DEBUG },
++ { "dhcp-mode", 1, 0, LOPT_DHCP_MODE },
+ { NULL, 0, 0, 0 }
+ };
+
+@@ -527,6 +529,7 @@
+ { LOPT_DUMPFILE, ARG_ONE, "<path>", gettext_noop("Path to debug packet dump file"), NULL },
+ { LOPT_DUMPMASK, ARG_ONE, "<hex>", gettext_noop("Mask which packets to dump"), NULL },
+ { LOPT_SCRIPT_TIME, OPT_LEASE_RENEW, NULL, gettext_noop("Call dhcp-script when lease expiry changes."), NULL },
++ { LOPT_DHCP_MODE, ARG_ONE, "<mode>", gettext_noop("Router or passthrough"), NULL },
+ { 0, 0, NULL, NULL, NULL }
+ };
+
+@@ -1999,6 +2002,9 @@
+ daemon->dump_mask = strtol(arg, NULL, 0);
+ break;
+
++ case LOPT_DHCP_MODE: /* --dhcp-mode */
++ daemon->mode = opt_string_alloc(arg);
++ break;
+ #ifdef HAVE_DHCP
+ case 'l': /* --dhcp-leasefile */
+ daemon->lease_file = opt_string_alloc(arg);
--
2.17.1

View File

@ -0,0 +1,60 @@
From ceb0aacfff2e39e837aa737f804e13312fe6c9af Mon Sep 17 00:00:00 2001
From: gl-dengxinfa <xinfa.deng@gl-inet.com>
Date: Fri, 10 Feb 2023 09:44:32 +0800
Subject: [PATCH] odhcpd add hotplug
---
.../patches/00-add-hotplug-for-relay.patch | 41 +++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 package/network/services/odhcpd/patches/00-add-hotplug-for-relay.patch
diff --git a/package/network/services/odhcpd/patches/00-add-hotplug-for-relay.patch b/package/network/services/odhcpd/patches/00-add-hotplug-for-relay.patch
new file mode 100644
index 0000000000..68e5c6bbd7
--- /dev/null
+++ b/package/network/services/odhcpd/patches/00-add-hotplug-for-relay.patch
@@ -0,0 +1,41 @@
+Index: src/ndp.c
+===================================================================
+--- a/src/ndp.c
++++ b/src/ndp.c
+@@ -322,6 +322,21 @@ static void send_na(struct in6_addr *to_
+ odhcpd_send(iface->ndp_ping_fd, &dest, &iov, 1, iface);
+ }
+
++static void call_hotplug(const char *ifname, const char *ip, const char *master_ifname)
++{
++ pid_t pid = fork();
++ if (pid < 0) {
++ perror("fork");
++ return;
++ } else if (pid == 0) {
++ setenv("ADDR", ip, 1);
++ setenv("INTERFACE", ifname, 1);
++ setenv("MASTER", master_ifname, 1);
++ execl("/sbin/hotplug-call", "hotplug-call", "dhcpv6", (char *)NULL);
++ }
++ return;
++}
++
+ /* Handle solicitations */
+ static void handle_solicit(void *addr, void *data, size_t len,
+ struct interface *iface, _unused void *dest)
+@@ -359,8 +374,12 @@ static void handle_solicit(void *addr, v
+
+ avl_for_each_element(&interfaces, c, avl) {
+ if (iface != c && c->ndp == MODE_RELAY &&
+- (ns_is_dad || !c->external))
+- ping6(&req->nd_ns_target, c);
++ (ns_is_dad || !c->external)) {
++ ping6(&req->nd_ns_target, c);
++ if (iface->ra == MODE_RELAY && !strcmp(iface->name, "lan")) {
++ call_hotplug(iface->name, ipbuf, c->name);
++ }
++ }
+ }
+
+ /* Catch global-addressed NS and answer them manually.
--
2.34.1

View File

@ -0,0 +1,45 @@
From 04b8b791664f77178d48756a67a3bf10636bc49f Mon Sep 17 00:00:00 2001
From: Hongjian Zhang <hongjian.zhang@gl-inet.com>
Date: Thu, 23 Mar 2023 09:26:29 +0800
Subject: [PATCH] Kernel: fix led netdev trigger
---
.../hack-5.4/931-fix-led-netdev-trigger.patch | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/931-fix-led-netdev-trigger.patch
diff --git a/target/linux/generic/hack-5.4/931-fix-led-netdev-trigger.patch b/target/linux/generic/hack-5.4/931-fix-led-netdev-trigger.patch
new file mode 100644
index 0000000000..e4b5950faf
--- /dev/null
+++ b/target/linux/generic/hack-5.4/931-fix-led-netdev-trigger.patch
@@ -0,0 +1,26 @@
+Index: b/drivers/leds/trigger/ledtrig-netdev.c
+===================================================================
+--- a/drivers/leds/trigger/ledtrig-netdev.c 2021-08-26 20:55:22.000000000 +0800
++++ b/drivers/leds/trigger/ledtrig-netdev.c 2021-09-18 16:00:16.427666394 +0800
+@@ -109,6 +109,7 @@ static ssize_t device_name_store(struct
+ size_t size)
+ {
+ struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
++ unsigned int flags;
+
+ if (size >= IFNAMSIZ)
+ return -EINVAL;
+@@ -132,9 +133,11 @@ static ssize_t device_name_store(struct
+ dev_get_by_name(&init_net, trigger_data->device_name);
+
+ clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode);
+- if (trigger_data->net_dev != NULL)
+- if (netif_carrier_ok(trigger_data->net_dev))
++ if (trigger_data->net_dev != NULL){
++ flags = dev_get_flags(trigger_data->net_dev);
++ if (flags & IFF_LOWER_UP)
+ set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode);
++ }
+
+ trigger_data->last_activity = 0;
+
--
2.17.1

View File

@ -0,0 +1,176 @@
From 585a68f603684a5b1cfe4551f5d8ccbe9f5fd6de Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Mon, 27 Jun 2022 15:04:37 +0800
Subject: [PATCH] kernel: add named gpio exports
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../941-GPIO-add-named-gpio-exports.patch | 156 ++++++++++++++++++
1 file changed, 156 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/941-GPIO-add-named-gpio-exports.patch
diff --git a/target/linux/generic/hack-5.4/941-GPIO-add-named-gpio-exports.patch b/target/linux/generic/hack-5.4/941-GPIO-add-named-gpio-exports.patch
new file mode 100644
index 0000000000..8bf2f9c011
--- /dev/null
+++ b/target/linux/generic/hack-5.4/941-GPIO-add-named-gpio-exports.patch
@@ -0,0 +1,156 @@
+--- a/drivers/gpio/gpiolib-of.c
++++ b/drivers/gpio/gpiolib-of.c
+@@ -19,6 +19,8 @@
+ #include <linux/pinctrl/pinctrl.h>
+ #include <linux/slab.h>
+ #include <linux/gpio/machine.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
+
+ #include "gpiolib.h"
+ #include "gpiolib-of.h"
+@@ -917,3 +919,72 @@ void of_gpiochip_remove(struct gpio_chip
+ {
+ of_node_put(chip->of_node);
+ }
++
++#ifdef CONFIG_GPIO_SYSFS
++
++static struct of_device_id gpio_export_ids[] = {
++ { .compatible = "gpio-export" },
++ { /* sentinel */ }
++};
++
++static int of_gpio_export_probe(struct platform_device *pdev)
++{
++ struct device_node *np = pdev->dev.of_node;
++ struct device_node *cnp;
++ u32 val;
++ int nb = 0;
++
++ for_each_child_of_node(np, cnp) {
++ const char *name = NULL;
++ int gpio;
++ bool dmc;
++ int max_gpio = 1;
++ int i;
++
++ of_property_read_string(cnp, "gpio-export,name", &name);
++
++ if (!name)
++ max_gpio = of_gpio_count(cnp);
++
++ for (i = 0; i < max_gpio; i++) {
++ unsigned flags = 0;
++ enum of_gpio_flags of_flags;
++
++ gpio = of_get_gpio_flags(cnp, i, &of_flags);
++ if (!gpio_is_valid(gpio))
++ return gpio;
++
++ if (of_flags == OF_GPIO_ACTIVE_LOW)
++ flags |= GPIOF_ACTIVE_LOW;
++
++ if (!of_property_read_u32(cnp, "gpio-export,output", &val))
++ flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
++ else
++ flags |= GPIOF_IN;
++
++ if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np)))
++ continue;
++
++ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change");
++ gpio_export_with_name(gpio, dmc, name);
++ nb++;
++ }
++ }
++
++ dev_info(&pdev->dev, "%d gpio(s) exported\n", nb);
++
++ return 0;
++}
++
++static struct platform_driver gpio_export_driver = {
++ .driver = {
++ .name = "gpio-export",
++ .owner = THIS_MODULE,
++ .of_match_table = of_match_ptr(gpio_export_ids),
++ },
++ .probe = of_gpio_export_probe,
++};
++
++module_platform_driver(gpio_export_driver);
++
++#endif
+--- a/drivers/gpio/gpiolib-sysfs.c
++++ b/drivers/gpio/gpiolib-sysfs.c
+@@ -571,7 +571,7 @@ static struct class gpio_class = {
+ *
+ * Returns zero on success, else an error.
+ */
+-int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
++int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name)
+ {
+ struct gpio_chip *chip;
+ struct gpio_device *gdev;
+@@ -633,6 +633,8 @@ int gpiod_export(struct gpio_desc *desc,
+ offset = gpio_chip_hwgpio(desc);
+ if (chip->names && chip->names[offset])
+ ioname = chip->names[offset];
++ if (name)
++ ioname = name;
+
+ dev = device_create_with_groups(&gpio_class, &gdev->dev,
+ MKDEV(0, 0), data, gpio_groups,
+@@ -654,6 +656,12 @@ err_unlock:
+ gpiod_dbg(desc, "%s: status %d\n", __func__, status);
+ return status;
+ }
++EXPORT_SYMBOL_GPL(__gpiod_export);
++
++int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
++{
++ return __gpiod_export(desc, direction_may_change, NULL);
++}
+ EXPORT_SYMBOL_GPL(gpiod_export);
+
+ static int match_export(struct device *dev, const void *desc)
+--- a/include/asm-generic/gpio.h
++++ b/include/asm-generic/gpio.h
+@@ -127,6 +127,12 @@ static inline int gpio_export(unsigned g
+ return gpiod_export(gpio_to_desc(gpio), direction_may_change);
+ }
+
++int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
++static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name)
++{
++ return __gpiod_export(gpio_to_desc(gpio), direction_may_change, name);
++}
++
+ static inline int gpio_export_link(struct device *dev, const char *name,
+ unsigned gpio)
+ {
+--- a/include/linux/gpio/consumer.h
++++ b/include/linux/gpio/consumer.h
+@@ -668,6 +668,7 @@ static inline void devm_acpi_dev_remove_
+
+ #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
+
++int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
+ int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
+ int gpiod_export_link(struct device *dev, const char *name,
+ struct gpio_desc *desc);
+@@ -675,6 +676,13 @@ void gpiod_unexport(struct gpio_desc *de
+
+ #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
+
++static inline int _gpiod_export(struct gpio_desc *desc,
++ bool direction_may_change,
++ const char *name)
++{
++ return -ENOSYS;
++}
++
+ static inline int gpiod_export(struct gpio_desc *desc,
+ bool direction_may_change)
+ {
--
2.34.1

View File

@ -0,0 +1,239 @@
From e088178286775d64db5d297e233d4753c44dc6fb Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Thu, 7 Jul 2022 15:18:12 +0800
Subject: [PATCH] wireguard: support hotplug for gl
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Signed-off-by: Dongming Han <handongming@gl-inet.com>
---
.../950-wireguard-support-hotplug.patch | 156 ++++++++++++++++++
...d-server-not-do-handshake-initiation.patch | 21 +++
...MEOUT-hotplug-after-3-consecutive-fa.patch | 25 +++
3 files changed, 202 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/950-wireguard-support-hotplug.patch
create mode 100644 target/linux/generic/hack-5.4/951-make-wireguard-server-not-do-handshake-initiation.patch
create mode 100644 target/linux/generic/hack-5.4/951-trigger-REKEY_TIMEOUT-hotplug-after-3-consecutive-fa.patch
diff --git a/target/linux/generic/hack-5.4/950-wireguard-support-hotplug.patch b/target/linux/generic/hack-5.4/950-wireguard-support-hotplug.patch
new file mode 100644
index 0000000000..cadd51e9c8
--- /dev/null
+++ b/target/linux/generic/hack-5.4/950-wireguard-support-hotplug.patch
@@ -0,0 +1,156 @@
+--- a/drivers/net/wireguard/Makefile
++++ b/drivers/net/wireguard/Makefile
+@@ -14,4 +14,5 @@ wireguard-y += allowedips.o
+ wireguard-y += ratelimiter.o
+ wireguard-y += cookie.o
+ wireguard-y += netlink.o
++wireguard-y += hotplug.o
+ obj-$(CONFIG_WIREGUARD) := wireguard.o
+--- /dev/null
++++ b/drivers/net/wireguard/hotplug.c
+@@ -0,0 +1,82 @@
++#include <linux/workqueue.h>
++#include <linux/netlink.h>
++#include <linux/kobject.h>
++#include <linux/skbuff.h>
++#include <linux/if.h>
++
++#define SUBSYSTEM_NAME "wireguard"
++
++#define EVENT_BUF_SIZE 2048
++
++struct wg_event {
++ struct work_struct work;
++ char ifname[IFNAMSIZ];
++ const char *action;
++};
++
++
++/* -------------------------------------------------------------------------*/
++static int bh_event_add_var(struct sk_buff *skb, int argv,
++ const char *format, ...)
++{
++ static char buf[128];
++ char *s;
++ va_list args;
++ int len;
++
++ if (argv)
++ return 0;
++
++ va_start(args, format);
++ len = vsnprintf(buf, sizeof(buf), format, args);
++ va_end(args);
++
++ if (len >= sizeof(buf)) {
++ //WARN(1, "buffer size too small\n");
++ return -ENOMEM;
++ }
++
++ s = skb_put(skb, len + 1);
++ strcpy(s, buf);
++
++ return 0;
++}
++
++static void hotplug_work(struct work_struct *work)
++{
++ struct wg_event *event = container_of(work, struct wg_event, work);
++ struct sk_buff *skb;
++
++ skb = alloc_skb(EVENT_BUF_SIZE, GFP_KERNEL);
++ if (!skb)
++ goto out_free_event;
++
++ bh_event_add_var(skb, 0, "SUBSYSTEM=%s", SUBSYSTEM_NAME);
++ bh_event_add_var(skb, 0, "ACTION=%s", event->action);
++ bh_event_add_var(skb, 0, "ifname=%s", event->ifname);
++
++ NETLINK_CB(skb).dst_group = 1;
++ broadcast_uevent(skb, 0, 1, GFP_KERNEL);
++
++out_free_event:
++ kfree(event);
++}
++
++void wireguard_hotplug(const char *ifname, const char *action)
++{
++ struct wg_event *event;
++
++ if (!strcmp(ifname, "wgserver"))
++ return;
++
++ event = kzalloc(sizeof(struct wg_event), GFP_ATOMIC);
++ if (!event)
++ return;
++
++ memcpy(event->ifname, ifname, IFNAMSIZ);
++
++ event->action = action;
++
++ INIT_WORK(&event->work, hotplug_work);
++ schedule_work(&event->work);
++}
+--- /dev/null
++++ b/drivers/net/wireguard/hotplug.h
+@@ -0,0 +1,13 @@
++#ifndef __HOTPLUG_H__
++#define __HOTPLUG_H__
++
++#define REKEY_GIVEUP_EVENT "REKEY-GIVEUP"
++#define REKEY_TIMEOUT_EVENT "REKEY-TIMEOUT"
++#define KEYPAIR_CREATED_EVENT "KEYPAIR-CREATED"
++
++extern void wireguard_hotplug(const char *ifname, const char *action);
++extern void wg_hotplug_init(void);
++extern void wg_hotplug_free(void);
++
++#endif
++
+--- a/drivers/net/wireguard/noise.c
++++ b/drivers/net/wireguard/noise.c
+@@ -9,6 +9,7 @@
+ #include "messages.h"
+ #include "queueing.h"
+ #include "peerlookup.h"
++#include "hotplug.h"
+
+ #include <linux/rcupdate.h>
+ #include <linux/slab.h>
+@@ -850,6 +851,8 @@ bool wg_noise_handshake_begin_session(st
+ ret = wg_index_hashtable_replace(
+ handshake->entry.peer->device->index_hashtable,
+ &handshake->entry, &new_keypair->entry);
++
++ wireguard_hotplug(handshake->entry.peer->device->dev->name, KEYPAIR_CREATED_EVENT);
+ } else {
+ kzfree(new_keypair);
+ }
+--- a/drivers/net/wireguard/timers.c
++++ b/drivers/net/wireguard/timers.c
+@@ -8,6 +8,7 @@
+ #include "peer.h"
+ #include "queueing.h"
+ #include "socket.h"
++#include "hotplug.h"
+
+ /*
+ * - Timer for retransmitting the handshake if we don't hear back after
+@@ -60,6 +61,8 @@ static void wg_expired_retransmit_handsh
+ if (!timer_pending(&peer->timer_zero_key_material))
+ mod_peer_timer(peer, &peer->timer_zero_key_material,
+ jiffies + REJECT_AFTER_TIME * 3 * HZ);
++
++ wireguard_hotplug(peer->device->dev->name, REKEY_GIVEUP_EVENT);
+ } else {
+ ++peer->timer_handshake_attempts;
+ pr_debug("%s: Handshake for peer %llu (%pISpfsc) did not complete after %d seconds, retrying (try %d)\n",
+@@ -73,6 +76,8 @@ static void wg_expired_retransmit_handsh
+ wg_socket_clear_peer_endpoint_src(peer);
+
+ wg_packet_send_queued_handshake_initiation(peer, true);
++
++ wireguard_hotplug(peer->device->dev->name, REKEY_TIMEOUT_EVENT);
+ }
+ }
+
diff --git a/target/linux/generic/hack-5.4/951-make-wireguard-server-not-do-handshake-initiation.patch b/target/linux/generic/hack-5.4/951-make-wireguard-server-not-do-handshake-initiation.patch
new file mode 100644
index 0000000000..a3db60aada
--- /dev/null
+++ b/target/linux/generic/hack-5.4/951-make-wireguard-server-not-do-handshake-initiation.patch
@@ -0,0 +1,21 @@
+From 8bfdfc1e0546835e25ae011053ae4e52583d8220 Mon Sep 17 00:00:00 2001
+From: Dongming Han <handongming@gl-inet.com>
+Date: Wed, 1 Feb 2023 19:14:16 +0800
+Subject: [PATCH] make wireguard server not do handshake initiation
+
+---
+ drivers/net/wireguard/send.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/wireguard/send.c
++++ b/drivers/net/wireguard/send.c
+@@ -22,6 +22,9 @@ static void wg_packet_send_handshake_ini
+ {
+ struct message_handshake_initiation packet;
+
++ if (!strncmp(peer->device->dev->name, "wgs", 3))
++ return;
++
+ if (!wg_birthdate_has_expired(atomic64_read(&peer->last_sent_handshake),
+ REKEY_TIMEOUT))
+ return; /* This function is rate limited. */
diff --git a/target/linux/generic/hack-5.4/951-trigger-REKEY_TIMEOUT-hotplug-after-3-consecutive-fa.patch b/target/linux/generic/hack-5.4/951-trigger-REKEY_TIMEOUT-hotplug-after-3-consecutive-fa.patch
new file mode 100644
index 0000000000..49a1301111
--- /dev/null
+++ b/target/linux/generic/hack-5.4/951-trigger-REKEY_TIMEOUT-hotplug-after-3-consecutive-fa.patch
@@ -0,0 +1,25 @@
+From 82d7f8de2a1b640b5545976e495b16911a105fa2 Mon Sep 17 00:00:00 2001
+From: Dongming Han <handongming@gl-inet.com>
+Date: Wed, 1 Feb 2023 19:11:20 +0800
+Subject: [PATCH] trigger REKEY_TIMEOUT hotplug after 3 consecutive failure of
+ handshake initiation
+
+detect disconnect time change from 0 ~ 2min to 15s ~ 2min15s
+Optimize the stability in packet loss environment
+---
+ drivers/net/wireguard/timers.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/wireguard/timers.c
++++ b/drivers/net/wireguard/timers.c
+@@ -76,8 +76,8 @@ static void wg_expired_retransmit_handsh
+ wg_socket_clear_peer_endpoint_src(peer);
+
+ wg_packet_send_queued_handshake_initiation(peer, true);
+-
+- wireguard_hotplug(peer->device->dev->name, REKEY_TIMEOUT_EVENT);
++ if(peer->timer_handshake_attempts > 3)
++ wireguard_hotplug(peer->device->dev->name, REKEY_TIMEOUT_EVENT);
+ }
+ }
+
--
2.34.1

View File

@ -0,0 +1,923 @@
From d3356e2dc7a28d315bf950f7c691766acc2b37f8 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Fri, 19 May 2023 11:04:29 +0800
Subject: [PATCH] kernel: backport rtl8221b from openwrt master
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../hack-5.4/961-backport-rtl8221b.patch | 903 ++++++++++++++++++
1 file changed, 903 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/961-backport-rtl8221b.patch
diff --git a/target/linux/generic/hack-5.4/961-backport-rtl8221b.patch b/target/linux/generic/hack-5.4/961-backport-rtl8221b.patch
new file mode 100644
index 0000000000..0b53a146cf
--- /dev/null
+++ b/target/linux/generic/hack-5.4/961-backport-rtl8221b.patch
@@ -0,0 +1,903 @@
+--- a/drivers/net/phy/realtek.c
++++ b/drivers/net/phy/realtek.c
+@@ -1,6 +1,5 @@
+ // SPDX-License-Identifier: GPL-2.0+
+-/*
+- * drivers/net/phy/realtek.c
++/* drivers/net/phy/realtek.c
+ *
+ * Driver for Realtek PHYs
+ *
+@@ -9,8 +8,10 @@
+ * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ */
+ #include <linux/bitops.h>
++#include <linux/of.h>
+ #include <linux/phy.h>
+ #include <linux/module.h>
++#include <linux/delay.h>
+
+ #define RTL821x_PHYSR 0x11
+ #define RTL821x_PHYSR_DUPLEX BIT(13)
+@@ -26,26 +27,56 @@
+ #define RTL821x_EXT_PAGE_SELECT 0x1e
+ #define RTL821x_PAGE_SELECT 0x1f
+
++#define RTL8211F_PHYCR1 0x18
++#define RTL8211F_PHYCR2 0x19
+ #define RTL8211F_INSR 0x1d
+
+ #define RTL8211F_TX_DELAY BIT(8)
+-#define RTL8211E_TX_DELAY BIT(1)
+-#define RTL8211E_RX_DELAY BIT(2)
+-#define RTL8211E_MODE_MII_GMII BIT(3)
++#define RTL8211F_RX_DELAY BIT(3)
++
++#define RTL8211F_ALDPS_PLL_OFF BIT(1)
++#define RTL8211F_ALDPS_ENABLE BIT(2)
++#define RTL8211F_ALDPS_XTAL_OFF BIT(12)
++
++#define RTL8211E_CTRL_DELAY BIT(13)
++#define RTL8211E_TX_DELAY BIT(12)
++#define RTL8211E_RX_DELAY BIT(11)
++
++#define RTL8211F_CLKOUT_EN BIT(0)
+
+ #define RTL8201F_ISR 0x1e
++#define RTL8201F_ISR_ANERR BIT(15)
++#define RTL8201F_ISR_DUPLEX BIT(13)
++#define RTL8201F_ISR_LINK BIT(11)
++#define RTL8201F_ISR_MASK (RTL8201F_ISR_ANERR | \
++ RTL8201F_ISR_DUPLEX | \
++ RTL8201F_ISR_LINK)
+ #define RTL8201F_IER 0x13
+
++#define RTL8221B_MMD_SERDES_CTRL MDIO_MMD_VEND1
++#define RTL8221B_MMD_PHY_CTRL MDIO_MMD_VEND2
++#define RTL8221B_SERDES_OPTION 0x697a
++#define RTL8221B_SERDES_OPTION_MODE_MASK GENMASK(5, 0)
++#define RTL8221B_SERDES_OPTION_MODE_2500BASEX_SGMII 0
++#define RTL8221B_SERDES_OPTION_MODE_HISGMII_SGMII 1
++#define RTL8221B_SERDES_OPTION_MODE_2500BASEX 2
++#define RTL8221B_SERDES_OPTION_MODE_HISGMII 3
++
++#define RTL8221B_PHYCR1 0xa430
++#define RTL8221B_PHYCR1_ALDPS_EN BIT(2)
++#define RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN BIT(12)
++
+ #define RTL8366RB_POWER_SAVE 0x15
+ #define RTL8366RB_POWER_SAVE_ON BIT(12)
+
+ #define RTL_SUPPORTS_5000FULL BIT(14)
+ #define RTL_SUPPORTS_2500FULL BIT(13)
+ #define RTL_SUPPORTS_10000FULL BIT(0)
+-#define RTL_ADV_2500FULL BIT(7)
+-#define RTL_LPADV_10000FULL BIT(11)
+-#define RTL_LPADV_5000FULL BIT(6)
+-#define RTL_LPADV_2500FULL BIT(5)
++
++#define RTL9000A_GINMR 0x14
++#define RTL9000A_GINMR_LINK_STATUS BIT(4)
++
++#define RTLGEN_SPEED_MASK 0x0630
+
+ #define RTL_GENERIC_PHYID 0x001cc800
+
+@@ -53,6 +84,11 @@ MODULE_DESCRIPTION("Realtek PHY driver")
+ MODULE_AUTHOR("Johnson Leung");
+ MODULE_LICENSE("GPL");
+
++struct rtl821x_priv {
++ u16 phycr1;
++ u16 phycr2;
++};
++
+ static int rtl821x_read_page(struct phy_device *phydev)
+ {
+ return __phy_read(phydev, RTL821x_PAGE_SELECT);
+@@ -63,6 +99,37 @@ static int rtl821x_write_page(struct phy
+ return __phy_write(phydev, RTL821x_PAGE_SELECT, page);
+ }
+
++static int rtl821x_probe(struct phy_device *phydev)
++{
++ struct device *dev = &phydev->mdio.dev;
++ struct rtl821x_priv *priv;
++ int ret;
++
++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
++ if (!priv)
++ return -ENOMEM;
++
++ ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR1);
++ if (ret < 0)
++ return ret;
++
++ priv->phycr1 = ret & (RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF);
++ if (of_property_read_bool(dev->of_node, "realtek,aldps-enable"))
++ priv->phycr1 |= RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF;
++
++ ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR2);
++ if (ret < 0)
++ return ret;
++
++ priv->phycr2 = ret & RTL8211F_CLKOUT_EN;
++ if (of_property_read_bool(dev->of_node, "realtek,clkout-disable"))
++ priv->phycr2 &= ~RTL8211F_CLKOUT_EN;
++
++ phydev->priv = priv;
++
++ return 0;
++}
++
+ static int rtl8201_ack_interrupt(struct phy_device *phydev)
+ {
+ int err;
+@@ -93,24 +160,45 @@ static int rtl8211f_ack_interrupt(struct
+ static int rtl8201_config_intr(struct phy_device *phydev)
+ {
+ u16 val;
++ int err;
++
++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
++ err = rtl8201_ack_interrupt(phydev);
++ if (err)
++ return err;
+
+- if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+ val = BIT(13) | BIT(12) | BIT(11);
+- else
++ err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
++ } else {
+ val = 0;
++ err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
++ if (err)
++ return err;
+
+- return phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
++ err = rtl8201_ack_interrupt(phydev);
++ }
++
++ return err;
+ }
+
+ static int rtl8211b_config_intr(struct phy_device *phydev)
+ {
+ int err;
+
+- if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
++ err = rtl821x_ack_interrupt(phydev);
++ if (err)
++ return err;
++
+ err = phy_write(phydev, RTL821x_INER,
+ RTL8211B_INER_INIT);
+- else
++ } else {
+ err = phy_write(phydev, RTL821x_INER, 0);
++ if (err)
++ return err;
++
++ err = rtl821x_ack_interrupt(phydev);
++ }
+
+ return err;
+ }
+@@ -119,11 +207,20 @@ static int rtl8211e_config_intr(struct p
+ {
+ int err;
+
+- if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
++ err = rtl821x_ack_interrupt(phydev);
++ if (err)
++ return err;
++
+ err = phy_write(phydev, RTL821x_INER,
+ RTL8211E_INER_LINK_STATUS);
+- else
++ } else {
+ err = phy_write(phydev, RTL821x_INER, 0);
++ if (err)
++ return err;
++
++ err = rtl821x_ack_interrupt(phydev);
++ }
+
+ return err;
+ }
+@@ -131,13 +228,85 @@ static int rtl8211e_config_intr(struct p
+ static int rtl8211f_config_intr(struct phy_device *phydev)
+ {
+ u16 val;
++ int err;
++
++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
++ err = rtl8211f_ack_interrupt(phydev);
++ if (err)
++ return err;
+
+- if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+ val = RTL8211F_INER_LINK_STATUS;
+- else
++ err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val);
++ } else {
+ val = 0;
++ err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val);
++ if (err)
++ return err;
++
++ err = rtl8211f_ack_interrupt(phydev);
++ }
+
+- return phy_write_paged(phydev, 0xa42, RTL821x_INER, val);
++ return err;
++}
++
++static int rtl8201_handle_interrupt(struct phy_device *phydev)
++{
++ int irq_status;
++
++ irq_status = phy_read(phydev, RTL8201F_ISR);
++ if (irq_status < 0) {
++ phydev_err(phydev, "Err: read RTL8201F_ISR: %d\n", irq_status);
++ return -1;
++ }
++
++ if (!(irq_status & RTL8201F_ISR_MASK))
++ return -1;
++
++ phy_queue_state_machine(phydev, 0);
++
++ return 0;
++}
++
++static int rtl821x_handle_interrupt(struct phy_device *phydev)
++{
++ int irq_status, irq_enabled;
++
++ irq_status = phy_read(phydev, RTL821x_INSR);
++ if (irq_status < 0) {
++ phydev_err(phydev, "Err: read RTL821x_INSR: %d\n", irq_status);
++ return -1;
++ }
++
++ irq_enabled = phy_read(phydev, RTL821x_INER);
++ if (irq_enabled < 0) {
++ phydev_err(phydev, "Err: read RTL821x_INER: %d\n", irq_enabled);
++ return -1;
++ }
++
++ if (!(irq_status & irq_enabled))
++ return -1;
++
++ phy_queue_state_machine(phydev, 0);
++
++ return 0;
++}
++
++static int rtl8211f_handle_interrupt(struct phy_device *phydev)
++{
++ int irq_status;
++
++ irq_status = phy_read_paged(phydev, 0xa43, RTL8211F_INSR);
++ if (irq_status < 0) {
++ phydev_err(phydev, "Err: read RTL8211F_INSR: %d\n", irq_status);
++ return -1;
++ }
++
++ if (!(irq_status & RTL8211F_INER_LINK_STATUS))
++ return -1;
++
++ phy_queue_state_machine(phydev, 0);
++
++ return 0;
+ }
+
+ static int rtl8211_config_aneg(struct phy_device *phydev)
+@@ -171,41 +340,96 @@ static int rtl8211c_config_init(struct p
+
+ static int rtl8211f_config_init(struct phy_device *phydev)
+ {
++ struct rtl821x_priv *priv = phydev->priv;
+ struct device *dev = &phydev->mdio.dev;
+- u16 val;
++ u16 val_txdly, val_rxdly;
+ int ret;
+
+- /* enable TX-delay for rgmii-{id,txid}, and disable it for rgmii and
+- * rgmii-rxid. The RX-delay can be enabled by the external RXDLY pin.
+- */
++ ret = phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1,
++ RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF,
++ priv->phycr1);
++ if (ret < 0) {
++ dev_err(dev, "aldps mode configuration failed: %pe\n",
++ ERR_PTR(ret));
++ return ret;
++ }
++
+ switch (phydev->interface) {
+ case PHY_INTERFACE_MODE_RGMII:
++ val_txdly = 0;
++ val_rxdly = 0;
++ break;
++
+ case PHY_INTERFACE_MODE_RGMII_RXID:
+- val = 0;
++ val_txdly = 0;
++ val_rxdly = RTL8211F_RX_DELAY;
+ break;
+- case PHY_INTERFACE_MODE_RGMII_ID:
++
+ case PHY_INTERFACE_MODE_RGMII_TXID:
+- val = RTL8211F_TX_DELAY;
++ val_txdly = RTL8211F_TX_DELAY;
++ val_rxdly = 0;
+ break;
++
++ case PHY_INTERFACE_MODE_RGMII_ID:
++ val_txdly = RTL8211F_TX_DELAY;
++ val_rxdly = RTL8211F_RX_DELAY;
++ break;
++
+ default: /* the rest of the modes imply leaving delay as is. */
+ return 0;
+ }
+
+ ret = phy_modify_paged_changed(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY,
+- val);
++ val_txdly);
+ if (ret < 0) {
+ dev_err(dev, "Failed to update the TX delay register\n");
+ return ret;
+ } else if (ret) {
+ dev_dbg(dev,
+ "%s 2ns TX delay (and changing the value from pin-strapping RXD1 or the bootloader)\n",
+- val ? "Enabling" : "Disabling");
++ val_txdly ? "Enabling" : "Disabling");
+ } else {
+ dev_dbg(dev,
+ "2ns TX delay was already %s (by pin-strapping RXD1 or bootloader configuration)\n",
+- val ? "enabled" : "disabled");
++ val_txdly ? "enabled" : "disabled");
++ }
++
++ ret = phy_modify_paged_changed(phydev, 0xd08, 0x15, RTL8211F_RX_DELAY,
++ val_rxdly);
++ if (ret < 0) {
++ dev_err(dev, "Failed to update the RX delay register\n");
++ return ret;
++ } else if (ret) {
++ dev_dbg(dev,
++ "%s 2ns RX delay (and changing the value from pin-strapping RXD0 or the bootloader)\n",
++ val_rxdly ? "Enabling" : "Disabling");
++ } else {
++ dev_dbg(dev,
++ "2ns RX delay was already %s (by pin-strapping RXD0 or bootloader configuration)\n",
++ val_rxdly ? "enabled" : "disabled");
+ }
+
++ ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2,
++ RTL8211F_CLKOUT_EN, priv->phycr2);
++ if (ret < 0) {
++ dev_err(dev, "clkout configuration failed: %pe\n",
++ ERR_PTR(ret));
++ return ret;
++ }
++
++ return genphy_soft_reset(phydev);
++}
++
++static int rtl821x_resume(struct phy_device *phydev)
++{
++ int ret;
++
++ ret = genphy_resume(phydev);
++ if (ret < 0)
++ return ret;
++
++ msleep(20);
++
+ return 0;
+ }
+
+@@ -217,16 +441,16 @@ static int rtl8211e_config_init(struct p
+ /* enable TX/RX delay for rgmii-* modes, and disable them for rgmii. */
+ switch (phydev->interface) {
+ case PHY_INTERFACE_MODE_RGMII:
+- val = 0;
++ val = RTL8211E_CTRL_DELAY | 0;
+ break;
+ case PHY_INTERFACE_MODE_RGMII_ID:
+- val = RTL8211E_TX_DELAY | RTL8211E_RX_DELAY;
++ val = RTL8211E_CTRL_DELAY | RTL8211E_TX_DELAY | RTL8211E_RX_DELAY;
+ break;
+ case PHY_INTERFACE_MODE_RGMII_RXID:
+- val = RTL8211E_RX_DELAY;
++ val = RTL8211E_CTRL_DELAY | RTL8211E_RX_DELAY;
+ break;
+ case PHY_INTERFACE_MODE_RGMII_TXID:
+- val = RTL8211E_TX_DELAY;
++ val = RTL8211E_CTRL_DELAY | RTL8211E_TX_DELAY;
+ break;
+ default: /* the rest of the modes imply leaving delays as is. */
+ return 0;
+@@ -234,11 +458,12 @@ static int rtl8211e_config_init(struct p
+
+ /* According to a sample driver there is a 0x1c config register on the
+ * 0xa4 extension page (0x7) layout. It can be used to disable/enable
+- * the RX/TX delays otherwise controlled by RXDLY/TXDLY pins. It can
+- * also be used to customize the whole configuration register:
+- * 8:6 = PHY Address, 5:4 = Auto-Negotiation, 3 = Interface Mode Select,
+- * 2 = RX Delay, 1 = TX Delay, 0 = SELRGV (see original PHY datasheet
+- * for details).
++ * the RX/TX delays otherwise controlled by RXDLY/TXDLY pins.
++ * The configuration register definition:
++ * 14 = reserved
++ * 13 = Force Tx RX Delay controlled by bit12 bit11,
++ * 12 = RX Delay, 11 = TX Delay
++ * 10:0 = Test && debug settings reserved by realtek
+ */
+ oldpage = phy_select_page(phydev, 0x7);
+ if (oldpage < 0)
+@@ -248,7 +473,8 @@ static int rtl8211e_config_init(struct p
+ if (ret)
+ goto err_restore_page;
+
+- ret = __phy_modify(phydev, 0x1c, RTL8211E_TX_DELAY | RTL8211E_RX_DELAY,
++ ret = __phy_modify(phydev, 0x1c, RTL8211E_CTRL_DELAY
++ | RTL8211E_TX_DELAY | RTL8211E_RX_DELAY,
+ val);
+
+ err_restore_page:
+@@ -269,18 +495,53 @@ static int rtl8211b_resume(struct phy_de
+ return genphy_resume(phydev);
+ }
+
+-static int rtl8366rb_config_init(struct phy_device *phydev)
++/* get actual speed to cover the downshift case */
++static int rtlgen_get_speed(struct phy_device *phydev)
+ {
+- int ret;
++ int val;
+
+- ret = phy_set_bits(phydev, RTL8366RB_POWER_SAVE,
+- RTL8366RB_POWER_SAVE_ON);
+- if (ret) {
+- dev_err(&phydev->mdio.dev,
+- "error enabling power management\n");
++ if (!phydev->link)
++ return 0;
++
++ val = phy_read_paged(phydev, 0xa43, 0x12);
++ if (val < 0)
++ return val;
++
++ switch (val & RTLGEN_SPEED_MASK) {
++ case 0x0000:
++ phydev->speed = SPEED_10;
++ break;
++ case 0x0010:
++ phydev->speed = SPEED_100;
++ break;
++ case 0x0020:
++ phydev->speed = SPEED_1000;
++ break;
++ case 0x0200:
++ phydev->speed = SPEED_10000;
++ break;
++ case 0x0210:
++ phydev->speed = SPEED_2500;
++ break;
++ case 0x0220:
++ phydev->speed = SPEED_5000;
++ break;
++ default:
++ break;
+ }
+
+- return ret;
++ return 0;
++}
++
++static int rtlgen_read_status(struct phy_device *phydev)
++{
++ int ret;
++
++ ret = genphy_read_status(phydev);
++ if (ret < 0)
++ return ret;
++
++ return rtlgen_get_speed(phydev);
+ }
+
+ static int rtlgen_read_mmd(struct phy_device *phydev, int devnum, u16 regnum)
+@@ -322,7 +583,7 @@ static int rtlgen_write_mmd(struct phy_d
+ return ret;
+ }
+
+-static int rtl8125_read_mmd(struct phy_device *phydev, int devnum, u16 regnum)
++static int rtl822x_read_mmd(struct phy_device *phydev, int devnum, u16 regnum)
+ {
+ int ret = rtlgen_read_mmd(phydev, devnum, regnum);
+
+@@ -346,7 +607,7 @@ static int rtl8125_read_mmd(struct phy_d
+ return ret;
+ }
+
+-static int rtl8125_write_mmd(struct phy_device *phydev, int devnum, u16 regnum,
++static int rtl822x_write_mmd(struct phy_device *phydev, int devnum, u16 regnum,
+ u16 val)
+ {
+ int ret = rtlgen_write_mmd(phydev, devnum, regnum, val);
+@@ -363,7 +624,7 @@ static int rtl8125_write_mmd(struct phy_
+ return ret;
+ }
+
+-static int rtl8125_get_features(struct phy_device *phydev)
++static int rtl822x_get_features(struct phy_device *phydev)
+ {
+ int val;
+
+@@ -381,19 +642,16 @@ static int rtl8125_get_features(struct p
+ return genphy_read_abilities(phydev);
+ }
+
+-static int rtl8125_config_aneg(struct phy_device *phydev)
++static int rtl822x_config_aneg(struct phy_device *phydev)
+ {
+ int ret = 0;
+
+ if (phydev->autoneg == AUTONEG_ENABLE) {
+- u16 adv2500 = 0;
+-
+- if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
+- phydev->advertising))
+- adv2500 = RTL_ADV_2500FULL;
+-
+ ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12,
+- RTL_ADV_2500FULL, adv2500);
++ MDIO_AN_10GBT_CTRL_ADV10G |
++ MDIO_AN_10GBT_CTRL_ADV5G |
++ MDIO_AN_10GBT_CTRL_ADV2_5G,
++ linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising));
+ if (ret < 0)
+ return ret;
+ }
+@@ -401,32 +659,61 @@ static int rtl8125_config_aneg(struct ph
+ return __genphy_config_aneg(phydev, ret);
+ }
+
+-static int rtl8125_read_status(struct phy_device *phydev)
++static void rtl822x_update_interface(struct phy_device *phydev)
++{
++ /* Automatically switch SERDES interface between
++ * SGMII and 2500-BaseX according to speed.
++ */
++ switch (phydev->speed) {
++ case SPEED_2500:
++ phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
++ break;
++ case SPEED_1000:
++ case SPEED_100:
++ case SPEED_10:
++ phydev->interface = PHY_INTERFACE_MODE_SGMII;
++ break;
++ default:
++ break;
++ }
++}
++
++static int rtl822x_read_status(struct phy_device *phydev)
+ {
++ int ret;
++
+ if (phydev->autoneg == AUTONEG_ENABLE) {
+ int lpadv = phy_read_paged(phydev, 0xa5d, 0x13);
+
+ if (lpadv < 0)
+ return lpadv;
+
+- linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
+- phydev->lp_advertising, lpadv & RTL_LPADV_10000FULL);
+- linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
+- phydev->lp_advertising, lpadv & RTL_LPADV_5000FULL);
+- linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
+- phydev->lp_advertising, lpadv & RTL_LPADV_2500FULL);
++ if (!(lpadv & MDIO_AN_10GBT_STAT_REMOK) ||
++ !(lpadv & MDIO_AN_10GBT_STAT_LOCOK))
++ lpadv = 0;
++
++ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, lpadv);
+ }
+
+- return genphy_read_status(phydev);
++ ret = rtlgen_read_status(phydev);
++ if (ret < 0)
++ return ret;
++
++ if (phydev->is_c45 && phydev->link)
++ rtl822x_update_interface(phydev);
++
++ return 0;
+ }
+
+ static bool rtlgen_supports_2_5gbps(struct phy_device *phydev)
+ {
+ int val;
+
+- phy_write(phydev, RTL821x_PAGE_SELECT, 0xa61);
+- val = phy_read(phydev, 0x13);
+- phy_write(phydev, RTL821x_PAGE_SELECT, 0);
++ mutex_lock(&phydev->mdio.bus->mdio_lock);
++ rtl821x_write_page(phydev, 0xa61);
++ val = __phy_read(phydev, 0x13);
++ rtl821x_write_page(phydev, 0);
++ mutex_unlock(&phydev->mdio.bus->mdio_lock);
+
+ return val >= 0 && val & RTL_SUPPORTS_2500FULL;
+ }
+@@ -437,21 +724,102 @@ static int rtlgen_match_phy_device(struc
+ !rtlgen_supports_2_5gbps(phydev);
+ }
+
+-static int rtl8125_match_phy_device(struct phy_device *phydev)
++static int rtl8226_match_phy_device(struct phy_device *phydev)
+ {
+ return phydev->phy_id == RTL_GENERIC_PHYID &&
+ rtlgen_supports_2_5gbps(phydev);
+ }
+
++static int rtl822x_probe(struct phy_device *phydev)
++{
++ struct device *dev = &phydev->mdio.dev;
++ int val;
++
++ val = phy_read_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, RTL8221B_PHYCR1);
++ if (val < 0)
++ return val;
++
++ if (of_property_read_bool(dev->of_node, "realtek,aldps-enable"))
++ val |= RTL8221B_PHYCR1_ALDPS_EN | RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN;
++ else
++ val &= ~(RTL8221B_PHYCR1_ALDPS_EN | RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN);
++
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, RTL8221B_PHYCR1, val);
++
++ return 0;
++}
++
++static int rtlgen_resume(struct phy_device *phydev)
++{
++ int ret = genphy_resume(phydev);
++
++ /* Internal PHY's from RTL8168h up may not be instantly ready */
++ msleep(20);
++
++ return ret;
++}
++
++static int rtl8221b_config_init(struct phy_device *phydev)
++{
++ u16 option_mode;
++ int val;
++
++ switch (phydev->interface) {
++ case PHY_INTERFACE_MODE_2500BASEX:
++ if (!phydev->is_c45) {
++ option_mode = RTL8221B_SERDES_OPTION_MODE_2500BASEX;
++ break;
++ }
++ fallthrough;
++ case PHY_INTERFACE_MODE_SGMII:
++ option_mode = RTL8221B_SERDES_OPTION_MODE_2500BASEX_SGMII;
++ break;
++ default:
++ return 0;
++ }
++
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL,
++ 0x75f3, 0);
++
++ phy_modify_mmd_changed(phydev, RTL8221B_MMD_SERDES_CTRL,
++ RTL8221B_SERDES_OPTION,
++ RTL8221B_SERDES_OPTION_MODE_MASK, option_mode);
++ switch (option_mode) {
++ case RTL8221B_SERDES_OPTION_MODE_2500BASEX_SGMII:
++ case RTL8221B_SERDES_OPTION_MODE_2500BASEX:
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6a04, 0x0503);
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f10, 0xd455);
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f11, 0x8020);
++ break;
++ case RTL8221B_SERDES_OPTION_MODE_HISGMII_SGMII:
++ case RTL8221B_SERDES_OPTION_MODE_HISGMII:
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6a04, 0x0503);
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f10, 0xd433);
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f11, 0x8020);
++ break;
++ }
++
++ /* Disable SGMII AN */
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7588, 0x2);
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7589, 0x71d0);
++ phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587, 0x3);
++ phy_read_mmd_poll_timeout(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587,
++ val, !(val & BIT(0)), 500, 100000, false);
++
++ return 0;
++}
++
+ static struct phy_driver realtek_drvs[] = {
+ {
+ PHY_ID_MATCH_EXACT(0x00008201),
+ .name = "RTL8201CP Ethernet",
++ .read_page = rtl821x_read_page,
++ .write_page = rtl821x_write_page,
+ }, {
+ PHY_ID_MATCH_EXACT(0x001cc816),
+ .name = "RTL8201F Fast Ethernet",
+- .ack_interrupt = &rtl8201_ack_interrupt,
+ .config_intr = &rtl8201_config_intr,
++ .handle_interrupt = rtl8201_handle_interrupt,
+ .suspend = genphy_suspend,
+ .resume = genphy_resume,
+ .read_page = rtl821x_read_page,
+@@ -476,8 +844,8 @@ static struct phy_driver realtek_drvs[]
+ }, {
+ PHY_ID_MATCH_EXACT(0x001cc912),
+ .name = "RTL8211B Gigabit Ethernet",
+- .ack_interrupt = &rtl821x_ack_interrupt,
+ .config_intr = &rtl8211b_config_intr,
++ .handle_interrupt = rtl821x_handle_interrupt,
+ .read_mmd = &genphy_read_mmd_unsupported,
+ .write_mmd = &genphy_write_mmd_unsupported,
+ .suspend = rtl8211b_suspend,
+@@ -495,8 +863,8 @@ static struct phy_driver realtek_drvs[]
+ }, {
+ PHY_ID_MATCH_EXACT(0x001cc914),
+ .name = "RTL8211DN Gigabit Ethernet",
+- .ack_interrupt = rtl821x_ack_interrupt,
+ .config_intr = rtl8211e_config_intr,
++ .handle_interrupt = rtl821x_handle_interrupt,
+ .suspend = genphy_suspend,
+ .resume = genphy_resume,
+ .read_page = rtl821x_read_page,
+@@ -505,8 +873,8 @@ static struct phy_driver realtek_drvs[]
+ PHY_ID_MATCH_EXACT(0x001cc915),
+ .name = "RTL8211E Gigabit Ethernet",
+ .config_init = &rtl8211e_config_init,
+- .ack_interrupt = &rtl821x_ack_interrupt,
+ .config_intr = &rtl8211e_config_intr,
++ .handle_interrupt = rtl821x_handle_interrupt,
+ .suspend = genphy_suspend,
+ .resume = genphy_resume,
+ .read_page = rtl821x_read_page,
+@@ -514,47 +882,103 @@ static struct phy_driver realtek_drvs[]
+ }, {
+ PHY_ID_MATCH_EXACT(0x001cc916),
+ .name = "RTL8211F Gigabit Ethernet",
++ .probe = rtl821x_probe,
+ .config_init = &rtl8211f_config_init,
+- .ack_interrupt = &rtl8211f_ack_interrupt,
++ .read_status = rtlgen_read_status,
+ .config_intr = &rtl8211f_config_intr,
++ .handle_interrupt = rtl8211f_handle_interrupt,
+ .suspend = genphy_suspend,
+- .resume = genphy_resume,
++ .resume = rtl821x_resume,
+ .read_page = rtl821x_read_page,
+ .write_page = rtl821x_write_page,
+ }, {
+ .name = "Generic FE-GE Realtek PHY",
+ .match_phy_device = rtlgen_match_phy_device,
++ .read_status = rtlgen_read_status,
+ .suspend = genphy_suspend,
+- .resume = genphy_resume,
++ .resume = rtlgen_resume,
+ .read_page = rtl821x_read_page,
+ .write_page = rtl821x_write_page,
+ .read_mmd = rtlgen_read_mmd,
+ .write_mmd = rtlgen_write_mmd,
+ }, {
+- .name = "RTL8125 2.5Gbps internal",
+- .match_phy_device = rtl8125_match_phy_device,
+- .get_features = rtl8125_get_features,
+- .config_aneg = rtl8125_config_aneg,
+- .read_status = rtl8125_read_status,
++ .name = "RTL8226 2.5Gbps PHY",
++ .match_phy_device = rtl8226_match_phy_device,
++ .get_features = rtl822x_get_features,
++ .config_aneg = rtl822x_config_aneg,
++ .probe = rtl822x_probe,
++ .read_status = rtl822x_read_status,
+ .suspend = genphy_suspend,
+- .resume = genphy_resume,
++ .resume = rtlgen_resume,
+ .read_page = rtl821x_read_page,
+ .write_page = rtl821x_write_page,
+- .read_mmd = rtl8125_read_mmd,
+- .write_mmd = rtl8125_write_mmd,
+- }, {
+- PHY_ID_MATCH_EXACT(0x001cc961),
+- .name = "RTL8366RB Gigabit Ethernet",
+- .config_init = &rtl8366rb_config_init,
+- /* These interrupts are handled by the irq controller
+- * embedded inside the RTL8366RB, they get unmasked when the
+- * irq is requested and ACKed by reading the status register,
+- * which is done by the irqchip code.
+- */
+- .ack_interrupt = genphy_no_ack_interrupt,
+- .config_intr = genphy_no_config_intr,
++ .read_mmd = rtl822x_read_mmd,
++ .write_mmd = rtl822x_write_mmd,
++ .soft_reset = genphy_soft_reset,
++ }, {
++ PHY_ID_MATCH_EXACT(0x001cc840),
++ .name = "RTL8226B_RTL8221B 2.5Gbps PHY",
++ .get_features = rtl822x_get_features,
++ .config_aneg = rtl822x_config_aneg,
++ .probe = rtl822x_probe,
++ .read_status = rtl822x_read_status,
+ .suspend = genphy_suspend,
+- .resume = genphy_resume,
++ .resume = rtlgen_resume,
++ .read_page = rtl821x_read_page,
++ .write_page = rtl821x_write_page,
++ .read_mmd = rtl822x_read_mmd,
++ .write_mmd = rtl822x_write_mmd,
++ .soft_reset = genphy_soft_reset,
++ }, {
++ PHY_ID_MATCH_EXACT(0x001cc838),
++ .name = "RTL8226-CG 2.5Gbps PHY",
++ .get_features = rtl822x_get_features,
++ .config_aneg = rtl822x_config_aneg,
++ .probe = rtl822x_probe,
++ .read_status = rtl822x_read_status,
++ .suspend = genphy_suspend,
++ .resume = rtlgen_resume,
++ .read_page = rtl821x_read_page,
++ .write_page = rtl821x_write_page,
++ .soft_reset = genphy_soft_reset,
++ }, {
++ PHY_ID_MATCH_EXACT(0x001cc848),
++ .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY",
++ .get_features = rtl822x_get_features,
++ .config_aneg = rtl822x_config_aneg,
++ .probe = rtl822x_probe,
++ .read_status = rtl822x_read_status,
++ .suspend = genphy_suspend,
++ .resume = rtlgen_resume,
++ .read_page = rtl821x_read_page,
++ .write_page = rtl821x_write_page,
++ .soft_reset = genphy_soft_reset,
++ }, {
++ PHY_ID_MATCH_EXACT(0x001cc849),
++ .name = "RTL8221B-VB-CG 2.5Gbps PHY",
++ .get_features = rtl822x_get_features,
++ .config_init = rtl8221b_config_init,
++ .config_aneg = rtl822x_config_aneg,
++ .probe = rtl822x_probe,
++ .read_status = rtl822x_read_status,
++ .suspend = genphy_suspend,
++ .resume = rtlgen_resume,
++ .read_page = rtl821x_read_page,
++ .write_page = rtl821x_write_page,
++ .soft_reset = genphy_soft_reset,
++ }, {
++ PHY_ID_MATCH_EXACT(0x001cc84a),
++ .name = "RTL8221B-VM-CG 2.5Gbps PHY",
++ .get_features = rtl822x_get_features,
++ .config_aneg = rtl822x_config_aneg,
++ .config_init = rtl8221b_config_init,
++ .probe = rtl822x_probe,
++ .read_status = rtl822x_read_status,
++ .suspend = genphy_suspend,
++ .resume = rtlgen_resume,
++ .read_page = rtl821x_read_page,
++ .write_page = rtl821x_write_page,
++ .soft_reset = genphy_soft_reset,
+ },
+ };
+
--
2.34.1

View File

@ -0,0 +1,28 @@
From cbfde88afc04efa95e20802919e30260c457d560 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Tue, 28 Feb 2023 15:41:08 +0800
Subject: [PATCH] target/mediatek: fix compare macaddr in hwnat driver
Use ether_addr_equal to compare macaddr instead of strncmp
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
index 1041579f16..8b48dbba29 100644
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
@@ -298,7 +298,7 @@ void foe_clear_entry(struct neighbour *neigh)
*((u32 *)h_dest) = swab32(entry->ipv4_hnapt.dmac_hi);
*((u16 *)&h_dest[4]) =
swab16(entry->ipv4_hnapt.dmac_lo);
- if (strncmp(h_dest, neigh->ha, ETH_ALEN) != 0) {
+ if (!ether_addr_equal(h_dest, neigh->ha)) {
pr_info("%s: state=%d\n", __func__,
neigh->nud_state);
cr_set_field(hnat_priv->ppe_base[i] + PPE_TB_CFG,
--
2.34.1

View File

@ -0,0 +1,52 @@
From 0b62028e0dc1d9318111b370fa5bd87f83d6e3a6 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Fri, 26 Aug 2022 16:45:49 +0800
Subject: [PATCH] wext: increase scan data length
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../patches/100-increase-buffer-size.patch | 13 +++++++++++++
.../960-wext-increase-iw-scan-data-size.patch | 11 +++++++++++
2 files changed, 24 insertions(+)
create mode 100644 package/network/utils/wireless-tools/patches/100-increase-buffer-size.patch
create mode 100644 target/linux/generic/hack-5.4/patches-5.4/960-wext-increase-iw-scan-data-size.patch
diff --git a/package/network/utils/wireless-tools/patches/100-increase-buffer-size.patch b/package/network/utils/wireless-tools/patches/100-increase-buffer-size.patch
new file mode 100644
index 0000000000..697856b541
--- /dev/null
+++ b/package/network/utils/wireless-tools/patches/100-increase-buffer-size.patch
@@ -0,0 +1,13 @@
+Index: wireless_tools.29/iwpriv.c
+===================================================================
+--- wireless_tools.29.orig/iwpriv.c
++++ wireless_tools.29/iwpriv.c
+@@ -259,7 +259,7 @@ set_private_cmd(int skfd, /* Socket */
+ int priv_num) /* Number of descriptions */
+ {
+ struct iwreq wrq;
+- u_char buffer[4096]; /* Only that big in v25 and later */
++ u_char buffer[20 * 1024]; /* Only that big in v25 and later */
+ int i = 0; /* Start with first command arg */
+ int k; /* Index in private description table */
+ int temp;
diff --git a/target/linux/generic/hack-5.4/patches-5.4/960-wext-increase-iw-scan-data-size.patch b/target/linux/generic/hack-5.4/patches-5.4/960-wext-increase-iw-scan-data-size.patch
new file mode 100644
index 0000000000..2b1985734b
--- /dev/null
+++ b/target/linux/generic/hack-5.4/patches-5.4/960-wext-increase-iw-scan-data-size.patch
@@ -0,0 +1,11 @@
+--- a/include/uapi/linux/wireless.h
++++ b/include/uapi/linux/wireless.h
+@@ -544,7 +544,7 @@
+ #define IW_SCAN_TYPE_ACTIVE 0
+ #define IW_SCAN_TYPE_PASSIVE 1
+ /* Maximum size of returned data */
+-#define IW_SCAN_MAX_DATA 4096 /* In bytes */
++#define IW_SCAN_MAX_DATA 20 * 1024 /* In bytes */
+
+ /* Scan capability flags - in (struct iw_range *)->scan_capa */
+ #define IW_SCAN_CAPA_NONE 0x00
--
2.34.1

View File

@ -0,0 +1,276 @@
From c27a77a194aff24c5f42c145f46789e05cb99870 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Thu, 18 May 2023 11:07:18 +0800
Subject: [PATCH] kernel: Add some modems support
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../hack-5.4/960-support-some-modems.patch | 256 ++++++++++++++++++
1 file changed, 256 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/960-support-some-modems.patch
diff --git a/target/linux/generic/hack-5.4/960-support-some-modems.patch b/target/linux/generic/hack-5.4/960-support-some-modems.patch
new file mode 100644
index 0000000000..93ae6a2a1a
--- /dev/null
+++ b/target/linux/generic/hack-5.4/960-support-some-modems.patch
@@ -0,0 +1,256 @@
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -507,6 +507,24 @@ static const u8 default_modem_addr[ETH_A
+
+ static const u8 buggy_fw_addr[ETH_ALEN] = {0x00, 0xa0, 0xc6, 0x00, 0x00, 0x00};
+
++#if 1 //Added by Quectel
++#include <linux/etherdevice.h>
++struct sk_buff *qmi_wwan_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
++{
++ if (dev->udev->descriptor.idVendor != cpu_to_le16(0x2C7C))
++ return skb;
++ // Skip Ethernet header from message
++ if (skb_pull(skb, ETH_HLEN)) {
++ return skb;
++ } else {
++ dev_err(&dev->intf->dev, "Packet Dropped ");
++ }
++ // Filter the packet out, release it
++ dev_kfree_skb_any(skb);
++ return NULL;
++}
++#endif
++
+ /* Make up an ethernet header if the packet doesn't have one.
+ *
+ * A firmware bug common among several devices cause them to send raw
+@@ -801,6 +819,22 @@ static int qmi_wwan_bind(struct usbnet *
+ }
+ dev->net->netdev_ops = &qmi_wwan_netdev_ops;
+ dev->net->sysfs_groups[0] = &qmi_wwan_sysfs_attr_group;
++
++#if 1 //Added by Quectel
++ if (dev->udev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
++ dev_info(&intf->dev, "QuectelEC25&EC21&EG91&EG95&EG06&EP06&EM06&BG96&AG35 work on RawIP mode\n");
++ dev->net->flags |= IFF_NOARP;
++ usb_control_msg(
++ interface_to_usbdev(intf),
++ usb_sndctrlpipe(interface_to_usbdev(intf), 0),
++ 0x22, //USB_CDC_REQ_SET_CONTROL_LINE_STATE
++ 0x21, //USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE
++ 1, //active CDC DTR
++ intf->cur_altsetting->desc.bInterfaceNumber,
++ NULL, 0, 100);
++ }
++#endif
++
+ err:
+ return status;
+ }
+@@ -892,6 +926,9 @@ static const struct driver_info qmi_wwan
+ .unbind = qmi_wwan_unbind,
+ .manage_power = qmi_wwan_manage_power,
+ .rx_fixup = qmi_wwan_rx_fixup,
++#if 1 //Added by Quectel
++ .tx_fixup = qmi_wwan_tx_fixup,
++#endif
+ };
+
+ static const struct driver_info qmi_wwan_info_quirk_dtr = {
+@@ -938,6 +975,14 @@ static const struct driver_info qmi_wwan
+ .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr
+
+ static const struct usb_device_id products[] = {
++#if 1 //Added by Quectel
++ { QMI_FIXED_INTF(0x2C7C, 0x0125, 4) }, /* Quectel EC25 */
++ { QMI_FIXED_INTF(0x2C7C, 0x0121, 4) }, /* Quectel EC21 */
++ { QMI_FIXED_INTF(0x2C7C, 0x0191, 4) }, /* Quectel EG91 */
++ { QMI_FIXED_INTF(0x2C7C, 0x0195, 4) }, /* Quectel EG95 */
++ { QMI_FIXED_INTF(0x2C7C, 0x0306, 4) }, /* Quectel EG06/EP06/EM06 */
++ { QMI_FIXED_INTF(0x2C7C, 0x0435, 4) }, /* Quectel AG35 */
++#endif
+ /* 1. CDC ECM like devices match on the control interface */
+ { /* Huawei E392, E398 and possibly others sharing both device id and more... */
+ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 9),
+@@ -1047,6 +1092,7 @@ static const struct usb_device_id produc
+ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0620)}, /* Quectel EM160R-GL */
+ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */
+ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0801)}, /* Quectel RM520N */
++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x030b)}, /* Quectel Quectel EM060K-GL EM120K-GL */
+
+ /* 3. Combined interface devices matching on interface number */
+ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -595,6 +595,25 @@ static void option_instat_callback(struc
+ #define SIERRA_VENDOR_ID 0x1199
+ #define SIERRA_PRODUCT_EM9191 0x90d3
+
++#if 1 // Added by gl
++#define LONGSUNG_PRODUCT_U9300C 0x9b3c
++
++/* FORGE PRODUCT */
++#define FORGE_VENDOR_ID 0x05c6
++
++#define FORGE_PRODUCT_SLM750 0xf601
++
++/* NODECOM PRODUCT */
++#define NODECOM_VENDOR_ID 0x1508
++
++#define NODECOM_PRODUCT_NL660 0x1001
++
++/* NEOWAY PRODUCT */
++#define NEOWAY_VENDOR_ID 0x2949
++
++#define NEOWAY_PRODUCT_N720 0x8243
++#endif
++
+ /* Device flags */
+
+ /* Highest interface number which can be used with NCTRL() and RSVD() */
+@@ -614,6 +633,15 @@ static void option_instat_callback(struc
+
+
+ static const struct usb_device_id option_ids[] = {
++#if 1 // Added by gl
++ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9215) }, /* Quectel EC20 */
++ { USB_DEVICE(QUECTEL_VENDOR_ID, 0x0435) }, /* Quectel AG35 */
++ { USB_DEVICE(ZTE_VENDOR_ID, 0x0536) },/* MZ386 */
++ { USB_DEVICE(LONGCHEER_VENDOR_ID, LONGSUNG_PRODUCT_U9300C) },
++ { USB_DEVICE(FORGE_VENDOR_ID, FORGE_PRODUCT_SLM750) },
++ { USB_DEVICE(NODECOM_VENDOR_ID, NODECOM_PRODUCT_NL660) },
++ { USB_DEVICE(NEOWAY_VENDOR_ID, NEOWAY_PRODUCT_N720) },
++#endif
+ { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
+ { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
+ { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
+@@ -2294,7 +2322,104 @@ static int option_probe(struct usb_seria
+ return -ENODEV;
+
+ /* Store the device flags so we can use them during attach. */
+- usb_set_serial_data(serial, (void *)device_flags);
++#if 1 //Added by Quectel
++ //Quectel UC20's interface 4 can be used as USB network device
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && \
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x9003) \
++ && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
++ return -ENODEV;
++ //Quectel EC20's interface 4 can be used as USB network device
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && \
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x9215) \
++ && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
++ return -ENODEV;
++ //Quectel EC25&EC21&EG91&EG95&EG06&EP06&EM06&BG96/AG35's interface 4 can be used as USB network device
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C) && \
++ serial->dev->descriptor.idProduct != cpu_to_le16(0x6026) \
++ && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
++ return -ENODEV;
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C) && \
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x6026) \
++ && serial->interface->cur_altsetting->desc.bInterfaceNumber<= 1)
++ return -ENODEV;
++
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
++ __u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);
++ struct usb_interface_descriptor *intf = &serial->interface->cur_altsetting->desc;
++
++ if (intf->bInterfaceClass != 0xFF || intf->bInterfaceSubClass == 0x42) {
++ //ECM, RNDIS, NCM, MBIM, ACM, UAC, ADB
++ return -ENODEV;
++ }
++
++ if ((idProduct&0xF000) == 0x0000) {
++ //MDM interface 4 is QMI
++ if (intf->bInterfaceNumber == 4 && intf->bNumEndpoints == 3
++ && intf->bInterfaceSubClass == 0xFF && intf->bInterfaceProtocol == 0xFF)
++ return -ENODEV;
++ }
++ }
++#endif
++
++ #if 1 //Added by Quectel
++ //For USB Auto Suspend
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x9090)) {
++ pm_runtime_set_autosuspend_delay(&serial->dev->dev, 3000);
++ usb_enable_autosuspend(serial->dev);
++ }
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x9003)) {
++ pm_runtime_set_autosuspend_delay(&serial->dev->dev, 3000);
++ usb_enable_autosuspend(serial->dev);
++ }
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x9215)) {
++ pm_runtime_set_autosuspend_delay(&serial->dev->dev, 3000);
++ usb_set_serial_data(serial, (void *)device_flags);
++ usb_enable_autosuspend(serial->dev);
++ }
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
++ pm_runtime_set_autosuspend_delay(&serial->dev->dev, 3000);
++ usb_enable_autosuspend(serial->dev);
++ }
++#endif
++
++ #if 1 //Added by Quectel
++ //For USB Remote Wakeup
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x9090)) {
++ device_init_wakeup(&serial->dev->dev, 1); //usb remote wakeup
++ }
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x9003)) {
++ device_init_wakeup(&serial->dev->dev, 1); //usb remote wakeup
++ }
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x9215)) {
++ device_init_wakeup(&serial->dev->dev, 1); //usb remote wakeup
++ }
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
++ device_init_wakeup(&serial->dev->dev, 1); //usb remote wakeup
++ }
++#endif
++
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x19d2) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x1476) &&
++ serial->interface->cur_altsetting->desc. bInterfaceNumber == 3)
++ return -ENODEV;
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x19d2) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x1476) &&
++ serial->interface->cur_altsetting->desc. bInterfaceNumber == 4)
++ return -ENODEV;
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x19d2) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x1509) &&
++ serial->interface->cur_altsetting->desc. bInterfaceNumber == 4)
++ return -ENODEV;
++ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x19d2) &&
++ serial->dev->descriptor.idProduct == cpu_to_le16(0x1509) &&
++ serial->interface->cur_altsetting->desc. bInterfaceNumber == 5)
++ return -ENODEV;
+
+ return 0;
+ }
+--- a/drivers/usb/serial/usb_wwan.c
++++ b/drivers/usb/serial/usb_wwan.c
+@@ -478,6 +478,20 @@ static struct urb *usb_wwan_setup_urb(st
+ usb_sndbulkpipe(serial->dev, endpoint) | dir,
+ buf, len, callback, ctx);
+
++#if 1 //Added by Quectel for zero packet
++ if (dir == USB_DIR_OUT) {
++ struct usb_device_descriptor *desc = &serial->dev->descriptor;
++ if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9090))
++ urb->transfer_flags |= URB_ZERO_PACKET;
++ if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9003))
++ urb->transfer_flags |= URB_ZERO_PACKET;
++ if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9215))
++ urb->transfer_flags |= URB_ZERO_PACKET;
++ if (desc->idVendor == cpu_to_le16(0x2C7C))
++ urb->transfer_flags |= URB_ZERO_PACKET;
++ }
++#endif
++
+ if (intfdata->use_zlp && dir == USB_DIR_OUT)
+ urb->transfer_flags |= URB_ZERO_PACKET;
+
--
2.34.1

View File

@ -0,0 +1,349 @@
From 4d6aaa3f65eee6b55964f7917e2b8f062e09f2ed Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Tue, 9 May 2023 18:05:36 +0800
Subject: [PATCH] support MT6000 target
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../boot/dts/mediatek/mt7986a-gl-mt6000.dts | 290 ++++++++++++++++++
target/linux/mediatek/image/mt7986.mk | 17 +
target/linux/mediatek/mt7986/config-5.4 | 1 +
3 files changed, 308 insertions(+)
create mode 100644 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-gl-mt6000.dts
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-gl-mt6000.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-gl-mt6000.dts
new file mode 100644
index 0000000000..3513f4f125
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-gl-mt6000.dts
@@ -0,0 +1,290 @@
+/dts-v1/;
+#include "mt7986a.dtsi"
+#include "mt7986a-pinctrl.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ model = "GL.iNet GL-MT6000";
+ compatible = "glinet,mt6000-snand", "mediatek,mt7986a";
+
+ chosen {
+ bootargs = "console=ttyS0,115200n1 loglevel=8 \
+ earlycon=uart8250,mmio32,0x11002000";
+ };
+
+ gl-hw {
+ compatible = "gl-hw-info";
+ model = "mt6000";
+ wan = "eth0";
+ lan = "eth1";
+ usb-port = "1-1,2-1";
+ flash_size = <256>;
+ temperature = "/sys/devices/virtual/thermal/thermal_zone0/temp";
+ switch-button = "gpio-455";
+ reset-button = "gpio-456";
+ radio = "mt798611 mt798612";
+ //cfg-partition = "/dev/mtd7";
+ dfs;
+ factory_data {
+ device_mac = "Factory", "0x0a";
+ device_ddns = "Factory", "0x10";
+ device_sn_bak = "Factory", "0x20";
+ device_sn = "Factory", "0x30";
+ country_code = "Factory", "0x88";
+ device_cert = "Factory", "0x1000";
+ };
+ };
+
+ nmbm_spim_nand {
+ compatible = "generic,nmbm";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ lower-mtd-device = <&spi_nand>;
+ forced-create;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "BL2";
+ reg = <0x00000 0x0100000>;
+ read-only;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x0100000 0x0060000>;
+ };
+
+ factory: partition@160000 {
+ label = "Factory";
+ reg = <0x160000 0x0060000>;
+ };
+
+ partition@1c0000 {
+ label = "reserved";
+ reg = <0x1c0000 0x01c0000>;
+ };
+
+ partition@380000 {
+ label = "FIP";
+ reg = <0x380000 0x0200000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x7800000>;
+ };
+ };
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&watchdog {
+ status = "okay";
+};
+
+&eth {
+ status = "okay";
+
+ gmac0: mac@0 {
+ compatible = "mediatek,eth-mac";
+ reg = <0>;
+ phy-mode = "2500base-x";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+
+ gmac1: mac@1 {
+ compatible = "mediatek,eth-mac";
+ reg = <1>;
+ phy-mode = "2500base-x";
+ phy-handle = <&phy7>;
+ };
+
+ mdio: mdio-bus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ phy5: phy@5 {
+ compatible = "ethernet-phy-ieee802.3-c45";
+ reg = <5>;
+ reset-assert-us = <100000>;
+ reset-deassert-us = <100000>;
+ reset-gpios = <&pio 13 GPIO_ACTIVE_LOW>;
+ realtek,aldps-enable;
+ };
+
+ phy7: phy@7 {
+ compatible = "ethernet-phy-ieee802.3-c45";
+ reg = <7>;
+ reset-assert-us = <100000>;
+ reset-deassert-us = <100000>;
+ reset-gpios = <&pio 17 GPIO_ACTIVE_LOW>;
+ realtek,aldps-enable;
+ };
+
+ switch@0 {
+ compatible = "mediatek,mt7531";
+ reg = <31>;
+ reset-gpios = <&pio 5 0>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ label = "lan0";
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan1";
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan2";
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan3";
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan4";
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "lan5";
+ phy-mode = "2500base-x";
+ phy-handle = <&phy5>;
+ };
+
+ port@6 {
+ reg = <6>;
+ label = "cpu";
+ ethernet = <&gmac0>;
+ phy-mode = "2500base-x";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+ };
+ };
+ };
+};
+
+&hnat {
+ mtketh-wan = "eth1";
+ mtketh-lan = "lan";
+ mtketh-max-gmac = <2>;
+ status = "okay";
+};
+
+&spi0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi_flash_pins>;
+ cs-gpios = <0>, <0>;
+ status = "okay";
+
+ spi_nor@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <52000000>;
+ spi-tx-buswidth = <4>;
+ spi-rx-buswidth = <4>;
+ };
+
+ spi_nand: spi_nand@1 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "spi-nand";
+ reg = <1>;
+ spi-max-frequency = <52000000>;
+ spi-tx-buswidth = <4>;
+ spi-rx-buswidth = <4>;
+ };
+};
+
+&wbsys {
+ mediatek,mtd-eeprom = <&factory 0x0000>;
+ status = "okay";
+ pinctrl-names = "default", "dbdc";
+ pinctrl-0 = <&wf_2g_5g_pins>;
+ pinctrl-1 = <&wf_dbdc_pins>;
+};
+
+&pio {
+ spi_flash_pins: spi-flash-pins-33-to-38 {
+ mux {
+ function = "flash";
+ groups = "spi0", "spi0_wp_hold";
+ };
+ conf-pu {
+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
+ };
+ conf-pd {
+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
+ };
+ };
+
+ wf_2g_5g_pins: wf_2g_5g-pins {
+ mux {
+ function = "wifi";
+ groups = "wf_2g", "wf_5g";
+ };
+ conf {
+ pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
+ "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
+ "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
+ "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
+ "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
+ "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
+ "WF1_TOP_CLK", "WF1_TOP_DATA";
+ drive-strength = <MTK_DRIVE_4mA>;
+ };
+ };
+
+ wf_dbdc_pins: wf_dbdc-pins {
+ mux {
+ function = "wifi";
+ groups = "wf_dbdc";
+ };
+ conf {
+ pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
+ "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
+ "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
+ "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
+ "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
+ "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
+ "WF1_TOP_CLK", "WF1_TOP_DATA";
+ drive-strength = <MTK_DRIVE_4mA>;
+ };
+ };
+};
diff --git a/target/linux/mediatek/image/mt7986.mk b/target/linux/mediatek/image/mt7986.mk
index 0c62ce559a..592e4d6026 100644
--- a/target/linux/mediatek/image/mt7986.mk
+++ b/target/linux/mediatek/image/mt7986.mk
@@ -413,3 +413,20 @@ define Device/mediatek_mt7986-fpga-ubi
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += mediatek_mt7986-fpga-ubi
+
+define Device/glinet_gl-mt6000
+ DEVICE_VENDOR := GL.iNet
+ DEVICE_MODEL := GL-MT6000
+ DEVICE_DTS := mt7986a-gl-mt6000
+ DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
+ SUPPORTED_DEVICES := glinet,mt6000-snand
+ UBINIZE_OPTS := -E 5
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ IMAGE_SIZE := 65536k
+ KERNEL_IN_UBI := 1
+ IMAGES := factory.img sysupgrade.tar
+ IMAGE/factory.img := append-ubi | check-size $$$$(IMAGE_SIZE)
+ IMAGE/sysupgrade.tar := sysupgrade-tar | append-gl-metadata
+endef
+TARGET_DEVICES += glinet_gl-mt6000
diff --git a/target/linux/mediatek/mt7986/config-5.4 b/target/linux/mediatek/mt7986/config-5.4
index 63700ffe00..91c64cd21f 100644
--- a/target/linux/mediatek/mt7986/config-5.4
+++ b/target/linux/mediatek/mt7986/config-5.4
@@ -244,6 +244,7 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GLOB=y
CONFIG_GPIOLIB=y
CONFIG_GPY211_PHY=y
+CONFIG_REALTEK_PHY=y
CONFIG_GRO_CELLS=y
CONFIG_HANDLE_DOMAIN_IRQ=y
CONFIG_HARDEN_BRANCH_PREDICTOR=y
--
2.34.1

157
profiles/glinet_mt6000.yml Normal file
View File

@ -0,0 +1,157 @@
---
description: Add the glinet dependencies for the GL.iNET MT3000
feeds:
- name: mt7981_private
uri: https://gitlab.com/gl.sdk4.0/gl.router/mt7981-feeds.git
branch: master
- name: glinet
uri: https://gitlab.com/gl.sdk4.0/gl.router/gl-sdk4-collect.git
branch: master
packages:
- kmod-usb-storage
- kmod-usb-uhci
- kmod-usb2
- kmod-usb-ohci
- dnsmasq-full
- iwinfo
- block-mount
- blkid
- ntfs-3g
- ntfs-3g-utils
- kmod-fs-ext4
- kmod-fs-ntfs
- kmod-fs-vfat
- kmod-fs-exfat
- kmod-gl-sdk4-hw-info
- kmod-gl-sdk4-tertf
- kmod-gl-sdk4-parental-control
- gl-oui-rpc
- gl-sdk4-led
- gl-sdk4-luci
- gl-sdk4-rtty
- gl-sdk4-cable
- gl-sdk4-clients
- gl-sdk4-modem
- gl-sdk4-wifi
- gl-sdk4-switch-button
- gl-sdk4-adguardhome
- gl-sdk4-netmode
- gl-sdk4-base-files
- gl-sdk4-tethering
- gl-sdk4-upgrade
- gl-sdk4-ovpn-client
- gl-sdk4-ovpn-server
- gl-sdk4-wg-client
- gl-sdk4-wg-server
- gl-sdk4-macclone
- gl-sdk4-ddns
- gl-sdk4-plugins
- gl-sdk4-firewall
- gl-sdk4-repeater
- gl-sdk4-dns
- gl-sdk4-system
- gl-sdk4-network
- gl-sdk4-acl
- gl-sdk4-cloud
- gl-sdk4-lan
- gl-sdk4-ipv6
- gl-sdk4-upgrade
- gl-sdk4-vpn-policy
- gl-sdk4-logread
- gl-sdk4-qos
- gl-sdk4-network-diag
- gl-sdk4-carrier-monitor
- gl-sdk4-init-portal
- gl-sdk4-s2s
- gl-sdk4-edgerouter
- gl-sdk4-mwan3
- gl-sdk4-timer
- gl-sdk4-igmp
- gl-sdk4-tor
- gl-sdk4-zerotier
- gl-sdk4-ui-hwnat
- gl-sdk4-ui-adguardhome
- gl-sdk4-ui-adminpw
- gl-sdk4-ui-advanced
- gl-sdk4-ui-bridge
- gl-sdk4-ui-btnsettings
- gl-sdk4-ui-clients
- gl-sdk4-ui-cloud
- gl-sdk4-ui-core
- gl-sdk4-ui-dnsview
- gl-sdk4-ui-dynamicdns
- gl-sdk4-ui-edgerouter
- gl-sdk4-ui-firewallview
- gl-sdk4-ui-home
- gl-sdk4-ui-igmp
- gl-sdk4-ui-internet
- gl-sdk4-ui-ipv6
- gl-sdk4-ui-lanip
- gl-sdk4-ui-login
- gl-sdk4-ui-logview
- gl-sdk4-ui-macclone
- gl-sdk4-ui-modemmanage
- gl-sdk4-ui-multiwan
- gl-sdk4-ui-nasview
- gl-sdk4-ui-overview
- gl-sdk4-ui-ovpnclient
- gl-sdk4-ui-ovpnserver
- gl-sdk4-ui-plugins
- gl-sdk4-ui-process
- gl-sdk4-ui-reset
- gl-sdk4-ui-sms
- gl-sdk4-ui-timedtask
- gl-sdk4-ui-timezone
- gl-sdk4-ui-torview
- gl-sdk4-ui-upgrade
- gl-sdk4-ui-vlan
- gl-sdk4-ui-vpndashboard
- gl-sdk4-ui-welcome
- gl-sdk4-ui-wgclient
- gl-sdk4-ui-wgserver
- gl-sdk4-ui-wireless
- gl-sdk4-ui-parentalcontrol
- gl-sdk4-ui-zerotierview
- gl-sdk4-tailscale
- gl-sdk4-ui-tailscaleview
diffconfig: |
CONFIG_SIGNATURE_CHECK=n
CONFIG_PACKAGE_dnsmasq=n
CONFIG_PACKAGE_wpad-basic=n
CONFIG_PACKAGE_wpad=n
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_BUSYBOX_CONFIG_FEATURE_FLOAT_SLEEP=y
CONFIG_NGINX_HTTP_CHARSET=n
CONFIG_NGINX_HTTP_GZIP=n
CONFIG_NGINX_HTTP_SSI=n
CONFIG_NGINX_HTTP_USERID=n
CONFIG_NGINX_HTTP_ACCESS=n
CONFIG_NGINX_HTTP_AUTH_BASIC=n
CONFIG_NGINX_HTTP_AUTOINDEX=n
CONFIG_NGINX_HTTP_GEO=n
CONFIG_NGINX_HTTP_MAP=n
CONFIG_NGINX_HTTP_SPLIT_CLIENTS=n
CONFIG_NGINX_HTTP_REFERER=n
CONFIG_NGINX_HTTP_REWRITE=n
CONFIG_NGINX_HTTP_FASTCGI=n
CONFIG_NGINX_HTTP_SCGI=n
CONFIG_NGINX_HTTP_MEMCACHED=n
CONFIG_NGINX_HTTP_LIMIT_CONN=n
CONFIG_NGINX_HTTP_LIMIT_REQ=n
CONFIG_NGINX_HTTP_EMPTY_GIF=n
CONFIG_NGINX_HTTP_BROWSER=n
CONFIG_NGINX_HTTP_UPSTREAM_HASH=n
CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH=n
CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN=n
CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE=n
CONFIG_NGINX_HTTP_CACHE=n
CONFIG_NGINX_NAXSI=n
CONFIG_NGINX_HEADERS_MORE=n
CONFIG_LIBCURL_MBEDTLS=n
CONFIG_LIBCURL_OPENSSL=y
CONFIG_OPENSSL_OPTIMIZE_SPEED=y
CONFIG_LUCI_LANG_zh_Hans=y
CONFIG_LUA_ECO_OPENSSL=y

View File

@ -0,0 +1,223 @@
---
description: GL.iNET private profile for mt7986 wifi
diffconfig: |
CONFIG_PACKAGE_kmod-conninfra=y
CONFIG_MTK_CONNINFRA_APSOC=y
CONFIG_MTK_CONNINFRA_APSOC_MT7986=y
CONFIG_MTK_CONNINFRA_APSOC_MT7981=n
CONFIG_CONNINFRA_EMI_SUPPORT=y
CONFIG_FPGA_EARLY_PORTING=n
CONFIG_CONNINFRA_AUTO_UP=y
CONFIG_PACKAGE_kmod-mapfilter=y
CONFIG_PACKAGE_kmod-mt7915=n
CONFIG_PACKAGE_kmod-mt_wifi=y
CONFIG_MTK_SUPPORT_OPENWRT=y
CONFIG_MTK_WIFI_DRIVER=y
CONFIG_MTK_FIRST_IF_NONE=n
CONFIG_MTK_FIRST_IF_MT7615E=n
CONFIG_MTK_FIRST_IF_MT7622=n
CONFIG_MTK_FIRST_IF_MT7626=n
CONFIG_MTK_FIRST_IF_AXE=n
CONFIG_MTK_FIRST_IF_MT7915=n
CONFIG_MTK_FIRST_IF_MT7986=y
CONFIG_MTK_FIRST_IF_MT7916=n
CONFIG_MTK_FIRST_IF_MT7981=n
CONFIG_MTK_SECOND_IF_NONE=y
CONFIG_MTK_SECOND_IF_MT7615E=n
CONFIG_MTK_SECOND_IF_AXE=n
CONFIG_MTK_SECOND_IF_MT7915=n
CONFIG_MTK_SECOND_IF_MT7916=n
CONFIG_MTK_THIRD_IF_NONE=y
CONFIG_MTK_THIRD_IF_MT7615E=n
CONFIG_MTK_THIRD_IF_MT7915=n
CONFIG_MTK_THIRD_IF_MT7916=n
CONFIG_MTK_RT_FIRST_IF_RF_OFFSET=0xc0000
CONFIG_MTK_MT_WIFI=m
CONFIG_MTK_MT_WIFI_PATH="mt_wifi"
CONFIG_MTK_FIRST_IF_EEPROM_FLASH=y
CONFIG_MTK_FIRST_IF_EEPROM_PROM=n
CONFIG_MTK_FIRST_IF_EEPROM_EFUSE=n
CONFIG_MTK_RT_FIRST_CARD_EEPROM="flash"
CONFIG_MTK_WIFI_BASIC_FUNC=y
CONFIG_MTK_DOT11_N_SUPPORT=y
CONFIG_MTK_DOT11_VHT_AC=y
CONFIG_MTK_DOT11_HE_AX=y
CONFIG_MTK_CFG_SUPPORT_FALCON_MURU=y
CONFIG_MTK_CFG_SUPPORT_FALCON_TXCMD_DBG=y
CONFIG_MTK_CFG_SUPPORT_FALCON_SR=y
CONFIG_MTK_CFG_SUPPORT_FALCON_PP=y
CONFIG_MTK_WIFI_TWT_SUPPORT=y
CONFIG_MTK_G_BAND_256QAM_SUPPORT=y
CONFIG_MTK_BRCM_256QAM_SUPPORT=n
CONFIG_MTK_VHT_TXBF_2G_EPIGRAM_IE_SUPPORT=n
CONFIG_MTK_TPC_SUPPORT=y
CONFIG_MTK_ICAP_SUPPORT=y
CONFIG_MTK_SPECTRUM_SUPPORT=y
CONFIG_MTK_PHY_ICS_SUPPORT=y
CONFIG_MTK_BACKGROUND_SCAN_SUPPORT=y
CONFIG_MTK_SMART_CARRIER_SENSE_SUPPORT=y
CONFIG_MTK_THERMAL_PROTECT_SUPPORT=n
CONFIG_MTK_SCS_FW_OFFLOAD=y
CONFIG_MTK_MT_DFS_SUPPORT=y
CONFIG_MTK_OFFCHANNEL_SCAN_FEATURE=y
CONFIG_MTK_HDR_TRANS_TX_SUPPORT=y
CONFIG_MTK_HDR_TRANS_RX_SUPPORT=y
CONFIG_MTK_DBDC_MODE=y
CONFIG_MTK_MULTI_PROFILE_SUPPORT=y
CONFIG_MTK_DEFAULT_5G_PROFILE=n
CONFIG_MTK_WSC_INCLUDED=y
CONFIG_MTK_WSC_V2_SUPPORT=y
CONFIG_MTK_DOT11W_PMF_SUPPORT=y
CONFIG_MTK_TXBF_SUPPORT=y
CONFIG_MTK_FAST_NAT_SUPPORT=y
CONFIG_MTK_WHNAT_SUPPORT=m
CONFIG_MTK_WARP_V2=y
CONFIG_MTK_WIFI_SKB_USES_SLAB=n
CONFIG_MTK_FTM_SUPPORT=n
CONFIG_MTK_IGMP_SNOOP_SUPPORT=y
CONFIG_MTK_MEMORY_SHRINK=n
CONFIG_MTK_RTMP_FLASH_SUPPORT=y
CONFIG_MTK_PRE_CAL_TRX_SET1_SUPPORT=n
CONFIG_MTK_RLM_CAL_CACHE_SUPPORT=n
CONFIG_MTK_PRE_CAL_TRX_SET2_SUPPORT=n
CONFIG_MTK_CAL_BIN_FILE_SUPPORT=y
CONFIG_MTK_RF_LOCKDOWN_SUPPORT=n
CONFIG_MTK_LINK_TEST_SUPPORT=n
CONFIG_MTK_ATE_SUPPORT=y
CONFIG_MTK_WLAN_SERVICE=y
CONFIG_MTK_PASSPOINT_R2=n
CONFIG_MTK_MBO_SUPPORT=y
CONFIG_MTK_OCE_SUPPORT=y
CONFIG_MTK_WTBL_TDD_SUPPORT=n
CONFIG_MTK_SW_CONNECT_SUPPORT=n
CONFIG_MTK_MAP_SUPPORT=y
CONFIG_MTK_MAP_R2_VER_SUPPORT=y
CONFIG_MTK_MAP_R3_VER_SUPPORT=y
CONFIG_MTK_MAP_R2_6E_SUPPORT=y
CONFIG_MTK_MAP_R3_6E_SUPPORT=y
CONFIG_MTK_UAPSD=y
CONFIG_MTK_TCP_RACK_SUPPORT=n
CONFIG_MTK_RED_SUPPORT=y
CONFIG_MTK_CTXD_MEM_CPY_SUPPORT=n
CONFIG_MTK_CTXD_SCATTER_AND_GATHER_SUPPORT=n
CONFIG_MTK_FDB_SUPPORT=n
CONFIG_MTK_FIRST_IF_EPAELNA=n
CONFIG_MTK_FIRST_IF_IPAILNA=y
CONFIG_MTK_FIRST_IF_IPAELNA=n
CONFIG_MTK_WIFI_FW_BIN_LOAD=n
CONFIG_MTK_WIFI_SKU_TYPE="AX6000"
CONFIG_MTK_WIFI_ADIE_TYPE="mt7976"
CONFIG_MTK_RLT_MAC=n
CONFIG_MTK_RTMP_MAC=n
CONFIG_MTK_WIFI_MODE_AP=m
CONFIG_MTK_WIFI_MODE_STA=n
CONFIG_MTK_WIFI_MODE_BOTH=n
CONFIG_MTK_MT_AP_SUPPORT=m
CONFIG_MTK_WDS_SUPPORT=y
CONFIG_MTK_MBSS_SUPPORT=y
CONFIG_MTK_APCLI_SUPPORT=y
CONFIG_MTK_APCLI_CERT_SUPPORT=y
CONFIG_MTK_MAC_REPEATER_SUPPORT=y
CONFIG_MTK_APCLI_CONNECTION_TRIAL=n
CONFIG_MTK_MWDS=y
CONFIG_MTK_WIFI_SYSDVT=n
CONFIG_MTK_MUMIMO_SUPPORT=y
CONFIG_MTK_MU_RA_SUPPORT=y
CONFIG_MTK_DOT11R_FT_SUPPORT=y
CONFIG_MTK_DOT11K_RRM_SUPPORT=y
CONFIG_MTK_ENTERPRISE_AP_SUPPORT=n
CONFIG_MTK_MLME_MULTI_QUEUE_SUPPORT=y
CONFIG_MTK_WIFI_EAP_FEATURE=y
CONFIG_MTK_VLAN_SUPPORT=y
CONFIG_MTK_SNIFFER_SUPPORT=n
CONFIG_MTK_HIGHPRI_RATE_SPECIFIC=n
CONFIG_MTK_SNIFFER_RADIOTAP_SUPPORT=y
CONFIG_MTK_WF_RESET_SUPPORT=n
CONFIG_MTK_TXRX_STAT_SUPPORT=n
CONFIG_MTK_ANTENNA_CONTROL_SUPPORT=y
CONFIG_MTK_MGMT_TXPWR_CTRL=y
CONFIG_MTK_TXD_MGMT_TXPWR_CTRL=n
CONFIG_MTK_CHUTIL_SUPPORT=n
CONFIG_MTK_NF_SUPPORT=n
CONFIG_MTK_RA_PHY_RATE_SUPPORT=y
CONFIG_MTK_AMPDU_CONF_SUPPORT=y
CONFIG_MTK_ACK_CTS_TIMEOUT_SUPPORT=y
CONFIG_MTK_MBSS_DTIM_SUPPORT=y
CONFIG_MTK_ZERO_LOSS_CSA_SUPPORT=n
CONFIG_MTK_CFG80211_SUPPORT=n
CONFIG_MTK_DBDC_ONE_BAND_SUPPORT=n
CONFIG_MTK_MBSS_AS_WDS_AP_SUPPORT=n
CONFIG_MTK_DSCP_QOS_MAP_SUPPORT=n
CONFIG_MTK_QOS_R1_SUPPORT=y
CONFIG_MTK_DSCP_PRI_SUPPORT=y
CONFIG_MTK_MIN_PHY_RATE_SUPPORT=n
CONFIG_MTK_FAST_UP_RATE_SUPPORT=n
CONFIG_MTK_CON_WPS_SUPPORT=y
CONFIG_MTK_MCAST_RATE_SPECIFIC=y
CONFIG_MTK_VOW_SUPPORT=y
CONFIG_MTK_BAND_STEERING=y
CONFIG_MTK_LED_CONTROL_SUPPORT=y
CONFIG_MTK_WLAN_HOOK=y
CONFIG_MTK_RADIUS_ACCOUNTING_SUPPORT=n
CONFIG_MTK_GREENAP_SUPPORT=y
CONFIG_MTK_WIFI_CSI_CN_INFO_SUPPORT=n
CONFIG_MTK_6G_AFC_SUPPORT=n
CONFIG_MTK_VENDOR_FEATURE11_SUPPORT=n
CONFIG_MTK_PCIE_ASPM_DYM_CTRL_SUPPORT=n
CONFIG_MTK_COEX_SUPPORT=n
CONFIG_MTK_EASY_SETUP_SUPPORT=n
CONFIG_MTK_EVENT_NOTIFIER_SUPPORT=n
CONFIG_MTK_AIR_MONITOR=y
CONFIG_MTK_WNM_SUPPORT=y
CONFIG_MTK_INTERWORKING=y
CONFIG_MTK_LINUX_NET_TXQ_SUPPORT=n
CONFIG_MTK_WPA3_SUPPORT=y
CONFIG_MTK_OWE_SUPPORT=y
CONFIG_MTK_SINGLE_SKU=n
CONFIG_MTK_PROFILING_SUPPORT=n
CONFIG_MTK_6G_SUPPORT=n
CONFIG_MTK_WIFI_MT_MAC=y
CONFIG_MTK_MT_MAC=y
CONFIG_MTK_CHIP_MT7603E=n
CONFIG_MTK_CHIP_MT7615E=n
CONFIG_MTK_CHIP_MT7622=n
CONFIG_MTK_CHIP_MT7663E=n
CONFIG_MTK_CHIP_MT7626=n
CONFIG_MTK_CHIP_AXE=n
CONFIG_MTK_CHIP_MT7915=n
CONFIG_MTK_CHIP_MT7986=y
CONFIG_MTK_CHIP_MT7916=n
CONFIG_MTK_CHIP_MT7981=n
CONFIG_PACKAGE_kmod-mtfwd=y
CONFIG_PACKAGE_kmod-mtqos=y
CONFIG_PACKAGE_kmod-warp=y
CONFIG_WARP_VERSION=2
CONFIG_WARP_ATC_SUPPORT=n
CONFIG_WARP_DBG_SUPPORT=y
CONFIG_WARP_WDMA_RECYCLE_SUPPORT=n
CONFIG_WED_HW_RRO_SUPPORT=y
CONFIG_WARP_MEMORY_LEAK_DBG=y
CONFIG_WARP_CHIPSET="mt7986"
CONFIG_WARP_WO_EMBEDDED_LOAD=n
CONFIG_PACKAGE_wifi-profile=y
CONFIG_first_card=y
CONFIG_first_card_name="MT7986"
CONFIG_first_card_profile_path="/etc/wireless/mediatek/mt7986-ax6000.dbdc.b0.dat;/etc/wireless/mediatek/mt7986-ax6000.dbdc.b1.dat"
CONFIG_first_card_init_script="/lib/wifi/mtwifi.lua;/lib/wifi/mtwifi.lua"
CONFIG_first_card_init_compatible="mtwifi;mtwifi"
CONFIG_first_card_EEPROM_offset="0x0"
CONFIG_first_card_EEPROM_size="0xA0000"
CONFIG_first_card_EEPROM_name="e2p"
CONFIG_first_card_main_ifname="ra0;rax0"
CONFIG_first_card_ext_ifname="ra;rax"
CONFIG_first_card_wds_ifname="wds;wdsx"
CONFIG_first_card_apcli_ifname="apcli;apclix"
CONFIG_first_card_mesh_ifname="mesh;meshx"
CONFIG_first_card_nvram_zone="dev1;dev2"
CONFIG_first_card_single_sku_path="/etc/wireless/mediatek/mt7986-sku.dat"
CONFIG_first_card_bf_sku_path="/etc/wireless/mediatek/mt7986-sku-bf.dat"
CONFIG_second_card=n
CONFIG_third_card=n
CONFIG_WIFI_NORMAL_SETTING=n
CONFIG_WIFI_QUICK_SETTING=y

View File

@ -0,0 +1,28 @@
---
profile: glinet_gl-mt6000
target: mediatek
subtarget: mt7986
description: Build image for the GL.iNET MT6000
feeds:
- name: gl_feed_common
uri: https://github.com/gl-inet/gl-feeds.git
branch: common
- name: gl_feed_21_02
uri: https://github.com/gl-inet/gl-feeds.git
branch: 21.02.2
packages:
- ethtool
- iwinfo
- wireless-tools
- gl-sdk4-mtk-wifi-v2
- kmod-mediatek_hnat
- mii_mgr
- mtkhnat_util
- regs
- luci
- 8021xd
- fwdd
- kmod-mtfwd
- kmod-mtqos