Snapshot Boot Implementation Tips (Compact 2013)

3/26/2014

The following tips address common issues.

  • Avoid a corrupted display after resuming from a snapshot
    If your display buffer uses a memory region that the OS does not automatically detect, that region has to be reported in OEMGetSnapshotRegions so the display contents will be restored when you boot from a snapshot.
  • Be careful with the state of global variables
    If you have global variables that are set during a cold boot, be aware of logic that does not allow them to be reset if they are already set. When you boot from a snapshot, the value of global variables will be restored. Determine which global variables must be forcefully reset when you boot from a snapshot.

    Be sure to include any region of memory that the boot loader and OS share for globals when you return your OEM specific memory regions in OEMGetSnapshotRegions.

  • Avoid system hangs when booting from a snapshot
    If the system stops responding when you boot from snapshot, ensure that you are not using active KITL when you take the snapshot. When you take the final snapshot for your shipping device, you will typically take the snapshot without KITL.

    Also ensure that you have included SYSGEN_PM in your image.

  • Avoid system hangs when restoring from a snapshot
    The individual regions of RAM that you return from OEMGetSnapshotRegions must be physically contiguous or the device will fail to boot from the snapshot.
  • Make it easier to re-initialize device drivers
    Before taking a snapshot, remove any peripherials that are not required for your scenario. This way, after you boot from a snapshot, you can take advantage of the default device initialization that occurs when you add a peripherial.
  • Use SnapshotSupport->dwOemData to communicate information about the snapshot to the code that restores it
    The dwOemData field can be put to any purpose that you want. For example, you could identify the compression method that you used to compress the snapshot so that you can select the matching decompression routine when you restore the snapshot. You could also use it to record version information if you have to version the schema you use to store the CPU context that you save in the snapshot, and so on.
  • Use passive KITL
    As mentioned earlier, active KITL prevents taking a snapshot. Because a KITL connection is not available, and because many of the OAL snapshot functions are called from the OS, you will not be able to debug those functions using breakpoints, and so on.

    You can add RETAILMSG calls to your functions to provide diagnostic information by using the terminal window. When the system powers down and then back up during the snapshot boot process, your serial driver may not always be available during that time. Therefore, there may be instances when diagnostic output from the device is unavailable.

See Also

Concepts

Snapshot Boot Development

Other Resources

Kernel Independent Transport Layer