From 1fa04b5d9fb1cba56a8597d6da9e1d52b8030f6b Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sat, 18 Jan 2020 02:21:13 +0100 Subject: [PATCH] mvebu: split base-files across subtargets For the mvebu target in particular, there is a lot of files in base-files that are only relevant for one subtarget. Improve overview and reduce size per subtarget by moving/splitting base-files depending on the subtarget they belong to. While at it, consolidate 01_leds by using the model part of the board name as variable. Signed-off-by: Adrian Schmutzler Acked-by: Tomasz Maciej Nowak --- .../mvebu/base-files/etc/board.d/01_leds | 55 ----------------- .../mvebu/base-files/lib/upgrade/platform.sh | 52 ---------------- .../base-files/etc/board.d/02_network | 31 ++++++++++ .../base-files/lib/preinit/82_uDPU | 0 .../base-files/lib/upgrade/platform.sh | 52 ++++++++++++++++ .../base-files/lib/upgrade/uDPU.sh | 0 .../base-files/etc/board.d/02_network | 30 ++++++++++ .../base-files/lib/upgrade/platform.sh | 37 ++++++++++++ .../cortexa9/base-files/etc/board.d/01_leds | 40 +++++++++++++ .../base-files/etc/board.d/02_network | 24 +------- .../base-files/etc/init.d/bootcount | 0 .../base-files/etc/uci-defaults/03_wireless | 0 .../base-files/etc/uci-defaults/04_mambafan | 0 .../base-files/lib/preinit/06_set_iface_mac | 0 .../base-files/lib/preinit/81_linksys_syscfg | 0 .../base-files/lib/upgrade/linksys.sh | 0 .../base-files/lib/upgrade/platform.sh | 59 +++++++++++++++++++ 17 files changed, 251 insertions(+), 129 deletions(-) delete mode 100755 target/linux/mvebu/base-files/etc/board.d/01_leds delete mode 100755 target/linux/mvebu/base-files/lib/upgrade/platform.sh create mode 100755 target/linux/mvebu/cortexa53/base-files/etc/board.d/02_network rename target/linux/mvebu/{ => cortexa53}/base-files/lib/preinit/82_uDPU (100%) create mode 100755 target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh rename target/linux/mvebu/{ => cortexa53}/base-files/lib/upgrade/uDPU.sh (100%) create mode 100755 target/linux/mvebu/cortexa72/base-files/etc/board.d/02_network create mode 100755 target/linux/mvebu/cortexa72/base-files/lib/upgrade/platform.sh create mode 100755 target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds rename target/linux/mvebu/{ => cortexa9}/base-files/etc/board.d/02_network (66%) rename target/linux/mvebu/{ => cortexa9}/base-files/etc/init.d/bootcount (100%) rename target/linux/mvebu/{ => cortexa9}/base-files/etc/uci-defaults/03_wireless (100%) rename target/linux/mvebu/{ => cortexa9}/base-files/etc/uci-defaults/04_mambafan (100%) rename target/linux/mvebu/{ => cortexa9}/base-files/lib/preinit/06_set_iface_mac (100%) rename target/linux/mvebu/{ => cortexa9}/base-files/lib/preinit/81_linksys_syscfg (100%) rename target/linux/mvebu/{ => cortexa9}/base-files/lib/upgrade/linksys.sh (100%) create mode 100755 target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh diff --git a/target/linux/mvebu/base-files/etc/board.d/01_leds b/target/linux/mvebu/base-files/etc/board.d/01_leds deleted file mode 100755 index 14313ee664..0000000000 --- a/target/linux/mvebu/base-files/etc/board.d/01_leds +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2014-2016 OpenWrt.org -# Copyright (C) 2016 LEDE-Project.org -# - -. /lib/functions/uci-defaults.sh - -board_config_update - -board=$(board_name) - -case "$board" in -linksys,caiman) - ucidef_set_led_netdev "wan" "WAN" "pca963x:caiman:white:wan" "eth1" - ucidef_set_led_usbport "usb1" "USB 1" "pca963x:caiman:white:usb2" "usb1-port1" - ucidef_set_led_usbport "usb2" "USB 2" "pca963x:caiman:white:usb3_1" "usb2-port1" "usb3-port1" - ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:caiman:white:usb3_2" "usb3-port1" - ;; -linksys,cobra) - ucidef_set_led_netdev "wan" "WAN" "pca963x:cobra:white:wan" "eth1" - ucidef_set_led_usbport "usb1" "USB 1" "pca963x:cobra:white:usb2" "usb1-port1" - ucidef_set_led_usbport "usb2" "USB 2" "pca963x:cobra:white:usb3_1" "usb2-port1" "usb3-port1" - ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:cobra:white:usb3_2" "usb3-port1" - ;; -linksys,mamba) - ucidef_set_led_netdev "wan" "WAN" "mamba:white:wan" "eth1" - ucidef_set_led_usbport "usb1" "USB 1" "mamba:white:usb2" "usb1-port1" - ucidef_set_led_usbport "usb2" "USB 2" "mamba:white:usb3_1" "usb2-port1" "usb3-port1" - ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "mamba:white:usb3_2" "usb3-port2" - ;; -linksys,rango) - ucidef_set_led_netdev "wan" "WAN" "pca963x:rango:white:wan" "eth1" - ucidef_set_led_usbport "usb1" "USB 1" "pca963x:rango:white:usb2" "usb1-port1" - ucidef_set_led_usbport "usb2" "USB 2" "pca963x:rango:white:usb3_1" "usb2-port1" "usb3-port1" - ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:rango:white:usb3_2" "usb3-port1" - ;; -linksys,shelby) - ucidef_set_led_netdev "wan" "WAN" "pca963x:shelby:white:wan" "eth1" - ucidef_set_led_usbport "usb1" "USB 1" "pca963x:shelby:white:usb2" "usb1-port1" - ucidef_set_led_usbport "usb2" "USB 2" "pca963x:shelby:white:usb3_1" "usb2-port1" "usb3-port1" - ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:shelby:white:usb3_2" "usb3-port1" - ;; -linksys,venom) - ucidef_set_led_netdev "wan" "WAN" "pca963x:venom:blue:wan" "eth1" - ucidef_set_led_usbport "usb1" "USB 1" "pca963x:venom:blue:usb2" "usb1-port1" - ucidef_set_led_usbport "usb2" "USB 2" "pca963x:venom:blue:usb3_1" "usb2-port1" "usb3-port1" - ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:venom:blue:usb3_2" "usb3-port1" - ;; - -esac - -board_config_flush - -exit 0 diff --git a/target/linux/mvebu/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/base-files/lib/upgrade/platform.sh deleted file mode 100755 index 0223b72d71..0000000000 --- a/target/linux/mvebu/base-files/lib/upgrade/platform.sh +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (C) 2014-2016 OpenWrt.org -# Copyright (C) 2016 LEDE-Project.org -# - -RAMFS_COPY_BIN='fw_printenv fw_setenv' -RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' -REQUIRE_IMAGE_METADATA=1 - -platform_check_image() { - case "$(board_name)" in - cznic,turris-omnia|globalscale,espressobin|globalscale,espressobin-emmc|globalscale,espressobin-v7|globalscale,espressobin-v7-emmc|\ - marvell,armada8040-mcbin|solidrun,clearfog-base-a1|solidrun,clearfog-pro-a1) - platform_check_image_sdcard "$1" - ;; - *) - return 0 - ;; - esac -} - -platform_do_upgrade() { - case "$(board_name)" in - linksys,caiman|linksys,cobra|linksys,mamba|linksys,rango|linksys,shelby|linksys,venom) - platform_do_upgrade_linksys "$1" - ;; - cznic,turris-omnia|globalscale,espressobin|globalscale,espressobin-emmc|globalscale,espressobin-v7|globalscale,espressobin-v7-emmc|\ - marvell,armada8040-mcbin|solidrun,clearfog-base-a1|solidrun,clearfog-pro-a1) - platform_do_upgrade_sdcard "$1" - ;; - methode,udpu) - platform_do_upgrade_uDPU "$1" - ;; - *) - default_do_upgrade "$1" - ;; - esac -} -platform_copy_config() { - case "$(board_name)" in - linksys,caiman|linksys,cobra|linksys,mamba|linksys,rango|linksys,shelby|linksys,venom) - platform_copy_config_linksys - ;; - cznic,turris-omnia|globalscale,espressobin|globalscale,espressobin-emmc|globalscale,espressobin-v7|globalscale,espressobin-v7-emmc|\ - marvell,armada8040-mcbin|solidrun,clearfog-base-a1|solidrun,clearfog-pro-a1) - platform_copy_config_sdcard - ;; - methode,udpu) - platform_copy_config_uDPU - ;; - esac -} diff --git a/target/linux/mvebu/cortexa53/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa53/base-files/etc/board.d/02_network new file mode 100755 index 0000000000..ba4b930426 --- /dev/null +++ b/target/linux/mvebu/cortexa53/base-files/etc/board.d/02_network @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Copyright (C) 2014-2016 OpenWrt.org +# Copyright (C) 2016 LEDE-Project.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +globalscale,espressobin|\ +globalscale,espressobin-emmc|\ +globalscale,espressobin-v7|\ +globalscale,espressobin-v7-emmc) + ucidef_set_interfaces_lan_wan "lan0 lan1" "wan" + ;; +marvell,armada-3720-db|\ +methode,udpu) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ;; +*) + ucidef_set_interface_lan "eth0" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/mvebu/base-files/lib/preinit/82_uDPU b/target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU similarity index 100% rename from target/linux/mvebu/base-files/lib/preinit/82_uDPU rename to target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU diff --git a/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..cdf5933272 --- /dev/null +++ b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh @@ -0,0 +1,52 @@ +# +# Copyright (C) 2014-2016 OpenWrt.org +# Copyright (C) 2016 LEDE-Project.org +# + +RAMFS_COPY_BIN='fw_printenv fw_setenv' +RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + case "$(board_name)" in + globalscale,espressobin|\ + globalscale,espressobin-emmc|\ + globalscale,espressobin-v7|\ + globalscale,espressobin-v7-emmc) + platform_check_image_sdcard "$1" + ;; + *) + return 0 + ;; + esac +} + +platform_do_upgrade() { + case "$(board_name)" in + globalscale,espressobin|\ + globalscale,espressobin-emmc|\ + globalscale,espressobin-v7|\ + globalscale,espressobin-v7-emmc) + platform_do_upgrade_sdcard "$1" + ;; + methode,udpu) + platform_do_upgrade_uDPU "$1" + ;; + *) + default_do_upgrade "$1" + ;; + esac +} +platform_copy_config() { + case "$(board_name)" in + globalscale,espressobin|\ + globalscale,espressobin-emmc|\ + globalscale,espressobin-v7|\ + globalscale,espressobin-v7-emmc) + platform_copy_config_sdcard + ;; + methode,udpu) + platform_copy_config_uDPU + ;; + esac +} diff --git a/target/linux/mvebu/base-files/lib/upgrade/uDPU.sh b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/uDPU.sh similarity index 100% rename from target/linux/mvebu/base-files/lib/upgrade/uDPU.sh rename to target/linux/mvebu/cortexa53/base-files/lib/upgrade/uDPU.sh diff --git a/target/linux/mvebu/cortexa72/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa72/base-files/etc/board.d/02_network new file mode 100755 index 0000000000..080e32ada3 --- /dev/null +++ b/target/linux/mvebu/cortexa72/base-files/etc/board.d/02_network @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright (C) 2014-2016 OpenWrt.org +# Copyright (C) 2016 LEDE-Project.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +marvell,armada8040-mcbin) + ucidef_set_interfaces_lan_wan "eth0 eth1 eth3" "eth2" + ;; +marvell,armada8040-db) + ucidef_set_interfaces_lan_wan "eth0 eth2 eth3" "eth1" + ;; +marvell,armada7040-db) + ucidef_set_interfaces_lan_wan "eth0 eth2" "eth1" + ;; +*) + ucidef_set_interface_lan "eth0" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/mvebu/cortexa72/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa72/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..2428de08c4 --- /dev/null +++ b/target/linux/mvebu/cortexa72/base-files/lib/upgrade/platform.sh @@ -0,0 +1,37 @@ +# +# Copyright (C) 2014-2016 OpenWrt.org +# Copyright (C) 2016 LEDE-Project.org +# + +RAMFS_COPY_BIN='fw_printenv fw_setenv' +RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + case "$(board_name)" in + marvell,armada8040-mcbin) + platform_check_image_sdcard "$1" + ;; + *) + return 0 + ;; + esac +} + +platform_do_upgrade() { + case "$(board_name)" in + marvell,armada8040-mcbin) + platform_do_upgrade_sdcard "$1" + ;; + *) + default_do_upgrade "$1" + ;; + esac +} +platform_copy_config() { + case "$(board_name)" in + marvell,armada8040-mcbin) + platform_copy_config_sdcard + ;; + esac +} diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds b/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds new file mode 100755 index 0000000000..a7762f0080 --- /dev/null +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Copyright (C) 2014-2016 OpenWrt.org +# Copyright (C) 2016 LEDE-Project.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) +boardname="${board##*,}" + +case "$board" in +linksys,caiman|\ +linksys,cobra|\ +linksys,rango|\ +linksys,shelby) + ucidef_set_led_netdev "wan" "WAN" "pca963x:$boardname:white:wan" "eth1" + ucidef_set_led_usbport "usb1" "USB 1" "pca963x:$boardname:white:usb2" "usb1-port1" + ucidef_set_led_usbport "usb2" "USB 2" "pca963x:$boardname:white:usb3_1" "usb2-port1" "usb3-port1" + ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:$boardname:white:usb3_2" "usb3-port1" + ;; +linksys,mamba) + ucidef_set_led_netdev "wan" "WAN" "mamba:white:wan" "eth1" + ucidef_set_led_usbport "usb1" "USB 1" "mamba:white:usb2" "usb1-port1" + ucidef_set_led_usbport "usb2" "USB 2" "mamba:white:usb3_1" "usb2-port1" "usb3-port1" + ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "mamba:white:usb3_2" "usb3-port2" + ;; +linksys,venom) + ucidef_set_led_netdev "wan" "WAN" "pca963x:venom:blue:wan" "eth1" + ucidef_set_led_usbport "usb1" "USB 1" "pca963x:venom:blue:usb2" "usb1-port1" + ucidef_set_led_usbport "usb2" "USB 2" "pca963x:venom:blue:usb3_1" "usb2-port1" "usb3-port1" + ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:venom:blue:usb3_2" "usb3-port1" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/mvebu/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network similarity index 66% rename from target/linux/mvebu/base-files/etc/board.d/02_network rename to target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network index 283a856258..b10e1419b5 100755 --- a/target/linux/mvebu/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network @@ -15,12 +15,6 @@ cznic,turris-omnia) ucidef_set_interface_lan "lan0 lan1 lan2 lan3 lan4" ucidef_set_interface_wan "eth2" ;; -globalscale,espressobin|\ -globalscale,espressobin-emmc|\ -globalscale,espressobin-v7|\ -globalscale,espressobin-v7-emmc) - ucidef_set_interfaces_lan_wan "lan0 lan1" "wan" - ;; linksys,caiman|\ linksys,cobra|\ linksys,mamba|\ @@ -34,25 +28,11 @@ linksys,venom) marvell,a385-db-ap) ucidef_set_interfaces_lan_wan "eth0 eth1" "eth2" ;; -marvell,armada8040-mcbin) - ucidef_set_interfaces_lan_wan "eth0 eth1 eth3" "eth2" - ;; -marvell,armada8040-db) - ucidef_set_interfaces_lan_wan "eth0 eth2 eth3" "eth1" - ;; -marvell,armada7040-db) - ucidef_set_interfaces_lan_wan "eth0 eth2" "eth1" - ;; -marvell,armada-3720-db) - ucidef_set_interfaces_lan_wan "eth1" "eth0" - ;; marvell,axp-gp) ucidef_set_interface_lan "eth0 eth1 eth2 eth3" ;; -methode,udpu) - ucidef_set_interfaces_lan_wan "eth1" "eth0" - ;; -solidrun,clearfog-a1|solidrun,clearfog-pro-a1) +solidrun,clearfog-a1|\ +solidrun,clearfog-pro-a1) # eth0 is standalone ethernet # eth1 is switch # eth2 is SFP diff --git a/target/linux/mvebu/base-files/etc/init.d/bootcount b/target/linux/mvebu/cortexa9/base-files/etc/init.d/bootcount similarity index 100% rename from target/linux/mvebu/base-files/etc/init.d/bootcount rename to target/linux/mvebu/cortexa9/base-files/etc/init.d/bootcount diff --git a/target/linux/mvebu/base-files/etc/uci-defaults/03_wireless b/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/03_wireless similarity index 100% rename from target/linux/mvebu/base-files/etc/uci-defaults/03_wireless rename to target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/03_wireless diff --git a/target/linux/mvebu/base-files/etc/uci-defaults/04_mambafan b/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/04_mambafan similarity index 100% rename from target/linux/mvebu/base-files/etc/uci-defaults/04_mambafan rename to target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/04_mambafan diff --git a/target/linux/mvebu/base-files/lib/preinit/06_set_iface_mac b/target/linux/mvebu/cortexa9/base-files/lib/preinit/06_set_iface_mac similarity index 100% rename from target/linux/mvebu/base-files/lib/preinit/06_set_iface_mac rename to target/linux/mvebu/cortexa9/base-files/lib/preinit/06_set_iface_mac diff --git a/target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg b/target/linux/mvebu/cortexa9/base-files/lib/preinit/81_linksys_syscfg similarity index 100% rename from target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg rename to target/linux/mvebu/cortexa9/base-files/lib/preinit/81_linksys_syscfg diff --git a/target/linux/mvebu/base-files/lib/upgrade/linksys.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh similarity index 100% rename from target/linux/mvebu/base-files/lib/upgrade/linksys.sh rename to target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..8baed969a3 --- /dev/null +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh @@ -0,0 +1,59 @@ +# +# Copyright (C) 2014-2016 OpenWrt.org +# Copyright (C) 2016 LEDE-Project.org +# + +RAMFS_COPY_BIN='fw_printenv fw_setenv' +RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + case "$(board_name)" in + cznic,turris-omnia|\ + solidrun,clearfog-base-a1|\ + solidrun,clearfog-pro-a1) + platform_check_image_sdcard "$1" + ;; + *) + return 0 + ;; + esac +} + +platform_do_upgrade() { + case "$(board_name)" in + cznic,turris-omnia|\ + solidrun,clearfog-base-a1|\ + solidrun,clearfog-pro-a1) + platform_do_upgrade_sdcard "$1" + ;; + linksys,caiman|\ + linksys,cobra|\ + linksys,mamba|\ + linksys,rango|\ + linksys,shelby|\ + linksys,venom) + platform_do_upgrade_linksys "$1" + ;; + *) + default_do_upgrade "$1" + ;; + esac +} +platform_copy_config() { + case "$(board_name)" in + cznic,turris-omnia|\ + solidrun,clearfog-base-a1|\ + solidrun,clearfog-pro-a1) + platform_copy_config_sdcard + ;; + linksys,caiman|\ + linksys,cobra|\ + linksys,mamba|\ + linksys,rango|\ + linksys,shelby|\ + linksys,venom) + platform_copy_config_linksys + ;; + esac +} -- 2.30.2