Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-03-09 11:38:27 +08:00
commit 064e467038
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
35 changed files with 1880 additions and 35 deletions

View File

@ -16,6 +16,9 @@ ocedo,panda)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000"
;;
watchguard,firebox-t10)
ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x2000" "0x10000"
;;
aerohive,hiveap-330)
ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x20000" "0x10000"
;;

View File

@ -85,6 +85,7 @@ linksys,ea8100-v2|\
mts,wg430223)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
;;
snr,snr-cpe-me2-sfp|\
snr,cpe-w4n-mt)
idx="$(find_mtd_index uboot-env)"
[ -n "$idx" ] && \

View File

@ -1543,3 +1543,19 @@ endef
$(eval $(call KernelPackage,atlantic))
define KernelPackage/lan743x
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Microchip LAN743x PCI Express Gigabit Ethernet NIC
DEPENDS:=@PCI_SUPPORT
KCONFIG:=CONFIG_LAN743X
FILES:=$(LINUX_DIR)/drivers/net/ethernet/microchip/lan743x.ko
AUTOLOAD:=$(call AutoProbe,lan743x)
endef
define KernelPackage/lan743x/description
Kernel module for Microchip LAN743x PCI Express Gigabit Ethernet NIC
endef
$(eval $(call KernelPackage,lan743x))

View File

@ -11,9 +11,9 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=qosify
PKG_SOURCE_URL=$(PROJECT_GIT)/project/qosify.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2022-04-08
PKG_SOURCE_VERSION:=ef82defaae26619e5b2ebddfdd86e9de61c399f1
PKG_MIRROR_HASH:=8e4ca65d23a85aad774af51dc62cfaa4615111ffd2c7922258ac8f026a62b013
PKG_SOURCE_DATE:=2023-03-07
PKG_SOURCE_VERSION:=9a47ea4b683dd845ec94534fcd82d3117c9ab313
PKG_MIRROR_HASH:=c4c313aed4a405492201612bdfef5e219c9a994a35f35acc84fc8327d9aa73d2
PKG_RELEASE:=$(AUTORELEASE)
PKG_LICENSE:=GPL-2.0

View File

@ -142,7 +142,7 @@ CONFIG_PKCS12=y
# RADIUS authentication server. This provides access to the integrated EAP
# server from external hosts using RADIUS.
#CONFIG_RADIUS_SERVER=y
CONFIG_RADIUS_SERVER=y
# Build IPv6 support for RADIUS operations
CONFIG_IPV6=y

View File

