crossystem should switch on VbNvContext storage type

We may have multiple storage types (disk or mkbp) of VbNvContext.
crossystem should switch the type and choose the corresponding device
driver.

After patching U-Boot, you may check storage type:
  [ "mkbp" = "$(cat /proc/device-tree/firmware/chromeos/nonvolatile-context-storage)" ]

And cross-verify crossystem with mosys:

  $ mosys nvram vboot read
  70000000000000000000000000000020
  $ crossystem recovery_request
  0

  $ crossystem recovery_request=123
  $ mosys nvram vboot read
  70007b0000000000000000000000005d

  $ mosys nvram vboot write 70000000000000000000000000000020
  $ crossystem recovery_request
  0

More importantly, crossystem should also work with older version of
firmware, which does not pass down this information.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>

BRANCH=none
BUG=chrome-os-partner:13766
TEST=Check storage type on a Snow device:
     [ "mkbp" = "$(cat /proc/device-tree/firmware/chromeos/nonvolatile-context-storage)" ]
     Make sure that FAFT is still happy:
     ./run_remote_tests.sh --remote $ADDR --board daisy 'firmware_TryFwB/control$'
     ./run_remote_tests.sh --remote $ADDR --board daisy 'firmware_TryFwB/control.dev$'
     More importantly, check crossystem worked well even when ChromeOS
     is booted from an older version of firmware.

Change-Id: I3989a8c181efe03cd9f06127743763e0ad97e281
Reviewed-on: https://gerrit.chromium.org/gerrit/32470
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
1 file changed