Commit Graph

4 Commits

Author SHA1 Message Date
Nam T. Nguyen
9a8dfd00ec cgpt_wrapper: Fix non-zero return code when okay
I forgot to reset "ret" to zero in the case the two hashes come out the
same. This CL fixes that silly logic bug.

BUG=None
BRANCH=None
TEST=`cgpt show /dev/mtd0` should exit with status 0

Change-Id: I1c64ea215c861c8afb44e235d090c72a5d006d55
Reviewed-on: https://chromium-review.googlesource.com/243325
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Trybot-Ready: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
2015-01-27 00:22:11 +00:00
Nam T. Nguyen
9fa6afce26 cgpt_wrapper: Resolve the path to "cgpt" command
Because we do not use "execvp", "cgpt.bin" is not resolved to the same
directory as "cgpt". So we need to resolve the original command to its
absolute path first, then append ".bin" to it.

BUG=None
BRANCH=None
TEST="cgpt" no longer fails.

Change-Id: Id22c2d97616867125e9744c00bbf527f8a176df4
Reviewed-on: https://chromium-review.googlesource.com/242294
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@google.com>
2015-01-22 21:14:29 +00:00
Nam T. Nguyen
c67b061cb5 cgpt_wrapper: Only write rw_gpt back if changed
We always wrote back the rw_gpt file to NOR flash. This operation is too
slow. This CL compares if the original file has been changed by cgpt.bin
before writing the file back to NOR.

BUG=None
BRANCH=None
TEST=/usr/bin/cgpt show /dev/mtd0 now does not write back to NOR

Change-Id: I4c63f0d4da72f3674e06a896fa329f5fc964a885
Reviewed-on: https://chromium-review.googlesource.com/242293
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@google.com>
2015-01-22 21:14:26 +00:00
Nam T. Nguyen
d1236e4be6 Add cgpt_wrapper binary to transparently support NAND
This CL adds a "cgpt_wrapper" binary that will forward to "cgpt" binary
as needed to transparently support NAND.

The idea is that if we are working with an MTD device, this binary will
exec out to "flashrom" to read in the GPT section, then exec out to the
actual "cgpt" binary to work on that file, and finally write it back
with "flashrom".

This CL introduces a make target "install_mtd" to install this wrapper.
The corresponding ebuild should use this make target when "mtd" USE flag
is on.

BUG=chromium:442518
BRANCH=none
CQ-DEPEND=CL:239573
TEST=unittest and some trial runs with mtdram
TEST=test on a real device with NOR flash and NAND

Change-Id: I54534afa9a970ec858f313f698c0eb210c827477
Reviewed-on: https://chromium-review.googlesource.com/239580
Tested-by: Nam Nguyen <namnguyen@chromium.org>
Reviewed-by: Daniel Ehrenberg <dehrenberg@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
2015-01-17 05:49:12 +00:00