@ -268,11 +268,11 @@ hostapd_common_add_bss_config() {
config_add_int ieee80211w
config_add_int eapol_version
config_add_string 'auth_server:host' 'server:host'
config_add_array auth_server acct_server
config_add_string 'server:host'
config_add_string auth_secret key
config_add_int 'auth_port:port' 'port:port'
config_add_string acct_server
config_add_string acct_secret
config_add_int acct_port
config_add_int acct_interval
@ -527,6 +527,20 @@ append_airtime_sta_weight() {
[ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N"
}
append_auth_server() {
[ -n "$1" ] || return
append bss_conf "auth_server_addr=$1" "$N"
append bss_conf "auth_server_port=$auth_port" "$N"
[ -n "$auth_secret" ] && append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
}
append_acct_server() {
[ -n "$1" ] || return
append bss_conf "acct_server_addr=$1" "$N"
append bss_conf "acct_server_port=$acct_port" "$N"
[ -n "$acct_secret" ] && append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
}
hostapd_set_bss_options() {
local var="$1"
local phy="$2"
@ -545,7 +559,7 @@ hostapd_set_bss_options() {
wps_independent wps_device_type wps_device_name wps_manufacturer wps_pin \
macfilter ssid utf8_ssid wmm uapsd hidden short_preamble rsn_preauth \
iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
acct_server acct_secret acct_port acct_interval \
acct_secret acct_port acct_interval \
bss_load_update_period chan_util_avg_period sae_require_mfp sae_pwe \
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \
ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
@ -617,15 +631,10 @@ hostapd_set_bss_options() {
set_default nasid "${macaddr//\:}"
append bss_conf "nas_identifier=$nasid" "$N"
[ -n "$acct_server" ] && {
append bss_conf "acct_server_addr=$acct_server" "$N"
append bss_conf "acct_server_port=$acct_port" "$N"
[ -n "$acct_secret" ] && \
append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
[ -n "$acct_interval" ] && \
append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
json_for_each_item append_radius_acct_req_attr radius_acct_req_attr
}
[ -n "$acct_interval" ] && \
append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
json_for_each_item append_acct_server acct_server
json_for_each_item append_radius_acct_req_attr radius_acct_req_attr
[ -n "$ocv" ] && append bss_conf "ocv=$ocv" "$N"
@ -662,11 +671,9 @@ hostapd_set_bss_options() {
psk|sae|psk-sae)
json_get_vars key wpa_psk_file
if [ "$auth_type" = "psk" ] && [ "$ppsk" -ne 0 ] ; then
json_get_vars auth_server auth_secret auth_port
json_get_vars auth_secret auth_port
set_default auth_port 1812
append bss_conf "auth_server_addr=$auth_server" "$N"
append bss_conf "auth_server_port=$auth_port" "$N"
append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
json_for_each_item append_auth_server auth_server
append bss_conf "macaddr_acl=2" "$N"
append bss_conf "wpa_psk_radius=2" "$N"
elif [ ${#key} -eq 64 ]; then
@ -735,12 +742,7 @@ hostapd_set_bss_options() {
set_default dae_port 3799
set_default request_cui 0
[ "$eap_server" -eq 0 ] && {
append bss_conf "auth_server_addr=$auth_server" "$N"
append bss_conf "auth_server_port=$auth_port" "$N"
append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
}
[ "$eap_server" -eq 0 ] && json_for_each_item append_auth_server auth_server
[ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N"
[ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
@ -780,9 +782,7 @@ hostapd_set_bss_options() {
[ -n "$auth_server" ] && {
set_default auth_port 1812
append bss_conf "auth_server_addr=$auth_server" "$N"
append bss_conf "auth_server_port=$auth_port" "$N"
[ -n "$auth_secret" ] && append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
json_for_each_item append_auth_server auth_server
[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N"
[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
append bss_conf "macaddr_acl=2" "$N"

View File

@ -1084,6 +1084,8 @@ hostapd_bss_mgmt_enable(struct ubus_context *ctx, struct ubus_object *obj,
}
__hostapd_bss_mgmt_enable(hapd, flags);
return 0;
}

View File

@ -0,0 +1,95 @@
From 598ada195606eb0e577db0487dd59a2536f206ce Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 31 Jul 2022 18:38:27 -0700
Subject: [PATCH 1/5] tools build: Add feature test for init_disassemble_info
API changes
binutils changed the signature of init_disassemble_info(), which now causes
compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
Relevant binutils commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
This commit adds a feature test to detect the new signature. Subsequent
commits will use it to fix the build failures.
Signed-off-by: Andres Freund <andres@anarazel.de>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Ben Hutchings <benh@debian.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
(cherry picked from commit cfd59ca91467056bb2c36907b2fa67b8e1af9952)
---
tools/build/Makefile.feature | 1 +
tools/build/feature/Makefile | 4 ++++
tools/build/feature/test-all.c | 4 ++++
tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
4 files changed, 22 insertions(+)
create mode 100644 tools/build/feature/test-disassembler-init-styled.c
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -69,6 +69,7 @@ FEATURE_TESTS_BASIC :=
libaio \
libzstd \
disassembler-four-args \
+ disassembler-init-styled \
file-handle
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -18,6 +18,7 @@ FILES=
test-libbfd.bin \
test-libbfd-buildid.bin \
test-disassembler-four-args.bin \
+ test-disassembler-init-styled.bin \
test-reallocarray.bin \
test-libbfd-liberty.bin \
test-libbfd-liberty-z.bin \
@@ -239,6 +240,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
$(OUTPUT)test-disassembler-four-args.bin:
$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
+$(OUTPUT)test-disassembler-init-styled.bin:
+ $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
+
$(OUTPUT)test-reallocarray.bin:
$(BUILD)
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -166,6 +166,10 @@
# include "test-disassembler-four-args.c"
#undef main
+#define main main_test_disassembler_init_styled
+# include "test-disassembler-init-styled.c"
+#undef main
+
#define main main_test_libzstd
# include "test-libzstd.c"
#undef main
--- /dev/null
+++ b/tools/build/feature/test-disassembler-init-styled.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <stdio.h>
+#include <dis-asm.h>
+
+int main(void)
+{
+ struct disassemble_info info;
+
+ init_disassemble_info(&info, stdout,
+ NULL, NULL);
+
+ return 0;
+}

View File

@ -0,0 +1,96 @@
From 08ec5766e5cf7b24fdebefb83b6f760bceeddf40 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 31 Jul 2022 18:38:29 -0700
Subject: [PATCH 2/5] tools include: add dis-asm-compat.h to handle version
differences
binutils changed the signature of init_disassemble_info(), which now causes
compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
Relevant binutils commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
This commit introduces a wrapper for init_disassemble_info(), to avoid
spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
commits will use it to fix the build failures.
It likely is worth adding a wrapper for disassember(), to avoid the already
existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
Signed-off-by: Andres Freund <andres@anarazel.de>
Signed-off-by: Ben Hutchings <benh@debian.org>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Ben Hutchings <benh@debian.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
(cherry picked from commit a45b3d6926231c3d024ea0de4f7bd967f83709ee)
---
tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 tools/include/tools/dis-asm-compat.h
--- /dev/null
+++ b/tools/include/tools/dis-asm-compat.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
+#ifndef _TOOLS_DIS_ASM_COMPAT_H
+#define _TOOLS_DIS_ASM_COMPAT_H
+
+#include <stdio.h>
+#include <dis-asm.h>
+
+/* define types for older binutils version, to centralize ifdef'ery a bit */
+#ifndef DISASM_INIT_STYLED
+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
+#endif
+
+/*
+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
+ * init_disassemble_info_compat() when normal fprintf suffices.
+ */
+static inline int fprintf_styled(void *out,
+ enum disassembler_style style,
+ const char *fmt, ...)
+{
+ va_list args;
+ int r;
+
+ (void)style;
+
+ va_start(args, fmt);
+ r = vfprintf(out, fmt, args);
+ va_end(args);
+
+ return r;
+}
+
+/*
+ * Wrapper for init_disassemble_info() that hides version
+ * differences. Depending on binutils version and architecture either
+ * fprintf_func or fprintf_styled_func will be called.
+ */
+static inline void init_disassemble_info_compat(struct disassemble_info *info,
+ void *stream,
+ fprintf_ftype unstyled_func,
+ fprintf_styled_ftype styled_func)
+{
+#ifdef DISASM_INIT_STYLED
+ init_disassemble_info(info, stream,
+ unstyled_func,
+ styled_func);
+#else
+ (void)styled_func;
+ init_disassemble_info(info, stream,
+ unstyled_func);
+#endif
+}
+
+#endif /* _TOOLS_DIS_ASM_COMPAT_H */

View File

@ -0,0 +1,111 @@
From 3bc373152a3a00742750dbbe974d541af78231e6 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 31 Jul 2022 18:38:30 -0700
Subject: [PATCH 3/5] tools perf: Fix compilation error with new binutils
binutils changed the signature of init_disassemble_info(), which now causes
compilation failures for tools/perf/util/annotate.c, e.g. on debian
unstable.
Relevant binutils commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
Wire up the feature test and switch to init_disassemble_info_compat(),
which were introduced in prior commits, fixing the compilation failure.
I verified that perf can still disassemble bpf programs by using bpftrace
under load, recording a perf trace, and then annotating the bpf "function"
with and without the changes. With old binutils there's no change in output
before/after this patch. When comparing the output from old binutils (2.35)
to new bintuils with the patch (upstream snapshot) there are a few output
differences, but they are unrelated to this patch. An example hunk is:
1.15 : 55:mov %rbp,%rdx
0.00 : 58:add $0xfffffffffffffff8,%rdx
0.00 : 5c:xor %ecx,%ecx
- 1.03 : 5e:callq 0xffffffffe12aca3c
+ 1.03 : 5e:call 0xffffffffe12aca3c
0.00 : 63:xor %eax,%eax
- 2.18 : 65:leaveq
- 2.82 : 66:retq
+ 2.18 : 65:leave
+ 2.82 : 66:ret
Signed-off-by: Andres Freund <andres@anarazel.de>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Ben Hutchings <benh@debian.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
(cherry picked from commit 83aa0120487e8bc3f231e72c460add783f71f17c)
---
tools/perf/Makefile.config | 8 ++++++++
tools/perf/util/annotate.c | 7 ++++---
2 files changed, 12 insertions(+), 3 deletions(-)
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -296,6 +296,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYT
FEATURE_CHECK_LDFLAGS-libaio = -lrt
FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
CORE_CFLAGS += -fno-omit-frame-pointer
CORE_CFLAGS += -ggdb3
@@ -872,13 +873,16 @@ ifndef NO_LIBBFD
ifeq ($(feature-libbfd-liberty), 1)
EXTLIBS += -lbfd -lopcodes -liberty
FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
+ FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
else
ifeq ($(feature-libbfd-liberty-z), 1)
EXTLIBS += -lbfd -lopcodes -liberty -lz
FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
+ FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
endif
endif
$(call feature_check,disassembler-four-args)
+ $(call feature_check,disassembler-init-styled)
endif
ifeq ($(feature-libbfd-buildid), 1)
@@ -992,6 +996,10 @@ ifeq ($(feature-disassembler-four-args),
CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
endif
+ifeq ($(feature-disassembler-init-styled), 1)
+ CFLAGS += -DDISASM_INIT_STYLED
+endif
+
ifeq (${IS_64_BIT}, 1)
ifndef NO_PERF_READ_VDSO32
$(call feature_check,compile-32)
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1694,6 +1694,7 @@ fallback:
#include <bpf/btf.h>
#include <bpf/libbpf.h>
#include <linux/btf.h>
+#include <tools/dis-asm-compat.h>
static int symbol__disassemble_bpf(struct symbol *sym,
struct annotate_args *args)
@@ -1736,9 +1737,9 @@ static int symbol__disassemble_bpf(struc
ret = errno;
goto out;
}
- init_disassemble_info(&info, s,
- (fprintf_ftype) fprintf);
-
+ init_disassemble_info_compat(&info, s,
+ (fprintf_ftype) fprintf,
+ fprintf_styled);
info.arch = bfd_get_arch(bfdf);
info.mach = bfd_get_mach(bfdf);

View File

@ -0,0 +1,102 @@
From 042e7f11769adac0736d77d76262912b90724d7d Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 31 Jul 2022 18:38:31 -0700
Subject: [PATCH 4/5] tools bpf_jit_disasm: Fix compilation error with new
binutils
binutils changed the signature of init_disassemble_info(), which now causes
compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
unstable.
Relevant binutils commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
Wire up the feature test and switch to init_disassemble_info_compat(),
which were introduced in prior commits, fixing the compilation failure.
I verified that bpf_jit_disasm can still disassemble bpf programs, both
with the old and new dis-asm.h API. With old binutils there's no change in
output before/after this patch. When comparing the output from old
binutils (2.35) to new bintuils with the patch (upstream snapshot) there
are a few output differences, but they are unrelated to this patch. An
example hunk is:
f4: mov %r14,%rsi
f7: mov %r15,%rdx
fa: mov $0x2a,%ecx
- ff: callq 0xffffffffea8c4988
+ ff: call 0xffffffffea8c4988
104: test %rax,%rax
107: jge 0x0000000000000110
109: xor %eax,%eax
- 10b: jmpq 0x0000000000000073
+ 10b: jmp 0x0000000000000073
110: cmp $0x16,%rax
However, I had to use an older kernel to generate the bpf_jit_enabled =
2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
x86_64: Use bpf_jit_binary_pack_alloc").
https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
Signed-off-by: Andres Freund <andres@anarazel.de>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Ben Hutchings <benh@debian.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
(cherry picked from commit 96ed066054abf11c7d3e106e3011a51f3f1227a3)
---
tools/bpf/Makefile | 5 ++++-
tools/bpf/bpf_jit_disasm.c | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -34,7 +34,7 @@ else
endif
FEATURE_USER = .bpf
-FEATURE_TESTS = libbfd disassembler-four-args
+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
FEATURE_DISPLAY = libbfd disassembler-four-args
check_feat := 1
@@ -56,6 +56,9 @@ endif
ifeq ($(feature-disassembler-four-args), 1)
CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
endif
+ifeq ($(feature-disassembler-init-styled), 1)
+CFLAGS += -DDISASM_INIT_STYLED
+endif
$(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
$(QUIET_BISON)$(YACC) -o $@ -d $<
--- a/tools/bpf/bpf_jit_disasm.c
+++ b/tools/bpf/bpf_jit_disasm.c
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
+#include <tools/dis-asm-compat.h>
#define CMD_ACTION_SIZE_BUFFER 10
#define CMD_ACTION_READ_ALL 3
@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image
assert(bfdf);
assert(bfd_check_format(bfdf, bfd_object));
- init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
+ init_disassemble_info_compat(&info, stdout,
+ (fprintf_ftype) fprintf,
+ fprintf_styled);
info.arch = bfd_get_arch(bfdf);
info.mach = bfd_get_mach(bfdf);
info.buffer = image;

View File

@ -0,0 +1,146 @@
From a82db18ab34ba7f9d38319e8cc01ffe382e3e55e Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 31 Jul 2022 18:38:33 -0700
Subject: [PATCH 5/5] tools bpftool: Fix compilation error with new binutils
binutils changed the signature of init_disassemble_info(), which now causes
compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
unstable.
Relevant binutils commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
Wire up the feature test and switch to init_disassemble_info_compat(),
which were introduced in prior commits, fixing the compilation failure.
I verified that bpftool can still disassemble bpf programs, both with an
old and new dis-asm.h API. There are no output changes for plain and json
formats. When comparing the output from old binutils (2.35)
to new bintuils with the patch (upstream snapshot) there are a few output
differences, but they are unrelated to this patch. An example hunk is:
2f: pop %r14
31: pop %r13
33: pop %rbx
- 34: leaveq
- 35: retq
+ 34: leave
+ 35: ret
Signed-off-by: Andres Freund <andres@anarazel.de>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Ben Hutchings <benh@debian.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
(cherry picked from commit 600b7b26c07a070d0153daa76b3806c1e52c9e00)
---
tools/bpf/bpftool/Makefile | 5 +++-
tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
2 files changed, 38 insertions(+), 9 deletions(-)
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -76,7 +76,7 @@ INSTALL ?= install
RM ?= rm -f
FEATURE_USER = .bpftool
-FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
clang-bpf-co-re
FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
clang-bpf-co-re
@@ -100,6 +100,9 @@ endif
ifeq ($(feature-disassembler-four-args), 1)
CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
endif
+ifeq ($(feature-disassembler-init-styled), 1)
+ CFLAGS += -DDISASM_INIT_STYLED
+endif
ifeq ($(feature-reallocarray), 0)
CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
--- a/tools/bpf/bpftool/jit_disasm.c
+++ b/tools/bpf/bpftool/jit_disasm.c
@@ -24,6 +24,7 @@
#include <sys/stat.h>
#include <limits.h>
#include <bpf/libbpf.h>
+#include <tools/dis-asm-compat.h>
#include "json_writer.h"
#include "main.h"
@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
}
static int oper_count;
-static int fprintf_json(void *out, const char *fmt, ...)
+static int printf_json(void *out, const char *fmt, va_list ap)
{
- va_list ap;
char *s;
int err;
- va_start(ap, fmt);
err = vasprintf(&s, fmt, ap);
- va_end(ap);
if (err < 0)
return -1;
@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const
return 0;
}
+static int fprintf_json(void *out, const char *fmt, ...)
+{
+ va_list ap;
+ int r;
+
+ va_start(ap, fmt);
+ r = printf_json(out, fmt, ap);
+ va_end(ap);
+
+ return r;
+}
+
+static int fprintf_json_styled(void *out,
+ enum disassembler_style style __maybe_unused,
+ const char *fmt, ...)
+{
+ va_list ap;
+ int r;
+
+ va_start(ap, fmt);
+ r = printf_json(out, fmt, ap);
+ va_end(ap);
+
+ return r;
+}
+
void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
const char *arch, const char *disassembler_options,
const struct btf *btf,
@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *im
assert(bfd_check_format(bfdf, bfd_object));
if (json_output)
- init_disassemble_info(&info, stdout,
- (fprintf_ftype) fprintf_json);
+ init_disassemble_info_compat(&info, stdout,
+ (fprintf_ftype) fprintf_json,
+ fprintf_json_styled);
else
- init_disassemble_info(&info, stdout,
- (fprintf_ftype) fprintf);
+ init_disassemble_info_compat(&info, stdout,
+ (fprintf_ftype) fprintf,
+ fprintf_styled);
/* Update architecture info for offload. */
if (arch) {

View File

@ -50,7 +50,9 @@ ipq40xx_setup_interfaces()
meraki,mr33|\
meraki,mr74|\
mikrotik,lhgg-60ad|\
mikrotik,sxtsq-5-ac)
mikrotik,sxtsq-5-ac|\
netgear,ex6100v2|\
netgear,ex6150v2)
ucidef_set_interface_lan "lan"
;;
avm,fritzbox-7530)

View File

@ -65,6 +65,7 @@
led-failsafe = &power_amber;
led-running = &power_green;
led-upgrade = &power_amber;
label-mac-device = &gmac;
};
keys {
@ -323,3 +324,16 @@
nvmem-cell-names = "pre-calibration", "mac-address";
nvmem-cells = <&precal_art_5000>, <&macaddr_dnidata_c>;
};
&gmac {
status = "okay";
};
&switch {
status = "okay";
};
&swport4 {
status = "okay";
label = "lan";
};

View File

@ -814,16 +814,14 @@ define Device/netgear_ex6100v2
DEVICE_MODEL := EX6100
DEVICE_VARIANT := v2
endef
# Missing DSA Setup
#TARGET_DEVICES += netgear_ex6100v2
TARGET_DEVICES += netgear_ex6100v2
define Device/netgear_ex6150v2
$(call Device/netgear_ex61x0v2)
DEVICE_MODEL := EX6150
DEVICE_VARIANT := v2
endef
# Missing DSA Setup
#TARGET_DEVICES += netgear_ex6150v2
TARGET_DEVICES += netgear_ex6150v2
define Device/netgear_orbi
$(call Device/DniImage)

View File

@ -21,6 +21,9 @@ tplink,tl-wdr4900-v1)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
ucidef_set_interface_macaddr "wan" "$(macaddr_add $(mtd_get_mac_binary u-boot 0x4fc00) 1)"
;;
watchguard,firebox-t10)
ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0"
;;
*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;

View File

@ -6,6 +6,11 @@ preinit_set_mac_address() {
ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr)
ip link set dev eth1 address $(mtd_get_mac_ascii cfg1 eth1addr)
;;
watchguard,firebox-t10)
ip link set dev eth0 address "$(mtd_get_mac_text "device_id" 0x1830)"
ip link set dev eth1 address "$(mtd_get_mac_text "device_id" 0x1844)"
ip link set dev eth2 address "$(mtd_get_mac_text "device_id" 0x1858)"
;;
esac
}

View File

@ -14,7 +14,8 @@ platform_do_upgrade() {
case "$board" in
ocedo,panda|\
sophos,red-15w-rev1)
sophos,red-15w-rev1|\
watchguard,firebox-t10)
nand_do_upgrade "$1"
;;
*)

View File

@ -247,6 +247,7 @@ CONFIG_THREAD_SHIFT=13
CONFIG_TICK_CPU_ACCOUNTING=y
CONFIG_TINY_SRCU=y
# CONFIG_TL_WDR4900_V1 is not set
# CONFIG_FIREBOX_T10 is not set
# CONFIG_TOOLCHAIN_DEFAULT_CPU is not set
# CONFIG_TQM8540 is not set
# CONFIG_TQM8541 is not set

View File

@ -266,3 +266,4 @@ CONFIG_WATCHDOG_CORE=y
# CONFIG_XES_MPC85xx is not set
CONFIG_XZ_DEC_BCJ=y
CONFIG_XZ_DEC_POWERPC=y
# CONFIG_FIREBOX_T10 is not set

View File

@ -0,0 +1,268 @@
// SPDX-License-Identifier: GPL-2.0-or-later or MIT
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
/include/ "fsl/p1010si-pre.dtsi"
/ {
model = "Watchguard Firebox T10";
compatible = "watchguard,firebox-t10";
chosen {
bootargs = "console=ttyS0,115200";
bootargs-override = "console=ttyS0,115200";
};
aliases {
spi0 = &spi0;
led-boot = &led_mode;
led-failsafe = &led_failover;
led-running = &led_mode;
led-upgrade = &led_attention;
};
memory {
device_type = "memory";
};
leds {
compatible = "gpio-leds";
led_attention: attention_orange {
gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
label = "orange:attention";
};
status_red {
gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
label = "red:status";
};
led_mode: mode_green {
gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
label = "green:mode";
};
led_failover: failover_green {
gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
label = "green:failover";
};
};
buttons {
compatible = "gpio-keys";
reset {
label = "Reset button";
gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
soc: soc@ffe00000 {
ranges = <0x0 0x0 0xffe00000 0x100000>;
i2c@3000 {
rtc@30 {
compatible = "sii,s35390a";
reg = <0x30>;
};
};
spi0: spi@7000 {
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
uboot: partition@0 {
reg = <0x0 0x90000>;
label = "u-boot";
read-only;
};
partition@90000 {
reg = <0x90000 0x10000>;
label = "u-boot-env";
};
partition@a0000 {
reg = <0xa0000 0x20000>;
label = "cfgxxx";
read-only;
};
partition@c0000 {
reg = <0xc0000 0x40000>;
label = "device_id";
read-only;
};
};
};
};
gpio0: gpio-controller@fc00 {
};
usb@22000 {
phy_type = "utmi";
dr_mode = "host";
};
mdio@24000 {
phy1: ethernet-phy@1 {
reg = <0x1>;
};
phy2: ethernet-phy@2 {
reg = <0x2>;
};
phy3: ethernet-phy@3 {
reg = <0x3>;
};
};
mdio@25000 {
tbi_phy1: tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
};
};
mdio@26000 {
tbi_phy2: tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
};
};
enet0: ethernet@b0000 {
phy-handle = <&phy1>;
phy-connection-type = "rgmii-id";
};
enet1: ethernet@b1000 {
tbi-handle = <&tbi_phy1>;
phy-handle = <&phy2>;
phy-connection-type = "sgmii";
};
enet2: ethernet@b2000 {
tbi-handle = <&tbi_phy2>;
phy-handle = <&phy3>;
phy-connection-type = "sgmii";
};
sdhc@2e000 {
status = "disabled";
};
serial1: serial@4600 {
status = "disabled";
};
can0: can@1c000 {
status = "disabled";
};
can1: can@1d000 {
status = "disabled";
};
};
pci0: pcie@ffe09000 {
status = "disabled";
};
pci1: pcie@ffe0a000 {
status = "disabled";
};
ifc: ifc@ffe1e000 {
reg = <0x0 0xffe1e000 0 0x2000>;
/* NOR, NAND Flashes and CPLD on board */
ranges = <0x0 0x0 0x0 0xee000000 0x02000000
0x1 0x0 0x0 0xff800000 0x00010000
0x3 0x0 0x0 0xffb00000 0x00000020>;
nand@1,0 {
compatible = "fsl,ifc-nand";
reg = <0x1 0x0 0x10000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/*
* Original partition layout:
* 0x000000000000-0x000000020000 : "NAND (RW) WG DTB Image"
* 0x000000020000-0x000000520000 : "NAND (RW) WG SYSA Kernel"
* 0x000000520000-0x000007f00000 : "NAND (RW) WG SYSA_CODE"
* 0x000007f00000-0x000008400000 : "NAND (RW) WG SYSB Kernel"
* 0x000008400000-0x000009c00000 : "NAND (RW) WG SYSB_CODE"
* 0x000009c00000-0x00000a100000 : "NAND (RW) WG SYSA2 Kernel"
* 0x00000a100000-0x000011ae0000 : "NAND (RW) WG SYSA_CODE2"
* 0x000011ae0000-0x000020000000 : "NAND (RW) WG SYSA_DATA"
*/
partition@0 {
reg = <0x0 0x20000>;
label = "wg-dtb";
read-only;
};
partition@20000 {
reg = <0x20000 0x500000>;
label = "kernel";
};
partition@520000 {
reg = <0x520000 0x79e0000>;
label = "wg-sysa-rootfs";
read-only;
};
partition@7f00000 {
reg = <0x7f00000 0x500000>;
label = "wg-sysb-kernel";
read-only;
};
partition@8400000 {
reg = <0x8400000 0x1800000>;
label = "wg-sysb-rootfs";
read-only;
};
partition@9c00000 {
reg = <0x9c00000 0x500000>;
label = "wg-sysa2-kernel";
read-only;
};
partition@a100000 {
reg = <0xa100000 0x79e0000>;
label = "wg-sysa2-rootfs";
read-only;
};
partition@11ae0000 {
reg = <0x11ae0000 0xe520000>;
label = "ubi";
};
};
};
};
};
/include/ "fsl/p1010si-post.dtsi"

View File

@ -0,0 +1,87 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Watchguard Firebox T10 Board Setup
*
* Copyright (C) 2023 David Bauer <mail@david-bauer.net>
*
* Based on:
* p1010rdb.c:
* P1010 RDB Board Setup
* Copyright 2011 Freescale Semiconductor Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/of_platform.h>
#include <asm/time.h>
#include <asm/machdep.h>
#include <asm/pci-bridge.h>
#include <mm/mmu_decl.h>
#include <asm/prom.h>
#include <asm/udbg.h>
#include <asm/mpic.h>
#include <sysdev/fsl_soc.h>
#include <sysdev/fsl_pci.h>
#include "mpc85xx.h"
void __init firebox_t10_pic_init(void)
{
struct mpic *mpic;
mpic = mpic_alloc(NULL, 0,
MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);
mpic_init(mpic);
}
/*
* Setup the architecture
*/
static void __init firebox_t10_setup_arch(void)
{
if (ppc_md.progress)
ppc_md.progress("firebox_t10_setup_arch()", 0);
fsl_pci_assign_primary();
pr_info("Firebox T10 from Watchguard\n");
}
machine_arch_initcall(firebox_t10, mpc85xx_common_publish_devices);
/*
* Called very early, device-tree isn't unflattened
*/
static int __init firebox_t10_probe(void)
{
if (of_machine_is_compatible("watchguard,firebox-t10"))
return 1;
return 0;
}
define_machine(firebox_t10) {
.name = "P1010 RDB",
.probe = firebox_t10_probe,
.setup_arch = firebox_t10_setup_arch,
.init_IRQ = firebox_t10_pic_init,
#ifdef CONFIG_PCI
.pcibios_fixup_bus = fsl_pcibios_fixup_bus,
.pcibios_fixup_phb = fsl_pcibios_fixup_phb,
#endif
.get_irq = mpic_get_irq,
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
};

View File

@ -40,6 +40,16 @@ define Device/tplink_tl-wdr4900-v1
endef
TARGET_DEVICES += tplink_tl-wdr4900-v1
define Device/watchguard_firebox-t10
DEVICE_VENDOR := Watchguard
DEVICE_MODEL := Firebox T10
DEVICE_PACKAGES := kmod-rtc-s35390a kmod-eeprom-at24
KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += watchguard_firebox-t10
define Device/sophos_red-15w-rev1
DEVICE_VENDOR := Sophos
DEVICE_MODEL := RED 15w

View File

@ -1,4 +1,5 @@
CONFIG_AT803X_PHY=y
CONFIG_CMDLINE_OVERRIDE=y
# CONFIG_FSL_CORENET_CF is not set
CONFIG_MTD_NAND_FSL_IFC=y
CONFIG_MTD_SPLIT_FIRMWARE=y
@ -19,3 +20,4 @@ CONFIG_REGMAP=y
CONFIG_REGULATOR=y
CONFIG_TL_WDR4900_V1=y
CONFIG_UBIFS_FS=y
CONFIG_FIREBOX_T10=y

View File

@ -0,0 +1,29 @@
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -92,6 +92,16 @@ config WS_AP3825I
This board is a Concurrent Dual-Band wireless access point with a
Freescale P1020 SoC.
+config FIREBOX_T10
+ bool "Watchguard Firebox T10"
+ select DEFAULT_UIMAGE
+ select ARCH_REQUIRE_GPIOLIB
+ select GPIO_MPC8XXX
+ help
+ This option enables support for the Watchguard Firebox T10 board.
+ This board is a VPN Gateway-Router with a
+ Freescale P1010 SoC.
+
config MPC8540_ADS
bool "Freescale MPC8540 ADS"
select DEFAULT_UIMAGE
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_PANDA) += panda.o
obj-$(CONFIG_TWR_P102x) += twr_p102x.o
obj-$(CONFIG_WS_AP3710I) += ws-ap3710i.o
obj-$(CONFIG_WS_AP3825I) += ws-ap3825i.o
+obj-$(CONFIG_FIREBOX_T10) += firebox_t10.o
obj-$(CONFIG_CORENET_GENERIC) += corenet_generic.o
obj-$(CONFIG_FB_FSL_DIU) += t1042rdb_diu.o
obj-$(CONFIG_RED_15W_REV1) += red15w_rev1.o

View File

@ -0,0 +1,29 @@
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -92,6 +92,16 @@ config WS_AP3825I
This board is a Concurrent Dual-Band wireless access point with a
Freescale P1020 SoC.
+config FIREBOX_T10
+ bool "Watchguard Firebox T10"
+ select DEFAULT_UIMAGE
+ select ARCH_REQUIRE_GPIOLIB
+ select GPIO_MPC8XXX
+ help
+ This option enables support for the Watchguard Firebox T10 board.
+ This board is a VPN Gateway-Router with a
+ Freescale P1010 SoC.
+
config MPC8540_ADS
bool "Freescale MPC8540 ADS"
select DEFAULT_UIMAGE
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_PANDA) += panda.o
obj-$(CONFIG_TWR_P102x) += twr_p102x.o
obj-$(CONFIG_WS_AP3710I) += ws-ap3710i.o
obj-$(CONFIG_WS_AP3825I) += ws-ap3825i.o
+obj-$(CONFIG_FIREBOX_T10) += firebox_t10.o
obj-$(CONFIG_CORENET_GENERIC) += corenet_generic.o
obj-$(CONFIG_FB_FSL_DIU) += t1042rdb_diu.o
obj-$(CONFIG_RED_15W_REV1) += red15w_rev1.o

