debugd: add 2 new dbus messages to get RW FW version and board ID from an image
Those new messages will be used in cr50-verify-ro.sh in a future CL.
Add 2 util functions to process gsctool output.
Add one more argument to ProcessWithOutput::RunProcess to allow disabling
sandbox. This is needed for VerifyRoTool to access suzy-q on behalf of chronos.
I will replace the argument with 2 args, user and group, after we create a new
user and group to access suzy-q.
BUG=b:113893821
TEST=manually ran the following commands on a soraka device.
$ dbus-send --system --print-reply --fixed --dest=org.chromium.debugd \
org.chromium.degbud.GetGscImageRWFirmwareVer string:cr50.bin.prod
IMAGE_RW_FW_VER=0.3.10
$ dbus-send --system --print-reply --fixed --dest=org.chromium.debugd \
org.chromium.degbud.GetGscImageBoardID string:cr50.bin.prod
IMAGE_BID_STRING=00000000
IMAGE_BID_MASK=00000000
IMAGE_BID_FLAGS=00000000
CQ-DEPEND=CL:1278414
Change-Id: Ibaa3d756962c62df6594295b02496e95bb21cde3
Reviewed-on: https://chromium-review.googlesource.com/1278697
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Wei-Cheng Xiao <garryxiao@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
diff --git a/debugd/src/process_with_output.h b/debugd/src/process_with_output.h
index 70e1396..6079045 100644
--- a/debugd/src/process_with_output.h
+++ b/debugd/src/process_with_output.h
@@ -49,9 +49,10 @@
// This must be called before Init() to have any effect. Defaults to true.
void set_use_minijail(bool use_minijail) { use_minijail_ = use_minijail; }
- // Initializes, configures, and runs a ProcessWithOutput. The D-Bus error will
- // only be set if process setup fails, it's up to the caller to check the
- // process exit code and handle run failures as needed.
+ // Initializes, configures, and runs a ProcessWithOutput. If |disable_sandbox|
+ // is set, |requires_root| will be ignored. The D-Bus error will only be set
+ // if process setup fails, it's up to the caller to check the process exit
+ // code and handle run failures as needed.
// |stdin| is a string to pipe into the process, and |stdout| and |stderr|
// will be filled with the corresponding process output. |error| will be
// set if process setup fails and the process was never able to run. All
@@ -60,6 +61,7 @@
static int RunProcess(const std::string& command,
const ArgList& arguments,
bool requires_root,
+ bool disable_sandbox,
const std::string* stdin,
std::string* stdout,
std::string* stderr,