ramips: Revert 'allow to set switchdev by board in ramips_set_preinit_iface' (#3000)

This may affect wireless and network.
This commit is contained in:
AmadeusGhost 2020-02-08 17:14:44 +08:00 committed by GitHub
parent 7fce313c4c
commit da5186e8f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 71 deletions

View File

@ -3,54 +3,27 @@
# Copyright (C) 2013 OpenWrt.org # Copyright (C) 2013 OpenWrt.org
# #
. /lib/functions.sh
ramips_switchdev_from_soc() {
# The ethernet switch driver enables VLAN by default, but
# failsafe uses eth0, making the device unreachable:
# https://dev.openwrt.org/ticket/18768
local switchdev
local RT3X5X=$(grep -E "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)" /proc/cpuinfo)
[ -n "$RT3X5X" ] || return 1
case "$RT3X5X" in
*MT7620*)
switchdev=mt7620
;;
*MT7621*)
switchdev=mt7530
;;
*)
switchdev=rt305x
;;
esac
echo "$switchdev"
}
ramips_switchdev_from_board() {
# For these devices, external ethernet switch should be used
# instead of the SoC internal switch.
local switchdev
local board=$(board_name)
case "$board" in
esac
echo "$switchdev"
}
ramips_set_preinit_iface() { ramips_set_preinit_iface() {
local switchdev=$(ramips_switchdev_from_board) RT3X5X=$(grep -E "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)" /proc/cpuinfo)
[ -n "$switchdev" ] || switchdev=$(ramips_switchdev_from_soc)
if [ -n "$switchdev" ]; then if [ -n "${RT3X5X}" ]; then
swconfig dev $switchdev set reset 1 # The ethernet switch driver enables VLAN by default, but
swconfig dev $switchdev set enable_vlan 0 # failsafe uses eth0, making the device unreachable:
swconfig dev $switchdev set apply 1 # https://dev.openwrt.org/ticket/18768
case "${RT3X5X}" in
*MT7620*)
ralink_switchdev=mt7620
;;
*MT7621*)
ralink_switchdev=mt7530
;;
*)
ralink_switchdev=rt305x
;;
esac
swconfig dev $ralink_switchdev set reset 1
swconfig dev $ralink_switchdev set enable_vlan 0
swconfig dev $ralink_switchdev set apply 1
fi fi
ifname=eth0 ifname=eth0

View File

@ -6,8 +6,8 @@
#include <dt-bindings/input/input.h> #include <dt-bindings/input/input.h>
/ { / {
compatible = "netis,wf-2881", "mediatek,mt7621-soc"; compatible = "netis,wf2881", "mediatek,mt7621-soc";
model = "NETIS WF-2881"; model = "NETIS WF2881";
aliases { aliases {
led-boot = &led_wps; led-boot = &led_wps;
@ -25,14 +25,14 @@
compatible = "gpio-leds"; compatible = "gpio-leds";
usb { usb {
label = "wf-2881:green:usb"; label = "wf2881:green:usb";
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
trigger-sources = <&xhci_ehci_port1>, <&ehci_port2>; trigger-sources = <&xhci_ehci_port1>, <&ehci_port2>;
linux,default-trigger = "usbport"; linux,default-trigger = "usbport";
}; };
led_wps: wps { led_wps: wps {
label = "wf-2881:green:wps"; label = "wf2881:green:wps";
gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
}; };
}; };
@ -75,9 +75,22 @@
}; };
partition@140000 { partition@140000 {
compatible = "denx,uimage";
label = "firmware"; label = "firmware";
reg = <0x140000 0x7e40000>; reg = <0x140000 0x7e40000>;
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "kernel";
reg = <0x0 0x400000>;
};
partition@400000 {
label = "ubi";
reg = <0x400000 0x7a40000>;
};
}; };
}; };
}; };

View File

