openwrt22.03.2: support s1300 emmc target

This commit is contained in:
Dongming Han 2022-11-11 16:01:25 +08:00
parent 67801bb8e8
commit bb863359b2
4 changed files with 979 additions and 4 deletions

View File

@ -0,0 +1,580 @@
From 0f5e588f06413a5d1d23d092376c8f7000a1b47a Mon Sep 17 00:00:00 2001
From: Dongming Han <handongming@gl-inet.com>
Date: Wed, 2 Nov 2022 23:47:24 +0800
Subject: [PATCH] ipq40xx add support for gl-s1300-emmc
---
.../ipq40xx/base-files/etc/board.d/01_leds | 8 +-
.../ipq40xx/base-files/etc/board.d/02_network | 9 +
.../base-files/lib/upgrade/platform.sh | 2 +
.../boot/dts/qcom-ipq4029-gl-s1300-emmc.dts | 412 ++++++++++++++++++
target/linux/ipq40xx/image/generic.mk | 29 ++
.../901-arm-boot-add-dts-files.patch | 3 +-
6 files changed, 461 insertions(+), 2 deletions(-)
create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300-emmc.dts
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
index 0e473534f5..d8e69da700 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
@@ -28,10 +28,15 @@ avm,fritzbox-4040)
ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x1e"
;;
avm,fritzbox-7530 |\
-glinet,gl-b1300 |\
mikrotik,lhgg-60ad)
ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt"
;;
+glinet,gl-s1300 |\
+glinet,gl-s1300-emmc |\
+glinet,gl-b1300)
+ ucidef_set_led_default "power" "POWER" "green:power" "1"
+ ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt"
+ ;;
edgecore,oap100)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wlan2g" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "blue:wlan5g" "phy1tpt"
@@ -53,6 +58,7 @@ engenius,ens620ext)
ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth1"
;;
glinet,gl-ap1300)
+ ucidef_set_led_default "power" "POWER" "green:power" "1"
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
;;
mikrotik,cap-ac)
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index 2aa4886e6a..53a5f3f4cf 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -110,6 +110,7 @@ ipq40xx_setup_interfaces()
;;
glinet,gl-ap1300 |\
glinet,gl-b1300 |\
+ glinet,gl-s1300-emmc |\
glinet,gl-s1300)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
@@ -216,6 +217,14 @@ ipq40xx_setup_macs()
lan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
label_mac="$lan_mac"
;;
+ glinet,gl-s1300-emmc|\
+ glinet,gl-s1300|\
+ glinet,gl-b1300|\
+ glinet,gl-ap1300|\
+ glinet,gl-a1300)
+ wan_mac=$(mtd_get_mac_binary ART 0)
+ lan_mac=$(macaddr_add "$wan_mac" 1)
+ ;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
index e8c94409a7..856a793e19 100644
--- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
@@ -119,6 +119,7 @@ platform_do_upgrade() {
qxwlan,e2600ac-c2)
nand_do_upgrade "$1"
;;
+ glinet,gl-s1300-emmc |\
glinet,gl-b2200)
CI_KERNPART="0:HLOS"
CI_ROOTPART="rootfs"
@@ -200,6 +201,7 @@ platform_do_upgrade() {
platform_copy_config() {
case "$(board_name)" in
+ glinet,gl-s1300-emmc |\
glinet,gl-b2200)
emmc_copy_config
;;
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300-emmc.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300-emmc.dts
new file mode 100644
index 0000000000..1ba67cdea0
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300-emmc.dts
@@ -0,0 +1,412 @@
+// SPDX-License-Identifier: GPL-2.0-only OR MIT
+
+#include "qcom-ipq4019.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/soc/qcom,tcsr.h>
+
+/ {
+ model = "GL.iNet GL-S1300-EMMC";
+ compatible = "glinet,gl-s1300-emmc";
+
+ aliases {
+ led-boot = &led_power;
+ led-failsafe = &led_power;
+ led-running = &led_power;
+ led-upgrade = &led_power;
+ };
+
+ gl_hw {
+ compatible = "gl-hw-info";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "s1300";
+ wan = "eth1";
+ lan = "eth0";
+ usb-port = "1-1,2-1";
+ flash_size = <512>;
+ reset-button = "gpio-18";
+ radio = "radio0";
+ factory_data {
+ device_mac = "ART", "0x0";
+ device_ddns = "ART", "0x10";
+ device_sn_bak = "ART", "0x20";
+ device_sn = "ART", "0x30";
+ country_code = "ART", "0x88";
+ };
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0x80000000 0x10000000>;
+ };
+
+ chosen {
+ bootargs-append = " root=/dev/mmcblk0p2 rw rootwait clk_ignore_unused";
+ };
+
+ soc {
+ rng@22000 {
+ status = "okay";
+ };
+
+ mdio@90000 {
+ status = "okay";
+ };
+
+ ess-psgmii@98000 {
+ status = "okay";
+ };
+
+ tcsr@1949000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1949000 0x100>;
+ qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
+ };
+
+ tcsr@194b000 {
+ /* select hostmode */
+ compatible = "qcom,tcsr";
+ reg = <0x194b000 0x100>;
+ qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
+ status = "okay";
+ };
+
+ ess_tcsr@1953000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1953000 0x1000>;
+ qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
+ };
+
+ tcsr@1957000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1957000 0x100>;
+ qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
+ };
+
+ usb2@60f8800 {
+ status = "okay";
+ };
+
+ usb3@8af8800 {
+ status = "okay";
+ };
+
+ crypto@8e3a000 {
+ status = "okay";
+ };
+
+ watchdog@b017000 {
+ status = "okay";
+ };
+
+ ess-switch@c000000 {
+ status = "okay";
+ switch_lan_bmp = <0x18>;
+ switch_wan_bmp = <0x20>;
+ };
+
+ edma@c080000 {
+ status = "okay";
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ wps {
+ label = "wps";
+ gpios = <&tlmm 53 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_WPS_BUTTON>;
+ };
+
+ reset {
+ label = "reset";
+ gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_power: power {
+ label = "green:power";
+ gpios = <&tlmm 57 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+
+ mesh {
+ label = "green:mesh";
+ gpios = <&tlmm 59 GPIO_ACTIVE_HIGH>;
+ };
+
+ wlan {
+ label = "green:wlan";
+ gpios = <&tlmm 60 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "phy0tpt";
+ };
+ };
+
+ gpio_export {
+ compatible = "gpio-export";
+
+ usb {
+ gpio-export,name = "usb_power";
+ gpio-export,output = <1>;
+ gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>;
+ };
+
+ zb_rst {
+ gpio-export,name = "zb_rst";
+ gpio-export,output = <1>;
+ gpios = <&tlmm 49 GPIO_ACTIVE_LOW>;
+ };
+
+ ble_rst {
+ gpio-export,name = "ble_rst";
+ gpio-export,output = <1>;
+ gpios = <&tlmm 48 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&vqmmc {
+ status = "okay";
+};
+
+&sdhci {
+ status = "okay";
+ pinctrl-0 = <&sd_pins>;
+ pinctrl-names = "default";
+ cd-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>;
+ vqmmc-supply = <&vqmmc>;
+};
+
+&blsp_dma {
+ status = "okay";
+};
+
+&cryptobam {
+ status = "okay";
+};
+
+&blsp1_spi1 {
+ pinctrl-0 = <&spi_0_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+ cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>;
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <24000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ SBL1@0 {
+ label = "SBL1";
+ reg = <0x0 0x40000>;
+ read-only;
+ };
+
+ MIBIB@40000 {
+ label = "MIBIB";
+ reg = <0x40000 0x20000>;
+ read-only;
+ };
+
+ QSEE@60000 {
+ label = "QSEE";
+ reg = <0x60000 0x60000>;
+ read-only;
+ };
+
+ CDT@c0000 {
+ label = "CDT";
+ reg = <0xc0000 0x10000>;
+ read-only;
+ };
+
+ DDRPARAMS@d0000 {
+ label = "DDRPARAMS";
+ reg = <0xd0000 0x10000>;
+ read-only;
+ };
+
+ APPSBLENV@e0000 {
+ label = "APPSBLENV";
+ reg = <0xe0000 0x10000>;
+ read-only;
+ };
+
+ APPSBL@f0000 {
+ label = "APPSBL";
+ reg = <0xf0000 0x80000>;
+ read-only;
+ };
+
+ ART@170000 {
+ label = "ART";
+ reg = <0x170000 0x10000>;
+ read-only;
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ precal_art_1000: precal@1000 {
+ reg = <0x1000 0x2f20>;
+ };
+
+ precal_art_5000: precal@5000 {
+ reg = <0x5000 0x2f20>;
+ };
+ };
+ };
+ };
+};
+
+&blsp1_spi2 {
+ pinctrl-0 = <&spi_1_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ spidev1: spi@0 {
+ compatible = "siliconlabs,si3210";
+ reg = <0>;
+ spi-max-frequency = <24000000>;
+ };
+};
+
+&blsp1_uart1 {
+ pinctrl-0 = <&serial_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&blsp1_uart2 {
+ pinctrl-0 = <&serial_1_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&tlmm {
+ serial_pins: serial_pinmux {
+ mux {
+ pins = "gpio16", "gpio17";
+ function = "blsp_uart0";
+ bias-disable;
+ };
+ };
+
+ serial_1_pins: serial1_pinmux {
+ mux {
+ pins = "gpio8", "gpio9",
+ "gpio10", "gpio11";
+ function = "blsp_uart1";
+ bias-disable;
+ };
+ };
+
+ spi_0_pins: spi_0_pinmux {
+ pinmux {
+ function = "blsp_spi0";
+ pins = "gpio13", "gpio14", "gpio15";
+ };
+ pinmux_cs {
+ function = "gpio";
+ pins = "gpio12";
+ };
+ pinconf {
+ pins = "gpio13", "gpio14", "gpio15";
+ drive-strength = <12>;
+ bias-disable;
+ };
+ pinconf_cs {
+ pins = "gpio12";
+ drive-strength = <2>;
+ bias-disable;
+ output-high;
+ };
+ };
+
+ spi_1_pins: spi_1_pinmux {
+ mux {
+ pins = "gpio44", "gpio46", "gpio47";
+ function = "blsp_spi1";
+ bias-disable;
+ };
+ host_int {
+ pins = "gpio42";
+ function = "gpio";
+ input;
+ };
+ cs {
+ pins = "gpio45";
+ function = "gpio";
+ bias-pull-up;
+ };
+ wake {
+ pins = "gpio40";
+ function = "gpio";
+ output-high;
+ };
+ reset {
+ pins = "gpio49";
+ function = "gpio";
+ output-high;
+ };
+ };
+
+ sd_pins: sd_pins {
+ pinmux {
+ function = "sdio";
+ pins = "gpio23", "gpio24", "gpio25", "gpio26",
+ "gpio28", "gpio29", "gpio30", "gpio31";
+ drive-strength = <10>;
+ };
+
+ pinmux_sd_clk {
+ function = "sdio";
+ pins = "gpio27";
+ drive-strength = <16>;
+ };
+
+ pinmux_sd7 {
+ function = "sdio";
+ pins = "gpio32";
+ drive-strength = <10>;
+ bias-disable;
+ };
+ };
+};
+
+&usb2_hs_phy {
+ status = "okay";
+};
+
+&usb3_hs_phy {
+ status = "okay";
+};
+
+&usb3_ss_phy {
+ status = "okay";
+};
+
+&wifi0 {
+ status = "okay";
+ nvmem-cell-names = "pre-calibration";
+ nvmem-cells = <&precal_art_1000>;
+ qcom,ath10k-calibration-variant = "GL-S1300-EMMC";
+};
+
+&wifi1 {
+ status = "okay";
+ nvmem-cell-names = "pre-calibration";
+ nvmem-cells = <&precal_art_5000>;
+ qcom,ath10k-calibration-variant = "GL-S1300-EMMC";
+};
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index cf89409b17..3201c89a3d 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -106,6 +106,17 @@ define Build/qsdk-ipq-app-gpt
rm $@.tmp
endef
+define Build/qsdk-ipq-app-gpt2
+ cp $@ $@.tmp 2>/dev/null || true
+ ptgen -g -o $@.tmp -a 1 -l 1 \
+ -t 0x2e -N 0:HLOS -r -p 32M \
+ -t 0x83 -N rootfs -r -p 128M \
+ -N rootfs_data -p 512M \
+ -N user_data -p 6774M
+ cat $@.tmp >> $@
+ rm $@.tmp
+endef
+
define Build/SenaoFW
-$(STAGING_DIR_HOST)/bin/mksenaofw \
-n $(BOARD_NAME) -r $(VENDOR_ID) -p $(1) \
@@ -587,6 +598,24 @@ define Device/glinet_gl-b2200
endef
TARGET_DEVICES += glinet_gl-b2200
+define Device/glinet_gl-s1300-emmc
+ $(call Device/FitzImage)
+ DEVICE_VENDOR := GL.iNet
+ DEVICE_MODEL := GL-S1300-EMMC
+ SOC := qcom-ipq4029
+ DEVICE_DTS_CONFIG := config@ap.dk04.1-c1
+ KERNEL_INITRAMFS_SUFFIX := -recovery.itb
+ IMAGES := emmc.img sysupgrade.bin
+ IMAGE/emmc.img := qsdk-ipq-app-gpt2 |\
+ pad-to 17k | append-kernel |\
+ pad-to 32785k | append-rootfs |\
+ append-gl-metadata
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
+ DEVICE_PACKAGES := ipq-wifi-glinet_gl-s1300 \
+ kmod-fs-ext4 kmod-mmc kmod-spi-dev mkf2fs e2fsprogs kmod-fs-f2fs
+endef
+TARGET_DEVICES += glinet_gl-s1300-emmc
+
define Device/glinet_gl-s1300
$(call Device/FitzImage)
DEVICE_VENDOR := GL.iNet
diff --git a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch
index 4fc0566c73..5add3c7bf0 100644
--- a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch
+++ b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch
@@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
-@@ -904,11 +904,75 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -904,11 +904,76 @@ dtb-$(CONFIG_ARCH_QCOM) += \
qcom-apq8074-dragonboard.dtb \
qcom-apq8084-ifc6540.dtb \
qcom-apq8084-mtp.dtb \
@@ -82,6 +82,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
+ qcom-ipq4029-gl-b1300.dtb \
+ qcom-ipq4019-gl-b2200.dtb \
+ qcom-ipq4029-gl-s1300.dtb \
++ qcom-ipq4029-gl-s1300-emmc.dtb \
+ qcom-ipq4029-mr33.dtb \
qcom-ipq8064-ap148.dtb \
qcom-ipq8064-rb3011.dtb \
--
2.25.1

View File

@ -0,0 +1,241 @@
From 6bd030c30913058af543edccb8732cdcd93178cb Mon Sep 17 00:00:00 2001
From: Dongming Han <handongming@gl-inet.com>
Date: Fri, 11 Nov 2022 15:41:00 +0800
Subject: [PATCH] ipq40xx fix wireguard support hotplug
---
.../856-wireguard-support-hotplug.patch | 222 ++++++++++++++++++
1 file changed, 222 insertions(+)
create mode 100644 target/linux/ipq40xx/patches-5.10/856-wireguard-support-hotplug.patch
diff --git a/target/linux/ipq40xx/patches-5.10/856-wireguard-support-hotplug.patch b/target/linux/ipq40xx/patches-5.10/856-wireguard-support-hotplug.patch
new file mode 100644
index 0000000000..0de25b62ec
--- /dev/null
+++ b/target/linux/ipq40xx/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 <linux/module.h>
++#include <linux/version.h>
++#include <linux/kmod.h>
++#include <linux/input.h>
++
++#include <linux/workqueue.h>
++#include <linux/skbuff.h>
++#include <linux/netlink.h>
++#include <linux/kobject.h>
++
++#include <linux/workqueue.h>
++
++#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 <linux/genetlink.h>
+ #include <net/rtnetlink.h>
+
++#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 <Jason@zx2c4.com>. 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 <linux/rcupdate.h>
+ #include <linux/slab.h>
+@@ -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.25.1

View File

@ -1,11 +1,165 @@
---
description: Add the glinet dependencies
feeds:
- name: glinet
path: ../feeds_dir/glinet
uri: https://gitlab.com/gl.sdk4.0/gl.router/gl-sdk4-collect.git
revision: 4a44ac6d4adfb511e4f9f9c5ae02d47c148388e7
- name: gl_feeds_commmon
uri: https://github.com/gl-inet/gl-feeds.git
revision: 3736d7437fb9a57014bb779d495aa11700462959
# - name: glinet
# path: ../feeds_dir/glinet
# - name: gl_feeds
# uri: https://github.com/gl-inet/gl-feeds.git
# revision: b0b2d6c2a563be5787bde3acb7b5cf4e83ddc0ce
packages:
- helloworld
- gl-sdk4-led
- gl-sdk4-adguardhome
- gl-sdk4-timer
- gl-sdk4-igmp
- gl-sdk4-sms-forward
- kmod-usb-storage
- kmod-usb-uhci
- kmod-usb2
- kmod-usb-ohci
- kmod-gl-sdk4-hw-info
- kmod-gl-sdk4-tertf
- dnsmasq-full
- mwan3
- iwinfo
- block-mount
- blkid
- ntfs-3g
- ntfs-3g-utils
- kmod-fs-ext4
- kmod-fs-ntfs
- kmod-fs-vfat
- kmod-fs-exfat
- iptables-mod-tproxy
- iptables-mod-filter
- gl-oui-rpc
- oui-librpc
- gl-sdk4-luci
- gl-sdk4-rtty
- gl-sdk4-base-files
- gl-sdk4-tethering
- gl-sdk4-network
- gl-sdk4-acl
- gl-sdk4-system
- gl-sdk4-mqtt
- gl-sdk4-qos
- gl-sdk4-network-diag
- gl-sdk4-carrier-monitor
- gl-sdk4-init-portal
- gl-sdk4-vpn-policy
- gl-sdk4-s2s
- gl-sdk4-utils
- gl-sdk4-dns
- gl-sdk4-tor
- gl-sdk4-mwan3
- gl-sdk4-cloud-batch-manage
- gl-sdk4-repeater
- gl-sdk4-wifi
- gl-sdk4-ui-adguardhome
- gl-sdk4-ui-adminpw
- gl-sdk4-ui-advanced
- gl-sdk4-ui-bridge
- gl-sdk4-ui-clients
- gl-sdk4-ui-cloud
- gl-sdk4-ui-core
- gl-sdk4-ui-dnsview
- gl-sdk4-ui-dynamicdns
- gl-sdk4-ui-edgerouter
- gl-sdk4-ui-firewallview
- gl-sdk4-ui-home
- gl-sdk4-ui-internet
- gl-sdk4-ui-ipv6
- gl-sdk4-ui-lanip
- gl-sdk4-ui-login
- gl-sdk4-ui-logview
- gl-sdk4-ui-macclone
- gl-sdk4-ui-modemmanage
- gl-sdk4-ui-nasview
- gl-sdk4-ui-ovpnclient
- gl-sdk4-ui-ovpnserver
- gl-sdk4-ui-plugins
- gl-sdk4-ui-process
- gl-sdk4-ui-reset
- gl-sdk4-ui-timezone
- gl-sdk4-ui-upgrade
- gl-sdk4-ui-vpndashboard
- gl-sdk4-ui-welcome
- gl-sdk4-ui-wgclient
- gl-sdk4-ui-wgserver
- gl-sdk4-ui-igmp
- gl-sdk4-ui-overview
- gl-sdk4-ui-timedtask
- gl-sdk4-ui-torview
- gl-sdk4-ui-multiwan
- gl-sdk4-ui-wireless
- kmod-inet-diag
- kmod-usb-storage-uas
- gl-sdk4-ui-hwnat
- kmod-ipt-offload
- gl-sdk4-ui-sms
- ip6tables-zz-legacy
- ip6tables-nft
- iptables-zz-legacy
- iptables-nft
diffconfig: |
CONFIG_SIGNATURE_CHECK=n
CONFIG_PACKAGE_dnsmasq=n
CONFIG_PACKAGE_wpad-basic=n
CONFIG_PACKAGE_wpad=n
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_BUSYBOX_CONFIG_FEATURE_FLOAT_SLEEP=y
CONFIG_NGINX_HTTP_CHARSET=n
CONFIG_NGINX_HTTP_GZIP=n
CONFIG_NGINX_HTTP_SSI=n
CONFIG_NGINX_HTTP_USERID=n
CONFIG_NGINX_HTTP_ACCESS=n
CONFIG_NGINX_HTTP_AUTH_BASIC=n
CONFIG_NGINX_HTTP_AUTOINDEX=n
CONFIG_NGINX_HTTP_GEO=n
CONFIG_NGINX_HTTP_MAP=n
CONFIG_NGINX_HTTP_SPLIT_CLIENTS=n
CONFIG_NGINX_HTTP_REFERER=n
CONFIG_NGINX_HTTP_REWRITE=n
CONFIG_NGINX_HTTP_FASTCGI=n
CONFIG_NGINX_HTTP_SCGI=n
CONFIG_NGINX_HTTP_MEMCACHED=n
CONFIG_NGINX_HTTP_LIMIT_CONN=n
CONFIG_NGINX_HTTP_LIMIT_REQ=n
CONFIG_NGINX_HTTP_EMPTY_GIF=n
CONFIG_NGINX_HTTP_BROWSER=n
CONFIG_NGINX_HTTP_UPSTREAM_HASH=n
CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH=n
CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN=n
CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE=n
CONFIG_NGINX_HTTP_CACHE=n
CONFIG_NGINX_NAXSI=n
CONFIG_NGINX_HEADERS_MORE=n
CONFIG_LIBCURL_MBEDTLS=n
CONFIG_LIBCURL_OPENSSL=y
CONFIG_OPENSSL_OPTIMIZE_SPEED=y
CONFIG_LUCI_LANG_zh_Hans=y
CONFIG_PACKAGE_wpad-basic-wolfssl=n
CONFIG_PACKAGE_ath10k-firmware-qca4019=m
CONFIG_PACKAGE_ath10k-firmware-qca4019-ct=y
CONFIG_PACKAGE_kmod-ath10k=m
CONFIG_PACKAGE_kmod-ath10k-ct=y
CONFIG_ATH10K_LEDS=y
CONFIG_ATH10K-CT_LEDS=y
CONFIG_ATH10K_THERMAL=y
CONFIG_KERNEL_DEVMEM=y
CONFIG_BUSYBOX_CONFIG_DEVMEM=y
CONFIG_BUSYBOX_CONFIG_TLS=y
CONFIG_PACKAGE_fdisk=y
CONFIG_PACKAGE_kmod-usb-storage-extras=y
CONFIG_PACKAGE_dnscrypt-proxy2=y
CONFIG_PACKAGE_badblocks=y
CONFIG_PACKAGE_ip-tiny=y

View File

@ -2,4 +2,4 @@
profile: glinet_gl-s1300-emmc
target: ipq40xx
subtarget: generic
description: Build image for the GL.iNET S1300
description: Build image for the GL.iNET S1300 EMMC