Copy Kernel Logs

Give user option to copy kernel logs to current storage

Change-Id: I0c61122fb34826ddb08977e6cbf98e3adf477acd
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index cbf4730..72674ae 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1070,4 +1070,14 @@
 	return 0;
 }
 
+void TWFunc::copy_kernel_log(string curr_storage) {
+	std::string dmesgDst = curr_storage + "/dmesg.log";
+	std::string dmesgCmd = "/sbin/dmesg";
+
+	std::string result;
+	Exec_Cmd(dmesgCmd, result);
+	write_file(dmesgDst, result);
+	gui_msg(Msg("copy_kernel_log=Copied kernel log to {1}")(dmesgDst));
+	tw_set_default_metadata(dmesgDst.c_str());
+}
 #endif // ndef BUILD_TWRPTAR_MAIN