@ -7,6 +7,21 @@ include ./common-tp-link.mk
DEFAULT_SOC := mt7621 DEFAULT_SOC := mt7621
KERNEL_DTB += -d21 KERNEL_DTB += -d21
DEVICE_VARS += UIMAGE_MAGIC
# The OEM webinterface expects an kernel with initramfs which has the uImage
# header field ih_name.
# We don't want to set the header name field for the kernel include in the
# sysupgrade image as well, as this image shouldn't be accepted by the OEM
# webinterface. It will soft-brick the board.
define Build/custom-initramfs-uimage
mkimage -A $(LINUX_KARCH) \
-O linux -T kernel \
-C lzma -a $(KERNEL_LOADADDR) $(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC),) \
-e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-n '$(1)' -d $@ $@.new
mv $@.new $@
endef
define Build/elecom-gst-factory define Build/elecom-gst-factory
$(eval product=$(word 1,$(1))) $(eval product=$(word 1,$(1)))
@ -74,19 +89,6 @@ define Build/ubnt-erx-factory-image
fi fi
endef endef
# The OEM webinterface expects an kernel with initramfs which has the uImage
# header field ih_name.
# We don't wan't to set the header name field for the kernel include in the
# sysupgrade image as well, as this image shouldn't be accepted by the OEM
# webinterface. It will soft-brick the board.
define Build/wr1201-factory-header
mkimage -A $(LINUX_KARCH) \
-O linux -T kernel \
-C lzma -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-n 'WR1201_8_128' -d $@ $@.new
mv $@.new $@
endef
define Device/afoundry_ew1200 define Device/afoundry_ew1200
IMAGE_SIZE := 16064k IMAGE_SIZE := 16064k
DEVICE_VENDOR := AFOUNDRY DEVICE_VENDOR := AFOUNDRY
@ -466,7 +468,7 @@ define Device/mtc_wr1201
IMAGE_SIZE := 16000k IMAGE_SIZE := 16000k
DEVICE_VENDOR := MTC DEVICE_VENDOR := MTC
DEVICE_MODEL := Wireless Router WR1201 DEVICE_MODEL := Wireless Router WR1201
KERNEL_INITRAMFS := $(KERNEL_DTB) | wr1201-factory-header KERNEL_INITRAMFS := $(KERNEL_DTB) | custom-initramfs-uimage WR1201_8_128
DEVICE_PACKAGES := kmod-sdhci-mt7620 kmod-mt76x2 kmod-usb3 \ DEVICE_PACKAGES := kmod-sdhci-mt7620 kmod-mt76x2 kmod-usb3 \
kmod-usb-ledtrig-usbport wpad-openssl kmod-usb-ledtrig-usbport wpad-openssl
endef endef
@ -586,21 +588,24 @@ define Device/netgear_wndr3700-v5
endef endef
TARGET_DEVICES += netgear_wndr3700-v5 TARGET_DEVICES += netgear_wndr3700-v5
define Device/netis_wf-2881 define Device/netis_wf2881
BLOCKSIZE := 128k BLOCKSIZE := 128k
PAGESIZE := 2048 PAGESIZE := 2048
FILESYSTEMS := squashfs FILESYSTEMS := squashfs
KERNEL_SIZE := 4096k
IMAGE_SIZE := 129280k IMAGE_SIZE := 129280k
KERNEL := $(KERNEL_DTB) | pad-offset $$(BLOCKSIZE) 64 | uImage lzma KERNEL := $(KERNEL_DTB) | pad-offset $$(BLOCKSIZE) 64 | uImage lzma
UBINIZE_OPTS := -E 5 UBINIZE_OPTS := -E 5
IMAGE/sysupgrade.bin := append-kernel | append-ubi | append-metadata | \ IMAGES += factory.bin
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
check-size $$$$(IMAGE_SIZE) check-size $$$$(IMAGE_SIZE)
DEVICE_VENDOR := NETIS DEVICE_VENDOR := NETIS
DEVICE_MODEL := WF-2881 DEVICE_MODEL := WF2881
DEVICE_PACKAGES := kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-openssl DEVICE_PACKAGES := kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-openssl
SUPPORTED_DEVICES += wf-2881 SUPPORTED_DEVICES += wf-2881
endef endef
TARGET_DEVICES += netis_wf-2881 TARGET_DEVICES += netis_wf2881
define Device/phicomm_k2p define Device/phicomm_k2p
IMAGE_SIZE := 15744k IMAGE_SIZE := 15744k

View File

@ -48,7 +48,7 @@ ramips_setup_interfaces()
netgear,r6800|\ netgear,r6800|\
netgear,r6850|\ netgear,r6850|\
netgear,wndr3700-v5|\ netgear,wndr3700-v5|\
netis,wf-2881|\ netis,wf2881|\
wevo,11acnas|\ wevo,11acnas|\
wevo,w2914ns-v2|\ wevo,w2914ns-v2|\
zio,freezio) zio,freezio)
@ -184,7 +184,7 @@ ramips_setup_macs()
elecom,wrc-1900gst|\ elecom,wrc-1900gst|\
elecom,wrc-2533gst|\ elecom,wrc-2533gst|\
lenovo,newifi-d1|\ lenovo,newifi-d1|\
netis,wf-2881|\ netis,wf2881|\
phicomm,k2p|\ phicomm,k2p|\
planex,vr500|\ planex,vr500|\
samknows,whitebox-v8|\ samknows,whitebox-v8|\

View File

@ -50,6 +50,7 @@ platform_do_upgrade() {
netgear,r6350|\ netgear,r6350|\
netgear,r6800|\ netgear,r6800|\
netgear,r6850|\ netgear,r6850|\
netis,wf2881|\
xiaomi,mir3g|\ xiaomi,mir3g|\
xiaomi,mir3p) xiaomi,mir3p)
nand_do_upgrade "$1" nand_do_upgrade "$1"