From 80f89c621f8ab173cd45a0e847066a0045f5d675 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 3 Mar 2021 13:12:28 +0100 Subject: [PATCH 01/38] Added support for BPI-R1 --- build.sh | 2 ++ config-bpi-r1 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 config-bpi-r1 diff --git a/build.sh b/build.sh index 8787570d..d01472fc 100755 --- a/build.sh +++ b/build.sh @@ -64,6 +64,8 @@ elif [ "$OMR_TARGET" = "wrt3200acm" ]; then OMR_REAL_TARGET="arm_cortex-a9_vfpv3" elif [ "$OMR_TARGET" = "wrt32x" ]; then OMR_REAL_TARGET="arm_cortex-a9_vfpv3" +elif [ "$OMR_TARGET" = "bpi-r1" ]; then + OMR_REAL_TARGET="arm_cortex-a8_vfpv3" elif [ "$OMR_TARGET" = "bpi-r2" ]; then OMR_REAL_TARGET="arm_cortex-a7_neon-vfpv4" elif [ "$OMR_TARGET" = "bpi-r64" ]; then diff --git a/config-bpi-r1 b/config-bpi-r1 new file mode 100644 index 00000000..d6873708 --- /dev/null +++ b/config-bpi-r1 @@ -0,0 +1,74 @@ +CONFIG_DEFAULT_TARGET_OPTIMIZATION="-Os -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3-d16" +CONFIG_TARGET_ARCH_PACKAGES="sunxi" +CONFIG_TARGET_BOARD="sunxi" +CONFIG_TARGET_EXT4_BLOCKSIZE=4096 +CONFIG_TARGET_EXT4_BLOCKSIZE_4K=y +CONFIG_TARGET_EXT4_MAXINODE=6000 +CONFIG_TARGET_EXT4_RESERVED_PCT=0 +CONFIG_TARGET_IMAGES_GZIP=y +CONFIG_TARGET_INIT_CMD="/sbin/init" +CONFIG_TARGET_INIT_ENV="" +CONFIG_TARGET_INIT_PATH="/bin:/sbin:/usr/bin:/usr/sbin" +CONFIG_TARGET_INIT_SUPPRESS_STDERR=y +CONFIG_TARGET_OPTIMIZATION="-Os -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3-d16" +CONFIG_TARGET_PREINIT_BROADCAST="192.168.1.255" +CONFIG_TARGET_PREINIT_IFNAME="" +CONFIG_TARGET_PREINIT_IP="192.168.1.1" +CONFIG_TARGET_PREINIT_NETMASK="255.255.255.0" +CONFIG_TARGET_PREINIT_SUPPRESS_STDERR=y +CONFIG_TARGET_PREINIT_TIMEOUT=2 +CONFIG_TARGET_ROOTFS_DIR="" +CONFIG_TARGET_ROOTFS_EXT4FS=y +CONFIG_TARGET_ROOTFS_INCLUDE_FIT=y +CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE=y +CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE=y +CONFIG_TARGET_ROOTFS_PARTSIZE=48 +CONFIG_TARGET_SUFFIX="uclibcgnueabi" +CONFIG_TARGET_sunxi_BPI-R1=y +CONFIG_TARGET_sunxi=y +CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP=y +CONFIG_TARGET_UBIFS_JOURNAL_SIZE="" +CONFIG_PACKAGE_kmod-ata-sunxi=y +CONFIG_PACKAGE_kmod-cfg80211=y +CONFIG_PACKAGE_kmod-crypto-aes=y +CONFIG_PACKAGE_kmod-crypto-arc4=y +CONFIG_PACKAGE_kmod-crypto-core=y +CONFIG_PACKAGE_kmod-eeprom-sunxi=y +CONFIG_PACKAGE_kmod-ip6tables=y +CONFIG_PACKAGE_kmod-ipt-conntrack=y +CONFIG_PACKAGE_kmod-ipt-core=y +CONFIG_PACKAGE_kmod-ipt-nat=y +CONFIG_PACKAGE_kmod-ipv6=y +CONFIG_PACKAGE_kmod-lib-crc-ccitt=y +CONFIG_PACKAGE_kmod-mac80211=y +CONFIG_PACKAGE_kmod-nf-conntrack6=y +CONFIG_PACKAGE_kmod-nf-conntrack=y +CONFIG_PACKAGE_kmod-nf-ipt6=y +CONFIG_PACKAGE_kmod-nf-ipt=y +CONFIG_PACKAGE_kmod-nf-nathelper=y +CONFIG_PACKAGE_kmod-nf-nat=y +CONFIG_PACKAGE_kmod-nls-base=y +CONFIG_PACKAGE_kmod-pppoe=y +CONFIG_PACKAGE_kmod-pppox=y +CONFIG_PACKAGE_kmod-ppp=y +CONFIG_PACKAGE_kmod-rtl8192c-common=y +CONFIG_PACKAGE_kmod-rtl8192cu=y +CONFIG_PACKAGE_kmod-rtlwifi-usb=y +CONFIG_PACKAGE_kmod-rtlwifi=y +CONFIG_PACKAGE_kmod-scsi-core=y +CONFIG_PACKAGE_kmod-slhc=y +CONFIG_PACKAGE_kmod-usb-core=y +CONFIG_PACKAGE_kmod-wdt-sunxi=y +CONFIG_EXTERNAL_KERNEL_TREE="" +CONFIG_KERNEL_CC_STACKPROTECTOR_NONE=y +CONFIG_KERNEL_COREDUMP=y +CONFIG_KERNEL_DEBUG_FS=y +CONFIG_KERNEL_DEBUG_INFO=y +CONFIG_KERNEL_DEBUG_KERNEL=y +CONFIG_KERNEL_ELF_CORE=y +CONFIG_KERNEL_GIT_CLONE_URI="" +CONFIG_KERNEL_KALLSYMS=y +CONFIG_KERNEL_MAGIC_SYSRQ=y +CONFIG_KERNEL_PRINTK_TIME=y +CONFIG_KERNEL_PRINTK=y +CONFIG_KERNEL_SWAP=y From c3e4c76a03851822c77503af4f492bb89fb2c0cb Mon Sep 17 00:00:00 2001 From: Olli Date: Wed, 3 Mar 2021 21:43:20 +0100 Subject: [PATCH 02/38] Set target to lamobo r1, arm cortex a7 neon-vfpv4 --- build.sh | 2 +- config-bpi-r1 | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index d01472fc..d847160e 100755 --- a/build.sh +++ b/build.sh @@ -65,7 +65,7 @@ elif [ "$OMR_TARGET" = "wrt3200acm" ]; then elif [ "$OMR_TARGET" = "wrt32x" ]; then OMR_REAL_TARGET="arm_cortex-a9_vfpv3" elif [ "$OMR_TARGET" = "bpi-r1" ]; then - OMR_REAL_TARGET="arm_cortex-a8_vfpv3" + OMR_REAL_TARGET="arm_cortex-a7_neon-vfpv4" elif [ "$OMR_TARGET" = "bpi-r2" ]; then OMR_REAL_TARGET="arm_cortex-a7_neon-vfpv4" elif [ "$OMR_TARGET" = "bpi-r64" ]; then diff --git a/config-bpi-r1 b/config-bpi-r1 index d6873708..b0b2cb62 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -1,6 +1,16 @@ CONFIG_DEFAULT_TARGET_OPTIMIZATION="-Os -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3-d16" +CONFIG_TARGET_OPTIMIZATION="-Os -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3-d16" CONFIG_TARGET_ARCH_PACKAGES="sunxi" CONFIG_TARGET_BOARD="sunxi" +CONFIG_TARGET_sunxi_BPI-R1=y +CONFIG_TARGET_sunxi=y +CONFIG_TARGET_sunxi_cortexa7=y +CONFIG_TARGET_sunxi_cortexa7_DEVICE_lamobo_lamobo-r1=y +CONFIG_TARGET_SUBTARGET="cortexa7" +CONFIG_TARGET_PROFILE="DEVICE_lamobo_lamobo-r1" +CONFIG_TARGET_ARCH_PACKAGES="arm_cortex-a7_neon-vfpv4" +CONFIG_CPU_TYPE="cortex-a7+neon-vfpv4" +CONFIG_PACKAGE_u-boot-Lamobo_R1=y CONFIG_TARGET_EXT4_BLOCKSIZE=4096 CONFIG_TARGET_EXT4_BLOCKSIZE_4K=y CONFIG_TARGET_EXT4_MAXINODE=6000 @@ -10,7 +20,6 @@ CONFIG_TARGET_INIT_CMD="/sbin/init" CONFIG_TARGET_INIT_ENV="" CONFIG_TARGET_INIT_PATH="/bin:/sbin:/usr/bin:/usr/sbin" CONFIG_TARGET_INIT_SUPPRESS_STDERR=y -CONFIG_TARGET_OPTIMIZATION="-Os -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3-d16" CONFIG_TARGET_PREINIT_BROADCAST="192.168.1.255" CONFIG_TARGET_PREINIT_IFNAME="" CONFIG_TARGET_PREINIT_IP="192.168.1.1" @@ -24,8 +33,6 @@ CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE=y CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE=y CONFIG_TARGET_ROOTFS_PARTSIZE=48 CONFIG_TARGET_SUFFIX="uclibcgnueabi" -CONFIG_TARGET_sunxi_BPI-R1=y -CONFIG_TARGET_sunxi=y CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP=y CONFIG_TARGET_UBIFS_JOURNAL_SIZE="" CONFIG_PACKAGE_kmod-ata-sunxi=y From ba2370a58e225446e81df0f13a9944e6662b550b Mon Sep 17 00:00:00 2001 From: Olli Date: Thu, 4 Mar 2021 13:49:52 +0100 Subject: [PATCH 03/38] Fixed configuration after boot fail --- config-bpi-r1 | 85 +++++++++++++-------------------------------------- 1 file changed, 22 insertions(+), 63 deletions(-) diff --git a/config-bpi-r1 b/config-bpi-r1 index b0b2cb62..7840b3b0 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -1,5 +1,3 @@ -CONFIG_DEFAULT_TARGET_OPTIMIZATION="-Os -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3-d16" -CONFIG_TARGET_OPTIMIZATION="-Os -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3-d16" CONFIG_TARGET_ARCH_PACKAGES="sunxi" CONFIG_TARGET_BOARD="sunxi" CONFIG_TARGET_sunxi_BPI-R1=y @@ -8,56 +6,21 @@ CONFIG_TARGET_sunxi_cortexa7=y CONFIG_TARGET_sunxi_cortexa7_DEVICE_lamobo_lamobo-r1=y CONFIG_TARGET_SUBTARGET="cortexa7" CONFIG_TARGET_PROFILE="DEVICE_lamobo_lamobo-r1" -CONFIG_TARGET_ARCH_PACKAGES="arm_cortex-a7_neon-vfpv4" -CONFIG_CPU_TYPE="cortex-a7+neon-vfpv4" -CONFIG_PACKAGE_u-boot-Lamobo_R1=y -CONFIG_TARGET_EXT4_BLOCKSIZE=4096 -CONFIG_TARGET_EXT4_BLOCKSIZE_4K=y -CONFIG_TARGET_EXT4_MAXINODE=6000 -CONFIG_TARGET_EXT4_RESERVED_PCT=0 -CONFIG_TARGET_IMAGES_GZIP=y -CONFIG_TARGET_INIT_CMD="/sbin/init" -CONFIG_TARGET_INIT_ENV="" -CONFIG_TARGET_INIT_PATH="/bin:/sbin:/usr/bin:/usr/sbin" -CONFIG_TARGET_INIT_SUPPRESS_STDERR=y -CONFIG_TARGET_PREINIT_BROADCAST="192.168.1.255" -CONFIG_TARGET_PREINIT_IFNAME="" -CONFIG_TARGET_PREINIT_IP="192.168.1.1" -CONFIG_TARGET_PREINIT_NETMASK="255.255.255.0" -CONFIG_TARGET_PREINIT_SUPPRESS_STDERR=y -CONFIG_TARGET_PREINIT_TIMEOUT=2 -CONFIG_TARGET_ROOTFS_DIR="" CONFIG_TARGET_ROOTFS_EXT4FS=y -CONFIG_TARGET_ROOTFS_INCLUDE_FIT=y -CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE=y -CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE=y -CONFIG_TARGET_ROOTFS_PARTSIZE=48 -CONFIG_TARGET_SUFFIX="uclibcgnueabi" -CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP=y -CONFIG_TARGET_UBIFS_JOURNAL_SIZE="" +CONFIG_TARGET_ROOTFS_SQUASHFS=y +CONFIG_PACKAGE_u-boot-Lamobo_R1=y +CONFIG_PACKAGE_uboot-envtools=y +CONFIG_PACKAGE_attr=y +CONFIG_PACKAGE_f2fs-tools=y +CONFIG_PACKAGE_f2fsck=y +CONFIG_PACKAGE_mkf2fs=y +CONFIG_PACKAGE_swconfig=y +CONFIG_PACKAGE_kmod-swconfig=y CONFIG_PACKAGE_kmod-ata-sunxi=y -CONFIG_PACKAGE_kmod-cfg80211=y -CONFIG_PACKAGE_kmod-crypto-aes=y -CONFIG_PACKAGE_kmod-crypto-arc4=y -CONFIG_PACKAGE_kmod-crypto-core=y -CONFIG_PACKAGE_kmod-eeprom-sunxi=y -CONFIG_PACKAGE_kmod-ip6tables=y -CONFIG_PACKAGE_kmod-ipt-conntrack=y -CONFIG_PACKAGE_kmod-ipt-core=y -CONFIG_PACKAGE_kmod-ipt-nat=y -CONFIG_PACKAGE_kmod-ipv6=y -CONFIG_PACKAGE_kmod-lib-crc-ccitt=y -CONFIG_PACKAGE_kmod-mac80211=y -CONFIG_PACKAGE_kmod-nf-conntrack6=y -CONFIG_PACKAGE_kmod-nf-conntrack=y -CONFIG_PACKAGE_kmod-nf-ipt6=y -CONFIG_PACKAGE_kmod-nf-ipt=y -CONFIG_PACKAGE_kmod-nf-nathelper=y -CONFIG_PACKAGE_kmod-nf-nat=y -CONFIG_PACKAGE_kmod-nls-base=y -CONFIG_PACKAGE_kmod-pppoe=y -CONFIG_PACKAGE_kmod-pppox=y -CONFIG_PACKAGE_kmod-ppp=y +CONFIG_PACKAGE_kmod-rtc-sunxi=m +CONFIG_PACKAGE_kmod-sunxi-ir=y +CONFIG_PACKAGE_kmod-sound-soc-sunxi=y +CONFIG_PACKAGE_kmod-sound-soc-sunxi-spdif=y CONFIG_PACKAGE_kmod-rtl8192c-common=y CONFIG_PACKAGE_kmod-rtl8192cu=y CONFIG_PACKAGE_kmod-rtlwifi-usb=y @@ -66,16 +29,12 @@ CONFIG_PACKAGE_kmod-scsi-core=y CONFIG_PACKAGE_kmod-slhc=y CONFIG_PACKAGE_kmod-usb-core=y CONFIG_PACKAGE_kmod-wdt-sunxi=y -CONFIG_EXTERNAL_KERNEL_TREE="" -CONFIG_KERNEL_CC_STACKPROTECTOR_NONE=y -CONFIG_KERNEL_COREDUMP=y -CONFIG_KERNEL_DEBUG_FS=y -CONFIG_KERNEL_DEBUG_INFO=y -CONFIG_KERNEL_DEBUG_KERNEL=y -CONFIG_KERNEL_ELF_CORE=y -CONFIG_KERNEL_GIT_CLONE_URI="" -CONFIG_KERNEL_KALLSYMS=y -CONFIG_KERNEL_MAGIC_SYSRQ=y -CONFIG_KERNEL_PRINTK_TIME=y -CONFIG_KERNEL_PRINTK=y -CONFIG_KERNEL_SWAP=y +CONFIG_PACKAGE_kmod-leds-gpio=m +CONFIG_PACKAGE_kmod-ledtrig-activity=m +CONFIG_PACKAGE_kmod-ledtrig-gpio=m +CONFIG_PACKAGE_kmod-ledtrig-oneshot=m +CONFIG_PACKAGE_kmod-ledtrig-transient=m +CONFIG_PACKAGE_kmod-ipt-led=m +CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=m +CONFIG_PACKAGE_wpad-basic-wolfssl=y +CONFIG_KERNEL_ARM_MODULE_PLTS=y From 6754c41eab3468cb3197a3d89778f9b39bd83924 Mon Sep 17 00:00:00 2001 From: Olli Date: Thu, 4 Mar 2021 21:09:51 +0100 Subject: [PATCH 04/38] Removed mc from config, due to compilation errors --- config-bpi-r1 | 1 + 1 file changed, 1 insertion(+) diff --git a/config-bpi-r1 b/config-bpi-r1 index 7840b3b0..62e9eca5 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -15,6 +15,7 @@ CONFIG_PACKAGE_f2fs-tools=y CONFIG_PACKAGE_f2fsck=y CONFIG_PACKAGE_mkf2fs=y CONFIG_PACKAGE_swconfig=y +# CONFIG_PACKAGE_mc is not set CONFIG_PACKAGE_kmod-swconfig=y CONFIG_PACKAGE_kmod-ata-sunxi=y CONFIG_PACKAGE_kmod-rtc-sunxi=m From 9bdeb2e579a44aded65f570d855c5c78606e28cb Mon Sep 17 00:00:00 2001 From: Olli Date: Thu, 4 Mar 2021 22:46:16 +0100 Subject: [PATCH 05/38] Added required modules for lamobo r1 --- config-bpi-r1 | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/config-bpi-r1 b/config-bpi-r1 index 62e9eca5..faa8b1cb 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -14,28 +14,44 @@ CONFIG_PACKAGE_attr=y CONFIG_PACKAGE_f2fs-tools=y CONFIG_PACKAGE_f2fsck=y CONFIG_PACKAGE_mkf2fs=y -CONFIG_PACKAGE_swconfig=y # CONFIG_PACKAGE_mc is not set -CONFIG_PACKAGE_kmod-swconfig=y +CONFIG_PACKAGE_wpad-basic-wolfssl=y +CONFIG_PACKAGE_rtl8188eu-firmware=y +CONFIG_PACKAGE_ath9k-htc-firmware=y +CONFIG_PACKAGE_mt7601u-firmware=y +CONFIG_PACKAGE_rt2800-usb-firmware=y +CONFIG_PACKAGE_rtl8192cu-firmware=y +CONFIG_PACKAGE_rtl8192su-firmware=y +CONFIG_PACKAGE_kmod-switch-bcm53xx=y +CONFIG_PACKAGE_kmod-switch-bcm53xx-mdio=y +CONFIG_PACKAGE_swconfig=y +CONFIG_PACAKGE_kmod-swconfig=y CONFIG_PACKAGE_kmod-ata-sunxi=y -CONFIG_PACKAGE_kmod-rtc-sunxi=m -CONFIG_PACKAGE_kmod-sunxi-ir=y -CONFIG_PACKAGE_kmod-sound-soc-sunxi=y -CONFIG_PACKAGE_kmod-sound-soc-sunxi-spdif=y +CONFIG_PACKAGE_kmod-rtl8192cu=y +CONFIG_PACKAGE_kmod-ath9k-common=y +CONFIG_PACKAGE_kmod-ath9k-htc=y +CONFIG_PACKAGE_kmod-usb-net-rtl8150=y +CONFIG_PACKAGE_kmod-usb-net-rtl8152=y +CONFIG_PACKAGE_kmod-net-rtl8192su=y +CONFIG_PACKAGE_kmod-rtl8187=y CONFIG_PACKAGE_kmod-rtl8192c-common=y CONFIG_PACKAGE_kmod-rtl8192cu=y +CONFIG_PACKAGE_kmod-rtl8xxxu=y +CONFIG_PACKAGE_kmod-sunxi-ir=y +CONFIG_PACKAGE_kmod-sound-soc-sunxi=y CONFIG_PACKAGE_kmod-rtlwifi-usb=y CONFIG_PACKAGE_kmod-rtlwifi=y CONFIG_PACKAGE_kmod-scsi-core=y CONFIG_PACKAGE_kmod-slhc=y CONFIG_PACKAGE_kmod-usb-core=y CONFIG_PACKAGE_kmod-wdt-sunxi=y -CONFIG_PACKAGE_kmod-leds-gpio=m +CONFIG_PACKAGE_kmod-leds-gpio=y CONFIG_PACKAGE_kmod-ledtrig-activity=m -CONFIG_PACKAGE_kmod-ledtrig-gpio=m +CONFIG_PACKAGE_kmod-ledtrig-gpio=y CONFIG_PACKAGE_kmod-ledtrig-oneshot=m CONFIG_PACKAGE_kmod-ledtrig-transient=m CONFIG_PACKAGE_kmod-ipt-led=m CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=m -CONFIG_PACKAGE_wpad-basic-wolfssl=y +CONFIG_PACKAGE_kmod-can-bcm=y CONFIG_KERNEL_ARM_MODULE_PLTS=y +CONFIG_DEFAULT_kmod-sunxi-gmac=y From 6d64917973171db431587df5ff547c2fac33ca76 Mon Sep 17 00:00:00 2001 From: Olli Date: Thu, 4 Mar 2021 23:47:15 +0100 Subject: [PATCH 06/38] Added mc remove patch --- build.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.sh b/build.sh index d847160e..e45e2a8d 100755 --- a/build.sh +++ b/build.sh @@ -202,6 +202,15 @@ if [ "$OMR_PACKAGES" = "mini" ]; then echo "CONFIG_PACKAGE_${OMR_DIST}-mini=y" >> "$OMR_TARGET/source/.config" fi +if [ "$OMR_TARGET" = "bpi-r1" ]; then + # We disable mc for now, because it leads to unknown compile errors on bpi-r1 target + sed -i "s/CONFIG_PACKAGE_mc=y/# CONFIG_PACKAGE_mc is not set/" "$OMR_TARGET/source/.config" + sed -i "s/CONFIG_MC_EDITOR=y/# CONFIG_MC_EDITOR is not set/" "$OMR_TARGET/source/.config" + sed -i "s/CONFIG_MC_SUBSHELL=y/# CONFIG_MC_SUBSHELL is not set/" "$OMR_TARGET/source/.config" + sed -i "s/CONFIG_MC_CHARSET=y/# CONFIG_MC_CHARSET is not set/" "$OMR_TARGET/source/.config" + sed -i "s/CONFIG_MC_VFS=y/# CONFIG_MC_VFS is not set/" "$OMR_TARGET/source/.config" +fi + cd "$OMR_TARGET/source" #if [ "$OMR_UEFI" = "yes" ] && [ "$OMR_TARGET" = "x86_64" ]; then From 98b91532800952ed06f8cdaf44d39645c1b0b575 Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 00:58:24 +0100 Subject: [PATCH 07/38] Fixed missing config items --- build.sh | 7 +++++++ config-bpi-r1 | 9 +-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index e45e2a8d..c9a2bc69 100755 --- a/build.sh +++ b/build.sh @@ -209,6 +209,13 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then sed -i "s/CONFIG_MC_SUBSHELL=y/# CONFIG_MC_SUBSHELL is not set/" "$OMR_TARGET/source/.config" sed -i "s/CONFIG_MC_CHARSET=y/# CONFIG_MC_CHARSET is not set/" "$OMR_TARGET/source/.config" sed -i "s/CONFIG_MC_VFS=y/# CONFIG_MC_VFS is not set/" "$OMR_TARGET/source/.config" + + # Switch to wpad-wolfssl + sed -i "s/CONFIG_PACKAGE_wpad-basic=y/# CONFIG_PACKAGE_wpad-basic is not set/" "$OMR_TARGET/source/.config" + sed -i "s/CONFIG_PACKAGE_wpad-basic-wolfssl=m/CONFIG_PACKAGE_wpad-basic-wolfssl=y/" "$OMR_TARGET/source/.config" + + # Enable sound soc sunxi kernel module + sed -i "s/CONFIG_PACKAGE_kmod-sound-soc-sunxi=m/CONFIG_PACKAGE_kmod-sound-soc-sunxi=y/" "$OMR_TARGET/source/.config" fi cd "$OMR_TARGET/source" diff --git a/config-bpi-r1 b/config-bpi-r1 index faa8b1cb..f81bcaf8 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -1,6 +1,4 @@ -CONFIG_TARGET_ARCH_PACKAGES="sunxi" CONFIG_TARGET_BOARD="sunxi" -CONFIG_TARGET_sunxi_BPI-R1=y CONFIG_TARGET_sunxi=y CONFIG_TARGET_sunxi_cortexa7=y CONFIG_TARGET_sunxi_cortexa7_DEVICE_lamobo_lamobo-r1=y @@ -14,8 +12,6 @@ CONFIG_PACKAGE_attr=y CONFIG_PACKAGE_f2fs-tools=y CONFIG_PACKAGE_f2fsck=y CONFIG_PACKAGE_mkf2fs=y -# CONFIG_PACKAGE_mc is not set -CONFIG_PACKAGE_wpad-basic-wolfssl=y CONFIG_PACKAGE_rtl8188eu-firmware=y CONFIG_PACKAGE_ath9k-htc-firmware=y CONFIG_PACKAGE_mt7601u-firmware=y @@ -25,7 +21,7 @@ CONFIG_PACKAGE_rtl8192su-firmware=y CONFIG_PACKAGE_kmod-switch-bcm53xx=y CONFIG_PACKAGE_kmod-switch-bcm53xx-mdio=y CONFIG_PACKAGE_swconfig=y -CONFIG_PACAKGE_kmod-swconfig=y +CONFIG_PACKAGE_kmod-swconfig=y CONFIG_PACKAGE_kmod-ata-sunxi=y CONFIG_PACKAGE_kmod-rtl8192cu=y CONFIG_PACKAGE_kmod-ath9k-common=y @@ -44,7 +40,6 @@ CONFIG_PACKAGE_kmod-rtlwifi=y CONFIG_PACKAGE_kmod-scsi-core=y CONFIG_PACKAGE_kmod-slhc=y CONFIG_PACKAGE_kmod-usb-core=y -CONFIG_PACKAGE_kmod-wdt-sunxi=y CONFIG_PACKAGE_kmod-leds-gpio=y CONFIG_PACKAGE_kmod-ledtrig-activity=m CONFIG_PACKAGE_kmod-ledtrig-gpio=y @@ -52,6 +47,4 @@ CONFIG_PACKAGE_kmod-ledtrig-oneshot=m CONFIG_PACKAGE_kmod-ledtrig-transient=m CONFIG_PACKAGE_kmod-ipt-led=m CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=m -CONFIG_PACKAGE_kmod-can-bcm=y CONFIG_KERNEL_ARM_MODULE_PLTS=y -CONFIG_DEFAULT_kmod-sunxi-gmac=y From acc528016ab6402056d960bd92830cd6e65ab00d Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 02:51:23 +0100 Subject: [PATCH 08/38] Integrate b53 to make switch work --- build.sh | 30 +++++++++++++++--------------- config-bpi-r1 | 7 ++++--- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/build.sh b/build.sh index c9a2bc69..7af27604 100755 --- a/build.sh +++ b/build.sh @@ -202,21 +202,21 @@ if [ "$OMR_PACKAGES" = "mini" ]; then echo "CONFIG_PACKAGE_${OMR_DIST}-mini=y" >> "$OMR_TARGET/source/.config" fi -if [ "$OMR_TARGET" = "bpi-r1" ]; then - # We disable mc for now, because it leads to unknown compile errors on bpi-r1 target - sed -i "s/CONFIG_PACKAGE_mc=y/# CONFIG_PACKAGE_mc is not set/" "$OMR_TARGET/source/.config" - sed -i "s/CONFIG_MC_EDITOR=y/# CONFIG_MC_EDITOR is not set/" "$OMR_TARGET/source/.config" - sed -i "s/CONFIG_MC_SUBSHELL=y/# CONFIG_MC_SUBSHELL is not set/" "$OMR_TARGET/source/.config" - sed -i "s/CONFIG_MC_CHARSET=y/# CONFIG_MC_CHARSET is not set/" "$OMR_TARGET/source/.config" - sed -i "s/CONFIG_MC_VFS=y/# CONFIG_MC_VFS is not set/" "$OMR_TARGET/source/.config" - - # Switch to wpad-wolfssl - sed -i "s/CONFIG_PACKAGE_wpad-basic=y/# CONFIG_PACKAGE_wpad-basic is not set/" "$OMR_TARGET/source/.config" - sed -i "s/CONFIG_PACKAGE_wpad-basic-wolfssl=m/CONFIG_PACKAGE_wpad-basic-wolfssl=y/" "$OMR_TARGET/source/.config" - - # Enable sound soc sunxi kernel module - sed -i "s/CONFIG_PACKAGE_kmod-sound-soc-sunxi=m/CONFIG_PACKAGE_kmod-sound-soc-sunxi=y/" "$OMR_TARGET/source/.config" -fi +#if [ "$OMR_TARGET" = "bpi-r1" ]; then +# # We disable mc for now, because it leads to unknown compile errors on bpi-r1 target +# sed -i "s/CONFIG_PACKAGE_mc=y/# CONFIG_PACKAGE_mc is not set/" "$OMR_TARGET/source/.config" +# sed -i "s/CONFIG_MC_EDITOR=y/# CONFIG_MC_EDITOR is not set/" "$OMR_TARGET/source/.config" +# sed -i "s/CONFIG_MC_SUBSHELL=y/# CONFIG_MC_SUBSHELL is not set/" "$OMR_TARGET/source/.config" +# sed -i "s/CONFIG_MC_CHARSET=y/# CONFIG_MC_CHARSET is not set/" "$OMR_TARGET/source/.config" +# sed -i "s/CONFIG_MC_VFS=y/# CONFIG_MC_VFS is not set/" "$OMR_TARGET/source/.config" +# +# # Switch to wpad-wolfssl +# sed -i "s/CONFIG_PACKAGE_wpad-basic=y/# CONFIG_PACKAGE_wpad-basic is not set/" "$OMR_TARGET/source/.config" +# sed -i "s/CONFIG_PACKAGE_wpad-basic-wolfssl=m/CONFIG_PACKAGE_wpad-basic-wolfssl=y/" "$OMR_TARGET/source/.config" +# +# # Enable sound soc sunxi kernel module +# sed -i "s/CONFIG_PACKAGE_kmod-sound-soc-sunxi=m/CONFIG_PACKAGE_kmod-sound-soc-sunxi=y/" "$OMR_TARGET/source/.config" +#fi cd "$OMR_TARGET/source" diff --git a/config-bpi-r1 b/config-bpi-r1 index f81bcaf8..63a7c64a 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -22,14 +22,15 @@ CONFIG_PACKAGE_kmod-switch-bcm53xx=y CONFIG_PACKAGE_kmod-switch-bcm53xx-mdio=y CONFIG_PACKAGE_swconfig=y CONFIG_PACKAGE_kmod-swconfig=y +CONFIG_PACKAGE_kmod-b53=y +CONFIG_PACKAGE_kmod-swconfig-b53=y +CONFIG_PACKAGE_kmod-swconfig-b53-phy-driver=y +CONFIG_PACKAGE_kmod-swconfig-b53-phy-fixup=y CONFIG_PACKAGE_kmod-ata-sunxi=y CONFIG_PACKAGE_kmod-rtl8192cu=y CONFIG_PACKAGE_kmod-ath9k-common=y CONFIG_PACKAGE_kmod-ath9k-htc=y -CONFIG_PACKAGE_kmod-usb-net-rtl8150=y -CONFIG_PACKAGE_kmod-usb-net-rtl8152=y CONFIG_PACKAGE_kmod-net-rtl8192su=y -CONFIG_PACKAGE_kmod-rtl8187=y CONFIG_PACKAGE_kmod-rtl8192c-common=y CONFIG_PACKAGE_kmod-rtl8192cu=y CONFIG_PACKAGE_kmod-rtl8xxxu=y From d19f706b752721d8d63a7f8c7fc68d201193fe6a Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 02:53:57 +0100 Subject: [PATCH 09/38] Added b53 kmod default --- config-bpi-r1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config-bpi-r1 b/config-bpi-r1 index 63a7c64a..5ce38da2 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -21,8 +21,8 @@ CONFIG_PACKAGE_rtl8192su-firmware=y CONFIG_PACKAGE_kmod-switch-bcm53xx=y CONFIG_PACKAGE_kmod-switch-bcm53xx-mdio=y CONFIG_PACKAGE_swconfig=y -CONFIG_PACKAGE_kmod-swconfig=y CONFIG_PACKAGE_kmod-b53=y +CONFIG_PACKAGE_kmod-swconfig=y CONFIG_PACKAGE_kmod-swconfig-b53=y CONFIG_PACKAGE_kmod-swconfig-b53-phy-driver=y CONFIG_PACKAGE_kmod-swconfig-b53-phy-fixup=y @@ -49,3 +49,4 @@ CONFIG_PACKAGE_kmod-ledtrig-transient=m CONFIG_PACKAGE_kmod-ipt-led=m CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=m CONFIG_KERNEL_ARM_MODULE_PLTS=y +CONFIG_DEFAULT_kmod-b53=y From 883957605771f39d88bd07ae857967ac75cf9708 Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 11:42:46 +0100 Subject: [PATCH 10/38] Added support for DSA --- config-bpi-r1 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/config-bpi-r1 b/config-bpi-r1 index 5ce38da2..11462b54 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -22,10 +22,19 @@ CONFIG_PACKAGE_kmod-switch-bcm53xx=y CONFIG_PACKAGE_kmod-switch-bcm53xx-mdio=y CONFIG_PACKAGE_swconfig=y CONFIG_PACKAGE_kmod-b53=y +CONFIG_PACKAGE_kmod-b53-mdio-driver=y +CONFIG_PACKAGE_kmod-net-dsa=y +CONFIG_PACKAGE_kmod-net-dsa-tag-8021q=y +CONFIG_PACKAGE_kmod-net-dsa-tag-brcm=y +CONFIG_PACKAGE_kmod-net-dsa-tag-prepend=y +CONFIG_PACKAGE_kmod-mdio-bus-mux-multiplexer=y +CONFIG_PACKAGE_kmod-led-trigger-phy=y CONFIG_PACKAGE_kmod-swconfig=y +CONFIG_PACKAGE_kmod-swconfig-leds=y CONFIG_PACKAGE_kmod-swconfig-b53=y CONFIG_PACKAGE_kmod-swconfig-b53-phy-driver=y CONFIG_PACKAGE_kmod-swconfig-b53-phy-fixup=y +CONFIG_PACKAGE_kmod-ste10xp=y CONFIG_PACKAGE_kmod-ata-sunxi=y CONFIG_PACKAGE_kmod-rtl8192cu=y CONFIG_PACKAGE_kmod-ath9k-common=y @@ -42,11 +51,10 @@ CONFIG_PACKAGE_kmod-scsi-core=y CONFIG_PACKAGE_kmod-slhc=y CONFIG_PACKAGE_kmod-usb-core=y CONFIG_PACKAGE_kmod-leds-gpio=y -CONFIG_PACKAGE_kmod-ledtrig-activity=m +CONFIG_PACKAGE_kmod-ledtrig-activity=y CONFIG_PACKAGE_kmod-ledtrig-gpio=y -CONFIG_PACKAGE_kmod-ledtrig-oneshot=m -CONFIG_PACKAGE_kmod-ledtrig-transient=m -CONFIG_PACKAGE_kmod-ipt-led=m -CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=m +CONFIG_PACKAGE_kmod-ledtrig-oneshot=y +CONFIG_PACKAGE_kmod-ledtrig-transient=y +CONFIG_PACKAGE_kmod-ipt-led=y +CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=y CONFIG_KERNEL_ARM_MODULE_PLTS=y -CONFIG_DEFAULT_kmod-b53=y From 3781228ee032e353b5e791cb3aac67b8312eadcc Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 12:53:26 +0100 Subject: [PATCH 11/38] Removed patches and changed kernel parameters --- build.sh | 57 +++++++++++++++++++++++++++++++++++++-------------- config-bpi-r1 | 36 +------------------------------- 2 files changed, 43 insertions(+), 50 deletions(-) diff --git a/build.sh b/build.sh index 7af27604..b108129d 100755 --- a/build.sh +++ b/build.sh @@ -202,21 +202,48 @@ if [ "$OMR_PACKAGES" = "mini" ]; then echo "CONFIG_PACKAGE_${OMR_DIST}-mini=y" >> "$OMR_TARGET/source/.config" fi -#if [ "$OMR_TARGET" = "bpi-r1" ]; then -# # We disable mc for now, because it leads to unknown compile errors on bpi-r1 target -# sed -i "s/CONFIG_PACKAGE_mc=y/# CONFIG_PACKAGE_mc is not set/" "$OMR_TARGET/source/.config" -# sed -i "s/CONFIG_MC_EDITOR=y/# CONFIG_MC_EDITOR is not set/" "$OMR_TARGET/source/.config" -# sed -i "s/CONFIG_MC_SUBSHELL=y/# CONFIG_MC_SUBSHELL is not set/" "$OMR_TARGET/source/.config" -# sed -i "s/CONFIG_MC_CHARSET=y/# CONFIG_MC_CHARSET is not set/" "$OMR_TARGET/source/.config" -# sed -i "s/CONFIG_MC_VFS=y/# CONFIG_MC_VFS is not set/" "$OMR_TARGET/source/.config" -# -# # Switch to wpad-wolfssl -# sed -i "s/CONFIG_PACKAGE_wpad-basic=y/# CONFIG_PACKAGE_wpad-basic is not set/" "$OMR_TARGET/source/.config" -# sed -i "s/CONFIG_PACKAGE_wpad-basic-wolfssl=m/CONFIG_PACKAGE_wpad-basic-wolfssl=y/" "$OMR_TARGET/source/.config" -# -# # Enable sound soc sunxi kernel module -# sed -i "s/CONFIG_PACKAGE_kmod-sound-soc-sunxi=m/CONFIG_PACKAGE_kmod-sound-soc-sunxi=y/" "$OMR_TARGET/source/.config" -#fi +if [ "$OMR_TARGET" = "bpi-r1" -a "$OMR_OPENWRT" = "master" ]; then + # We disable mc in master, because it leads to unknown compilation errors on bpi-r1 target + # No time to check this, now, cause i am focused on make this target work + # Maybe someone can do this later + echo -n "Disabling error causing midnight commander (mc) package..." + sed -i "s/CONFIG_PACKAGE_mc=y/# CONFIG_PACKAGE_mc is not set/" "$OMR_TARGET/source/.config" + sed -i "s/CONFIG_MC_EDITOR=y/# CONFIG_MC_EDITOR is not set/" "$OMR_TARGET/source/.config" + sed -i "s/CONFIG_MC_SUBSHELL=y/# CONFIG_MC_SUBSHELL is not set/" "$OMR_TARGET/source/.config" + sed -i "s/CONFIG_MC_CHARSET=y/# CONFIG_MC_CHARSET is not set/" "$OMR_TARGET/source/.config" + sed -i "s/CONFIG_MC_VFS=y/# CONFIG_MC_VFS is not set/" "$OMR_TARGET/source/.config" + echo "done" + + # 2021-03-05 Oliver Welter +fi + +if [ "$OMR_TARGET" = "bpi-r1" ]; then + # Remove the 310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th patch + echo -n "Removing unwanted patches from kernel 5.4..." + rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-5.4/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 + echo "done" + + # Add support for distributed switch architecture + echo -n "Adding DSA support to kernel 5.4..." + for i in NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_PREPEND; do + echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + done + echo "done" + + # Add support for MDIO bus multiplexer + echo -n "Adding support for MDIO bus multiplexer to kernel 5.4..." + echo "CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + echo "done" + + # Add led support + echo -n "Adding LED support to kernel 5.4..." + for i in SWCONFIG_LEDS LED_TRIGGER_PHY LEDS_GPIO LEDTRIG_ACTIVITY LEDTRIG_GPIO LEDTRIG_ONESHOT LEDTRIG_TRANSIENT IPT_LED USB_LEDTRIG_USBSUPPORT; do + echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + done + echo "done" + + # 2021-03-05 Oliver Welter +fi cd "$OMR_TARGET/source" diff --git a/config-bpi-r1 b/config-bpi-r1 index 11462b54..7928ef1e 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -12,49 +12,15 @@ CONFIG_PACKAGE_attr=y CONFIG_PACKAGE_f2fs-tools=y CONFIG_PACKAGE_f2fsck=y CONFIG_PACKAGE_mkf2fs=y -CONFIG_PACKAGE_rtl8188eu-firmware=y +CONFIG_PACKAGE_swconfig=y CONFIG_PACKAGE_ath9k-htc-firmware=y -CONFIG_PACKAGE_mt7601u-firmware=y -CONFIG_PACKAGE_rt2800-usb-firmware=y -CONFIG_PACKAGE_rtl8192cu-firmware=y -CONFIG_PACKAGE_rtl8192su-firmware=y CONFIG_PACKAGE_kmod-switch-bcm53xx=y CONFIG_PACKAGE_kmod-switch-bcm53xx-mdio=y -CONFIG_PACKAGE_swconfig=y -CONFIG_PACKAGE_kmod-b53=y -CONFIG_PACKAGE_kmod-b53-mdio-driver=y -CONFIG_PACKAGE_kmod-net-dsa=y -CONFIG_PACKAGE_kmod-net-dsa-tag-8021q=y -CONFIG_PACKAGE_kmod-net-dsa-tag-brcm=y -CONFIG_PACKAGE_kmod-net-dsa-tag-prepend=y -CONFIG_PACKAGE_kmod-mdio-bus-mux-multiplexer=y -CONFIG_PACKAGE_kmod-led-trigger-phy=y -CONFIG_PACKAGE_kmod-swconfig=y -CONFIG_PACKAGE_kmod-swconfig-leds=y -CONFIG_PACKAGE_kmod-swconfig-b53=y -CONFIG_PACKAGE_kmod-swconfig-b53-phy-driver=y -CONFIG_PACKAGE_kmod-swconfig-b53-phy-fixup=y -CONFIG_PACKAGE_kmod-ste10xp=y CONFIG_PACKAGE_kmod-ata-sunxi=y -CONFIG_PACKAGE_kmod-rtl8192cu=y CONFIG_PACKAGE_kmod-ath9k-common=y CONFIG_PACKAGE_kmod-ath9k-htc=y -CONFIG_PACKAGE_kmod-net-rtl8192su=y -CONFIG_PACKAGE_kmod-rtl8192c-common=y -CONFIG_PACKAGE_kmod-rtl8192cu=y -CONFIG_PACKAGE_kmod-rtl8xxxu=y CONFIG_PACKAGE_kmod-sunxi-ir=y CONFIG_PACKAGE_kmod-sound-soc-sunxi=y -CONFIG_PACKAGE_kmod-rtlwifi-usb=y -CONFIG_PACKAGE_kmod-rtlwifi=y CONFIG_PACKAGE_kmod-scsi-core=y CONFIG_PACKAGE_kmod-slhc=y -CONFIG_PACKAGE_kmod-usb-core=y -CONFIG_PACKAGE_kmod-leds-gpio=y -CONFIG_PACKAGE_kmod-ledtrig-activity=y -CONFIG_PACKAGE_kmod-ledtrig-gpio=y -CONFIG_PACKAGE_kmod-ledtrig-oneshot=y -CONFIG_PACKAGE_kmod-ledtrig-transient=y -CONFIG_PACKAGE_kmod-ipt-led=y -CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=y CONFIG_KERNEL_ARM_MODULE_PLTS=y From 3d9c64e011c0a7425e05fead3b1a937a63694867 Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 13:05:32 +0100 Subject: [PATCH 12/38] Fixed typo in net dsa broadcom prepend --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index b108129d..cf2236f9 100755 --- a/build.sh +++ b/build.sh @@ -225,7 +225,7 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then # Add support for distributed switch architecture echo -n "Adding DSA support to kernel 5.4..." - for i in NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_PREPEND; do + for i in NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" From cc023117d4b1826267e7ea802256a9d6434aad61 Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 13:27:56 +0100 Subject: [PATCH 13/38] Fixed resulting config and cleanup --- build.sh | 7 +++++-- config-bpi-r1 | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index cf2236f9..8f1fa1f1 100755 --- a/build.sh +++ b/build.sh @@ -224,20 +224,23 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then echo "done" # Add support for distributed switch architecture - echo -n "Adding DSA support to kernel 5.4..." - for i in NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do + echo -n "Adding B53 DSA support to kernel 5.4..." + for i in B53 B53_MDIO_DRIVER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do + cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" # Add support for MDIO bus multiplexer echo -n "Adding support for MDIO bus multiplexer to kernel 5.4..." + cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y" || \ echo "CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" echo "done" # Add led support echo -n "Adding LED support to kernel 5.4..." for i in SWCONFIG_LEDS LED_TRIGGER_PHY LEDS_GPIO LEDTRIG_ACTIVITY LEDTRIG_GPIO LEDTRIG_ONESHOT LEDTRIG_TRANSIENT IPT_LED USB_LEDTRIG_USBSUPPORT; do + cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" diff --git a/config-bpi-r1 b/config-bpi-r1 index 7928ef1e..4fe5a044 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -12,15 +12,33 @@ CONFIG_PACKAGE_attr=y CONFIG_PACKAGE_f2fs-tools=y CONFIG_PACKAGE_f2fsck=y CONFIG_PACKAGE_mkf2fs=y -CONFIG_PACKAGE_swconfig=y +CONFIG_PACKAGE_rtl8188eu-firmware=y CONFIG_PACKAGE_ath9k-htc-firmware=y +CONFIG_PACKAGE_mt7601u-firmware=y +CONFIG_PACKAGE_rt2800-usb-firmware=y +CONFIG_PACKAGE_rtl8192cu-firmware=y +CONFIG_PACKAGE_rtl8192su-firmware=y CONFIG_PACKAGE_kmod-switch-bcm53xx=y CONFIG_PACKAGE_kmod-switch-bcm53xx-mdio=y +CONFIG_PACKAGE_swconfig=y +CONFIG_PACKAGE_kmod-swconfig=y +CONFIG_PACKAGE_kmod-swconfig-b53=y +CONFIG_PACKAGE_kmod-swconfig-b53-phy-driver=y +CONFIG_PACKAGE_kmod-swconfig-b53-phy-fixup=y +CONFIG_PACKAGE_kmod-ste10xp=y CONFIG_PACKAGE_kmod-ata-sunxi=y +CONFIG_PACKAGE_kmod-rtl8192cu=y CONFIG_PACKAGE_kmod-ath9k-common=y CONFIG_PACKAGE_kmod-ath9k-htc=y +CONFIG_PACKAGE_kmod-net-rtl8192su=y +CONFIG_PACKAGE_kmod-rtl8192c-common=y +CONFIG_PACKAGE_kmod-rtl8192cu=y +CONFIG_PACKAGE_kmod-rtl8xxxu=y CONFIG_PACKAGE_kmod-sunxi-ir=y CONFIG_PACKAGE_kmod-sound-soc-sunxi=y +CONFIG_PACKAGE_kmod-rtlwifi-usb=y +CONFIG_PACKAGE_kmod-rtlwifi=y CONFIG_PACKAGE_kmod-scsi-core=y CONFIG_PACKAGE_kmod-slhc=y +CONFIG_PACKAGE_kmod-usb-core=y CONFIG_KERNEL_ARM_MODULE_PLTS=y From 5cdc66aa7fd3ef8feb8677c0a7f862b12a56a75a Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 13:37:04 +0100 Subject: [PATCH 14/38] Configuration fixes --- build.sh | 10 ++-------- config-bpi-r1 | 11 ++++++++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/build.sh b/build.sh index 8f1fa1f1..9b8d784e 100755 --- a/build.sh +++ b/build.sh @@ -224,19 +224,13 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then echo "done" # Add support for distributed switch architecture - echo -n "Adding B53 DSA support to kernel 5.4..." - for i in B53 B53_MDIO_DRIVER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do + echo -n "Adding B53 SWCONFIG and DSA support to kernel 5.4..." + for i in B53 B53_MDIO_DRIVER SWCONFIG SWCONFIG_B53 SWCONFIG_B53_PHY_DRIVER SWCONFIG_B53_PHY_FIXUP MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" - # Add support for MDIO bus multiplexer - echo -n "Adding support for MDIO bus multiplexer to kernel 5.4..." - cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y" || \ - echo "CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" - echo "done" - # Add led support echo -n "Adding LED support to kernel 5.4..." for i in SWCONFIG_LEDS LED_TRIGGER_PHY LEDS_GPIO LEDTRIG_ACTIVITY LEDTRIG_GPIO LEDTRIG_ONESHOT LEDTRIG_TRANSIENT IPT_LED USB_LEDTRIG_USBSUPPORT; do diff --git a/config-bpi-r1 b/config-bpi-r1 index 4fe5a044..26f9ea7c 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -22,10 +22,8 @@ CONFIG_PACKAGE_kmod-switch-bcm53xx=y CONFIG_PACKAGE_kmod-switch-bcm53xx-mdio=y CONFIG_PACKAGE_swconfig=y CONFIG_PACKAGE_kmod-swconfig=y -CONFIG_PACKAGE_kmod-swconfig-b53=y -CONFIG_PACKAGE_kmod-swconfig-b53-phy-driver=y -CONFIG_PACKAGE_kmod-swconfig-b53-phy-fixup=y CONFIG_PACKAGE_kmod-ste10xp=y +CONFIG_PACKAGE_kmod-can-bcm=y CONFIG_PACKAGE_kmod-ata-sunxi=y CONFIG_PACKAGE_kmod-rtl8192cu=y CONFIG_PACKAGE_kmod-ath9k-common=y @@ -41,4 +39,11 @@ CONFIG_PACKAGE_kmod-rtlwifi=y CONFIG_PACKAGE_kmod-scsi-core=y CONFIG_PACKAGE_kmod-slhc=y CONFIG_PACKAGE_kmod-usb-core=y +CONFIG_PACKAGE_kmod-leds-gpio=y +CONFIG_PACKAGE_kmod-ledtrig-activity=y +CONFIG_PACKAGE_kmod-ledtrig-gpio=y +CONFIG_PACKAGE_kmod-ledtrig-oneshot=y +CONFIG_PACKAGE_kmod-ledtrig-transient=y +CONFIG_PACKAGE_kmod-ipt-led=y +CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=y CONFIG_KERNEL_ARM_MODULE_PLTS=y From 0021ef0d07e0aa846d98d4f37516d53497610741 Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 13:39:56 +0100 Subject: [PATCH 15/38] Configuration fixes --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 9b8d784e..77721d91 100755 --- a/build.sh +++ b/build.sh @@ -224,8 +224,8 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then echo "done" # Add support for distributed switch architecture - echo -n "Adding B53 SWCONFIG and DSA support to kernel 5.4..." - for i in B53 B53_MDIO_DRIVER SWCONFIG SWCONFIG_B53 SWCONFIG_B53_PHY_DRIVER SWCONFIG_B53_PHY_FIXUP MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do + echo -n "Adding B53 DSA support to kernel 5.4..." + for i in B53 B53_MDIO_DRIVER MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done From 6e3e6a146d454241929d2f82f21195ce25773beb Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 15:22:55 +0100 Subject: [PATCH 16/38] Changed LED support --- build.sh | 8 ++++---- config-bpi-r1 | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 77721d91..4ed8f402 100755 --- a/build.sh +++ b/build.sh @@ -225,17 +225,17 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then # Add support for distributed switch architecture echo -n "Adding B53 DSA support to kernel 5.4..." - for i in B53 B53_MDIO_DRIVER MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do + for i in B53 B53_MDIO_DRIVER SWCONFIG_LEDS LED_TRIGGER_PHY MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" # Add led support - echo -n "Adding LED support to kernel 5.4..." - for i in SWCONFIG_LEDS LED_TRIGGER_PHY LEDS_GPIO LEDTRIG_ACTIVITY LEDTRIG_GPIO LEDTRIG_ONESHOT LEDTRIG_TRANSIENT IPT_LED USB_LEDTRIG_USBSUPPORT; do + echo -n "Adding LED TRIGGER support to kernel 5.4..." + for i in TIMER ONESHOT DISK MTD HEARTBEAT BACKLIGHT CPU ACTIVITY GPIO DEFAULT_ON TRANSIENT CAMERA PANIC NETDEV PATTERN AUDIO; do cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ - echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + echo "CONFIG_LEDS_TRIGGER_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" diff --git a/config-bpi-r1 b/config-bpi-r1 index 26f9ea7c..868f1652 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -44,6 +44,15 @@ CONFIG_PACKAGE_kmod-ledtrig-activity=y CONFIG_PACKAGE_kmod-ledtrig-gpio=y CONFIG_PACKAGE_kmod-ledtrig-oneshot=y CONFIG_PACKAGE_kmod-ledtrig-transient=y +CONFIG_PACKAGE_kmod-ledtrig-disk=y +CONFIG_PACKAGE_kmod-ledtrig-mtd=y +CONFIG_PACKAGE_kmod-ledtrig-heartbeat=y +CONFIG_PACKAGE_kmod-ledtrig-backlight=y +CONFIG_PACKAGE_kmod-ledtrig-cpu=y +CONFIG_PACKAGE_kmod-ledtrig-panic=y +CONFIG_PACKAGE_kmod-ledtrig-netdev=y +CONFIG_PACKAGE_kmod-ledtrig-pattern=y +CONFIG_PACKAGE_kmod-ledtrig-audio=y CONFIG_PACKAGE_kmod-ipt-led=y CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=y CONFIG_KERNEL_ARM_MODULE_PLTS=y From f67fb0e6ed0c0f3e93944178988f38eae5088caf Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 16:28:10 +0100 Subject: [PATCH 17/38] Added support to force DSA instead of SWCONFIG --- build.sh | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index 4ed8f402..9f91dcc2 100755 --- a/build.sh +++ b/build.sh @@ -49,6 +49,8 @@ CUSTOM_FEED_URL="${CUSTOM_FEED_URL}" OMR_OPENWRT=${OMR_OPENWRT:-default} +OMR_FORCE_DSA=${OMR_FORCE_DSA:-0} + if [ ! -f "$OMR_TARGET_CONFIG" ]; then echo "Target $OMR_TARGET not found !" #exit 1 @@ -223,18 +225,42 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-5.4/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 echo "done" - # Add support for distributed switch architecture - echo -n "Adding B53 DSA support to kernel 5.4..." - for i in B53 B53_MDIO_DRIVER SWCONFIG_LEDS LED_TRIGGER_PHY MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do - cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ - echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" - done - echo "done" - + if [ "$OMR_FORCE_DSA" = "1" ]; then + # Remove support for swconfig + echo -n "Removing swconfig support from openwrt config..." + for i in DEFAULT_swconfig PACKAGE_swconfig PACKAGE_kmod-swconfig; do + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/.config" + done + echo "done" + echo -n "Removing B53 swconfig support from kernel 5.4..." + for i in SWCONFIG_B53 SWCONFIG_B53_PHY_DRIVER SWCONFIG_LEDS LED_TRIGGER_PHY SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER; do + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-5.4" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + done + echo "done" + + # Add support for distributed switch architecture + echo -n "Adding B53 DSA support to kernel 5.4..." + for i in B53 B53_MDIO_DRIVER MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do + cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_${i}=y" || \ + cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ + echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + done + echo "done" + fi + # Add led support echo -n "Adding LED TRIGGER support to kernel 5.4..." + if [ "$OMR_FORCE_DSA" != "1" ]; then + for i in SWCONFIG_LEDS LED_TRIGGER_PHY; do + cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_${i}=y" || \ + cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ + echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + done + fi for i in TIMER ONESHOT DISK MTD HEARTBEAT BACKLIGHT CPU ACTIVITY GPIO DEFAULT_ON TRANSIENT CAMERA PANIC NETDEV PATTERN AUDIO; do - cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ + cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_LEDS_TRIGGER_${i}=y" || \ + cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_LEDS_TRIGGER_${i}=y" || \ echo "CONFIG_LEDS_TRIGGER_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" From 293de84e8acf89cb670d2e16922f7517a7cf6c78 Mon Sep 17 00:00:00 2001 From: Olli Date: Fri, 5 Mar 2021 23:09:04 +0100 Subject: [PATCH 18/38] Removed b53 fixup --- build.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.sh b/build.sh index 9f91dcc2..45a48674 100755 --- a/build.sh +++ b/build.sh @@ -247,6 +247,14 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" + else + # Remove swconfig parts + echo -n "Removing unneeded B53 swconfig parts from kernel 5.4..." + for i in SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER; do + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-5.4" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + done + echo "done" fi # Add led support From af1500adbeb3d9a7329a442d824f02d5ad8599c7 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 01:16:07 +0100 Subject: [PATCH 19/38] Added untag script to make switch0 work --- .../base-files/etc/uci-defaults/99-switch-vlan-untag-cpu | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu new file mode 100755 index 00000000..e628e87b --- /dev/null +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu @@ -0,0 +1,4 @@ +uci set network.@switch_vlan[0].ports="4 0 1 2 8t" +uci set network.@switch_vlan[1].ports="3 8" +uci commit +exit 0 From 792286e405ca901655c0ac5516a6d287d679b6b7 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 01:19:13 +0100 Subject: [PATCH 20/38] Add switch0 vlanid changer --- .../base-files/etc/uci-defaults/99-switch-vlan-set-pvids | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids new file mode 100755 index 00000000..03932914 --- /dev/null +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids @@ -0,0 +1,4 @@ +uci set network.@switch_vlan[0].vlan=10 +uci set network.@switch_vlan[1].vlan=20 +uci commit +exit 0 From 6a6941c37949550adaf889b6154cf55b7f913618 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 03:42:30 +0100 Subject: [PATCH 21/38] Added support for ip-bridge in DSA mode --- build.sh | 7 +++++++ config-bpi-r1 | 1 + 2 files changed, 8 insertions(+) diff --git a/build.sh b/build.sh index 45a48674..0980b65e 100755 --- a/build.sh +++ b/build.sh @@ -248,6 +248,13 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then done echo "done" else + # Remove ip-bridge + echo -n "Removing ip-bridge support from openwrt config..." + for i in PACKAGE_ip-bridge; do + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/.config" + done + echo "done" + # Remove swconfig parts echo -n "Removing unneeded B53 swconfig parts from kernel 5.4..." for i in SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER; do diff --git a/config-bpi-r1 b/config-bpi-r1 index 868f1652..7fb4a74a 100644 --- a/config-bpi-r1 +++ b/config-bpi-r1 @@ -20,6 +20,7 @@ CONFIG_PACKAGE_rtl8192cu-firmware=y CONFIG_PACKAGE_rtl8192su-firmware=y CONFIG_PACKAGE_kmod-switch-bcm53xx=y CONFIG_PACKAGE_kmod-switch-bcm53xx-mdio=y +CONFIG_PACKAGE_ip-bridge=y CONFIG_PACKAGE_swconfig=y CONFIG_PACKAGE_kmod-swconfig=y CONFIG_PACKAGE_kmod-ste10xp=y From ef75c95d50f32a4b636c6d17827c2605160f5233 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 04:49:54 +0100 Subject: [PATCH 22/38] Tagged PHY or DSA mode in /etc and added kernel bridge vlan filter support --- build.sh | 8 +++++++- .../etc/uci-defaults/99-switch-vlan-set-pvids | 10 ++++++++-- .../etc/uci-defaults/99-switch-vlan-untag-cpu | 8 +++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 0980b65e..861f3c2b 100755 --- a/build.sh +++ b/build.sh @@ -241,12 +241,15 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then # Add support for distributed switch architecture echo -n "Adding B53 DSA support to kernel 5.4..." - for i in B53 B53_MDIO_DRIVER MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do + for i in B53 B53_MDIO_DRIVER BRIDGE_VLAN_FILTERING MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_${i}=y" || \ cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" + + # Mark as DSA + touch "$OMR_TARGET/source/target/linux/sunxi/base-files/etc/.lamobo-r1.dsa" else # Remove ip-bridge echo -n "Removing ip-bridge support from openwrt config..." @@ -262,6 +265,9 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done echo "done" + + # Mark as PHY + touch "$OMR_TARGET/source/target/linux/sunxi/base-files/etc/.lamobo-r1.phy" fi # Add led support diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids index 03932914..8c16e00c 100755 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids @@ -1,4 +1,10 @@ -uci set network.@switch_vlan[0].vlan=10 -uci set network.@switch_vlan[1].vlan=20 +if [ -f "/etc/.lamobo-r1.dsa" ]; then + uci delete network.@switch_vlan[1] + uci delete network.@switch_vlan[0] + uci delete network.@switch[0] +else + uci set network.@switch_vlan[0].vlan=10 + uci set network.@switch_vlan[1].vlan=20 +fi uci commit exit 0 diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu index e628e87b..16c99bf8 100755 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu @@ -1,4 +1,6 @@ -uci set network.@switch_vlan[0].ports="4 0 1 2 8t" -uci set network.@switch_vlan[1].ports="3 8" -uci commit +if [ -f "/etc/.lamobo-r1.phy" ]; then + uci set network.@switch_vlan[0].ports="4 0 1 2 8t" + uci set network.@switch_vlan[1].ports="3 8" + uci commit +fi exit 0 From e5393baa84dd3723cc0c43e32835f6f2b897d044 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 05:17:13 +0100 Subject: [PATCH 23/38] Added support for DSA and PHY default config --- .../etc/uci-defaults/99-switch-config | 26 +++++++++++++++++++ .../etc/uci-defaults/99-switch-vlan-set-pvids | 10 ------- .../etc/uci-defaults/99-switch-vlan-untag-cpu | 6 ----- 3 files changed, 26 insertions(+), 16 deletions(-) create mode 100755 root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config delete mode 100755 root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids delete mode 100755 root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config new file mode 100755 index 00000000..42d71050 --- /dev/null +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config @@ -0,0 +1,26 @@ +if [ -f "/etc/.lamobo-r1.dsa" ]; then + uci delete network.@switch_vlan[1] + uci delete network.@switch_vlan[0] + uci delete network.@switch[0] + + uci set network.lan.type=bridge + uci set network.lan.ifname="wan" + + uci set network.wan1.type=bridge + uci set network.wan2.type=bridge + uci set network.wan3.type=bridge + uci set network.wan4.type=bridge + + uci set network.wan1.ifname="lan1" + uci set network.wan2.ifname="lan2" + uci set network.wan3.ifname="lan3" + uci set network.wan4.ifname="lan4" +else + uci set network.@switch_vlan[0].vlan=10 + uci set network.@switch_vlan[1].vlan=20 + + uci set network.@switch_vlan[0].ports="4 0 1 2 8t" + uci set network.@switch_vlan[1].ports="3 8" +fi +uci commit +exit 0 diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids deleted file mode 100755 index 8c16e00c..00000000 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-set-pvids +++ /dev/null @@ -1,10 +0,0 @@ -if [ -f "/etc/.lamobo-r1.dsa" ]; then - uci delete network.@switch_vlan[1] - uci delete network.@switch_vlan[0] - uci delete network.@switch[0] -else - uci set network.@switch_vlan[0].vlan=10 - uci set network.@switch_vlan[1].vlan=20 -fi -uci commit -exit 0 diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu deleted file mode 100755 index 16c99bf8..00000000 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-vlan-untag-cpu +++ /dev/null @@ -1,6 +0,0 @@ -if [ -f "/etc/.lamobo-r1.phy" ]; then - uci set network.@switch_vlan[0].ports="4 0 1 2 8t" - uci set network.@switch_vlan[1].ports="3 8" - uci commit -fi -exit 0 From ada62d8ae9e55340effa70afcb0c6ce267bbbb96 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 05:25:39 +0100 Subject: [PATCH 24/38] Removed STM drivers in DSA mode --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 861f3c2b..a352a411 100755 --- a/build.sh +++ b/build.sh @@ -228,12 +228,12 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then if [ "$OMR_FORCE_DSA" = "1" ]; then # Remove support for swconfig echo -n "Removing swconfig support from openwrt config..." - for i in DEFAULT_swconfig PACKAGE_swconfig PACKAGE_kmod-swconfig; do + for i in DEFAULT_swconfig PACKAGE_swconfig PACKAGE_kmod-swconfig PACKAGE_kmod-st10xp; do sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/.config" done echo "done" echo -n "Removing B53 swconfig support from kernel 5.4..." - for i in SWCONFIG_B53 SWCONFIG_B53_PHY_DRIVER SWCONFIG_LEDS LED_TRIGGER_PHY SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER; do + for i in SWCONFIG_B53 SWCONFIG_B53_PHY_DRIVER SWCONFIG_LEDS LED_TRIGGER_PHY SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER DWMAC_GENERIC STMMAC_PLATFORM STMMAC_ETH NET_VENDOR_STMICRO; do sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-5.4" sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done From 156c95d02e7458f2e635765f5f4e4094397ceab2 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 05:30:07 +0100 Subject: [PATCH 25/38] Added bridges to phy mode --- .../etc/uci-defaults/99-switch-config | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config index 42d71050..9394d346 100755 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config @@ -1,16 +1,15 @@ +uci set network.lan.type=bridge +uci set network.wan1.type=bridge +uci set network.wan2.type=bridge +uci set network.wan3.type=bridge +uci set network.wan4.type=bridge + if [ -f "/etc/.lamobo-r1.dsa" ]; then uci delete network.@switch_vlan[1] uci delete network.@switch_vlan[0] uci delete network.@switch[0] - uci set network.lan.type=bridge uci set network.lan.ifname="wan" - - uci set network.wan1.type=bridge - uci set network.wan2.type=bridge - uci set network.wan3.type=bridge - uci set network.wan4.type=bridge - uci set network.wan1.ifname="lan1" uci set network.wan2.ifname="lan2" uci set network.wan3.ifname="lan3" @@ -21,6 +20,12 @@ else uci set network.@switch_vlan[0].ports="4 0 1 2 8t" uci set network.@switch_vlan[1].ports="3 8" + + uci set network.lan.ifname="eth0" + uci set network.wan1.ifname="eth0.1" + uci set network.wan2.ifname="eth0.2" + uci set network.wan3.ifname="eth0.3" + uci set network.wan4.ifname="eth0.4" fi uci commit exit 0 From 53afc520579c68292846d236b6109c0a5d29de4b Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 16:10:44 +0100 Subject: [PATCH 26/38] Oops. Accidently removed the STM driver for network. Reverted. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index a352a411..cd014728 100755 --- a/build.sh +++ b/build.sh @@ -233,7 +233,7 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then done echo "done" echo -n "Removing B53 swconfig support from kernel 5.4..." - for i in SWCONFIG_B53 SWCONFIG_B53_PHY_DRIVER SWCONFIG_LEDS LED_TRIGGER_PHY SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER DWMAC_GENERIC STMMAC_PLATFORM STMMAC_ETH NET_VENDOR_STMICRO; do + for i in SWCONFIG_B53 SWCONFIG_B53_PHY_DRIVER SWCONFIG_LEDS LED_TRIGGER_PHY SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER; do sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-5.4" sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" done From 0ef3dc5a262fbba2d55dcbbdb671169addbbf8e5 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 16:26:45 +0100 Subject: [PATCH 27/38] Added kernel version check and fixed config checking --- build.sh | 55 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/build.sh b/build.sh index cd014728..ea8cc1ab 100755 --- a/build.sh +++ b/build.sh @@ -220,31 +220,40 @@ if [ "$OMR_TARGET" = "bpi-r1" -a "$OMR_OPENWRT" = "master" ]; then fi if [ "$OMR_TARGET" = "bpi-r1" ]; then - # Remove the 310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th patch - echo -n "Removing unwanted patches from kernel 5.4..." - rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-5.4/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 - echo "done" + # Check kernel version + if [ "$OMR_KERNEL" != "5.4" ]; then + echo "Sorry, but for now kernel 5.4 is the only supported one." + exit 1 + fi + + if [ "$OMR_KERNEL" = "5.4" ]; then + # Remove the 310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th patch + echo -n "Removing unwanted patches from kernel $OMR_KERNEL..." + rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-$OMR_KERNEL/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 + echo "done" + fi if [ "$OMR_FORCE_DSA" = "1" ]; then # Remove support for swconfig echo -n "Removing swconfig support from openwrt config..." - for i in DEFAULT_swconfig PACKAGE_swconfig PACKAGE_kmod-swconfig PACKAGE_kmod-st10xp; do + for i in DEFAULT_swconfig PACKAGE_swconfig PACKAGE_kmod-swconfig; do sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/.config" done echo "done" - echo -n "Removing B53 swconfig support from kernel 5.4..." + echo -n "Removing B53 swconfig support from kernel $OMR_KERNEL..." for i in SWCONFIG_B53 SWCONFIG_B53_PHY_DRIVER SWCONFIG_LEDS LED_TRIGGER_PHY SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER; do - sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-5.4" - sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done" # Add support for distributed switch architecture - echo -n "Adding B53 DSA support to kernel 5.4..." + echo -n "Adding B53 DSA support to kernel $OMR_KERNEL..." for i in B53 B53_MDIO_DRIVER BRIDGE_VLAN_FILTERING MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do - cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_${i}=y" || \ - cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ - echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + check_sunxi_config=`cat "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + check_cortexa7_config=`cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + + [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done" @@ -259,10 +268,10 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then echo "done" # Remove swconfig parts - echo -n "Removing unneeded B53 swconfig parts from kernel 5.4..." + echo -n "Removing unneeded B53 swconfig parts from kernel $OMR_KERNEL..." for i in SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER; do - sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-5.4" - sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done" @@ -271,18 +280,20 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then fi # Add led support - echo -n "Adding LED TRIGGER support to kernel 5.4..." + echo -n "Adding LED TRIGGER support to kernel $OMR_KERNEL..." if [ "$OMR_FORCE_DSA" != "1" ]; then for i in SWCONFIG_LEDS LED_TRIGGER_PHY; do - cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_${i}=y" || \ - cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ - echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + check_sunxi_config=`cat "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + check_cortexa7_config=`cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + + [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done fi for i in TIMER ONESHOT DISK MTD HEARTBEAT BACKLIGHT CPU ACTIVITY GPIO DEFAULT_ON TRANSIENT CAMERA PANIC NETDEV PATTERN AUDIO; do - cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_LEDS_TRIGGER_${i}=y" || \ - cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_LEDS_TRIGGER_${i}=y" || \ - echo "CONFIG_LEDS_TRIGGER_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + check_sunxi_config=`cat "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" | grep "CONFIG_LEDS_TRIGGER_${i}=y"` + check_cortexa7_config=`cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" | grep "CONFIG_LEDS_TRIGGER_${i}=y"` + + [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_LEDS_TRIGGER_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done" From 785b03e1eff5d8cffe1eac0c14e05f2e24276175 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 16:45:48 +0100 Subject: [PATCH 28/38] Changed sunxi and cortexa7 config checks --- build.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index ea8cc1ab..7e2495dc 100755 --- a/build.sh +++ b/build.sh @@ -248,10 +248,10 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then echo "done" # Add support for distributed switch architecture - echo -n "Adding B53 DSA support to kernel $OMR_KERNEL..." + echo -n "Adding B53 DSA support to kernel $OMR_KERNEL..." for i in B53 B53_MDIO_DRIVER BRIDGE_VLAN_FILTERING MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do - check_sunxi_config=`cat "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` - check_cortexa7_config=`cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + check_sunxi_config=`grep "CONFIG_${i}=y" "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" || true` + check_cortexa7_config=`grep "CONFIG_${i}=y" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" || true` [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done @@ -283,20 +283,21 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then echo -n "Adding LED TRIGGER support to kernel $OMR_KERNEL..." if [ "$OMR_FORCE_DSA" != "1" ]; then for i in SWCONFIG_LEDS LED_TRIGGER_PHY; do - check_sunxi_config=`cat "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` - check_cortexa7_config=`cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + check_sunxi_config=`grep "CONFIG_${i}=y" "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" || true` + check_cortexa7_config=`grep "CONFIG_${i}=y" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" || true` [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done fi for i in TIMER ONESHOT DISK MTD HEARTBEAT BACKLIGHT CPU ACTIVITY GPIO DEFAULT_ON TRANSIENT CAMERA PANIC NETDEV PATTERN AUDIO; do - check_sunxi_config=`cat "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" | grep "CONFIG_LEDS_TRIGGER_${i}=y"` - check_cortexa7_config=`cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" | grep "CONFIG_LEDS_TRIGGER_${i}=y"` + check_sunxi_config=`grep "CONFIG_LEDS_TRIGGER_${i}=y" "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" || true` + check_cortexa7_config=`grep "CONFIG_LEDS_TRIGGER_${i}=y" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" || true` [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_LEDS_TRIGGER_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done" + # BPI-R1 additions: # 2021-03-05 Oliver Welter fi From 1a5f7fd2e8a969bd00f4f15c90c00d26b2c3b646 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 19:08:14 +0100 Subject: [PATCH 29/38] Enabled patch for DSA mode --- build.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 7e2495dc..757d0320 100755 --- a/build.sh +++ b/build.sh @@ -226,13 +226,6 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then exit 1 fi - if [ "$OMR_KERNEL" = "5.4" ]; then - # Remove the 310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th patch - echo -n "Removing unwanted patches from kernel $OMR_KERNEL..." - rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-$OMR_KERNEL/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 - echo "done" - fi - if [ "$OMR_FORCE_DSA" = "1" ]; then # Remove support for swconfig echo -n "Removing swconfig support from openwrt config..." @@ -260,6 +253,11 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then # Mark as DSA touch "$OMR_TARGET/source/target/linux/sunxi/base-files/etc/.lamobo-r1.dsa" else + # Remove the 310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th patch + echo -n "Removing unwanted patches from kernel $OMR_KERNEL..." + rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-$OMR_KERNEL/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 + echo "done" + # Remove ip-bridge echo -n "Removing ip-bridge support from openwrt config..." for i in PACKAGE_ip-bridge; do From 5cafd1b92edace7500e5852dacc57a13e695402c Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 20:42:41 +0100 Subject: [PATCH 30/38] Reverted to patch removal due to problems in DSA mode --- build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 757d0320..8a8f5259 100755 --- a/build.sh +++ b/build.sh @@ -226,6 +226,11 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then exit 1 fi + # Remove the 310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th patch + echo -n "Removing unwanted patches from kernel $OMR_KERNEL..." + rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-$OMR_KERNEL/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 + echo "done" + if [ "$OMR_FORCE_DSA" = "1" ]; then # Remove support for swconfig echo -n "Removing swconfig support from openwrt config..." @@ -253,11 +258,6 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then # Mark as DSA touch "$OMR_TARGET/source/target/linux/sunxi/base-files/etc/.lamobo-r1.dsa" else - # Remove the 310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th patch - echo -n "Removing unwanted patches from kernel $OMR_KERNEL..." - rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-$OMR_KERNEL/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 - echo "done" - # Remove ip-bridge echo -n "Removing ip-bridge support from openwrt config..." for i in PACKAGE_ip-bridge; do From bec2c973096c3bead806cbf3a081abcb37ef9e85 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 22:59:48 +0100 Subject: [PATCH 31/38] Removed bridge from interface types --- .../sunxi/base-files/etc/uci-defaults/99-switch-config | 6 ------ 1 file changed, 6 deletions(-) diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config index 9394d346..aa4e0b35 100755 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config @@ -1,9 +1,3 @@ -uci set network.lan.type=bridge -uci set network.wan1.type=bridge -uci set network.wan2.type=bridge -uci set network.wan3.type=bridge -uci set network.wan4.type=bridge - if [ -f "/etc/.lamobo-r1.dsa" ]; then uci delete network.@switch_vlan[1] uci delete network.@switch_vlan[0] From 709cf02b2bc0132a894a9e6e39782e7636dbaeb1 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 23:58:10 +0100 Subject: [PATCH 32/38] Fixed VLAN tagging for switch0 --- .../etc/uci-defaults/99-switch-config | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config index aa4e0b35..8c8e15a4 100755 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config @@ -9,11 +9,33 @@ if [ -f "/etc/.lamobo-r1.dsa" ]; then uci set network.wan3.ifname="lan3" uci set network.wan4.ifname="lan4" else - uci set network.@switch_vlan[0].vlan=10 - uci set network.@switch_vlan[1].vlan=20 + uci delete network.@switch_vlan[0] + uci delete network.@switch_vlan[1] - uci set network.@switch_vlan[0].ports="4 0 1 2 8t" - uci set network.@switch_vlan[1].ports="3 8" + uci add network switch_vlan + uci set network.@switch_vlan[0].vlan=5 + uci set network.@switch_vlan[0].ports="8 3" + uci set network.@switch_vlan[0].device="switch0" + + uci add network switch_vlan + uci set network.@switch_vlan[1].vlan=1 + uci set network.@switch_vlan[1].ports="8t 4" + uci set network.@switch_vlan[1].device="switch0" + + uci add network switch_vlan + uci set network.@switch_vlan[2].vlan=2 + uci set network.@switch_vlan[2].ports="8t 0" + uci set network.@switch_vlan[2].device="switch0" + + uci add network switch_vlan + uci set network.@switch_vlan[3].vlan=3 + uci set network.@switch_vlan[3].ports="8t 1" + uci set network.@switch_vlan[3].device="switch0" + + uci add network switch_vlan + uci set network.@switch_vlan[4].vlan=4 + uci set network.@switch_vlan[4].ports="8t 2" + uci set network.@switch_vlan[4].device="switch0" uci set network.lan.ifname="eth0" uci set network.wan1.ifname="eth0.1" From bc813156ccc3bcd70cd925c5dc2899b2f9c19632 Mon Sep 17 00:00:00 2001 From: Olli Date: Sun, 7 Mar 2021 02:49:09 +0100 Subject: [PATCH 33/38] Contrib agreement --- build.sh | 5 +---- contributors/welterrocks.md | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 contributors/welterrocks.md diff --git a/build.sh b/build.sh index 8a8f5259..95b53b2e 100755 --- a/build.sh +++ b/build.sh @@ -293,10 +293,7 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_LEDS_TRIGGER_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done - echo "done" - - # BPI-R1 additions: - # 2021-03-05 Oliver Welter + echo "done" fi cd "$OMR_TARGET/source" diff --git a/contributors/welterrocks.md b/contributors/welterrocks.md new file mode 100644 index 00000000..43b2f0a0 --- /dev/null +++ b/contributors/welterrocks.md @@ -0,0 +1,9 @@ +2021-03-05 + +I hereby agree to the terms of the "OpenMPTCProuter Individual Contributor License Agreement", with MD5 checksum bc827a07eb93611d793ddb7c75083c00. + +I furthermore declare that I am authorized and able to make this agreement and sign this declaration. + +Signed, + +Oliver Welter https://github.com/welterrocks From 35b806a8c90ebfeddb57ae4952d4b0d0ef42f112 Mon Sep 17 00:00:00 2001 From: Olli Date: Sun, 7 Mar 2021 07:03:35 +0100 Subject: [PATCH 34/38] Added automatic switch setup in DSA mode --- .../etc/uci-defaults/99-switch-config | 19 +++-- .../sunxi/base-files/lib/network/switch.sh | 79 +++++++++++++++++++ 2 files changed, 93 insertions(+), 5 deletions(-) create mode 100755 root/target/linux/sunxi/base-files/lib/network/switch.sh diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config index 8c8e15a4..260214d0 100755 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config @@ -3,11 +3,20 @@ if [ -f "/etc/.lamobo-r1.dsa" ]; then uci delete network.@switch_vlan[0] uci delete network.@switch[0] - uci set network.lan.ifname="wan" - uci set network.wan1.ifname="lan1" - uci set network.wan2.ifname="lan2" - uci set network.wan3.ifname="lan3" - uci set network.wan4.ifname="lan4" + uci set network.lan.ifname="wan eth0" + uci set network.lan.type="bridge" + + uci set network.wan1.ifname="lan1 eth0.11" + uci set network.wan1.type="bridge" + + uci set network.wan2.ifname="lan2 eth0.12" + uci set network.wan2.type="bridge" + + uci set network.wan3.ifname="lan3 eth0.13" + uci set network.wan3.type="bridge" + + uci set network.wan4.ifname="lan4 eth0.14" + uci set network.wan4.type="bridge" else uci delete network.@switch_vlan[0] uci delete network.@switch_vlan[1] diff --git a/root/target/linux/sunxi/base-files/lib/network/switch.sh b/root/target/linux/sunxi/base-files/lib/network/switch.sh new file mode 100755 index 00000000..f03e327d --- /dev/null +++ b/root/target/linux/sunxi/base-files/lib/network/switch.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# Copyright (C) 2009 OpenWrt.org +# Copyright (c) 2021 Oliver Welter + +setup_switch_dsa() { + local tries=15 + + /bin/sleep 10 + + local bridge_names=`/sbin/uci show network | /bin/grep type | /bin/grep bridge | /usr/bin/cut -d . -f2` + + for name in $bridge_names; do + local bridge_interface=`/sbin/uci get network.$name.ifname` + local trycount=1 + + while true; do + local my_interface="" + + for intf in $bridge_interface; do + local eth=`/bin/echo $intf | /bin/grep -v eth` + + if [ "$eth" != "" ]; then + my_interface="$eth" + fi + done + + if [ "$my_interface" = "" ]; then + break + fi + + local has_interface=`/sbin/ifconfig $my_interface >/dev/null 2>&1 && echo 1` + + if [ "$has_interface" = "" ]; then + /bin/sleep 1 + + trycount=$(($trycount+1)) + + if [ $trycount -gt $tries ]; then + break + fi + else + break + fi + done + + if [ "$has_interface" = "1" -a "$bridge_interface" != "" ]; then + for iface in $bridge_interface; do + local eth=`/bin/echo $iface | /bin/grep eth` + + if [ "$eth" != "" ]; then + local vlan=`/bin/echo $iface | /usr/bin/cut -d . -f2` + + if [ "$vlan" != "" -a "$vlan" != "$eth" ]; then + /usr/bin/logger -t switch.sh "Found interface $my_interface for alias $iface in bridge $name - adding to VLAN $vlan" + /usr/sbin/bridge vlan add dev $my_interface vid $vlan pvid untagged + fi + fi + done + fi + done +} + +setup_switch_dev() { + local name + config_get name "$1" name + name="${name:-$1}" + [ -d "/sys/class/net/$name" ] && ip link set dev "$name" up + swconfig dev "$name" load network +} + +setup_switch() { + config_load network + + if [ -f "/etc/.lamobo-r1.dsa" ]; then + setup_switch_dsa & return + else + config_foreach setup_switch_dev switch + fi +} From 8228dbbbde46b5daf312d095eeac37080804e42d Mon Sep 17 00:00:00 2001 From: Olli Date: Sun, 7 Mar 2021 07:15:05 +0100 Subject: [PATCH 35/38] Added master interface --- .../linux/sunxi/base-files/lib/network/switch.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/root/target/linux/sunxi/base-files/lib/network/switch.sh b/root/target/linux/sunxi/base-files/lib/network/switch.sh index f03e327d..f20d2609 100755 --- a/root/target/linux/sunxi/base-files/lib/network/switch.sh +++ b/root/target/linux/sunxi/base-files/lib/network/switch.sh @@ -50,9 +50,14 @@ setup_switch_dsa() { if [ "$eth" != "" ]; then local vlan=`/bin/echo $iface | /usr/bin/cut -d . -f2` - if [ "$vlan" != "" -a "$vlan" != "$eth" ]; then - /usr/bin/logger -t switch.sh "Found interface $my_interface for alias $iface in bridge $name - adding to VLAN $vlan" - /usr/sbin/bridge vlan add dev $my_interface vid $vlan pvid untagged + if [ "$vlan" != "" ]; then + if [ "$vlan" = "$eth" ]; then + /usr/bin/logger -t switch.sh "Found interface $my_interface for alias $iface in bridge $name - adding to master" + /usr/sbin/bridge vlan add dev $my_interface vid 1 master + else + /usr/bin/logger -t switch.sh "Found interface $my_interface for alias $iface in bridge $name - adding to VLAN $vlan" + /usr/sbin/bridge vlan add dev $my_interface vid $vlan pvid untagged + fi fi fi done From 75e5ee2fdd245735cf721a22741b6be85075bdbb Mon Sep 17 00:00:00 2001 From: Olli Date: Wed, 10 Mar 2021 00:53:42 +0100 Subject: [PATCH 36/38] Added swconfig-wrapper to take control about DSA switch configuration --- build.sh | 10 +- .../etc/uci-defaults/99-switch-config | 104 +++--- .../sunxi/base-files/lib/network/switch.sh | 84 ----- .../sunxi/base-files/sbin/swconfig-wrapper.sh | 350 ++++++++++++++++++ 4 files changed, 406 insertions(+), 142 deletions(-) delete mode 100755 root/target/linux/sunxi/base-files/lib/network/switch.sh create mode 100644 root/target/linux/sunxi/base-files/sbin/swconfig-wrapper.sh diff --git a/build.sh b/build.sh index 95b53b2e..f20817e5 100755 --- a/build.sh +++ b/build.sh @@ -255,8 +255,11 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then done echo "done" - # Mark as DSA - touch "$OMR_TARGET/source/target/linux/sunxi/base-files/etc/.lamobo-r1.dsa" + # Create DSA port map file (will be filled on first boot, by uci-defaults and tells the system, that it is in DSA mode) + touch "$OMR_TARGET/source/target/linux/sunxi/base-files/etc/dsa.map" + + # Remove the b53 hack in preinit + rm -f "$OMR_TARGET/source/target/linux/sunxi/base-files/lib/preinit/03_b53_hack.sh" else # Remove ip-bridge echo -n "Removing ip-bridge support from openwrt config..." @@ -272,9 +275,6 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done" - - # Mark as PHY - touch "$OMR_TARGET/source/target/linux/sunxi/base-files/etc/.lamobo-r1.phy" fi # Add led support diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config index 260214d0..1d24c6d5 100755 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config @@ -1,56 +1,54 @@ -if [ -f "/etc/.lamobo-r1.dsa" ]; then - uci delete network.@switch_vlan[1] - uci delete network.@switch_vlan[0] - uci delete network.@switch[0] - - uci set network.lan.ifname="wan eth0" - uci set network.lan.type="bridge" - - uci set network.wan1.ifname="lan1 eth0.11" - uci set network.wan1.type="bridge" - - uci set network.wan2.ifname="lan2 eth0.12" - uci set network.wan2.type="bridge" - - uci set network.wan3.ifname="lan3 eth0.13" - uci set network.wan3.type="bridge" - - uci set network.wan4.ifname="lan4 eth0.14" - uci set network.wan4.type="bridge" -else - uci delete network.@switch_vlan[0] - uci delete network.@switch_vlan[1] - - uci add network switch_vlan - uci set network.@switch_vlan[0].vlan=5 - uci set network.@switch_vlan[0].ports="8 3" - uci set network.@switch_vlan[0].device="switch0" - - uci add network switch_vlan - uci set network.@switch_vlan[1].vlan=1 - uci set network.@switch_vlan[1].ports="8t 4" - uci set network.@switch_vlan[1].device="switch0" - - uci add network switch_vlan - uci set network.@switch_vlan[2].vlan=2 - uci set network.@switch_vlan[2].ports="8t 0" - uci set network.@switch_vlan[2].device="switch0" - - uci add network switch_vlan - uci set network.@switch_vlan[3].vlan=3 - uci set network.@switch_vlan[3].ports="8t 1" - uci set network.@switch_vlan[3].device="switch0" - - uci add network switch_vlan - uci set network.@switch_vlan[4].vlan=4 - uci set network.@switch_vlan[4].ports="8t 2" - uci set network.@switch_vlan[4].device="switch0" - - uci set network.lan.ifname="eth0" - uci set network.wan1.ifname="eth0.1" - uci set network.wan2.ifname="eth0.2" - uci set network.wan3.ifname="eth0.3" - uci set network.wan4.ifname="eth0.4" +if [ -f "/etc/dsa.map" ]; then +echo 'ports="0 1 2 3 4 8" +port_3="wan" +port_4="lan1" +port_0="lan2" +port_1="lan3" +port_2="lan4" +port_8="eth0" +port_3_name="lan" +port_4_name="wan1" +port_0_name="wan2" +port_1_name="wan3" +port_2_name="wan4" +port_8_name="cpu" +port_cpu="8" +' > /etc/dsa.map fi + +uci delete network.@switch_vlan[0] +uci delete network.@switch_vlan[1] + +uci add network switch_vlan +uci set network.@switch_vlan[0].vlan=10 +uci set network.@switch_vlan[0].ports="8t 3" +uci set network.@switch_vlan[0].device="switch0" + +uci add network switch_vlan +uci set network.@switch_vlan[1].vlan=11 +uci set network.@switch_vlan[1].ports="8t 4" +uci set network.@switch_vlan[1].device="switch0" + +uci add network switch_vlan +uci set network.@switch_vlan[2].vlan=12 +uci set network.@switch_vlan[2].ports="8t 0" +uci set network.@switch_vlan[2].device="switch0" + +uci add network switch_vlan +uci set network.@switch_vlan[3].vlan=13 +uci set network.@switch_vlan[3].ports="8t 1" +uci set network.@switch_vlan[3].device="switch0" + +uci add network switch_vlan +uci set network.@switch_vlan[4].vlan=14 +uci set network.@switch_vlan[4].ports="8t 2" +uci set network.@switch_vlan[4].device="switch0" + +uci set network.lan.ifname="eth0.10" +uci set network.wan1.ifname="eth0.11" +uci set network.wan2.ifname="eth0.12" +uci set network.wan3.ifname="eth0.13" +uci set network.wan4.ifname="eth0.14" + uci commit exit 0 diff --git a/root/target/linux/sunxi/base-files/lib/network/switch.sh b/root/target/linux/sunxi/base-files/lib/network/switch.sh deleted file mode 100755 index f20d2609..00000000 --- a/root/target/linux/sunxi/base-files/lib/network/switch.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -# Copyright (C) 2009 OpenWrt.org -# Copyright (c) 2021 Oliver Welter - -setup_switch_dsa() { - local tries=15 - - /bin/sleep 10 - - local bridge_names=`/sbin/uci show network | /bin/grep type | /bin/grep bridge | /usr/bin/cut -d . -f2` - - for name in $bridge_names; do - local bridge_interface=`/sbin/uci get network.$name.ifname` - local trycount=1 - - while true; do - local my_interface="" - - for intf in $bridge_interface; do - local eth=`/bin/echo $intf | /bin/grep -v eth` - - if [ "$eth" != "" ]; then - my_interface="$eth" - fi - done - - if [ "$my_interface" = "" ]; then - break - fi - - local has_interface=`/sbin/ifconfig $my_interface >/dev/null 2>&1 && echo 1` - - if [ "$has_interface" = "" ]; then - /bin/sleep 1 - - trycount=$(($trycount+1)) - - if [ $trycount -gt $tries ]; then - break - fi - else - break - fi - done - - if [ "$has_interface" = "1" -a "$bridge_interface" != "" ]; then - for iface in $bridge_interface; do - local eth=`/bin/echo $iface | /bin/grep eth` - - if [ "$eth" != "" ]; then - local vlan=`/bin/echo $iface | /usr/bin/cut -d . -f2` - - if [ "$vlan" != "" ]; then - if [ "$vlan" = "$eth" ]; then - /usr/bin/logger -t switch.sh "Found interface $my_interface for alias $iface in bridge $name - adding to master" - /usr/sbin/bridge vlan add dev $my_interface vid 1 master - else - /usr/bin/logger -t switch.sh "Found interface $my_interface for alias $iface in bridge $name - adding to VLAN $vlan" - /usr/sbin/bridge vlan add dev $my_interface vid $vlan pvid untagged - fi - fi - fi - done - fi - done -} - -setup_switch_dev() { - local name - config_get name "$1" name - name="${name:-$1}" - [ -d "/sys/class/net/$name" ] && ip link set dev "$name" up - swconfig dev "$name" load network -} - -setup_switch() { - config_load network - - if [ -f "/etc/.lamobo-r1.dsa" ]; then - setup_switch_dsa & return - else - config_foreach setup_switch_dev switch - fi -} diff --git a/root/target/linux/sunxi/base-files/sbin/swconfig-wrapper.sh b/root/target/linux/sunxi/base-files/sbin/swconfig-wrapper.sh new file mode 100644 index 00000000..aeccbc9e --- /dev/null +++ b/root/target/linux/sunxi/base-files/sbin/swconfig-wrapper.sh @@ -0,0 +1,350 @@ +#!/bin/sh +# swconfig wrapper for BPI-R1 switch in DSA enabled environment +# Copyright (c) 2021 Oliver Welter + +SWCONFIG="/sbin/swconfig" +SWCONFIG_REAL="$SWCONFIG.real" +SWCONFIG_DSA="$SWCONFIG.dsa" +SWCONFIG_WRAPPER="$SWCONFIG-wrapper.sh" +SWCONFIG_LINK=`readlink $SWCONFIG` + +DSA_MAP="/etc/dsa.map" +DSA_MODE=0 + +UCI="/sbin/uci" +GREP="/bin/grep" +CUT="/usr/bin/cut" +AWK="/usr/bin/awk" +IP="/sbin/ip" + +SWITCHNULL="switch0" + +[ -f "$DSA_MAP" ] && DSA_MODE=1 + +if [ "$1" = "setup-wrapper" ]; then + if [ "$SWCONFIG_LINK" = "$SWCONFIG_WRAPPER" ]; then + echo "Already linked to wrapper" >/dev/stderr + exit 1 + elif [ -x "$SWCONFIG" ]; then + mv $SWCONFIG $SWCONFIG_REAL && \ + ln -sf $SWCONFIG_WRAPPER $SWCONFIG && \ + exit 0 || exit $? + else + echo "Unable to find swconfig binary" >/dev/stderr + exit 2 + fi +elif [ "$DSA_MODE" = 0 ]; then + if [ "$1" = "" ]; then + $SWCONFIG_REAL && exit 0 || exit $? + elif [ "$2" = "" ]; then + $SWCONFIG_REAL $1 && exit 0 || exit $? + elif [ "$3" = "" ]; then + $SWCONFIG_REAL $1 $2 && exit 0 || exit $? + elif [ "$4" = "" ]; then + $SWCONFIG_REAL $1 $2 $3 && exit 0 || exit $? + elif [ "$5" = "" ]; then + $SWCONFIG_REAL $1 $2 $3 $4 && exit 0 || exit $? + elif [ "$6" = "" ]; then + $SWCONFIG_REAL $1 $2 $3 $4 $5 && exit 0 || exit $? + elif [ "$7" = "" ]; then + $SWCONFIG_REAL $1 $2 $3 $4 $5 $6 && exit 0 || exit $? + else + exit 255 + fi +fi + +. $DSA_MAP + + get_interface_by_portlist() { + local ports="$1" + + for port in $ports; do + port_id=`echo $port | $CUT -d "t" -f1` + port_tagged=`echo $port | $GREP "t" >/dev/null 2>&1 && echo 1 || echo 0` + interface=`eval echo "\${port_$port_id}"` + name=`eval echo "\${port_name_$port_id}"` + + echo "$port_id:$port_tagged:$interface:$name" + done +} + +swconfig_usage() { + echo "WARNING: swconfig runs in DSA wrapper mode" + $SWCONFIG_REAL && exit 0 || exit $? +} + +swconfig_port_get() { + local port="$1" + local key="$2" + + return 0 +} + +swconfig_vlan_get() { + local vlan="$1" + local key="$2" + + return 0 +} + +swconfig_get() { + local key="$1" + + case $key in + reset|reset_mib|apply) + # This is ignored, but leads to exit code 0 to not confuse the networking scripts + return 0 + ;; + *) + echo "Unknown key $key for device" >/dev/stderr + return 1 + ;; + esac + + return 0 +} + +swconfig_port_set() { + local port="$1" + local key="$2" + local val="$3" + + case $key in + *) + echo "Unknown key $key for port" >/dev/stderr + return 1 + ;; + esac + + return 0 +} + +swconfig_vlan_set() { + local vlan="$1" + local key="$2" + local val="$3" + + case $key in + *) + echo "Unknown key $key for vlan" >/dev/stderr + return 1 + ;; + esac + + return 0 +} + +swconfig_set() { + local key="$1" + local val="$2" + + case $key in + reset|reset_mib|apply) + # This is ignored, but leads to exit code 0 to not confuse the networking scripts + return 0 + ;; + *) + echo "Unknown key $key for device" >/dev/stderr + return 1 + ;; + esac + + return 0 +} + +swconfig_port_load() { + local port="$1" + local config="$2" + + return 0 +} + +swconfig_vlan_load() { + local vlan="$1" + local config="$2" + + return 0 +} + +swconfig_load() { + local config="$1" + + # This is the part, where the magic happens. + # Due to its structure, swconfig gets the configuration to use by itself. + # At this point, we use uci to fetch the configuration for the vlans to setup. + + [ "$config" != "network" ] && return 1 + + # Set the CPU port + local CPUPORT=`eval echo "\${port_$port_cpu}"` + + # Bring up the CPU port + $IP link set $CPUPORT up + + for section in `$UCI show $config | $GREP "=switch_vlan" | $CUT -d "=" -f1`; do + section_id=`$UCI show $section | $GREP "=switch_vlan" | $CUT -d "=" -f1 | $CUT -d "." -f2` + + vlan=`$UCI show $config.$section_id.vlan | $CUT -d "=" -f2 | $CUT -d "'" -f2` + ports=`$UCI show $config.$section_id.ports | $CUT -d "=" -f2 | $CUT -d "'" -f2` + device=`$UCI show $config.$section_id.device | $CUT -d "=" -f2 | $CUT -d "'" -f2` + + [ "$device" != "$SWITCHNULL" ] && continue + + for iface in `get_interface_by_portlist $ports`; do + port_id=`echo $iface | $CUT -d ":" -f1` + + # We just want the CPU ports here + [ "$port_id" != "$port_cpu" ] && continue + + port_tagged=`echo $iface | $CUT -d ":" -f2` + interface=`echo $iface | $CUT -d ":" -f3` + name=`echo $iface | $CUT -d ":" -f4` + + # At this point, we have all we need. + if [ "$port_tagged" = 1 ]; then + # Tag the traffic on CPU port as master interface + $IP link add link $interface name $interface.$vlan type vlan id $vlan + + # Bring up the master interface before the slaves + $IP link set $interface.$vlan up + fi + done + + for iface in `get_interface_by_portlist $ports`; do + port_id=`echo $iface | $CUT -d ":" -f1` + + # We just want the slave ports here + [ "$port_id" = "$port_cpu" ] && continue + + port_tagged=`echo $iface | $CUT -d ":" -f2` + interface=`echo $iface | $CUT -d ":" -f3` + name=`echo $iface | $CUT -d ":" -f4` + + if [ "$port_tagged" = 1 ]; then + interface="$interface.$vlan" + fi + + # Bring up the slave interface + $IP link set $interface up + + # Create the bridge + $IP link add name $name type bridge + + # Set VLAN filtering and PVID + $IP link set dev $name type bridge vlan_filtering 1 vlan_default_pvid $vlan + done + + for iface in `get_interface_by_portlist $ports`; do + port_id=`echo $iface | $CUT -d ":" -f1` + port_tagged=`echo $iface | $CUT -d ":" -f2` + interface=`echo $iface | $CUT -d ":" -f3` + name=`echo $iface | $CUT -d ":" -f4` + + if [ "$port_tagged" = 1 ]; then + interface="$interface.$vlan" + fi + + # Add port to its corresponding bridge + $IP link set dev $interface master $name + done + done + + return 0 +} + +swconfig_port_show() { + local port="$1" + + return 0 +} + +swconfig_vlan_show() { + local vlan="$1" + + return 0 +} + +swconfig_show() { + return 0 +} + +case $1 in + dev) + device="$2" + mode="$3" + op="$5" + + key="$6" + val="$7" + + port="" + vlan="" + + case $3 in + port) + port="$4" + ;; + vlan) + vlan="$4" + ;; + *) + mode="switch" + op="$3" + key="$4" + val="$5" + ;; + esac + + case $op in + help) + $SWCONFIG_REAL $1 $2 $3 $4 && exit 0 || exit $? + ;; + set) + if [ "$mode" = "port" ]; then + swconfig_port_set $port $key $val && exit 0 || exit $? + elif [ "$mode" = "vlan" ]; then + swconfig_vlan_set $vlan $key $val && exit 0 || exit $? + else + swconfig_set $key $val && exit 0 || exit $? + fi + ;; + get) + if [ "$mode" = "port" ]; then + swconfig_port_get $port $key && exit 0 || exit $? + elif [ "$mode" = "vlan" ]; then + swconfig_vlan_get $vlan $key && exit 0 || exit $? + else + swconfig_get $key && exit 0 || exit $? + fi + ;; + load) + if [ "$mode" = "port" ]; then + swconfig_port_load $port $key && exit 0 || exit $? + elif [ "$mode" = "vlan" ]; then + swconfig_vlan_load $vlan $key && exit 0 || exit $? + else + swconfig_load $key && exit 0 || exit $? + fi + ;; + show) + if [ "$mode" = "port" ]; then + swconfig_port_show $port && exit 0 || exit $? + elif [ "$mode" = "vlan" ]; then + swconfig_vlan_show $vlan && exit 0 || exit $? + else + swconfig_show && exit 0 || exit $? + fi + ;; + *) + swconfig_usage + ;; + esac + ;; + list) + echo $SWITCHNULL + exit 0 + ;; + *) + swconfig_usage + ;; +esac From 9cd7fa498885c2412317a8541a429454f92077a5 Mon Sep 17 00:00:00 2001 From: Olli Date: Wed, 10 Mar 2021 23:32:40 +0100 Subject: [PATCH 37/38] Chmod to 755 swconfig-wrapper.sh --- root/target/linux/sunxi/base-files/sbin/swconfig-wrapper.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 root/target/linux/sunxi/base-files/sbin/swconfig-wrapper.sh diff --git a/root/target/linux/sunxi/base-files/sbin/swconfig-wrapper.sh b/root/target/linux/sunxi/base-files/sbin/swconfig-wrapper.sh old mode 100644 new mode 100755 From e7587826dbc0c9e983024085efe1c67981bf39f8 Mon Sep 17 00:00:00 2001 From: Olli Date: Wed, 10 Mar 2021 23:34:05 +0100 Subject: [PATCH 38/38] Enabled swconfig-wrapper --- .../linux/sunxi/base-files/etc/uci-defaults/99-switch-config | 1 + 1 file changed, 1 insertion(+) mode change 100755 => 100644 root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config diff --git a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config old mode 100755 new mode 100644 index 1d24c6d5..2eb372c6 --- a/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config +++ b/root/target/linux/sunxi/base-files/etc/uci-defaults/99-switch-config @@ -14,6 +14,7 @@ port_2_name="wan4" port_8_name="cpu" port_cpu="8" ' > /etc/dsa.map +/sbin/swconfig-wrapper.sh setup-wrapper fi uci delete network.@switch_vlan[0]