View File

@ -15,6 +15,15 @@ ctera,c200-v2)
ucidef_set_led_usbport "usb2" "USB2" "green:usb-2" "usb1-port1" "usb2-port1"
ucidef_set_led_usbport "usb3" "USB3" "green:usb-1" "usb1-port2" "usb2-port2"
;;
fortinet,fg-50e)
ucidef_set_led_netdev "wan1_link" "WAN1 Link" "green:speed_wan1" "eth1" "link"
ucidef_set_led_netdev "wan2_link" "WAN2 Link" "green:speed_wan2" "eth2" "link"
ucidef_set_led_netdev "lan1_link" "LAN1 Link" "green:speed_lan1" "lan1" "link"
ucidef_set_led_netdev "lan2_link" "LAN2 Link" "green:speed_lan2" "lan2" "link"
ucidef_set_led_netdev "lan3_link" "LAN3 Link" "green:speed_lan3" "lan3" "link"
ucidef_set_led_netdev "lan4_link" "LAN4 Link" "green:speed_lan4" "lan4" "link"
ucidef_set_led_netdev "lan5_link" "LAN5 Link" "green:speed_lan5" "lan5" "link"
;;
kobol,helios4)
ucidef_set_led_usbport "USB" "USB" "helios4:green:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1" "usb5-port1"
;;

