diff --git a/configs/config-22.03.2.yml b/configs/config-22.03.2.yml new file mode 100644 index 0000000..6335401 --- /dev/null +++ b/configs/config-22.03.2.yml @@ -0,0 +1,8 @@ +repo: https://github.com/openwrt/openwrt.git +branch: v22.03.2 +git_clone_dir: openwrt-22.03/openwrt-22.03.2 +openwrt_root_dir: openwrt-22.03/openwrt-22.03.2 +revision: ea845f76ea2406a4c70d96141d6386b81bba5431 + +patch_folders: + - patches-22.03.2/ diff --git a/patches-22.03.2/0001-fix-scripts-feeds-support-setup.patch b/patches-22.03.2/0001-fix-scripts-feeds-support-setup.patch new file mode 100644 index 0000000..60560a2 --- /dev/null +++ b/patches-22.03.2/0001-fix-scripts-feeds-support-setup.patch @@ -0,0 +1,83 @@ +From f283030999e56d68b612ee5baaa27dd714840531 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Sat, 17 Sep 2022 14:19:14 +0800 +Subject: [PATCH] fix: scripts feeds support setup + +--- + scripts/feeds | 46 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 46 insertions(+) + +diff --git a/scripts/feeds b/scripts/feeds +index aee73e793f..4b68b5e930 100755 +--- a/scripts/feeds ++++ b/scripts/feeds +@@ -856,6 +856,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"); ++ ++ 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; ++ } ++ ++ if ($opts{b}) { ++ printf $fd "src-include defaults feeds.conf.default\n"; ++ } ++ ++ return 0; ++} ++ + sub feed_config() { + foreach my $feed (@feeds) { + my $installed = (-f "feeds/$feed->[1].index"); +@@ -907,6 +948,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] ...: generate feeds.conf ++ Options: ++ -b : Use feeds.conf.default as base for new feeds.conf. ++ + clean: Remove downloaded/generated files. + + EOF +@@ -920,6 +965,7 @@ my %commands = ( + 'search' => \&search, + 'uninstall' => \&uninstall, + 'feed_config' => \&feed_config, ++ 'setup' => \&setup, + 'clean' => sub { + system("rm -rf ./feeds ./package/feeds ./target/linux/feeds"); + } +-- +2.34.1 + diff --git a/patches-22.03.2/0002-fix-add-append-gl-metadata.patch b/patches-22.03.2/0002-fix-add-append-gl-metadata.patch new file mode 100644 index 0000000..62b66af --- /dev/null +++ b/patches-22.03.2/0002-fix-add-append-gl-metadata.patch @@ -0,0 +1,53 @@ +From 6ab838f58b32024c5bb45fb6cec65a2148f0e599 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Tue, 27 Sep 2022 12:12:00 +0800 +Subject: [PATCH] fix: add append-gl-metadata + +--- + include/image-commands.mk | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/include/image-commands.mk b/include/image-commands.mk +index 402e3d71ed..6eeb246c17 100644 +--- a/include/image-commands.mk ++++ b/include/image-commands.mk +@@ -98,6 +98,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)$(call metadata_devices,$(OLD_SUPPORTED_DEVICES))]$(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.34.1 + diff --git a/patches-22.03.2/0003-fix-gl-mt1300-adapts-to-glinet-SDK4.0.patch b/patches-22.03.2/0003-fix-gl-mt1300-adapts-to-glinet-SDK4.0.patch new file mode 100644 index 0000000..8cf882c --- /dev/null +++ b/patches-22.03.2/0003-fix-gl-mt1300-adapts-to-glinet-SDK4.0.patch @@ -0,0 +1,71 @@ +From b493ef55dfe0a03374ef6cb7b7934336c9cdc603 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Tue, 27 Sep 2022 12:15:27 +0800 +Subject: [PATCH] fix:gl mt1300 adapts to glinet SDK4.0 + +--- + .../ramips/dts/mt7621_glinet_gl-mt1300.dts | 30 ++++++++++++++++--- + target/linux/ramips/image/mt7621.mk | 2 ++ + 2 files changed, 28 insertions(+), 4 deletions(-) + +diff --git a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts +index 384da1bfa9..23c5be89c8 100644 +--- a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts ++++ b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts +@@ -10,13 +10,35 @@ + model = "GL.iNet GL-MT1300"; + + aliases { +- led-boot = &led_run; +- led-failsafe = &led_run; +- led-running = &led_run; +- led-upgrade = &led_run; ++ //led-boot = &led_run; ++ //led-failsafe = &led_run; ++ //led-running = &led_run; ++ //led-upgrade = &led_run; + label-mac-device = &wan; + }; + ++ gl_hw { ++ compatible = "gl-hw-info"; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "mt1300"; ++ wan = "wan"; ++ lan = "lan1 lan2"; ++ reset-button = "gpio-18"; ++ flash_size = <32>; ++ switch-button = "gpio-16"; ++ radio = "radio0"; ++ usb-port = "1-1"; ++ factory_data { ++ device_mac = "factory", "0x4000"; ++ device_ddns = "factory", "0x4010"; ++ device_sn_bak = "factory", "0x4020"; ++ device_sn = "factory", "0x4030"; ++ country_code = "factory", "0x4048"; ++ }; ++ }; ++ + chosen { + bootargs = "console=ttyS0,115200"; + }; +diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk +index 7f903485aa..6c937a2409 100644 +--- a/target/linux/ramips/image/mt7621.mk ++++ b/target/linux/ramips/image/mt7621.mk +@@ -691,7 +691,9 @@ define Device/glinet_gl-mt1300 + IMAGE_SIZE := 32448k + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-MT1300 ++ OLD_SUPPORTED_DEVICES := gl-mt1300 + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 ++ IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-gl-metadata + endef + TARGET_DEVICES += glinet_gl-mt1300 + +-- +2.34.1 + diff --git a/patches-22.03.2/0004-fix-mt7615-wifi-init-DBDC-by-default.patch b/patches-22.03.2/0004-fix-mt7615-wifi-init-DBDC-by-default.patch new file mode 100644 index 0000000..a9d48b6 --- /dev/null +++ b/patches-22.03.2/0004-fix-mt7615-wifi-init-DBDC-by-default.patch @@ -0,0 +1,34 @@ +From d5c10dc93685c84239e3fec212838aa39b857b67 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Tue, 27 Sep 2022 12:13:36 +0800 +Subject: [PATCH] fix: mt7615 wifi init DBDC by default + +--- + package/kernel/mac80211/files/lib/wifi/mac80211.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh +index 6aa46b0c74..22b3c823cc 100644 +--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh ++++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh +@@ -111,7 +111,7 @@ END { + get_band_defaults() { + local phy="$1" + +- for c in $(__get_band_defaults "$phy"); do ++ for c in `echo $(__get_band_defaults "$phy") | awk '{for(i=NF;i>0;i--){print $i}}'`; do + local band="${c%%:*}" + c="${c#*:}" + local chan="${c%%:*}" +@@ -174,7 +174,7 @@ detect_mac80211() { + set wireless.radio${devidx}.channel=${channel} + set wireless.radio${devidx}.band=${mode_band} + set wireless.radio${devidx}.htmode=$htmode +- set wireless.radio${devidx}.disabled=1 ++ #set wireless.radio${devidx}.disabled=1 + + set wireless.default_radio${devidx}=wifi-iface + set wireless.default_radio${devidx}.device=radio${devidx} +-- +2.34.1 + diff --git a/patches-22.03.2/0005-fix-do-not-keep-config.patch b/patches-22.03.2/0005-fix-do-not-keep-config.patch new file mode 100644 index 0000000..1644c0a --- /dev/null +++ b/patches-22.03.2/0005-fix-do-not-keep-config.patch @@ -0,0 +1,24 @@ +From 0cc3433812dc4132876ae4edd930bec97bd6308c Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Wed, 28 Sep 2022 17:13:22 +0800 +Subject: [PATCH] fix: do not keep config + +--- + package/base-files/files/lib/preinit/80_mount_root | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/package/base-files/files/lib/preinit/80_mount_root b/package/base-files/files/lib/preinit/80_mount_root +index c3816c2cbf..62a1a4bf32 100644 +--- a/package/base-files/files/lib/preinit/80_mount_root ++++ b/package/base-files/files/lib/preinit/80_mount_root +@@ -17,6 +17,7 @@ missing_lines() { + do_mount_root() { + mount_root + boot_run_hook preinit_mount_root ++ return + [ -f /sysupgrade.tgz -o -f /tmp/sysupgrade.tar ] && { + echo "- config restore -" + cp /etc/passwd /etc/group /etc/shadow /tmp +-- +2.34.1 + diff --git a/patches-22.03.2/0006-fix-wireguard-support-hotplug.patch b/patches-22.03.2/0006-fix-wireguard-support-hotplug.patch new file mode 100644 index 0000000..159ec15 --- /dev/null +++ b/patches-22.03.2/0006-fix-wireguard-support-hotplug.patch @@ -0,0 +1,241 @@ +From 0d2f4bdd2bb401ec0635321bfa033703e869ea10 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Thu, 29 Sep 2022 11:45:43 +0800 +Subject: [PATCH] fix: wireguard support hotplug + +--- + .../856-wireguard-support-hotplug.patch | 222 ++++++++++++++++++ + 1 file changed, 222 insertions(+) + create mode 100644 target/linux/ramips/patches-5.10/856-wireguard-support-hotplug.patch + +diff --git a/target/linux/ramips/patches-5.10/856-wireguard-support-hotplug.patch b/target/linux/ramips/patches-5.10/856-wireguard-support-hotplug.patch +new file mode 100644 +index 0000000000..0de25b62ec +--- /dev/null ++++ b/target/linux/ramips/patches-5.10/856-wireguard-support-hotplug.patch +@@ -0,0 +1,222 @@ ++--- 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,124 @@ +++/* +++ * oui-tertf Hotplug driver +++ * +++ */ +++ +++#include +++#include +++#include +++#include +++ +++#include +++#include +++#include +++#include +++ +++#include +++ +++#define SUBSYSTEM_NAME "wireguard" +++ +++ +++#define BH_SKB_SIZE 2048 +++#define IFNAMSIZ 16 +++ +++struct work_struct wg_event_work; +++struct wg_event { +++ struct work_struct work; +++ char ifname[IFNAMSIZ]; +++ const char *action; +++}; +++struct wg_event *gl_wg_event; +++ +++static DEFINE_SPINLOCK(event_lock); +++ +++ +++/* -------------------------------------------------------------------------*/ +++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 wireguard_send_hotplug(struct work_struct *mywork) +++{ +++ struct wg_event * event; +++ struct sk_buff *skb; +++ char ifname[IFNAMSIZ]; +++ char *action; +++ +++ event = container_of(mywork, struct wg_event, work); +++ if (!event) +++ return; +++ skb = alloc_skb(BH_SKB_SIZE, GFP_KERNEL); +++ if (!skb) +++ return; +++ strcpy(ifname, event->ifname); +++ action = event->action; +++ +++ pr_info("wireguard-hotplug IFNAME=%s ACTION=%s\n", ifname, action); +++ +++ bh_event_add_var(skb, 0, "SUBSYSTEM=%s", SUBSYSTEM_NAME); +++ +++ spin_lock(&event_lock); +++ bh_event_add_var(skb, 0, "ACTION=%s", action); +++ bh_event_add_var(skb, 0, "ifname=%s", ifname); +++ spin_unlock(&event_lock); +++ +++ NETLINK_CB(skb).dst_group = 1; +++ broadcast_uevent(skb, 0, 1, GFP_KERNEL); +++} +++ +++void wireguard_hotplug(const char *ifname, const char *action) +++{ +++ if(gl_wg_event == NULL){ +++ return; +++ } +++ if (0 == strcmp(ifname,"wgserver")) +++ return; +++ +++ spin_lock(&event_lock); +++ memcpy(gl_wg_event->ifname, ifname, IFNAMSIZ); +++ gl_wg_event->action = action; +++ spin_unlock(&event_lock); +++ +++ schedule_work(&gl_wg_event->work); +++} +++ +++void wg_hotplug_init(void) +++{ +++ gl_wg_event = (struct wg_event *)kzalloc(sizeof(struct wg_event),GFP_KERNEL); +++ if(gl_wg_event == NULL){ +++ return; +++ } +++ gl_wg_event->work = wg_event_work; +++ INIT_WORK(&gl_wg_event->work, wireguard_send_hotplug); +++} +++ +++void wg_hotplug_free(void) +++{ +++ if(gl_wg_event){ +++ kfree(gl_wg_event); +++ } +++ return; +++} ++--- /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/main.c +++++ b/drivers/net/wireguard/main.c ++@@ -17,6 +17,8 @@ ++ #include ++ #include ++ +++#include "hotplug.h" +++ ++ static int __init mod_init(void) ++ { ++ int ret; ++@@ -44,6 +46,7 @@ static int __init mod_init(void) ++ ret = wg_genetlink_init(); ++ if (ret < 0) ++ goto err_netlink; +++ wg_hotplug_init(); ++ ++ pr_info("WireGuard " WIREGUARD_VERSION " loaded. See www.wireguard.com for information.\n"); ++ pr_info("Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.\n"); ++@@ -62,6 +65,7 @@ err_allowedips: ++ ++ static void __exit mod_exit(void) ++ { +++ wg_hotplug_free(); ++ wg_genetlink_uninit(); ++ wg_device_uninit(); ++ wg_peer_uninit(); ++--- 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 ++ #include ++@@ -850,6 +851,7 @@ 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 { ++ kfree_sensitive(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,7 @@ 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 +75,7 @@ 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.34.1 + diff --git a/patches-22.03.2/0007-fix-switch-button-execute-etc-rc.button-switch.patch b/patches-22.03.2/0007-fix-switch-button-execute-etc-rc.button-switch.patch new file mode 100644 index 0000000..c655dce --- /dev/null +++ b/patches-22.03.2/0007-fix-switch-button-execute-etc-rc.button-switch.patch @@ -0,0 +1,38 @@ +From 7931af1009601f514f44d17f8e288446bc5042f6 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Mon, 10 Oct 2022 11:22:41 +0800 +Subject: [PATCH] fix: switch button execute /etc/rc.button/switch + +--- + package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 1 + + target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +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 2b39ec8f3b..f3f0ad3172 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"), + }; + + /* -------------------------------------------------------------------------*/ +diff --git a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts +index b6b9396661..c488d72e36 100644 +--- a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts ++++ b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts +@@ -55,7 +55,7 @@ + switch { + label = "switch"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; +- linux,code = ; ++ linux,code = ; + linux,input-type = ; + }; + }; +-- +2.34.1 + diff --git a/patches-22.03.2/0008-fix-gl-mt1300-support-sdhci-by-default.patch b/patches-22.03.2/0008-fix-gl-mt1300-support-sdhci-by-default.patch new file mode 100644 index 0000000..a366871 --- /dev/null +++ b/patches-22.03.2/0008-fix-gl-mt1300-support-sdhci-by-default.patch @@ -0,0 +1,25 @@ +From 49a01620d8687597bee710d358c2d668e4c30694 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Mon, 10 Oct 2022 11:23:24 +0800 +Subject: [PATCH] fix: gl-mt1300 support sdhci by default + +--- + target/linux/ramips/image/mt7621.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk +index 6c937a2409..61a77c3d94 100644 +--- a/target/linux/ramips/image/mt7621.mk ++++ b/target/linux/ramips/image/mt7621.mk +@@ -692,7 +692,7 @@ define Device/glinet_gl-mt1300 + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-MT1300 + OLD_SUPPORTED_DEVICES := gl-mt1300 +- DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 ++ DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 kmod-sdhci-mt7620 + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-gl-metadata + endef + TARGET_DEVICES += glinet_gl-mt1300 +-- +2.34.1 + diff --git a/patches-22.03.2/0009-fix-mt1300-dts-add-log-part.patch b/patches-22.03.2/0009-fix-mt1300-dts-add-log-part.patch new file mode 100644 index 0000000..cda4470 --- /dev/null +++ b/patches-22.03.2/0009-fix-mt1300-dts-add-log-part.patch @@ -0,0 +1,30 @@ +From d0df617b77d67c842308d2f04687052c13b46c12 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Tue, 18 Oct 2022 11:17:31 +0800 +Subject: [PATCH] fix: mt1300 dts add log part + +--- + target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts +index c488d72e36..54ff1019b1 100644 +--- a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts ++++ b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts +@@ -119,7 +119,12 @@ + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; +- reg = <0x50000 0x1fb0000>; ++ reg = <0x50000 0x1f90000>; ++ }; ++ ++ partition@1ff0000 { ++ label = "log"; ++ reg = <0x1fe0000 0x20000>; + }; + }; + }; +-- +2.34.1 + diff --git a/patches-22.03.2/0010-fix-ramips-mtdoops-add-_panic_write.patch b/patches-22.03.2/0010-fix-ramips-mtdoops-add-_panic_write.patch new file mode 100644 index 0000000..ff90fbd --- /dev/null +++ b/patches-22.03.2/0010-fix-ramips-mtdoops-add-_panic_write.patch @@ -0,0 +1,32 @@ +From 03e26f26d9151977c5b7a0aef378d0faddb80086 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Tue, 18 Oct 2022 11:15:45 +0800 +Subject: [PATCH] fix: mtdoops add _panic_write + +--- + .../patches-5.10/857-mtd-oops-add-panic-write.patch | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + create mode 100644 target/linux/ramips/patches-5.10/857-mtd-oops-add-panic-write.patch + +diff --git a/target/linux/ramips/patches-5.10/857-mtd-oops-add-panic-write.patch b/target/linux/ramips/patches-5.10/857-mtd-oops-add-panic-write.patch +new file mode 100644 +index 0000000000..50231e50e6 +--- /dev/null ++++ b/target/linux/ramips/patches-5.10/857-mtd-oops-add-panic-write.patch +@@ -0,0 +1,13 @@ ++Index: linux-5.10.138/drivers/mtd/spi-nor/core.c ++=================================================================== ++--- linux-5.10.138.orig/drivers/mtd/spi-nor/core.c +++++ linux-5.10.138/drivers/mtd/spi-nor/core.c ++@@ -3207,6 +3207,8 @@ int spi_nor_scan(struct spi_nor *nor, co ++ ++ mtd->_write = spi_nor_write; ++ +++ mtd->_panic_write = spi_nor_write; +++ ++ /* Init flash parameters based on flash_info struct and SFDP */ ++ ret = spi_nor_init_params(nor); ++ if (ret) +-- +2.34.1 + diff --git a/patches-22.03.2/0011-feat-enable-2.4g-vht.patch b/patches-22.03.2/0011-feat-enable-2.4g-vht.patch new file mode 100644 index 0000000..72c3d30 --- /dev/null +++ b/patches-22.03.2/0011-feat-enable-2.4g-vht.patch @@ -0,0 +1,180 @@ +From 06476a2c422a9c88678568d9e305c201dd9641e3 Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Tue, 18 Oct 2022 11:20:01 +0800 +Subject: [PATCH] feat: enable 2.4g vht + +--- + .../files/lib/netifd/wireless/mac80211.sh | 7 ++- + .../subsys/783-mac80211-allow-vht-on-2g.patch | 42 +++++++++++++++++ + .../001-allow-VHT-rate-on-2.4GHz.patch | 47 +++++++++++++++++++ + .../network/services/hostapd/files/hostapd.sh | 5 +- + 4 files changed, 97 insertions(+), 4 deletions(-) + create mode 100644 package/kernel/mac80211/patches/subsys/783-mac80211-allow-vht-on-2g.patch + create mode 100644 package/kernel/mt76/patches/001-allow-VHT-rate-on-2.4GHz.patch + +diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +index daa54949a0..90fd553aeb 100644 +--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh ++++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +@@ -137,7 +137,7 @@ mac80211_hostapd_setup_base() { + [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && + append base_cfg "acs_exclude_dfs=1" "$N" + +- json_get_vars noscan ht_coex ++ json_get_vars noscan ht_coex vendor_vht + json_get_values ht_capab_list ht_capab tx_burst + json_get_values channel_list channels + +@@ -283,7 +283,7 @@ mac80211_hostapd_setup_base() { + } + [ "$hwmode" = "a" ] || enable_ac=0 + +- if [ "$enable_ac" != "0" ]; then ++ if [ "$enable_ac" != "0" -o "$vendor_vht" = "1" ]; then + json_get_vars \ + rxldpc:1 \ + short_gi_80:1 \ +@@ -310,6 +310,9 @@ mac80211_hostapd_setup_base() { + vht_cap=0 + for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do + vht_cap="$(($vht_cap | $cap))" ++ ++ # mt7615 dbdc vendor_vht work for 2.4g only ++ [ "$vendor_vht" == "1" -a -e /sys/kernel/debug/ieee80211/$phy/mt76/dbdc ] && break + done + + append base_cfg "vht_oper_chwidth=$vht_oper_chwidth" "$N" +diff --git a/package/kernel/mac80211/patches/subsys/783-mac80211-allow-vht-on-2g.patch b/package/kernel/mac80211/patches/subsys/783-mac80211-allow-vht-on-2g.patch +new file mode 100644 +index 0000000000..0c8bd53db7 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/783-mac80211-allow-vht-on-2g.patch +@@ -0,0 +1,42 @@ ++Index: backports-5.15.58-1/net/mac80211/mlme.c ++=================================================================== ++--- backports-5.15.58-1.orig/net/mac80211/mlme.c +++++ backports-5.15.58-1/net/mac80211/mlme.c ++@@ -5096,7 +5096,8 @@ static int ieee80211_prep_channel(struct ++ have_80mhz = false; ++ for (i = 0; i < sband->n_channels; i++) { ++ if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | ++- IEEE80211_CHAN_NO_80MHZ)) +++ IEEE80211_CHAN_NO_80MHZ) && +++ (sband->band != NL80211_BAND_2GHZ)) ++ continue; ++ ++ have_80mhz = true; ++Index: backports-5.15.58-1/net/mac80211/util.c ++=================================================================== ++--- backports-5.15.58-1.orig/net/mac80211/util.c +++++ backports-5.15.58-1/net/mac80211/util.c ++@@ -1919,7 +1919,8 @@ static int ieee80211_build_preq_ies_band ++ /* Check if any channel in this sband supports at least 80 MHz */ ++ for (i = 0; i < sband->n_channels; i++) { ++ if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | ++- IEEE80211_CHAN_NO_80MHZ)) +++ IEEE80211_CHAN_NO_80MHZ) && +++ (sband->band != NL80211_BAND_2GHZ)) ++ continue; ++ ++ have_80mhz = true; ++Index: backports-5.15.58-1/net/mac80211/vht.c ++=================================================================== ++--- backports-5.15.58-1.orig/net/mac80211/vht.c +++++ backports-5.15.58-1/net/mac80211/vht.c ++@@ -135,7 +135,8 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(stru ++ have_80mhz = false; ++ for (i = 0; i < sband->n_channels; i++) { ++ if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | ++- IEEE80211_CHAN_NO_80MHZ)) +++ IEEE80211_CHAN_NO_80MHZ) && +++ (sband->band != NL80211_BAND_2GHZ)) ++ continue; ++ ++ have_80mhz = true; +diff --git a/package/kernel/mt76/patches/001-allow-VHT-rate-on-2.4GHz.patch b/package/kernel/mt76/patches/001-allow-VHT-rate-on-2.4GHz.patch +new file mode 100644 +index 0000000000..c063a6f78f +--- /dev/null ++++ b/package/kernel/mt76/patches/001-allow-VHT-rate-on-2.4GHz.patch +@@ -0,0 +1,47 @@ ++Index: mt76-2022-08-26-5ec78e1e/mac80211.c ++=================================================================== ++--- mt76-2022-08-26-5ec78e1e.orig/mac80211.c +++++ mt76-2022-08-26-5ec78e1e/mac80211.c ++@@ -274,7 +274,7 @@ static void mt76_init_stream_cap(struct ++ void mt76_set_stream_caps(struct mt76_phy *phy, bool vht) ++ { ++ if (phy->cap.has_2ghz) ++- mt76_init_stream_cap(phy, &phy->sband_2g.sband, false); +++ mt76_init_stream_cap(phy, &phy->sband_2g.sband, vht); ++ if (phy->cap.has_5ghz) ++ mt76_init_stream_cap(phy, &phy->sband_5g.sband, vht); ++ if (phy->cap.has_6ghz) ++@@ -341,13 +341,13 @@ mt76_init_sband(struct mt76_phy *phy, st ++ ++ static int ++ mt76_init_sband_2g(struct mt76_phy *phy, struct ieee80211_rate *rates, ++- int n_rates) +++ int n_rates, bool vht) ++ { ++ phy->hw->wiphy->bands[NL80211_BAND_2GHZ] = &phy->sband_2g.sband; ++ ++ return mt76_init_sband(phy, &phy->sband_2g, mt76_channels_2ghz, ++ ARRAY_SIZE(mt76_channels_2ghz), rates, ++- n_rates, true, false); +++ n_rates, true, vht); ++ } ++ ++ static int ++@@ -495,7 +495,7 @@ int mt76_register_phy(struct mt76_phy *p ++ return ret; ++ ++ if (phy->cap.has_2ghz) { ++- ret = mt76_init_sband_2g(phy, rates, n_rates); +++ ret = mt76_init_sband_2g(phy, rates, n_rates, vht); ++ if (ret) ++ return ret; ++ } ++@@ -620,7 +620,7 @@ int mt76_register_device(struct mt76_dev ++ return ret; ++ ++ if (phy->cap.has_2ghz) { ++- ret = mt76_init_sband_2g(phy, rates, n_rates); +++ ret = mt76_init_sband_2g(phy, rates, n_rates, vht); ++ if (ret) ++ return ret; ++ } +diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh +index 3f24fd5e44..a4a8b9f5bb 100644 +--- a/package/network/services/hostapd/files/hostapd.sh ++++ b/package/network/services/hostapd/files/hostapd.sh +@@ -104,7 +104,7 @@ hostapd_common_add_device_config() { + config_add_array basic_rate + config_add_array supported_rates + config_add_string beacon_rate +- ++ config_add_boolean vendor_vht + config_add_string country country3 + config_add_boolean country_ie doth + config_add_boolean spectrum_mgmt_required +@@ -133,7 +133,7 @@ hostapd_prepare_device_config() { + + json_get_vars country country3 country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \ + acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \ +- rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc ++ rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc vendor_vht + + hostapd_set_log_options base_cfg + +@@ -235,6 +235,7 @@ hostapd_prepare_device_config() { + append base_cfg "dtim_period=$dtim_period" "$N" + [ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" + [ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N" ++ [ -n "$vendor_vht" ] && append base_cfg "vendor_vht=$vendor_vht" "$N" + + json_get_values opts hostapd_options + for val in $opts; do +-- +2.34.1 + diff --git a/patches-22.03.2/0012-fix-opkg-support-db.patch b/patches-22.03.2/0012-fix-opkg-support-db.patch new file mode 100644 index 0000000..8d2fc66 --- /dev/null +++ b/patches-22.03.2/0012-fix-opkg-support-db.patch @@ -0,0 +1,107 @@ +From 79d7f61ede3e4e7d5621999c25715dac1cb57a8a Mon Sep 17 00:00:00 2001 +From: gl-dengxinfa +Date: Tue, 18 Oct 2022 16:00:38 +0800 +Subject: [PATCH] fix: opkg support db + +--- + .../system/opkg/patches/001-support-db.patch | 88 +++++++++++++++++++ + 1 file changed, 88 insertions(+) + create mode 100644 package/system/opkg/patches/001-support-db.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..a38a272425 +--- /dev/null ++++ b/package/system/opkg/patches/001-support-db.patch +@@ -0,0 +1,88 @@ ++Index: opkg-2022-02-24-d038e5b6/libopkg/opkg_cmd.c ++=================================================================== ++--- opkg-2022-02-24-d038e5b6.orig/libopkg/opkg_cmd.c +++++ opkg-2022-02-24-d038e5b6/libopkg/opkg_cmd.c ++@@ -44,6 +44,29 @@ ++ int opkg_cli_argc = 0; ++ const char **opkg_cli_argv = NULL; ++ +++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); ++@@ -203,7 +226,7 @@ static int opkg_update_cmd(int argc, cha ++ rmdir(tmp); ++ free(tmp); ++ free(lists_dir); ++- +++ exec_command("update_plugins_db update"); ++ return failures; ++ } ++ ++@@ -489,7 +512,8 @@ static int opkg_install_cmd(int argc, ch ++ err = -1; ++ ++ write_status_files_if_changed(); ++- +++ if (err == 0) +++ exec_command("update_plugins_db install"); ++ return err; ++ } ++ ++@@ -917,6 +941,8 @@ 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; ++ } ++ ++Index: opkg-2022-02-24-d038e5b6/libopkg/opkg_install.c ++=================================================================== ++--- opkg-2022-02-24-d038e5b6.orig/libopkg/opkg_install.c +++++ opkg-2022-02-24-d038e5b6/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-2022-02-24-d038e5b6/libopkg/pkg.c ++=================================================================== ++--- opkg-2022-02-24-d038e5b6.orig/libopkg/pkg.c +++++ opkg-2022-02-24-d038e5b6/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.34.1 +