diff options
author | Tao Bao | 2015-12-07 19:04:58 -0600 |
---|---|---|
committer | Tao Bao | 2015-12-08 13:24:35 -0600 |
commit | 740e01e2bd5dae3f77191699636a1d6b51f436f0 (patch) | |
tree | 1f18a2ee459fc5e13f4a6571c7c545c5947ed10b /update_verifier/update_verifier.cpp | |
parent | 7197ee0e39bebea3a1bbe5d980f4dbf1cfe58136 (diff) | |
download | platform-bootable-recovery-740e01e2bd5dae3f77191699636a1d6b51f436f0.tar.gz platform-bootable-recovery-740e01e2bd5dae3f77191699636a1d6b51f436f0.tar.xz platform-bootable-recovery-740e01e2bd5dae3f77191699636a1d6b51f436f0.zip |
update_verifier: Log to logd instead of kernel log.
logd already gets started before we call update_verifier.
Bug: 26039641
Change-Id: If00669a77bf9a6e5534e33f4e50b42eabba2667a
(cherry picked from commit 45eac58ef188679f6df2d80efc0391c6d7904cd8)
Diffstat (limited to 'update_verifier/update_verifier.cpp')
-rw-r--r-- | update_verifier/update_verifier.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp index 9ba792b8..5e888157 100644 --- a/update_verifier/update_verifier.cpp +++ b/update_verifier/update_verifier.cpp | |||
@@ -32,25 +32,21 @@ | |||
32 | * A/B OTA package format in place. | 32 | * A/B OTA package format in place. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <cutils/klog.h> | ||
36 | #include <string.h> | 35 | #include <string.h> |
37 | 36 | ||
38 | #include <hardware/boot_control.h> | 37 | #include <hardware/boot_control.h> |
39 | 38 | ||
40 | #define LOG_TAG "update_verifier" | 39 | #define LOG_TAG "update_verifier" |
41 | #define INFO(x...) KLOG_INFO(LOG_TAG, x) | 40 | #include <log/log.h> |
42 | #define ERROR(x...) KLOG_ERROR(LOG_TAG, x) | ||
43 | 41 | ||
44 | int main(int argc, char** argv) { | 42 | int main(int argc, char** argv) { |
45 | klog_init(); | ||
46 | klog_set_level(6); | ||
47 | for (int i = 1; i < argc; i++) { | 43 | for (int i = 1; i < argc; i++) { |
48 | INFO("Started with arg %d: %s\n", i, argv[i]); | 44 | SLOGI("Started with arg %d: %s\n", i, argv[i]); |
49 | } | 45 | } |
50 | 46 | ||
51 | const hw_module_t* hw_module; | 47 | const hw_module_t* hw_module; |
52 | if (hw_get_module("bootctrl", &hw_module) != 0) { | 48 | if (hw_get_module("bootctrl", &hw_module) != 0) { |
53 | ERROR("Error getting bootctrl module.\n"); | 49 | SLOGE("Error getting bootctrl module.\n"); |
54 | return -1; | 50 | return -1; |
55 | } | 51 | } |
56 | 52 | ||
@@ -60,7 +56,7 @@ int main(int argc, char** argv) { | |||
60 | 56 | ||
61 | unsigned current_slot = module->getCurrentSlot(module); | 57 | unsigned current_slot = module->getCurrentSlot(module); |
62 | int bootable = module->isSlotBootable(module, current_slot); | 58 | int bootable = module->isSlotBootable(module, current_slot); |
63 | INFO("Booting slot %u: isSlotBootable=%d\n", current_slot, bootable); | 59 | SLOGI("Booting slot %u: isSlotBootable=%d\n", current_slot, bootable); |
64 | 60 | ||
65 | if (bootable == 0) { | 61 | if (bootable == 0) { |
66 | // The current slot has not booted successfully. | 62 | // The current slot has not booted successfully. |
@@ -73,12 +69,12 @@ int main(int argc, char** argv) { | |||
73 | 69 | ||
74 | int ret = module->markBootSuccessful(module); | 70 | int ret = module->markBootSuccessful(module); |
75 | if (ret != 0) { | 71 | if (ret != 0) { |
76 | ERROR("Error marking booted successfully: %s\n", strerror(-ret)); | 72 | SLOGE("Error marking booted successfully: %s\n", strerror(-ret)); |
77 | return -1; | 73 | return -1; |
78 | } | 74 | } |
79 | INFO("Marked slot %u as booted successfully.\n", current_slot); | 75 | SLOGI("Marked slot %u as booted successfully.\n", current_slot); |
80 | } | 76 | } |
81 | 77 | ||
82 | INFO("Leaving update_verifier.\n"); | 78 | SLOGI("Leaving update_verifier.\n"); |
83 | return 0; | 79 | return 0; |
84 | } | 80 | } |