vb2_context: Use fixed-width type for boot_mode

Using enum types in serialized data structures is dangerous, because
their width may depend on compiler settings. This patch changes the data
type for (vb2_context).boot_mode to uint8_t to make sure the struct
layout will be the same in all environments. Since we only defined boot
modes up to 5 for now (and our systems are always little endian), the
structure remains binary compatible with serializations of the previous
version (so no struct version change should be necessary).

BRANCH=none
BUG=none
TEST=make runtests

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I82bc8e665ea51adaaf1f5d94986c22bd62e58bba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3751833
Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-by: Subrata Banik <subratabanik@chromium.org>
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 785e449..ff89a29 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -412,10 +412,10 @@
 	 */
 
 	/*
-	 * Mutually exclusive boot mode.
+	 * Mutually exclusive boot mode (from enum vb2_boot_mode).
 	 * This constant is initialized after calling vb2api_fw_phase1().
 	 */
-	const enum vb2_boot_mode boot_mode;
+	const uint8_t boot_mode;
 };
 
 /* Resource index for vb2ex_read_resource() */