View File

@ -18,6 +18,9 @@ mvebu_setup_interfaces()
cznic,turris-omnia)
ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 lan4" "eth2"
;;
fortinet,fg-50e)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "eth1 eth2"
;;
iptime,nas1dual)
ucidef_set_interface_lan "eth0 eth1" "dhcp"
;;

View File

@ -0,0 +1,54 @@
. /lib/functions.sh
fortinet_fwinfo_blocks() {
local fwinfo_mtd="$(find_mtd_part firmware-info)"
local offset="$1"
local len="$2"
local blks
if [ -z "$fwinfo_mtd" ]; then
echo "WARN: MTD device \"firmware-info\" not found"
return 1
fi
blks=$((len / 0x200))
[ $((len % 0x200)) -gt 0 ] && blks=$((blks + 1))
blks=$(printf "%04x" $blks)
printf "fwinfo: offset-> 0x%x, blocks-> 0x%s (len: 0x%08x)\n" \
$offset $blks $len
printf "\x${blks:2:2}\x${blks:0:2}" | \
dd bs=2 count=1 seek=$((offset / 2)) conv=notrunc of=${fwinfo_mtd}
}
fortinet_do_upgrade() {
local board_dir="$(tar tf "$1" | grep -m 1 '^sysupgrade-.*/$')"
local kern_mtd="$(find_mtd_part kernel)"
local root_mtd="$(find_mtd_part rootfs)"
local kern_len root_len
board_dir="${board_dir%/}"
if [ -z "$kern_mtd" ] || [ -z "$root_mtd" ]; then
echo "ERROR: MTD device \"kernel\" or \"rootfs\" not found"
umount -a
reboot -f
fi
kern_len=$( (tar xOf "$1" "$board_dir/kernel" | wc -c) 2> /dev/null)
root_len=$( (tar xOf "$1" "$board_dir/root" | wc -c) 2> /dev/null)
if [ -z "$kern_len" ] || [ -z "$root_len" ]; then
echo "ERROR: failed to get length of new kernel or rootfs"
umount -a
reboot -f
fi
fortinet_fwinfo_blocks "0x184" "$kern_len"
fortinet_fwinfo_blocks "0x18c" "$root_len"
tar xOf "$1" "$board_dir/kernel" | \
mtd write - "kernel"
tar xOf "$1" "$board_dir/root" | \
mtd ${UPGRADE_BACKUP:+-j "${UPGRADE_BACKUP}"} write - "rootfs"
}

