gs101: dumpstate: Dump s2d.lst to dumpstate_board.txt

Gzip s2d.lst and base64 it for dumping to dumpstate_board.txt.

Bug: 187228956
Change-Id: I911145ed6ecc345177cd979262126b7c49194528
This commit is contained in:
Woody Lin 2021-05-05 16:48:05 +08:00 committed by TreeHugger Robot
parent 331796ed8d
commit e9f27f4a68

View file

@ -793,6 +793,16 @@ void DumpstateDevice::dumpSensorsUSFSection(int fd) {
} }
} }
// Gzip binary data and dump to fd in base64 format. Cmd to decode is also attached.
void dumpGzippedFileInBase64ToFd(int fd, const char* title, const char* file_path) {
auto cmd = android::base::StringPrintf("echo 'base64 -d <<EOF | gunzip' ; "
"/vendor/bin/gzip < \"%s\" | /vendor/bin/base64 ; "
"echo 'EOF'", file_path);
RunCommandToFd(fd, title,
{"/vendor/bin/sh", "-c", cmd.c_str()},
CommandOptions::WithTimeout(10).Build());
}
struct abl_log_header { struct abl_log_header {
uint64_t i; uint64_t i;
uint64_t size; uint64_t size;
@ -810,9 +820,10 @@ void DumpstateDevice::dumpRamdumpSection(int fd) {
} else { } else {
android::base::WriteStringToFd("*** Ramdump misc file: abl.log: File not found\n", fd); android::base::WriteStringToFd("*** Ramdump misc file: abl.log: File not found\n", fd);
} }
RunCommandToFd(fd, "Ramdump misc file: acpm.lst", dumpGzippedFileInBase64ToFd(
{"/vendor/bin/base64", "/mnt/vendor/ramdump/acpm.lst"}, fd, "Ramdump misc file: acpm.lst (gzipped in base64)", "/mnt/vendor/ramdump/acpm.lst");
CommandOptions::WithTimeout(2).Build()); dumpGzippedFileInBase64ToFd(
fd, "Ramdump misc file: s2d.lst (gzipped in base64)", "/mnt/vendor/ramdump/s2d.lst");
} }
// Dump items that don't fit well into any other section // Dump items that don't fit well into any other section