Intel® Stratix® 10 Hard Processor System Remote System Update User Guide

ID 683021
Date 11/10/2021
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

7.5.5.4. Corrupted Sub-Partition Table

This example uses the RSU client to demonstrate how sub-partition table corruptions can be detected and recovered. It also uses U-Boot to corrupt the SPT, as it's more conveniently done there.
Note: The commands listed in this example assume the initial flash image (JIC) was written to flash, with no other changes.
  1. Power cycle the board, boot to Linux, and query RSU status:
    root@linux:~# ./rsu_client --log
          VERSION: 0x00000202
            STATE: 0x00000000
    CURRENT IMAGE: 0x0000000001000000
       FAIL IMAGE: 0x0000000000000000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000
    Operation completed

    There are no errors.

  2. Reboot or power cycle the board, stop at U-Boot prompt, and corrupt SPT0 by erasing the corresponding flash area:
    SOCFPGA # sf probe 
    SF: Detected mt25qu02g with page size 256 Bytes, erase size 4 KiB, total 256 MiB
    SOCFPGA # sf erase 0x0910000 0x1000
    SF: 4096 bytes @ 0x910000 Erased: OK
  3. Power cycle the board. U-Boot runs, and before booting Linux it runs a few RSU commands. Running the first one causes rsu_init to be called, which detects corrupted SPT0 and recovers it from SPT1:
    Bad SPT0 magic number 0xFFFFFFFF
    Restoring SPT0
  4. boot to Linux and query RSU status:
    root@linux:~# ./rsu_client --log
          VERSION: 0x00000202
            STATE: 0x00000000
    CURRENT IMAGE: 0x0000000001000000
       FAIL IMAGE: 0x0000000000000000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000
    Operation completed

    There are no errors

  5. Save the currently used SPT to a file for backup purposes. Also call sync command to make sure the file is comitted to flash:
    root@linux:~# ./rsu_client --save-spt spt-backup.bin
    Operation completed
    root@linux:~# sync
  6. Reboot or power cycle, stop to U-Boot and corrupt both SPTs by erasing the flash at their locations:
    SOCFPGA # sf probe
    SF: Detected mt25qu02g with page size 256 Bytes, erase size 4 KiB, total 256 MiB
    SOCFPGA # sf erase 0x910000 0x1000
    SF: 4096 bytes @ 0x910000 Erased: OK
    SOCFPGA # sf erase 0x918000 0x1000
    SF: 4096 bytes @ 0x918000 Erased: OK
  7. Power cycle the board, boot to Linux, and query RSU status:
    root@linux:~# ./rsu_client --log
    librsu: load_spt(): Bad SPT1 magic number 0xFFFFFFFF [MED]
    librsu: load_spt(): Bad SPT0 magic number 0xFFFFFFFF [MED]
    librsu: load_spt(): error: No valid SPT0 or SPT1 found [LOW]
          VERSION: 0x00000202
            STATE: 0x00000000
    CURRENT IMAGE: 0x0000000001000000
       FAIL IMAGE: 0x0000000000000000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000

    The decision firmware loads the higest priority image, and it does not look at the SPTs. The LibRSU detects that both SPTs are corrupted.

  8. Try to run an RSU client command which requires a valid SPT - it fails:
    root@linux:~# ./rsu_client --count
    librsu: load_spt(): Bad SPT1 magic number 0xFFFFFFFF [MED]
    librsu: load_spt(): Bad SPT0 magic number 0xFFFFFFFF [MED]
    librsu: load_spt(): error: No valid SPT0 or SPT1 found [LOW]
    librsu: rsu_spt_corrupted_info(): corrupted SPT -- [LOW]
    librsu: rsu_spt_corrupted_info(): run rsu_client restore-spt <file_name> first
     [LOW]
    ERROR: Failed to get number of slots
  9. Restore the SPT from the backup copy that we have created:
    root@linux:~# ./rsu_client --restore-spt spt-backup.bin
    librsu: load_spt(): Bad SPT1 magic number 0xFFFFFFFF [MED]
    librsu: load_spt(): Bad SPT0 magic number 0xFFFFFFFF [MED]
    librsu: load_spt(): error: No valid SPT0 or SPT1 found [LOW]
    Operation completed
  10. Try again running RSU client commands which require a valid SPT - the commands work fine:
    root@linux:~# ./rsu_client --count
    number of slots is 3
    Operation completed