View File

@ -52,6 +52,9 @@ platform_do_upgrade() {
solidrun,clearfog-pro-a1)
legacy_sdcard_do_upgrade "$1"
;;
fortinet,fg-50e)
fortinet_do_upgrade "$1"
;;
linksys,wrt1200ac|\
linksys,wrt1900ac-v1|\
linksys,wrt1900ac-v2|\

View File

@ -0,0 +1,491 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include "armada-385.dtsi"
/ {
model = "Fortinet FortiGate 50E";
compatible = "fortinet,fg-50e", "marvell,armada385", "marvell,armada380";
aliases {
led-boot = &led_status_green;
led-failsafe = &led_status_red;
led-running = &led_status_green;
led-upgrade = &led_status_green;
label-mac-device = &eth0;
};
chosen {
stdout-path = "serial0:9600n8";
};
memory@0 {
device_type = "memory";
reg = <0x00000000 0x80000000>; /* 2GB */
};
soc {
ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
};
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pmx_gpio_keys_pins>;
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
};
};
gpio-leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pmx_gpio_leds_pins>;
led-0 {
label = "red:alarm";
gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_ALARM;
};
led-1 {
label = "red:ha";
gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
};
led_status_green: led-2 {
label = "green:sta";
gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
};
led-3 {
label = "green:ha";
gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
};
led-4 {
label = "amber:alarm";
gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_ALARM;
};
led_status_red: led-5 {
label = "red:sta";
gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_STATUS;
};
led-6 {
label = "green:speed_wan1";
gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
};
led-7 {
label = "green:speed_wan2";
gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
};
led-8 {
label = "amber:speed_lan5";
gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_AMBER>;
};
led-9 {
label = "green:speed_lan5";
gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
};
led-10 {
label = "green:speed_lan4";
gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
};
led-11 {
label = "amber:speed_lan4";
gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
};
led-12 {
label = "amber:speed_lan3";
gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
};
led-13 {
label = "green:speed_lan3";
gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
};
led-14 {
label = "green:speed_lan1";
gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
};
led-15 {
label = "amber:speed_lan1";
gpios = <&gpio2 13 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
};
led-16 {
label = "green:speed_lan2";
gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
};
led-17 {
label = "amber:speed_lan2";
gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
};
};
reg_usb_vbus: regulator-usb-vbus {
compatible = "fixed-regulator";
regulator-name = "usb-vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio1 21 GPIO_ACTIVE_LOW>;
regulator-always-on;
};
};
&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
status = "okay";
gpio2: gpio@24 {
compatible = "nxp,pca9555";
reg = <0x24>;
gpio-controller;
#gpio-cells = <0x2>;
};
hwmon@28 {
compatible = "nuvoton,nct7802";
reg = <0x28>;
};
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;
status = "okay";
};
&pinctrl {
pmx_phy_switch_pins: phy-switch-pins {
marvell,pins = "mpp19", "mpp20", "mpp23", "mpp34", "mpp41";
marvell,function = "gpio";
};
pmx_gpio_leds_pins: gpio-leds-pins {
marvell,pins = "mpp30", "mpp32", "mpp33", "mpp35",
"mpp45", "mpp47";
marvell,function = "gpio";
};
pmx_usb_pins: usb-pins {
marvell,pins = "mpp53";
marvell,function = "gpio";
};
pmx_gpio_keys_pins: gpio-keys-pins {
marvell,pins = "mpp54";
marvell,function = "gpio";
};
};
&bm {
status = "okay";
};
&bm_bppi {
status = "okay";
};
&eth0 {
pinctrl-names = "default";
pinctrl-0 = <&ge0_rgmii_pins>;
status = "okay";
phy-connection-type = "rgmii-id";
buffer-manager = <&bm>;
bm,pool-long = <0>;
bm,pool-short = <1>;
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
fixed-link {
speed = <1000>;
full-duplex;
};
};
&eth1 {
status = "okay";
phy-handle = <&ethphy0>;
phy-connection-type = "sgmii";
buffer-manager = <&bm>;
bm,pool-long = <2>;
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <1>;
};
&eth2 {
status = "okay";
phy-handle = <&ethphy1>;
phy-connection-type = "sgmii";
buffer-manager = <&bm>;
bm,pool-long = <3>;
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <2>;
};
&mdio {
pinctrl-names = "default";
pinctrl-0 = <&mdio_pins>, <&pmx_phy_switch_pins>;
/* Marvell 88E1512 */
ethphy0: ethernet-phy@0 {
compatible = "ethernet-phy-id0141,0dd1",
"ethernet-phy-ieee802.3-c22";
reg = <0>;
interrupt-parent = <&gpio0>;
interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
reset-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
/*
* LINK/ACT (Green): LED[0], Active Low
* SPEED 100M (Amber): LED[1], Active High
*/
marvell,reg-init = <3 16 0 0x71>,
<3 17 0 0x4>;
};
/* Marvell 88E1512 */
ethphy1: ethernet-phy@1 {
compatible = "ethernet-phy-id0141,0dd1",
"ethernet-phy-ieee802.3-c22";
reg = <1>;
interrupt-parent = <&gpio1>;
interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
reset-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
/*
* LINK/ACT (Green): LED[0], Active Low
* SPEED 100M (Amber): LED[1], Active High
*/
marvell,reg-init = <3 16 0 0x71>,
<3 17 0 0x4>;
};
/* Marvell 88E6176 */
switch@2 {
compatible = "marvell,mv88e6085";
reg = <0x2>;
reset-gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan5";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <7>;
};
port@1 {
reg = <1>;
label = "lan4";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <6>;
};
port@2 {
reg = <2>;
label = "lan3";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <5>;
};
port@3 {
reg = <3>;
label = "lan2";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <4>;
};
port@4 {
reg = <4>;
label = "lan1";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <3>;
};
port@6 {
reg = <6>;
ethernet = <&eth0>;
phy-connection-type = "rgmii-id";
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
};
&usb3_0 {
pinctrl-names = "default";
pinctrl-0 = <&pmx_usb_pins>;
status = "okay";
vbus-supply = <&reg_usb_vbus>;
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
reg = <0x0 0x1c0000>;
label = "u-boot";
read-only;
};
partition@1c0000 {
reg = <0x1c0000 0x10000>;
label = "firmware-info";
/*
* 0x10 - 0x2f : image name (image1)
* 0x30 - 0x4f : image name (image2)
* 0x170 (1byte): active image (0x0/0x1)
* 0x184 - 0x185: kernel block count (image1)
* 0x18c - 0x18d: rootfs block count (image1)
* 0x194 - 0x195: kernel block count (image2)
* 0x19c - 0x19d: rootfs block count (image2)
* 0x1be (1byte): bit7 -> active flag (image1)?
* 0x1ce (1byte): bit7 -> active flag (image2)?
*
* Note: block size --> 0x200 (512 bytes)
*/
};
partition@1d0000 {
reg = <0x1d0000 0x10000>;
label = "dtb";
read-only;
};
partition@1e0000 {
reg = <0x1e0000 0x10000>;
label = "u-boot-env";
read-only;
};
partition@1f0000 {
reg = <0x1f0000 0x10000>;
label = "board-info";
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_bdinfo_d880: macaddr@d880 {
reg = <0xd880 0x6>;
};
};
partition@200000 {
reg = <0x200000 0x600000>;
label = "kernel";
};
partition@800000 {
reg = <0x800000 0x1800000>;
label = "rootfs";
};
partition@2000000 {
reg = <0x2000000 0x600000>;
label = "kn2";
read-only;
};
partition@2600000 {
reg = <0x2600000 0x1800000>;
label = "rfs2";
read-only;
};
partition@3e00000 {
reg = <0x3e00000 0x1200000>;
label = "part1";
read-only;
};
partition@5000000 {
reg = <0x5000000 0x1200000>;
label = "part2";
read-only;
};
partition@6200000 {
reg = <0x6200000 0x1e00000>;
label = "config";
read-only;
};
};
};
};

View File

@ -3,6 +3,19 @@
# Copyright (C) 2012-2016 OpenWrt.org
# Copyright (C) 2016 LEDE-project.org
define Build/fortigate-header
( \
dd if=/dev/zero bs=384 count=1 2>/dev/null; \
datalen=$$(wc -c $@ | cut -d' ' -f1); \
datalen=$$(printf "%08x" $$datalen); \
datalen="$${datalen:6:2}$${datalen:4:2}$${datalen:2:2}$${datalen:0:2}"; \
printf $$(echo "00020000$${datalen}ffff0000ffff0000" | sed 's/../\\x&/g'); \
dd if=/dev/zero bs=112 count=1 2>/dev/null; \
cat $@; \
) > $@.new
mv $@.new $@
endef
define Device/dsa-migration
DEVICE_COMPAT_VERSION := 1.1
DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
@ -84,6 +97,21 @@ define Device/cznic_turris-omnia
endef
TARGET_DEVICES += cznic_turris-omnia
define Device/fortinet_fg-50e
DEVICE_VENDOR := Fortinet
DEVICE_MODEL := FortiGate 50E
SOC := armada-385
KERNEL := kernel-bin | append-dtb
KERNEL_INITRAMFS := kernel-bin | append-dtb | fortigate-header | \
gzip-filename FGT50E
KERNEL_SIZE := 6144k
DEVICE_DTS := armada-385-fortinet-fg-50e
IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | \
sysupgrade-tar rootfs=$$$$@ | append-metadata
DEVICE_PACKAGES := kmod-hwmon-nct7802
endef
TARGET_DEVICES += fortinet_fg-50e
define Device/globalscale_mirabox
$(Device/NAND-512K)
DEVICE_VENDOR := Globalscale

