mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix update scripts so updates don't wipe root keys :-O
This commit is contained in:
parent
9878dfc1a9
commit
b39f4c38eb
6 changed files with 36 additions and 8 deletions
|
|
@ -40,7 +40,7 @@ Start-Sleep 5
|
||||||
|
|
||||||
Invoke-WebRequest https://ci.betrusted.io/releases/latest/soc_csr.bin -OutFile soc_csr.bin
|
Invoke-WebRequest https://ci.betrusted.io/releases/latest/soc_csr.bin -OutFile soc_csr.bin
|
||||||
Invoke-WebRequest https://ci.betrusted.io/releases/latest/loader.bin -OutFile loader.bin
|
Invoke-WebRequest https://ci.betrusted.io/releases/latest/loader.bin -OutFile loader.bin
|
||||||
python usb_update.py --enable-boot --soc soc_csr.bin -l loader.bin
|
python usb_update.py --enable-boot-wipe --soc soc_csr.bin -l loader.bin
|
||||||
Remove-Item soc_csr.bin
|
Remove-Item soc_csr.bin
|
||||||
Remove-Item loader.bin
|
Remove-Item loader.bin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ sleep 5
|
||||||
# this should sequence last because it overwrites all of the CSR values on the currently loaded SoC
|
# this should sequence last because it overwrites all of the CSR values on the currently loaded SoC
|
||||||
wget https://ci.betrusted.io/$REVISION/soc_csr.bin -O /tmp/soc_csr.bin
|
wget https://ci.betrusted.io/$REVISION/soc_csr.bin -O /tmp/soc_csr.bin
|
||||||
wget https://ci.betrusted.io/$REVISION/loader.bin -O /tmp/loader.bin
|
wget https://ci.betrusted.io/$REVISION/loader.bin -O /tmp/loader.bin
|
||||||
./usb_update.py --enable-boot --soc /tmp/soc_csr.bin -l /tmp/loader.bin
|
./usb_update.py --enable-boot-wipe --soc /tmp/soc_csr.bin -l /tmp/loader.bin
|
||||||
rm /tmp/loader.bin
|
rm /tmp/loader.bin
|
||||||
rm /tmp/soc_csr.bin
|
rm /tmp/soc_csr.bin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ Start-Sleep 5
|
||||||
|
|
||||||
Invoke-WebRequest https://ci.betrusted.io/latest-ci/loader.bin -OutFile loader.bin
|
Invoke-WebRequest https://ci.betrusted.io/latest-ci/loader.bin -OutFile loader.bin
|
||||||
Invoke-WebRequest https://ci.betrusted.io/latest-ci/soc_csr.bin -OutFile soc_csr.bin
|
Invoke-WebRequest https://ci.betrusted.io/latest-ci/soc_csr.bin -OutFile soc_csr.bin
|
||||||
python usb_update.py --enable-boot --soc soc_csr.bin -l loader.bin
|
python usb_update.py --enable-boot-update -s soc_csr.bin -l loader.bin
|
||||||
Remove-Item loader.bin
|
Remove-Item loader.bin
|
||||||
Remove-Item soc_csr.bin
|
Remove-Item soc_csr.bin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ sleep 5
|
||||||
|
|
||||||
wget https://ci.betrusted.io/$REVISION/loader.bin -O /tmp/loader.bin
|
wget https://ci.betrusted.io/$REVISION/loader.bin -O /tmp/loader.bin
|
||||||
wget https://ci.betrusted.io/$REVISION/soc_csr.bin -O /tmp/soc_csr.bin
|
wget https://ci.betrusted.io/$REVISION/soc_csr.bin -O /tmp/soc_csr.bin
|
||||||
./usb_update.py --enable-boot --soc /tmp/soc_csr.bin -l /tmp/loader.bin
|
./usb_update.py --enable-boot-update -s /tmp/soc_csr.bin -l /tmp/loader.bin
|
||||||
rm /tmp/loader.bin
|
rm /tmp/loader.bin
|
||||||
rm /tmp/soc_csr.bin
|
rm /tmp/soc_csr.bin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ Start-Sleep 5
|
||||||
|
|
||||||
Invoke-WebRequest https://ci.betrusted.io/releases/latest/loader.bin -OutFile loader.bin
|
Invoke-WebRequest https://ci.betrusted.io/releases/latest/loader.bin -OutFile loader.bin
|
||||||
Invoke-WebRequest https://ci.betrusted.io/releases/latest/soc_csr.bin -OutFile soc_csr.bin
|
Invoke-WebRequest https://ci.betrusted.io/releases/latest/soc_csr.bin -OutFile soc_csr.bin
|
||||||
python usb_update.py --enable-boot --soc soc_csr.bin -l loader.bin
|
python usb_update.py --enable-boot-update -s soc_csr.bin -l loader.bin
|
||||||
Remove-Item loader.bin
|
Remove-Item loader.bin
|
||||||
Remove-Item soc_csr.bin
|
Remove-Item soc_csr.bin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,10 @@ def main():
|
||||||
"--disable-boot", required=False, action='store_true', help="Disable system boot (for use in multi-stage updates)"
|
"--disable-boot", required=False, action='store_true', help="Disable system boot (for use in multi-stage updates)"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--enable-boot", required=False, action='store_true', help="Re-enable system boot. Requires both a loader and a soc spec."
|
"--enable-boot-wipe", required=False, action='store_true', help="Re-enable system boot for factory reset. Requires both a loader (-l) and a soc (--soc) spec. Overwrites root keys."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--enable-boot-update", required=False, action='store_true', help="Re-enable system boot for updates. Requires both a loader (-l) and a staging (-s) spec. Stages SOC without overwriting root keys."
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-k", "--kernel", required=False, help="Kernel", type=str, nargs='?', metavar=('kernel file'), const='../target/riscv32imac-unknown-xous-elf/release/xous.img'
|
"-k", "--kernel", required=False, help="Kernel", type=str, nargs='?', metavar=('kernel file'), const='../target/riscv32imac-unknown-xous-elf/release/xous.img'
|
||||||
|
|
@ -558,7 +561,7 @@ def main():
|
||||||
print("Disabling boot")
|
print("Disabling boot")
|
||||||
pc_usb.erase_region(locs['LOC_LOADER'][0], 1024 * 256)
|
pc_usb.erase_region(locs['LOC_LOADER'][0], 1024 * 256)
|
||||||
|
|
||||||
if args.enable_boot:
|
if args.enable_boot_wipe:
|
||||||
if args.loader == None:
|
if args.loader == None:
|
||||||
print("Must provide both a loader and soc image")
|
print("Must provide both a loader and soc image")
|
||||||
if args.soc == None:
|
if args.soc == None:
|
||||||
|
|
@ -586,6 +589,31 @@ def main():
|
||||||
pass # we expect an error because we reset the SOC and that includes the USB core
|
pass # we expect an error because we reset the SOC and that includes the USB core
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
if args.enable_boot_update:
|
||||||
|
if args.loader == None:
|
||||||
|
print("Must provide both a loader and soc image")
|
||||||
|
if args.staging == None:
|
||||||
|
print("Must provide both a soc and loader image")
|
||||||
|
print("Enabling boot with {} and {}".format(args.loader, args.staging))
|
||||||
|
print("Programming loader image {}".format(args.loader))
|
||||||
|
with open(args.loader, "rb") as f:
|
||||||
|
image = f.read()
|
||||||
|
pc_usb.flash_program(locs['LOC_LOADER'][0], image, verify=verify)
|
||||||
|
print("Staging SoC gateware".format(args.staging))
|
||||||
|
with open(args.staging, "rb") as f:
|
||||||
|
image = f.read()
|
||||||
|
pc_usb.flash_program(locs['LOC_STAGING'][0], image, verify=verify)
|
||||||
|
|
||||||
|
print("Resuming CPU.")
|
||||||
|
pc_usb.poke(vexdbg_addr, 0x02000000)
|
||||||
|
|
||||||
|
print("Resetting SOC...")
|
||||||
|
try:
|
||||||
|
pc_usb.poke(pc_usb.register('reboot_soc_reset'), 0xac, display=False)
|
||||||
|
except usb.core.USBError:
|
||||||
|
pass # we expect an error because we reset the SOC and that includes the USB core
|
||||||
|
exit(0)
|
||||||
|
|
||||||
if args.image:
|
if args.image:
|
||||||
image_file, addr_str = args.image
|
image_file, addr_str = args.image
|
||||||
addr = int(addr_str, 0)
|
addr = int(addr_str, 0)
|
||||||
|
|
@ -607,7 +635,7 @@ def main():
|
||||||
pc_usb.flash_program(locs['LOC_WF200'][0], image, verify=verify)
|
pc_usb.flash_program(locs['LOC_WF200'][0], image, verify=verify)
|
||||||
|
|
||||||
if args.staging != None:
|
if args.staging != None:
|
||||||
print("Programming SoC gateware {}".format(args.soc))
|
print("Staging SoC gateware {}".format(args.soc))
|
||||||
with open(args.staging, "rb") as f:
|
with open(args.staging, "rb") as f:
|
||||||
image = f.read()
|
image = f.read()
|
||||||
pc_usb.flash_program(locs['LOC_STAGING'][0], image, verify=verify)
|
pc_usb.flash_program(locs['LOC_STAGING'][0], image, verify=verify)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue