mt798x: upgrade to v7.6.6.1

Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
This commit is contained in:
Jianhui Zhao 2022-09-20 19:16:34 +08:00
parent 284938b5a2
commit 8e06d62d59
23 changed files with 90107 additions and 185 deletions

View File

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

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,184 @@
From a98543c878c34dccb006b303956d548b541dc8d4 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] GPIO: add named gpio exports
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../800-GPIO-add-named-gpio-exports.patch | 164 ++++++++++++++++++
1 file changed, 164 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/800-GPIO-add-named-gpio-exports.patch
diff --git a/target/linux/generic/hack-5.4/800-GPIO-add-named-gpio-exports.patch b/target/linux/generic/hack-5.4/800-GPIO-add-named-gpio-exports.patch
new file mode 100644
index 0000000000..41f123910e
--- /dev/null
+++ b/target/linux/generic/hack-5.4/800-GPIO-add-named-gpio-exports.patch
@@ -0,0 +1,164 @@
+Index: linux-5.4.188/drivers/gpio/gpiolib-of.c
+===================================================================
+--- linux-5.4.188.orig/drivers/gpio/gpiolib-of.c
++++ linux-5.4.188/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"
+@@ -915,3 +917,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
+Index: linux-5.4.188/drivers/gpio/gpiolib-sysfs.c
+===================================================================
+--- linux-5.4.188.orig/drivers/gpio/gpiolib-sysfs.c
++++ linux-5.4.188/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)
+Index: linux-5.4.188/include/asm-generic/gpio.h
+===================================================================
+--- linux-5.4.188.orig/include/asm-generic/gpio.h
++++ linux-5.4.188/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)
+ {
+Index: linux-5.4.188/include/linux/gpio/consumer.h
+===================================================================
+--- linux-5.4.188.orig/include/linux/gpio/consumer.h
++++ linux-5.4.188/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.25.1

View File

@ -0,0 +1,54 @@
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,36 @@ 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))", \
+ "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)" \
+ }'
+
+define Build/append-gl-metadata
+ $(if $(SUPPORTED_DEVICES),-echo $(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,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,186 @@
From 916a1e5f3f467b96962ad78ab989df2ed3406c30 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>
---
.../950-wireguard-support-hotplug.patch | 166 ++++++++++++++++++
1 file changed, 166 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/950-wireguard-support-hotplug.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..740b300e5b
--- /dev/null
+++ b/target/linux/generic/hack-5.4/950-wireguard-support-hotplug.patch
@@ -0,0 +1,166 @@
+Index: linux-5.4.188/drivers/net/wireguard/Makefile
+===================================================================
+--- linux-5.4.188.orig/drivers/net/wireguard/Makefile
++++ linux-5.4.188/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
+Index: linux-5.4.188/drivers/net/wireguard/hotplug.c
+===================================================================
+--- /dev/null
++++ linux-5.4.188/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);
++}
+Index: linux-5.4.188/drivers/net/wireguard/hotplug.h
+===================================================================
+--- /dev/null
++++ linux-5.4.188/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
++
+Index: linux-5.4.188/drivers/net/wireguard/noise.c
+===================================================================
+--- linux-5.4.188.orig/drivers/net/wireguard/noise.c
++++ linux-5.4.188/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>
+@@ -817,6 +818,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);
+ }
+Index: linux-5.4.188/drivers/net/wireguard/timers.c
+===================================================================
+--- linux-5.4.188.orig/drivers/net/wireguard/timers.c
++++ linux-5.4.188/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);
+ }
+ }
+
--
2.25.1

View File

