Skip to content

Commit

Permalink
unit 01 reflash all slot 1 partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
j005u committed Sep 14, 2022
1 parent bb7435c commit a5d5670
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion units/01-corrupt_slot_1.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#/bin/sh

#this script enforces wtfos usage to slot 1 and will re-flash slot 1 before switching if it appears corrupt
check () {
#check whatever our conditions is - this may be more complicated for other issues
if [ $(unrd slot_1.status_successful) != "1" ] || [ $(slot_1.status_bootable) != "1" ]; then
if [ $(unrd slot_1.status_successful) != "1" ] || [ $(unrd slot_1.status_bootable) != "1" ]; then
echo "Slot 1 is corrupt, can reflash from Slot 2"
return 2

Expand All @@ -11,10 +14,15 @@ fix () {
echo "reflashing slot_1"
echo "please wait, this will take a few minutes"
dd if=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/system of=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/system_2 bs=1048675
dd if=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/vendor of=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/vendor_2 bs=1048675
dd if=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/cp of=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/cp_2 bs=1048675
dd if=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/normal of=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/normal_2 bs=1048675
dd if=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/rf_nvram of=/dev/block/platform/soc/f0000000.ahb/f0400000.dwmmc0/mirror/rf_nvram_2 bs=1048675
unrd slot_1.status_successful 1
unrd slot_1.status_active 1
unrd slot_1.status_bootable 1
unrd slot_2.status_active 0
unrd force_ota 0
echo "Slot 1 restored to good state"
echo "Rebooting"
reboot
Expand Down

0 comments on commit a5d5670

Please sign in to comment.