ramips: support openwrt22.03 and mt1300

This commit is contained in:
gl-dengxinfa 2022-09-27 12:29:44 +08:00
parent 8277d99320
commit 7752b76afd
7 changed files with 255 additions and 29 deletions

View File

@ -0,0 +1,8 @@
repo: https://github.com/openwrt/openwrt.git
branch: v22.03.0
git_clone_dir: openwrt-22.03/openwrt-22.03.0
openwrt_root_dir: openwrt-22.03/openwrt-22.03.0
revision: 17bd6b04777d71d081ddf4ff8fbf44ccaf6f422e
patch_folders:
- patches-22.03.0/

View File

@ -0,0 +1,83 @@
From f283030999e56d68b612ee5baaa27dd714840531 Mon Sep 17 00:00:00 2001
From: gl-dengxinfa <xinfa.deng@gl-inet.com>
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");
+
+ 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");
@@ -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] <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
@@ -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

View File

@ -0,0 +1,53 @@
From 6ab838f58b32024c5bb45fb6cec65a2148f0e599 Mon Sep 17 00:00:00 2001
From: gl-dengxinfa <xinfa.deng@gl-inet.com>
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

View File

@ -0,0 +1,71 @@
From b493ef55dfe0a03374ef6cb7b7934336c9cdc603 Mon Sep 17 00:00:00 2001
From: gl-dengxinfa <xinfa.deng@gl-inet.com>
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", "0x04";
+ 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

View File

@ -0,0 +1,34 @@
From d5c10dc93685c84239e3fec212838aa39b857b67 Mon Sep 17 00:00:00 2001
From: gl-dengxinfa <xinfa.deng@gl-inet.com>
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

View File

@ -2,32 +2,9 @@
description: Add the glinet dependencies
feeds:
- name: glinet
path: ../feeds_dir/glinet
packages:
- kmod-mt7615
- 8021xd
- gl-sdk4-mtk-wifi
- gl-sdk4-mtk-apcli
diffconfig: |
CONFIG_PACKAGE_kmod-mt7603=n
CONFIG_PACKAGE_kmod-mt76x2=n
CONFIG_PACKAGE_kmod-mt7615e=n
CONFIG_PACKAGE_hostapd-common=n
CONFIG_PACKAGE_wpad-basic=n
CONFIG_PACKAGE_wpad-openssl=n
CONFIG_MTK_FIRST_IF_NONE=n
CONFIG_MTK_FIRST_IF_MT7615E=y
CONFIG_MTK_MT_WIFI=y
CONFIG_MTK_BRCM_256QAM_SUPPORT=y
CONFIG_MTK_VHT_TXBF_2G_EPIGRAM_IE_SUPPORT=y
CONFIG_MTK_OFFCHANNEL_SCAN_FEATURE=y
CONFIG_MTK_TCP_RACK_SUPPORT=y
CONFIG_MTK_WIFI_MODE_AP=y
CONFIG_MTK_FAST_UP_RATE_SUPPORT=y
CONFIG_MTK_LED_CONTROL_SUPPORT=y
CONFIG_MTK_LINUX_NET_TXQ_SUPPORT=y
CONFIG_MTK_WPA3_SUPPORT=y
CONFIG_MTK_OWE_SUPPORT=y
uri: https://gitlab.com/gl.sdk4.0/gl.router/gl-sdk4-collect.git
branch: v4.1.0
- name: gl_feed_common
uri: https://github.com/gl-inet/gl-feeds.git
revision: 1c390c8a9f58a5e0a89998555956c894c7a5ff1f

View File

@ -1,5 +1,5 @@
---
profile: gl-mt1300
profile: glinet_gl-mt1300
target: ramips
subtarget: mt7621
description: Build image for the GL.iNET MT1300