@ -0,0 +1,453 @@
From 9e780b505183e3f754666adddd77b8084ca7b45b 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/0100-support-mtk.patch | 112 +++++++
package/network/utils/iwinfo/src/iwinfo_mtk.c | 299 ++++++++++++++++++
3 files changed, 412 insertions(+), 1 deletion(-)
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 815c477988..4fa21e7dee 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/0100-support-mtk.patch b/package/network/utils/iwinfo/patches/0100-support-mtk.patch
new file mode 100644
index 0000000000..4c5ebc014c
--- /dev/null
+++ b/package/network/utils/iwinfo/patches/0100-support-mtk.patch
@@ -0,0 +1,112 @@
+Index: libiwinfo-2021-04-30-c45f0b58/Makefile
+===================================================================
+--- libiwinfo-2021-04-30-c45f0b58.orig/Makefile
++++ libiwinfo-2021-04-30-c45f0b58/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-2021-04-30-c45f0b58/include/iwinfo.h
+===================================================================
+--- libiwinfo-2021-04-30-c45f0b58.orig/include/iwinfo.h
++++ libiwinfo-2021-04-30-c45f0b58/include/iwinfo.h
+@@ -305,6 +305,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-2021-04-30-c45f0b58/iwinfo_lib.c
+===================================================================
+--- libiwinfo-2021-04-30-c45f0b58.orig/iwinfo_lib.c
++++ libiwinfo-2021-04-30-c45f0b58/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-2021-04-30-c45f0b58/include/iwinfo/lua.h
+===================================================================
+--- libiwinfo-2021-04-30-c45f0b58.orig/include/iwinfo/lua.h
++++ libiwinfo-2021-04-30-c45f0b58/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-2021-04-30-c45f0b58/iwinfo_lua.c
+===================================================================
+--- libiwinfo-2021-04-30-c45f0b58.orig/iwinfo_lua.c
++++ libiwinfo-2021-04-30-c45f0b58/iwinfo_lua.c
+@@ -769,6 +769,15 @@ 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)
++#endif
++
+ /* Wext */
+ LUA_WRAP_INT_OP(wext,channel)
+ LUA_WRAP_INT_OP(wext,frequency)
+@@ -896,6 +905,19 @@ static const luaL_reg R_nl80211[] = {
+ };
+ #endif
+
++#ifdef USE_MTK
++/* NL80211 table */
++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,phyname),
++ { NULL, NULL }
++};
++#endif
++
+ /* Wext table */
+ static const luaL_reg R_wext[] = {
+ LUA_REG(wext,channel),
+@@ -965,6 +987,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..55f9d28e0c
--- /dev/null
+++ b/package/network/utils/iwinfo/src/iwinfo_mtk.c
@@ -0,0 +1,299 @@
+#include "iwinfo.h"
+#include "iwinfo_wext.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)
+
+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_isap(const char *ifname)
+{
+ return !strncmp(ifname, "ra", 2);
+}
+
+static int mtk_iscli(const char *ifname)
+{
+ return !strncmp(ifname, "apcli", 5);
+}
+
+static int mtk_iswds(const char *ifname)
+{
+ return !strncmp(ifname, "wds", 3);
+}
+
+static int mtk_probe(const char *ifname)
+{
+ return mtk_isap(ifname) || mtk_iscli(ifname) || mtk_iswds(ifname);
+}
+
+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)
+{
+ return wext_ops.ssid(ifname, buf);
+}
+
+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)
+{
+ return wext_ops.frequency(ifname, buf);
+}
+
+static int mtk_get_txpower(const char *ifname, int *buf)
+{
+ return wext_ops.txpower(ifname, buf);
+}
+
+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;
+ }
+
+ 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)
+{
+ return wext_ops.txpwrlist(ifname, buf, len);
+}
+
+static int mtk_get_scanlist(const char *ifname, char *buf, int *len)
+{
+ return -1;
+}
+
+static int mtk_get_freqlist(const char *ifname, char *buf, int *len)
+{
+ 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)
+{
+ return wext_ops.hwmodelist(ifname, buf);
+}
+
+static int mtk_get_htmodelist(const char *ifname, int *buf)
+{
+ /* Stub */
+ 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, "ra"))
+ strcpy(buf, "ra0");
+ else if (strstr(ifname, "rax"))
+ strcpy(buf, "rax0");
+ 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,
+ .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
+};
--
2.25.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,50 @@
From 992762cb82e78b44199e30a7f13d82eba2131e1f 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 392d773622..4f56ea9193 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
mkdir -p $(TARGET_DIR)/tmp
$(file >$(TMP_DIR)/opkg_install_list,\
$(call opkg_package_files,\
- $(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg)))))
+ $(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))) \
+ $(GL_APPEND_IPKS)
$(call opkg,$(TARGET_DIR)) install $$(cat $(TMP_DIR)/opkg_install_list)
@for file in $(PACKAGE_INSTALL_FILES); do \
[ -s $$file.flags ] || continue; \
--
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,291 @@
From 2dc469ac6ab76fa2df0f0804a1d158d3dac61357 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 13 Jul 2022 18:08:22 +0800
Subject: [PATCH] kernel: add some modem support for gl
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../951-add-some-modem-support-for-gl.patch | 271 ++++++++++++++++++
1 file changed, 271 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/951-add-some-modem-support-for-gl.patch
diff --git a/target/linux/generic/hack-5.4/951-add-some-modem-support-for-gl.patch b/target/linux/generic/hack-5.4/951-add-some-modem-support-for-gl.patch
new file mode 100644
index 0000000000..402fa7bb2f
--- /dev/null
+++ b/target/linux/generic/hack-5.4/951-add-some-modem-support-for-gl.patch
@@ -0,0 +1,271 @@
+Index: linux-5.4.188/drivers/net/usb/qmi_wwan.c
+===================================================================
+--- linux-5.4.188.orig/drivers/net/usb/qmi_wwan.c
++++ linux-5.4.188/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,20 @@ 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;
+ }
+@@ -891,7 +923,10 @@ static const struct driver_info qmi_wwan
+ .bind = qmi_wwan_bind,
+ .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,
++ .rx_fixup = qmi_wwan_rx_fixup,
++#endif
+ };
+
+ static const struct driver_info qmi_wwan_info_quirk_dtr = {
+@@ -938,6 +973,17 @@ 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(0x05C6, 0x9003, 4) }, /* Quectel UC20 */
++ { QMI_FIXED_INTF(0x2C7C, 0x0125, 4) }, /* Quectel EC25 */
++ { QMI_FIXED_INTF(0x2C7C, 0x0121, 4) }, /* Quectel EC21 */
++ { QMI_FIXED_INTF(0x05C6, 0x9215, 4) }, /* Quectel EC20 */
++ { 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, 0x0296, 4) }, /* Quectel BG96 */
++ { 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),
+@@ -1398,7 +1444,6 @@ static const struct usb_device_id produc
+ {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
+ {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
+ {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
+- {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
+ {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */
+ {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
+ {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
+Index: linux-5.4.188/drivers/usb/serial/option.c
+===================================================================
+--- linux-5.4.188.orig/drivers/usb/serial/option.c
++++ linux-5.4.188/drivers/usb/serial/option.c
+@@ -568,6 +568,23 @@ static void option_instat_callback(struc
+ #define WETELECOM_PRODUCT_WMD300 0x6803
+
+
++#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
++
+ /* Device flags */
+
+ /* Highest interface number which can be used with NCTRL() and RSVD() */
+@@ -587,6 +604,28 @@ static void option_instat_callback(struc
+
+
+ static const struct usb_device_id option_ids[] = {
++#if 1 //Added by Quectel
++ { USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */
++ { USB_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */
++ { USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC25 */
++ { USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */
++ { USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */
++ { USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */
++ { USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */
++ { USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */
++ { USB_DEVICE(0x2C7C, 0x0700) }, /* Quectel BG95 */
++ { USB_DEVICE(0x2C7C, 0x0296) }, /* Quectel BG96 */
++ { USB_DEVICE(0x2C7C, 0x0435) }, /* Quectel AG35 */
++ { USB_DEVICE(0x2C7C, 0x6026) }, /* Quectel EC200t */
++#endif
++ { USB_DEVICE(0x19d2, 0x0536) },/* MZ386 */
++ { USB_DEVICE(0x19d2, 0x0117) },
++ { USB_DEVICE(0x19d2, 0x0199) },
++ { USB_DEVICE(0x19d2, 0x1476) },
++ { 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) },
+ { 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) },
+@@ -2204,7 +2243,87 @@ 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;
++#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;
+ }
+Index: linux-5.4.188/drivers/usb/serial/qcserial.c
+===================================================================
+--- linux-5.4.188.orig/drivers/usb/serial/qcserial.c
++++ linux-5.4.188/drivers/usb/serial/qcserial.c
+@@ -88,7 +88,6 @@ static const struct usb_device_id id_tab
+ {USB_DEVICE(0x03f0, 0x241d)}, /* HP Gobi 2000 QDL device (VP412) */
+ {USB_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
+ {USB_DEVICE(0x05c6, 0x9214)}, /* Acer Gobi 2000 QDL device (VP413) */
+- {USB_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
+ {USB_DEVICE(0x05c6, 0x9264)}, /* Asus Gobi 2000 QDL device (VR305) */
+ {USB_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
+ {USB_DEVICE(0x05c6, 0x9234)}, /* Top Global Gobi 2000 QDL device (VR306) */
+Index: linux-5.4.188/drivers/usb/serial/usb_wwan.c
+===================================================================
+--- linux-5.4.188.orig/drivers/usb/serial/usb_wwan.c
++++ linux-5.4.188/drivers/usb/serial/usb_wwan.c
+@@ -477,6 +477,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.25.1

View File

@ -0,0 +1,104 @@
From 87ca5eb7ee50f3a7f3b68d51d79d5526ae6b1727 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Mon, 19 Sep 2022 14:11:34 +0800
Subject: [PATCH] target/mediatek: mtk-eth poll gpy211 link state
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../net/ethernet/mediatek/mtk_eth_soc.c | 42 ++++++++++++++++++-
.../drivers/net/ethernet/mediatek/mtk_sgmii.c | 5 ++-
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index a05cd19df6..559a78fd58 100755
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -11,6 +11,7 @@
#include <linux/of_net.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
+#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/pm_runtime.h>
#include <linux/if_vlan.h>
@@ -423,7 +424,10 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
mcr_new |= MAC_MCR_SPEED_1000;
break;
case SPEED_100:
- mcr_new |= MAC_MCR_SPEED_100;
+ if (state->interface == PHY_INTERFACE_MODE_2500BASEX)
+ mcr_new |= MAC_MCR_SPEED_1000;
+ else
+ mcr_new |= MAC_MCR_SPEED_100;
break;
}
if (state->duplex == DUPLEX_FULL) {
@@ -3509,6 +3513,40 @@ static const struct net_device_ops mtk_netdev_ops = {
#endif
};
+static void phylink_fixed_state(struct net_device *dev,
+ struct phylink_link_state *state)
+{
+#define PHY_MIISTAT 0x18 /* MII state */
+#define PHY_MIISTAT_SPD_MASK GENMASK(2, 0)
+#define PHY_MIISTAT_DPX BIT(3)
+#define PHY_MIISTAT_LS BIT(10)
+#define PHY_MIISTAT_SPD_10 0
+#define PHY_MIISTAT_SPD_100 1
+#define PHY_MIISTAT_SPD_1000 2
+#define PHY_MIISTAT_SPD_2500 4
+
+ struct mtk_mac *mac = netdev_priv(dev);
+ u32 val = _mtk_mdio_read(mac->hw, 0x05, PHY_MIISTAT);
+
+ state->link = (val & PHY_MIISTAT_LS) ? 1 : 0;
+ state->duplex = (val & PHY_MIISTAT_DPX) ? DUPLEX_FULL : DUPLEX_HALF;
+
+ switch (FIELD_GET(PHY_MIISTAT_SPD_MASK, val)) {
+ case PHY_MIISTAT_SPD_10:
+ state->speed = SPEED_10;
+ break;
+ case PHY_MIISTAT_SPD_100:
+ state->speed = SPEED_100;
+ break;
+ case PHY_MIISTAT_SPD_1000:
+ state->speed = SPEED_1000;
+ break;
+ case PHY_MIISTAT_SPD_2500:
+ state->speed = SPEED_2500;
+ break;
+ }
+}
+
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
{
const __be32 *_id = of_get_property(np, "reg", NULL);
@@ -3585,6 +3623,8 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
goto free_netdev;
}
+ phylink_fixed_state_cb(phylink, phylink_fixed_state);
+
mac->phylink = phylink;
fixed_node = fwnode_get_named_child_node(of_fwnode_handle(mac->of_node),
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c
index 8198c7cb59..e0406e2b86 100755
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c
@@ -111,7 +111,10 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, unsigned int id,
val |= SGMII_SPEED_10;
break;
case SPEED_100:
- val |= SGMII_SPEED_100;
+ if (state->interface == PHY_INTERFACE_MODE_2500BASEX)
+ val |= SGMII_SPEED_1000;
+ else
+ val |= SGMII_SPEED_100;
break;
case SPEED_2500:
case SPEED_1000:
--
2.25.1

View File

@ -0,0 +1,35 @@
From 8921a2f85f93142243dd33077fa51e6e5a3c6b19 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Mon, 19 Sep 2022 14:16:04 +0800
Subject: [PATCH] target/mediatek: mtkhnat: fix for gl
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 6b937d5f29..db2919a360 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
@@ -1526,7 +1526,7 @@ static unsigned int skb_to_hnat_info(struct sk_buff *skb,
gmac = ((skb_hnat_entry(skb) >> 1) % hnat_priv->gmac_num) ?
NR_GMAC2_PORT : NR_GMAC1_PORT;
else
- gmac = NR_GMAC1_PORT;
+ gmac = NR_GMAC2_PORT;
} else if (IS_WAN(dev)) {
if (IS_DSA_WAN(dev))
port_id = hnat_dsa_fill_stag(dev,&entry, hw_path,
@@ -1537,7 +1537,7 @@ static unsigned int skb_to_hnat_info(struct sk_buff *skb,
/* Set act_dp = wan_dev */
entry.ipv4_hnapt.act_dp = dev->ifindex;
} else {
- gmac = (IS_GMAC1_MODE) ? NR_GMAC1_PORT : NR_GMAC2_PORT;
+ gmac = NR_GMAC1_PORT;
}
} else if (IS_EXT(dev) && (FROM_GE_PPD(skb) || FROM_GE_LAN(skb) ||
FROM_GE_WAN(skb) || FROM_GE_VIRTUAL(skb) || FROM_WED(skb))) {
--
2.25.1

View File

@ -0,0 +1,32 @@
From 2549668921d0521884b76d3b49fbd04bab9bf65d Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Wed, 24 Aug 2022 19:25:30 +0800
Subject: [PATCH] kernel: fix phylink resolve fixed-link
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../hack-5.4/801-fix-phylink-resolve-fixed.patch | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/801-fix-phylink-resolve-fixed.patch
diff --git a/target/linux/generic/hack-5.4/801-fix-phylink-resolve-fixed.patch b/target/linux/generic/hack-5.4/801-fix-phylink-resolve-fixed.patch
new file mode 100644
index 0000000000..971fbce35b
--- /dev/null
+++ b/target/linux/generic/hack-5.4/801-fix-phylink-resolve-fixed.patch
@@ -0,0 +1,12 @@
+Index: linux-5.4.188/drivers/net/phy/phylink.c
+===================================================================
+--- linux-5.4.188.orig/drivers/net/phy/phylink.c
++++ linux-5.4.188/drivers/net/phy/phylink.c
+@@ -494,7 +494,6 @@ static void phylink_resolve(struct work_
+
+ case MLO_AN_FIXED:
+ phylink_get_fixed_state(pl, &link_state);
+- phylink_mac_config_up(pl, &link_state);
+ break;
+
+ case MLO_AN_INBAND:
--
2.25.1

View File

@ -0,0 +1,54 @@
From 7aba28aeff2c9e7257e642596c7c9b84f5cb29f4 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 +++++++++++++
.../9999-wext-increase-iw-scan-data-size.patch | 13 +++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 package/network/utils/wireless-tools/patches/100-increase-buffer-size.patch
create mode 100644 target/linux/mediatek/patches-5.4/9999-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/mediatek/patches-5.4/9999-wext-increase-iw-scan-data-size.patch b/target/linux/mediatek/patches-5.4/9999-wext-increase-iw-scan-data-size.patch
new file mode 100644
index 0000000000..0e61a0e986
--- /dev/null
+++ b/target/linux/mediatek/patches-5.4/9999-wext-increase-iw-scan-data-size.patch
@@ -0,0 +1,13 @@
+Index: linux-5.4.188/include/uapi/linux/wireless.h
+===================================================================
+--- linux-5.4.188.orig/include/uapi/linux/wireless.h
++++ linux-5.4.188/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.25.1

View File

@ -0,0 +1,78 @@
From 5109400c48d138f7c90c034e05ecfda78046031f Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Mon, 19 Sep 2022 14:44:38 +0800
Subject: [PATCH] kernel: nand: fix crash log for gl
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../hack-5.4/950-nand-crash-log-gl.patch | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 target/linux/generic/hack-5.4/950-nand-crash-log-gl.patch
diff --git a/target/linux/generic/hack-5.4/950-nand-crash-log-gl.patch b/target/linux/generic/hack-5.4/950-nand-crash-log-gl.patch
new file mode 100644
index 0000000000..0883501e2c
--- /dev/null
+++ b/target/linux/generic/hack-5.4/950-nand-crash-log-gl.patch
@@ -0,0 +1,58 @@
+Index: linux-5.4.211/drivers/mtd/mtdoops.c
+===================================================================
+--- linux-5.4.211.orig/drivers/mtd/mtdoops.c
++++ linux-5.4.211/drivers/mtd/mtdoops.c
+@@ -186,8 +186,25 @@ static void mtdoops_write(struct mtdoops
+ hdr[1] = MTDOOPS_KERNMSG_MAGIC;
+
+ if (panic) {
+- ret = mtd_panic_write(mtd, cxt->nextpage * record_size,
+- record_size, &retlen, cxt->oops_buf);
++ int count = record_size / 0x800;
++ int i = 0;
++ const u_char * p = cxt->oops_buf;
++ while(count--) {
++ ret = mtd_write(mtd, cxt->nextpage * record_size + i * 0x800,
++ record_size - i * 0x800, &retlen, p);
++ if (ret == 0) {
++ break;
++ }
++ else {
++ if ((p + 0x800) != NULL) {
++ p = p + 0x800;
++ i++;
++ }
++ else {
++ break;
++ }
++ }
++ }
+ if (ret == -EOPNOTSUPP) {
+ printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n");
+ return;
+@@ -195,10 +212,11 @@ static void mtdoops_write(struct mtdoops
+ } else
+ ret = mtd_write(mtd, cxt->nextpage * record_size,
+ record_size, &retlen, cxt->oops_buf);
+-
++#if 0
+ if (retlen != record_size || ret < 0)
+ printk(KERN_ERR "mtdoops: write failure at %ld (%td of %ld written), error %d\n",
+ cxt->nextpage * record_size, retlen, record_size, ret);
++#endif
+ mark_page_used(cxt, cxt->nextpage);
+ memset(cxt->oops_buf, 0xff, record_size);
+
+@@ -207,10 +225,12 @@ static void mtdoops_write(struct mtdoops
+
+ static void mtdoops_workfunc_write(struct work_struct *work)
+ {
++#if 0
+ struct mtdoops_context *cxt =
+ container_of(work, struct mtdoops_context, work_write);
+
+ mtdoops_write(cxt, 0);
++#endif
+ }
+
+ static void find_next_position(struct mtdoops_context *cxt)
--
2.25.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,376 @@
From 2dcedb28028296eace0551ebeb621724e5b75343 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Mon, 19 Sep 2022 15:20:05 +0800
Subject: [PATCH] target/mediatek: add board for GL.iNet GL-MT3000
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../boot/dts/mediatek/mt7981-gl-mt3000.dts | 274 ++++++++++++++++++
target/linux/mediatek/image/mt7981.mk | 18 ++
.../mt7981/base-files/etc/board.d/02_network | 31 +-
3 files changed, 300 insertions(+), 23 deletions(-)
create mode 100755 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-gl-mt3000.dts
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-gl-mt3000.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-gl-mt3000.dts
new file mode 100755
index 0000000000..f382be2a2c
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-gl-mt3000.dts
@@ -0,0 +1,274 @@
+/dts-v1/;
+
+#include "mt7981.dtsi"
+
+/ {
+ model = "GL.iNet GL-MT3000";
+ compatible = "glinet,mt3000-snand", "mediatek,mt7981";
+
+ aliases {
+ led-boot = &led_run;
+ led-failsafe = &led_run;
+ led-running = &led_run;
+ led-upgrade = &led_run;
+ };
+
+ chosen {
+ bootargs = "console=ttyS0,115200n1 loglevel=8 \
+ earlycon=uart8250,mmio32,0x11002000";
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ switch {
+ label = "switch";
+ linux,code = <KEY_SETUP>;
+ gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_run: led@0 {
+ label = "blue:run";
+ gpios = <&pio 31 GPIO_ACTIVE_LOW>;
+ };
+
+ led@1 {
+ label = "white:system";
+ gpios = <&pio 30 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ nmbm_spim_nand {
+ compatible = "generic,nmbm";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ lower-mtd-device = <&spi_nand>;
+ max-reserved-blocks = <32>;
+ forced-create;
+
+ partitions {
+ compatible = "fixed-partitions";
+
+ partition@0 {
+ label = "BL2";
+ reg = <0x00000 0x0100000>;
+ read-only;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x0100000 0x0080000>;
+ };
+
+ partition@180000 {
+ label = "Factory";
+ reg = <0x180000 0x0200000>;
+ };
+
+ partition@380000 {
+ label = "FIP";
+ reg = <0x380000 0x0200000>;
+ };
+
+ partition@580000 {
+ label = "log";
+ reg = <0x580000 0x40000>;
+ };
+
+ partition@5c0000 {
+ label = "ubi";
+ reg = <0x5c0000 0>;
+ };
+ };
+ };
+
+ gl-hw {
+ compatible = "gl-hw-info";
+ model = "mt3000";
+ wan = "eth0";
+ lan = "eth1";
+ usb-port = "1-1";
+ fan = "pwmchip0";
+ flash_size = <256>;
+ temperature = "/sys/devices/virtual/thermal/thermal_zone0/temp";
+ switch-button = "gpio-455";
+ reset-button = "gpio-456";
+ radio = "mt798111 mt798112";
+ dfs;
+ factory_data {
+ device_mac = "Factory", "0x0a";
+ device_ddns = "Factory", "0x10";
+ device_sn_bak = "Factory", "0x20";
+ device_sn = "Factory", "0x30";
+ country_code = "Factory", "0x88";
+ };
+ };
+
+ gl_fan {
+ compatible = "gl-fan";
+ interrupt-parent = <&pio>;
+ interrupts = <29 IRQ_TYPE_EDGE_RISING>;
+ };
+
+ pwm-fan {
+ compatible = "pwm-fan";
+ cooling-min-state = <0>;
+ cooling-max-state = <255>;
+ #cooling-cells = <2>;
+ pwms = <&pwm 0 40000 0>;
+ cooling-levels = <0 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
+ 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 37 38 39
+ 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
+ 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
+ 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
+ 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
+ 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
+ 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
+ 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
+ 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
+ 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
+ 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
+ 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255>;
+ };
+
+ gpio-export {
+ compatible = "gpio-export";
+
+ usb_power {
+ gpio-export,name = "usb_power";
+ gpio-export,output = <1>;
+ gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
+ };
+
+ fan_power {
+ gpio-export,name = "fan_power";
+ gpio-export,output = <1>;
+ gpios = <&pio 28 GPIO_ACTIVE_HIGH>;
+ };
+ };
+};
+
+&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 = "gmii";
+ phy-handle = <&phy0>;
+ };
+
+ mdio: mdio-bus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ phy0: phy@0 {
+ compatible = "ethernet-phy-id03a2.9461";
+ reg = <0>;
+ nvmem-cells = <&phy_calibration>;
+ nvmem-cell-names = "phy-cal-data";
+ };
+
+ phy5: phy@5 {
+ compatible = "ethernet-phy-id67c9.de0a";
+ reg = <5>;
+ reset-gpios = <&pio 14 1>;
+ reset-assert-us = <600>;
+ reset-deassert-us = <20000>;
+ };
+ };
+};
+
+&hnat {
+ mtketh-wan = "eth0";
+ mtketh-lan = "eth1";
+ mtketh-ppd = "eth1";
+ mtketh-max-gmac = <2>;
+ status = "okay";
+};
+
+&spi0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_flash_pins>;
+ status = "okay";
+ spi_nand: spi_nand@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "spi-nand";
+ reg = <0>;
+ spi-max-frequency = <52000000>;
+ spi-tx-buswidth = <4>;
+ spi-rx-buswidth = <4>;
+ };
+};
+
+&pio {
+ pwm0_pin: pwm0-pin-g0 {
+ mux {
+ function = "pwm";
+ groups = "pwm0_1";
+ };
+ };
+
+ spi0_flash_pins: spi0-pins {
+ mux {
+ function = "spi";
+ groups = "spi0", "spi0_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
+ };
+
+ conf-pd {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
+ };
+ };
+};
+
+&xhci {
+ mediatek,u3p-dis-msk = <0x0>;
+ phys = <&u2port0 PHY_TYPE_USB2>,
+ <&u3port0 PHY_TYPE_USB3>;
+ status = "okay";
+};
+
+&pwm {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwm0_pin>;
+};
diff --git a/target/linux/mediatek/image/mt7981.mk b/target/linux/mediatek/image/mt7981.mk
index ab3ed5b42f..3e47d600b5 100755
--- a/target/linux/mediatek/image/mt7981.mk
+++ b/target/linux/mediatek/image/mt7981.mk
@@ -171,3 +171,21 @@ define Device/mt7981-fpga-sd
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += mt7981-fpga-sd
+
+define Device/glinet_gl-mt3000
+ DEVICE_VENDOR := GL.iNet
+ DEVICE_MODEL := GL-MT3000
+ DEVICE_DTS := mt7981-gl-mt3000
+ DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
+ SUPPORTED_DEVICES := glinet,mt3000-snand
+ DEVICE_PACKAGES := kmod-hwmon-pwmfan
+ UBINIZE_OPTS := -E 5
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ IMAGE_SIZE := 65536k
+ KERNEL_IN_UBI := 1
+ IMAGES += factory.bin
+ IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
+endef
+TARGET_DEVICES += glinet_gl-mt3000
diff --git a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network
index 0d35a2207a..6865f52bb8 100755
--- a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network
@@ -22,6 +22,9 @@ mediatek_setup_interfaces()
*2500wan-p5*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan
;;
+ *mt3000*)
+ ucidef_set_interfaces_lan_wan eth1 eth0
+ ;;
*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1
;;
@@ -34,34 +37,16 @@ mediatek_setup_macs()
local part_name="Factory"
local lan_mac=""
local wan_mac=""
- local lan_mac_offset=""
- local wan_mac_offset=""
case $board in
- *)
- lan_mac_offset="0x2A"
- wan_mac_offset="0x24"
+ *mt3000*)
+ wan_mac=$(mtd_get_mac_binary $part_name 0x0a)
+ lan_mac=$(macaddr_add "$wan_mac" 1)
;;
esac
- lan_mac=$(mtd_get_mac_binary $part_name $lan_mac_offset)
- wan_mac=$(mtd_get_mac_binary $part_name $wan_mac_offset)
-
- case "$lan_mac" in
- 00:00:00:00:00:00);;
- ff:ff:ff:ff:ff:ff);;
- *)
- [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
- ;;
- esac
-
- case "$wan_mac" in
- 00:00:00:00:00:00);;
- ff:ff:ff:ff:ff:ff);;
- *)
- [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
- ;;
- esac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
}
board_config_update
--
2.25.1

View File

@ -0,0 +1,80 @@
From 196ce0cfa265f7ecace68547a56bdda5b4808650 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Mon, 19 Sep 2022 15:39:52 +0800
Subject: [PATCH] target/mediatek: add board for GL.iNet GL-X3000
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../boot/dts/mediatek/mt7981-gl-x3000.dts | 8 ++++++++
target/linux/mediatek/image/mt7981.mk | 18 ++++++++++++++++++
.../mt7981/base-files/etc/board.d/02_network | 6 ++++--
3 files changed, 30 insertions(+), 2 deletions(-)
create mode 100755 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-gl-x3000.dts
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-gl-x3000.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-gl-x3000.dts
new file mode 100755
index 0000000000..769a9416e6
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-gl-x3000.dts
@@ -0,0 +1,8 @@
+/dts-v1/;
+
+#include "mt7981-gl-mt3000.dts"
+
+/ {
+ model = "GL.iNet GL-X3000";
+ compatible = "glinet,x3000-snand", "mediatek,mt7981";
+};
diff --git a/target/linux/mediatek/image/mt7981.mk b/target/linux/mediatek/image/mt7981.mk
index 3e47d600b5..c6259ccd5f 100755
--- a/target/linux/mediatek/image/mt7981.mk
+++ b/target/linux/mediatek/image/mt7981.mk
@@ -189,3 +189,21 @@ define Device/glinet_gl-mt3000
IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
endef
TARGET_DEVICES += glinet_gl-mt3000
+
+define Device/glinet_gl-x3000
+ DEVICE_VENDOR := GL.iNet
+ DEVICE_MODEL := GL-X3000
+ DEVICE_DTS := mt7981-gl-x3000
+ DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
+ SUPPORTED_DEVICES := glinet,x3000-snand
+ DEVICE_PACKAGES := kmod-hwmon-pwmfan
+ UBINIZE_OPTS := -E 5
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ IMAGE_SIZE := 65536k
+ KERNEL_IN_UBI := 1
+ IMAGES += factory.bin
+ IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
+endef
+TARGET_DEVICES += glinet_gl-x3000
diff --git a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network
index 6865f52bb8..505a9c598c 100755
--- a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network
@@ -22,7 +22,8 @@ mediatek_setup_interfaces()
*2500wan-p5*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan
;;
- *mt3000*)
+ *mt3000*|\
+ *x3000*)
ucidef_set_interfaces_lan_wan eth1 eth0
;;
*)
@@ -39,7 +40,8 @@ mediatek_setup_macs()
local wan_mac=""
case $board in
- *mt3000*)
+ *mt3000*|\
+ *x3000*)
wan_mac=$(mtd_get_mac_binary $part_name 0x0a)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
--
2.25.1

View File

@ -5,36 +5,20 @@ subtarget: mt7981
description: Build image for the GL.iNET MT3000
feeds:
- name: mtk_openwrt_feed
uri: https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds.git
revision: 4c6b600
- name: gl_feed_common
uri: https://github.com/gl-inet/gl-feeds.git
revision: 6d6029902c2f1d3ba56e213feeb39028675dd0e5
- name: gl_feed_21_02
uri: https://github.com/gl-inet/gl-feeds.git
revision: 032786d5ff300ebdd83fb1b5fec5344b3da04953
- name: gl_feed_mt7981
uri: https://github.com/gl-inet/gl-feeds.git
revision: da09723846cf25c6b7e288cd1669c89ea4d6071e
- name: mt7981
uri: git@gitlab.com:gl.sdk4.0/gl.router/mt7981-feeds.git
revision: 6b3b18ad3c212096990eadbe64e96a19f081f8fb
- name: mt7981_private
uri: https://gitlab.com/gl.sdk4.0/gl.router/mt7981-feeds.git
revision: ff220779f907c3e60fa14f72e895ad295c8b4344
packages:
- 8021xd
- fwdd
- mii_mgr
- regs
- wificonf
- mtk-base-files
- mtk_factory_rw
- ethtool
- luci-app-mtk
- mtkhnat_util
- iwinfo
- wireless-tools
- kmod-conninfra
- kmod-mt_wifi
- kmod-gl-sdk4-fan
- gl-sdk4-led
- gl-sdk4-adguardhome
@ -42,71 +26,151 @@ packages:
- gl-sdk4-igmp
- gl-sdk4-mwan3
- select-sdk4-ui-all
- 8021xd
- ated_ext
- datconf
- datconf-lua
- fwdd
- kmod-conninfra
- kmod-mediatek_hnat
- kmod-mt_wifi
- kmod-mtfwd
- kmod-mtqos
- kmod-warp
- luci-app-mtk
- mii_mgr
- mtk-base-files
- mtk_factory_rw
- mtkhnat_util
- regs
- wifi-profile
- wificonf
diffconfig: |
CONFIG_MAP_R2_SUPPORT=y
CONFIG_MAP_R3_SUPPORT=y
CONFIG_CONNINFRA_AUTO_UP=y
CONFIG_CONNINFRA_EMI_SUPPORT=y
CONFIG_MTK_ACK_CTS_TIMEOUT_SUPPORT=y
CONFIG_MTK_AIR_MONITOR=y
CONFIG_MTK_AMPDU_CONF_SUPPORT=y
CONFIG_MTK_ANTENNA_CONTROL_SUPPORT=y
CONFIG_MTK_APCLI_CERT_SUPPORT=y
CONFIG_MTK_APCLI_SUPPORT=y
CONFIG_MTK_ATE_SUPPORT=y
CONFIG_MTK_BACKGROUND_SCAN_SUPPORT=y
CONFIG_MTK_BAND_STEERING=y
CONFIG_MTK_CAL_BIN_FILE_SUPPORT=y
CONFIG_MTK_CFG_SUPPORT_FALCON_MURU=y
CONFIG_MTK_CFG_SUPPORT_FALCON_PP=y
CONFIG_MTK_CFG_SUPPORT_FALCON_SR=y
CONFIG_MTK_CFG_SUPPORT_FALCON_TXCMD_DBG=y
CONFIG_MTK_CHIP_MT7981=y
CONFIG_MTK_CONNINFRA_APSOC=y
CONFIG_MTK_CONNINFRA_APSOC_MT7981=y
CONFIG_CONNINFRA_EMI_SUPPORT=y
CONFIG_CONNINFRA_AUTO_UP=y
CONFIG_MTK_FIRST_IF_MT7981=y
CONFIG_MTK_MT_WIFI=m
CONFIG_MTK_SCS_FW_OFFLOAD=y
CONFIG_MTK_OFFCHANNEL_SCAN_FEATURE=y
CONFIG_MTK_DEFAULT_5G_PROFILE=n
CONFIG_MTK_FAST_NAT_SUPPORT=y
CONFIG_MTK_WHNAT_SUPPORT=m
CONFIG_MTK_WARP_V2=y
CONFIG_MTK_MEMORY_SHRINK=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_WLAN_SERVICE=y
CONFIG_MTK_MBO_SUPPORT=y
CONFIG_MTK_MAP_SUPPORT=y
CONFIG_MTK_MAP_R2_VER_SUPPORT=y
CONFIG_MTK_MAP_R3_VER_SUPPORT=y
CONFIG_MTK_FIRST_IF_IPAILNA=y
CONFIG_MTK_WIFI_MODE_AP=m
CONFIG_MTK_APCLI_CERT_SUPPORT=y
CONFIG_MTK_MWDS=y
CONFIG_MTK_MLME_MULTI_QUEUE_SUPPORT=y
CONFIG_MTK_VLAN_SUPPORT=y
CONFIG_MTK_ANTENNA_CONTROL_SUPPORT=y
CONFIG_MTK_MGMT_TXPWR_CTRL=y
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_QOS_R1_SUPPORT=y
CONFIG_MTK_DSCP_PRI_SUPPORT=y
CONFIG_MTK_CON_WPS_SUPPORT=y
CONFIG_MTK_DBDC_MODE=y
CONFIG_MTK_DOT11K_RRM_SUPPORT=y
CONFIG_MTK_DOT11R_FT_SUPPORT=y
CONFIG_MTK_DOT11W_PMF_SUPPORT=y
CONFIG_MTK_DOT11_HE_AX=y
CONFIG_MTK_DOT11_N_SUPPORT=y
CONFIG_MTK_DOT11_VHT_AC=y
CONFIG_MTK_DSCP_PRI_SUPPORT=y
CONFIG_MTK_FAST_NAT_SUPPORT=y
CONFIG_MTK_FIRST_IF_EEPROM_FLASH=y
CONFIG_MTK_FIRST_IF_IPAILNA=y
CONFIG_MTK_FIRST_IF_MT7981=y
CONFIG_MTK_GREENAP_SUPPORT=y
CONFIG_MTK_G_BAND_256QAM_SUPPORT=y
CONFIG_MTK_HDR_TRANS_RX_SUPPORT=y
CONFIG_MTK_HDR_TRANS_TX_SUPPORT=y
CONFIG_MTK_ICAP_SUPPORT=y
CONFIG_MTK_IGMP_SNOOP_SUPPORT=y
CONFIG_MTK_INTERWORKING=y
CONFIG_MTK_LED_CONTROL_SUPPORT=y
CONFIG_MTK_WLAN_HOOK=y
CONFIG_MTK_PCIE_ASPM_DYM_CTRL_SUPPORT=n
CONFIG_MTK_AIR_MONITOR=y
CONFIG_MTK_WPA3_SUPPORT=y
CONFIG_MTK_MAC_REPEATER_SUPPORT=y
CONFIG_MTK_MAP_R2_6E_SUPPORT=y
CONFIG_MTK_MAP_R2_VER_SUPPORT=y
CONFIG_MTK_MAP_R3_6E_SUPPORT=y
CONFIG_MTK_MAP_R3_VER_SUPPORT=y
CONFIG_MTK_MAP_SUPPORT=y
CONFIG_MTK_MBO_SUPPORT=y
CONFIG_MTK_MBSS_DTIM_SUPPORT=y
CONFIG_MTK_MBSS_SUPPORT=y
CONFIG_MTK_MCAST_RATE_SPECIFIC=y
CONFIG_MTK_MEMORY_SHRINK=y
CONFIG_MTK_MGMT_TXPWR_CTRL=y
CONFIG_MTK_MLME_MULTI_QUEUE_SUPPORT=y
CONFIG_MTK_MT_AP_SUPPORT=m
CONFIG_MTK_MT_DFS_SUPPORT=y
CONFIG_MTK_MT_MAC=y
CONFIG_MTK_MT_WIFI=m
CONFIG_MTK_MT_WIFI_PATH="mt_wifi"
CONFIG_MTK_MULTI_PROFILE_SUPPORT=y
CONFIG_MTK_MUMIMO_SUPPORT=y
CONFIG_MTK_MU_RA_SUPPORT=y
CONFIG_MTK_MWDS=y
CONFIG_MTK_OFFCHANNEL_SCAN_FEATURE=y
CONFIG_MTK_OWE_SUPPORT=y
CONFIG_PACKAGE_kmod-mtfwd=y
CONFIG_PACKAGE_kmod-warp=y
CONFIG_WARP_VERSION=2
CONFIG_WARP_ATC_SUPPORT=n
CONFIG_WED_HW_RRO_SUPPORT=y
CONFIG_MTK_QOS_R1_SUPPORT=y
CONFIG_MTK_RA_PHY_RATE_SUPPORT=y
CONFIG_MTK_RED_SUPPORT=y
CONFIG_MTK_RTMP_FLASH_SUPPORT=y
CONFIG_MTK_RT_FIRST_CARD_EEPROM="flash"
CONFIG_MTK_RT_FIRST_IF_RF_OFFSET=0xc0000
CONFIG_MTK_SCS_FW_OFFLOAD=y
CONFIG_MTK_SECOND_IF_NONE=y
CONFIG_MTK_SMART_CARRIER_SENSE_SUPPORT=y
CONFIG_MTK_SNIFFER_RADIOTAP_SUPPORT=y
CONFIG_MTK_SPECTRUM_SUPPORT=y
CONFIG_MTK_SUPPORT_OPENWRT=y
CONFIG_MTK_THIRD_IF_NONE=y
CONFIG_MTK_TPC_SUPPORT=y
CONFIG_MTK_TXBF_SUPPORT=y
CONFIG_MTK_UAPSD=y
CONFIG_MTK_VLAN_SUPPORT=y
CONFIG_MTK_VOW_SUPPORT=y
CONFIG_MTK_WARP_V2=y
CONFIG_MTK_WDS_SUPPORT=y
CONFIG_MTK_WHNAT_SUPPORT=m
CONFIG_MTK_WIFI_BASIC_FUNC=y
CONFIG_MTK_WIFI_DRIVER=y
CONFIG_MTK_WIFI_EAP_FEATURE=y
CONFIG_MTK_WIFI_MODE_AP=m
CONFIG_MTK_WIFI_MT_MAC=y
CONFIG_MTK_WIFI_TWT_SUPPORT=y
CONFIG_MTK_WLAN_HOOK=y
CONFIG_MTK_WLAN_SERVICE=y
CONFIG_MTK_WNM_SUPPORT=y
CONFIG_MTK_WPA3_SUPPORT=y
CONFIG_MTK_WSC_INCLUDED=y
CONFIG_MTK_WSC_V2_SUPPORT=y
CONFIG_SUPPORT_LSDK_NVRAM_CMD=y
CONFIG_WARP_CHIPSET="mt7981"
CONFIG_first_card_name="MT7981"
CONFIG_first_card_profile_path="/etc/wireless/mediatek/mt7981.dbdc.b0.dat;/etc/wireless/mediatek/mt7981.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_size="0xA0000"
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/mt7981-sku.dat"
CONFIG_first_card_bf_sku_path="/etc/wireless/mediatek/mt7981-sku-bf.dat"
CONFIG_second_card=n
CONFIG_third_card=n
CONFIG_WARP_DBG_SUPPORT=y
CONFIG_WARP_VERSION=2
CONFIG_WED_HW_RRO_SUPPORT=y
CONFIG_WIFI_QUICK_SETTING=y
CONFIG_first_card=y
CONFIG_first_card_EEPROM_name="e2p"
CONFIG_first_card_EEPROM_offset="0x0"
CONFIG_first_card_EEPROM_size="0xA0000"
CONFIG_first_card_apcli_ifname="apcli;apclix"
CONFIG_first_card_bf_sku_path="/etc/wireless/mediatek/mt7981-sku-bf.dat"
CONFIG_first_card_ext_ifname="ra;rax"
CONFIG_first_card_init_compatible="mtwifi;mtwifi"
CONFIG_first_card_init_script="/lib/wifi/mtwifi.lua;/lib/wifi/mtwifi.lua"
CONFIG_first_card_main_ifname="ra0;rax0"
CONFIG_first_card_mesh_ifname="mesh;meshx"
CONFIG_first_card_name="MT7981"
CONFIG_first_card_nvram_zone="dev1;dev2"
CONFIG_first_card_profile_path="/etc/wireless/mediatek/mt7981.dbdc.b0.dat;/etc/wireless/mediatek/mt7981.dbdc.b1.dat"
CONFIG_first_card_single_sku_path="/etc/wireless/mediatek/mt7981-sku.dat"
CONFIG_first_card_wds_ifname="wds;wdsx"
# CONFIG_MTK_DEFAULT_5G_PROFILE is not set
# CONFIG_MTK_PCIE_ASPM_DYM_CTRL_SUPPORT is not set
# CONFIG_MTK_PRE_CAL_TRX_SET1_SUPPORT is not set
# CONFIG_MTK_PRE_CAL_TRX_SET2_SUPPORT is not set
# CONFIG_MTK_RLM_CAL_CACHE_SUPPORT is not set
# CONFIG_WARP_ATC_SUPPORT is not set
# CONFIG_second_card is not set
# CONFIG_third_card is not set

View File

@ -1,110 +1,6 @@
---
profile: glinet_gl-x3000
target: mediatek
subtarget: mt7981
description: Build image for the GL.iNET X3000
feeds:
- name: mtk_openwrt_feed
uri: https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds.git
revision: 4c6b600
- name: gl_feed_common
uri: https://github.com/gl-inet/gl-feeds.git
revision: 6d36fa8b49061674c709c40b8c3ed5881be3190a
- name: gl_feed_21_02
uri: https://github.com/gl-inet/gl-feeds.git
revision: 032786d5ff300ebdd83fb1b5fec5344b3da04953
- name: gl_feed_mt7981
uri: https://github.com/gl-inet/gl-feeds.git
revision: da09723846cf25c6b7e288cd1669c89ea4d6071e
- name: mt7981
uri: https://gitlab.com/gl.sdk4.0/gl.router/mt7981-feeds.git
revision: 408e1f3631e20dffe23eba9f3ceb68dfafe878a8
- name: glinet
path: ../feeds_dir/glinet
packages:
- 8021xd
- fwdd
- mii_mgr
- regs
- wificonf
- mtk-base-files
- mtk_factory_rw
- ethtool
- luci-app-mtk
- mtkhnat_util
- wireless-tools
- kmod-conninfra
- kmod-mt_wifi
- kmod-gl-sdk4-fan
- gl-sdk4-led
- gl-sdk4-adguardhome
diffconfig: |
CONFIG_MAP_R2_SUPPORT=y
CONFIG_MAP_R3_SUPPORT=y
CONFIG_MTK_CONNINFRA_APSOC=y
CONFIG_MTK_CONNINFRA_APSOC_MT7981=y
CONFIG_CONNINFRA_EMI_SUPPORT=y
CONFIG_CONNINFRA_AUTO_UP=y
CONFIG_MTK_FIRST_IF_MT7981=y
CONFIG_MTK_MT_WIFI=m
CONFIG_MTK_SCS_FW_OFFLOAD=y
CONFIG_MTK_OFFCHANNEL_SCAN_FEATURE=y
CONFIG_MTK_DEFAULT_5G_PROFILE=n
CONFIG_MTK_FAST_NAT_SUPPORT=y
CONFIG_MTK_WHNAT_SUPPORT=m
CONFIG_MTK_WARP_V2=y
CONFIG_MTK_MEMORY_SHRINK=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_WLAN_SERVICE=y
CONFIG_MTK_MBO_SUPPORT=y
CONFIG_MTK_MAP_SUPPORT=y
CONFIG_MTK_MAP_R2_VER_SUPPORT=y
CONFIG_MTK_MAP_R3_VER_SUPPORT=y
CONFIG_MTK_FIRST_IF_IPAILNA=y
CONFIG_MTK_WIFI_MODE_AP=m
CONFIG_MTK_APCLI_CERT_SUPPORT=y
CONFIG_MTK_MWDS=y
CONFIG_MTK_MLME_MULTI_QUEUE_SUPPORT=y
CONFIG_MTK_VLAN_SUPPORT=y
CONFIG_MTK_ANTENNA_CONTROL_SUPPORT=y
CONFIG_MTK_MGMT_TXPWR_CTRL=y
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_QOS_R1_SUPPORT=y
CONFIG_MTK_DSCP_PRI_SUPPORT=y
CONFIG_MTK_CON_WPS_SUPPORT=y
CONFIG_MTK_LED_CONTROL_SUPPORT=y
CONFIG_MTK_WLAN_HOOK=y
CONFIG_MTK_PCIE_ASPM_DYM_CTRL_SUPPORT=n
CONFIG_MTK_AIR_MONITOR=y
CONFIG_MTK_WPA3_SUPPORT=y
CONFIG_MTK_OWE_SUPPORT=y
CONFIG_PACKAGE_kmod-mtfwd=y
CONFIG_PACKAGE_kmod-warp=y
CONFIG_WARP_VERSION=2
CONFIG_WARP_ATC_SUPPORT=n
CONFIG_WED_HW_RRO_SUPPORT=y
CONFIG_WARP_CHIPSET="mt7981"
CONFIG_first_card_name="MT7981"
CONFIG_first_card_profile_path="/etc/wireless/mediatek/mt7981.dbdc.b0.dat;/etc/wireless/mediatek/mt7981.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_size="0xA0000"
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/mt7981-sku.dat"
CONFIG_first_card_bf_sku_path="/etc/wireless/mediatek/mt7981-sku-bf.dat"
CONFIG_second_card=n
CONFIG_third_card=n
CONFIG_WIFI_QUICK_SETTING=y
include:
- glinet_mt3000.yml