From 1fa04b5d9fb1cba56a8597d6da9e1d52b8030f6b Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sat, 18 Jan 2020 02:21:13 +0100 Subject: 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/lib/preinit/06_set_iface_mac | 46 --------------------- .../mvebu/base-files/lib/preinit/81_linksys_syscfg | 37 ----------------- target/linux/mvebu/base-files/lib/preinit/82_uDPU | 48 ---------------------- 3 files changed, 131 deletions(-) delete mode 100644 target/linux/mvebu/base-files/lib/preinit/06_set_iface_mac delete mode 100644 target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg delete mode 100644 target/linux/mvebu/base-files/lib/preinit/82_uDPU (limited to 'target/linux/mvebu/base-files/lib/preinit') diff --git a/target/linux/mvebu/base-files/lib/preinit/06_set_iface_mac b/target/linux/mvebu/base-files/lib/preinit/06_set_iface_mac deleted file mode 100644 index fd41836c8d..0000000000 --- a/target/linux/mvebu/base-files/lib/preinit/06_set_iface_mac +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (C) 2014-2015 OpenWrt.org -# Copyright (C) 2016 LEDE-Project.org -# - -preinit_set_mac_address() { - local mac - - . /lib/functions.sh - - case $(board_name) in - linksys,caiman|linksys,cobra|linksys,rango|linksys,shelby|linksys,venom) - # rename interfaces back to the way they were with 4.4 - case "$(readlink /sys/class/net/eth0)" in - *f1070000*) - ip link set eth0 name tmp0 - ip link set eth1 name eth0 - ip link set tmp0 name eth1 - ;; - esac - - mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - mac_wan=$(macaddr_setbit_la "$mac") - ip link set dev eth0 address $mac 2>/dev/null - ip link set dev eth1 address $mac_wan 2>/dev/null - ;; - linksys,mamba) - mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - ip link set dev eth0 address $mac 2>/dev/null - ip link set dev eth1 address $mac 2>/dev/null - ;; - marvell,a385-db-ap|solidrun,clearfog*a1) - # rename interfaces back to the way they were with 4.4 - case "$(readlink /sys/class/net/eth0)" in - *f1070000*) - ip link set eth0 name tmp0 - ip link set eth1 name eth0 - ip link set eth2 name eth1 - ip link set tmp0 name eth2 - ;; - esac - ;; - esac -} - -boot_hook_add preinit_main preinit_set_mac_address diff --git a/target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg b/target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg deleted file mode 100644 index 83448e5ace..0000000000 --- a/target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (C) 2014-2016 OpenWrt.org -# Copyright (C) 2016 LEDE-Project.org -# - -preinit_mount_syscfg() { - . /lib/functions.sh - . /lib/upgrade/common.sh - - case $(board_name) in - linksys,caiman|linksys,cobra|linksys,mamba|linksys,rango|linksys,shelby|linksys,venom) - needs_recovery=0 - syscfg_part=$(grep syscfg /proc/mtd |cut -c4) - ubiattach -m $syscfg_part || needs_recovery=1 - if [ $needs_recovery -eq 1 ] - then - echo "ubifs syscfg partition is damaged, reformatting" - ubidetach -m $syscfg_part - ubiformat -y -O 2048 -q /dev/mtd$syscfg_part - ubiattach -m $syscfg_part - ubimkvol /dev/ubi1 -n 0 -N syscfg -t dynamic --maxavsize - fi - mkdir /tmp/syscfg - mount -t ubifs ubi1:syscfg /tmp/syscfg - [ -f "/tmp/syscfg/$BACKUP_FILE" ] && { - echo "- config restore -" - cd / - mv "/tmp/syscfg/$BACKUP_FILE" /tmp - tar xzf "/tmp/$BACKUP_FILE" - rm -f "/tmp/$BACKUP_FILE" - sync - } - ;; - esac -} - -boot_hook_add preinit_main preinit_mount_syscfg diff --git a/target/linux/mvebu/base-files/lib/preinit/82_uDPU b/target/linux/mvebu/base-files/lib/preinit/82_uDPU deleted file mode 100644 index 12bbfc3725..0000000000 --- a/target/linux/mvebu/base-files/lib/preinit/82_uDPU +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright (C) 2014-2019 OpenWrt.org -# Copyright (C) 2016 LEDE-Project.org -# - -preinit_mount_udpu() { - . /lib/functions.sh - . /lib/upgrade/common.sh - - case $(board_name) in - methode,udpu) - # Check which device is detected - [ -b "/dev/mmcblk0" ] && mmcdev="/dev/mmcblk0" || mmcdev="/dev/mmcblk1" - - if [ -b "${mmcdev}p4" ]; then - mkdir /misc - mount -t f2fs ${mmcdev}p4 /misc - [ -f "/misc/$BACKUP_FILE" ] && { - echo "- Restoring configuration files -" - tar xzf "/misc/$BACKUP_FILE" -C / - rm -f "/misc/$BACKUP_FILE" - sync - } - [ -f "/misc/firmware/recovery.itb" ] && { - echo "- Updating /recovery partition -" - mkfs.ext4 -q ${mmcdev}p2 | echo y &> /dev/null - mkdir -p /tmp/recovery - mount ${mmcdev}p2 /tmp/recovery - cp /misc/firmware/recovery.itb /tmp/recovery - [ -f "/misc/firmware/boot.scr" ] && \ - cp /misc/firmware/boot.scr /tmp/recovery - sync - umount /tmp/recovery - rm -rf /tmp/recovery - - # Replace previous backup with the new one - [ -d "/misc/firmware_old" ] && rm -rf /misc/firmware_old - [ -d "/misc/firmware" ] && mv /misc/firmware /misc/firmware_old - } - fi - - # Legacy support - if rootfs was booted, instruct u-boot to keep the current root dev - [ "$(df | grep /dev/root)" ] && fw_setenv root_ok '2' - ;; - esac -} - -boot_hook_add preinit_main preinit_mount_udpu -- cgit v1.2.3