From: Stijn Tintel Date: Mon, 30 Nov 2020 21:32:54 +0000 (+0200) Subject: mvebu: sysupgrade support for TP-Link OC200 X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=cfa9a55dc2c54e26e99f00fd4b5353823ab40c0f;p=openwrt%2Fstaging%2Fstintel.git mvebu: sysupgrade support for TP-Link OC200 --- diff --git a/target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU b/target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU index 8d5a482b82..9005bb3ae6 100644 --- a/target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU +++ b/target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU @@ -43,6 +43,18 @@ preinit_mount_udpu() { # Legacy support - if rootfs was booted, instruct u-boot to keep the current root dev [ "$(df | grep /dev/root)" ] && fw_setenv root_ok '2' ;; + tplink,oc200) + if [ -b /dev/mmcblk0p4 ]; then + mkdir -p /data + mount -t ext4 /dev/mmcblk0p4 /data + [ -f "/data/$BACKUP_FILE" ] && { + echo "- Restoring configuration files -" + tar xzf "/data/$BACKUP_FILE" -C / + rm -f "/data/$BACKUP_FILE" + sync + } + fi + ;; esac } diff --git a/target/linux/mvebu/cortexa53/base-files/lib/upgrade/oc200.sh b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/oc200.sh new file mode 100644 index 0000000000..b94d5b45ae --- /dev/null +++ b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/oc200.sh @@ -0,0 +1,26 @@ +platform_do_prepare_oc200() { + if ! grep -q /data /proc/mounts; then + mkdir -p /data + mount /dev/mmcblk0p4 /data + fi +} + +platform_do_upgrade_oc200() { + platform_do_prepare_oc200 + platform_copy_config_oc200 + + grep -q /dev/mmcblk0p4 /proc/mounts && umount /data + grep -q /dev/root /proc/mounts && umount / + + dd if="$1" of=/dev/mmcblk0 bs=512 seek=896 + sync + + umount -l /tmp + umount -l /dev +} + +platform_copy_config_oc200() { + if [ -f "$UPGRADE_BACKUP" ]; then + cp -f "$UPGRADE_BACKUP" "/data/$BACKUP_FILE" + fi +} diff --git a/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh index cd41c39d7c..4011c88bee 100755 --- a/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh @@ -37,6 +37,9 @@ platform_do_upgrade() { methode,edpu) platform_do_upgrade_uDPU "$1" ;; + tplink,oc200) + platform_do_upgrade_oc200 "$1" + ;; *) default_do_upgrade "$1" ;; @@ -56,5 +59,8 @@ platform_copy_config() { methode,edpu) platform_copy_config_uDPU ;; + tplink,oc200) + platform_copy_config_oc200 + ;; esac }