pygpt: read bootloader section in binary mode
The bootloader section is a binary blob, we should open and read the
file in binary mode.
BUG=chromium:999876
TEST="image_tool preflash ..." can successfully build a preflash image
Change-Id: I697f2321ab31c1cbf331bace00e7c3278ae0b635
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/factory/+/2169118
Reviewed-by: Yilin Yang (kerker) <kerker@chromium.org>
Commit-Queue: Stimim Chen <stimim@chromium.org>
Tested-by: Stimim Chen <stimim@chromium.org>
diff --git a/py/utils/pygpt.py b/py/utils/pygpt.py
index f5a0785..fd4b66a 100755
--- a/py/utils/pygpt.py
+++ b/py/utils/pygpt.py
@@ -1074,7 +1074,7 @@
'-i', '--number', type=int,
help='Set bootable partition')
parser.add_argument(
- '-b', '--bootloader', type=argparse.FileType('r'),
+ '-b', '--bootloader', type=argparse.FileType('rb'),
help='Install bootloader code in the PMBR')
parser.add_argument(
'-p', '--pmbr', action='store_true',