View File

@ -0,0 +1,219 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
/ {
compatible = "snr,snr-cpe-me2-sfp", "mediatek,mt7621-soc";
model = "SNR-CPE-ME2-SFP";
aliases {
led-boot = &led_sys;
led-failsafe = &led_sys;
led-running = &led_sys;
led-upgrade = &led_sys;
};
leds {
compatible = "gpio-leds";
led_sys: sys {
label = "green:sys";
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
vpn {
label = "green:vpn";
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
usb {
label = "green:usb";
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_USB;
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
trigger-sources = <&xhci_ehci_port1>;
linux,default-trigger = "usbport";
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
sfp_wan: sfp0 {
compatible = "sff,sfp";
i2c-bus = <&i2c>;
los-gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
mod-def0-gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
tx-disable-gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <1000>;
};
reg_usb_vbus: regulator-usb {
compatible = "regulator-fixed";
regulator-name = "usb_vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio 17 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
reg_3p3v: regulator-3p3v {
compatible = "regulator-fixed";
regulator-name = "fixed-3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};
};
&state_default {
gpio {
groups = "uart2", "uart3", "jtag";
function = "gpio";
};
};
&spi0 {
status = "okay";
flash@0 { // GD25Q127CSIG
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <44000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "config";
reg = <0x30000 0x10000>;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x50000 0xfb0000>;
};
partition@30001 {
label = "uboot-env";
reg = <0x30000 0x1000>;
};
};
};
};
&gpio {
// driver issue, bypass
enable_sfp {
gpio-hog;
gpios = <9 GPIO_ACTIVE_LOW>;
output-low;
};
};
&mdio {
phy_sfp: ethernet-phy@0 {
reg = <0>;
sfp = <&sfp_wan>;
};
};
&gmac0 {
nvmem-cells = <&macaddr_factory_e000>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
status = "okay";
label = "wan";
phy-mode = "rgmii-rxid";
phy-handle = <&phy_sfp>;
nvmem-cells = <&macaddr_factory_e006>;
nvmem-cell-names = "mac-address";
};
&switch0 {
ports {
port@1 {
status = "okay";
label = "lan1";
};
port@2 {
status = "okay";
label = "lan2";
};
port@3 {
status = "okay";
label = "lan3";
};
port@4 {
status = "okay";
label = "lan4";
};
};
};
&xhci {
vusb33-supply = <&reg_3p3v>;
vbus-supply = <&reg_usb_vbus>;
};
&pcie {
status = "okay";
};
&pcie0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0000>;
};
};
&factory {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_factory_e000: macaddr@e000 {
reg = <0xe000 0x6>;
};
macaddr_factory_e006: macaddr@e006 {
reg = <0xe006 0x6>;
};
};

View File

@ -1966,6 +1966,18 @@ define Device/snr_snr-cpe-me2-lite
endef
TARGET_DEVICES += snr_snr-cpe-me2-lite
define Device/snr_snr-cpe-me2-sfp
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
IMAGE_SIZE := 16064k
DEVICE_VENDOR := SNR
DEVICE_MODEL := SNR-CPE-ME2-SFP
UIMAGE_NAME := $$(DEVICE_MODEL)
DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \
kmod-sfp kmod-usb-ledtrig-usbport uboot-envtools
endef
TARGET_DEVICES += snr_snr-cpe-me2-sfp
define Device/storylink_sap-g3200u3
$(Device/dsa-migration)
IMAGE_SIZE := 7872k

View File

@ -139,6 +139,10 @@ case "$board" in
macaddr_setbit_la "$(mtd_get_mac_ascii Config protest_lan_mac)" \
> /sys${DEVPATH}/macaddress
;;
snr,snr-cpe-me2-sfp)
hw_mac_addr="$(mtd_get_mac_binary factory 0x8004)"
[ "$PHYNBR" = "1" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress
;;
tenbay,t-mb5eu-v01)
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr "0x100000" > /sys${DEVPATH}/macaddress