From d88d552260730e97e683f1c039b35ddb303abce8 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 10 Feb 2022 00:39:38 +0800 Subject: [PATCH] add a windows version of the factory-reset command --- tools/factory_reset.ps1 | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tools/factory_reset.ps1 diff --git a/tools/factory_reset.ps1 b/tools/factory_reset.ps1 new file mode 100644 index 000000000..c81993431 --- /dev/null +++ b/tools/factory_reset.ps1 @@ -0,0 +1,45 @@ +Write-Output "This script will do a factory reset, removing all stored data and keys." +$title = 'Factory reset' +$question = 'Are you sure you want to proceed?' +$choices = '&Yes', '&No' + +$decision = $Host.UI.PromptForChoice($title, $question, $choices, 1) +if ($decision -eq 0) { + Write-Host 'confirmed' +} else { + Exit +} + +Invoke-WebRequest https://ci.betrusted.io/latest/loader.bin -OutFile loader.bin +python usb_update.py -l loader.bin +Remove-Item /tmp/loader.bin + +Write-Output "waiting for device to reboot" +Start-Sleep 5 + +Invoke-WebRequest https://ci.betrusted.io/latest/xous.img -OutFile xous.img +python usb_update.py -k xous.img +Remove-Item xous.img + +Write-Output "waiting for device to reboot" +Start-Sleep 5 + +Invoke-WebRequest https://ci.betrusted.io/latest/soc_csr.bin -OutFile soc_csr.bin +python usb_update.py --soc soc_csr.bin --force +Remove-Item soc_csr.bin + +Write-Output "waiting for device to reboot" +Start-Sleep 5 + +Invoke-WebRequest https://ci.betrusted.io/latest/ec_fw.bin -OutFile ec_fw.bin +python usb_update.py -e ec_fw.bin +Remove-Item soc_csr.bin + +Write-Output "waiting for device to reboot" +Start-Sleep 5 + +Invoke-WebRequest https://ci.betrusted.io/latest/wf200_fw.bin -OutFile wf200_fw.bin +python usb_update.py -w wf200_fw.bin +Remove-Item wf200_fw.bin + +Write-Output "IMPORTANT: you must run 'ecup auto' to update the EC with the staged firmware objects."