本文主要是介绍在recovery模式的升级过程中创建文件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
最近有一个客户有个需求在使用他们的fota升级的过程中:在recovery模式的升级过程中创建一个名为“/cache/recovery/last_fota_result”文件,添加判断升级的status,若为INSTALL_SUCCES,则往last_fota_result文件写入1,否则写入0。该文件的读写权限为0666。
在alps/bootable/recovery/目录下有一个recovery.cpp文件,我们找到这个文件之后会发现里面有一句static const char *LAST_LOG_FILE = "/cache/recovery/last_log";这个last_log在每次fota升级之后就会出现,我们就可以参照这个文件的生成思路来添加在recovery模式的升级过程中生成“/cache/recovery/last_fota_result”文件的功能:
@@ -123,6 +123,7 @@ static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";
static const char *TEMPORARY_INSTALL_FILE = "/tmp/last_install";
static const char *LAST_KMSG_FILE = "/cache/recovery/last_kmsg";
static const char *LAST_LOG_FILE = "/cache/recovery/last_log";
+static const char *LAST_LOG_FOTA_RESULT_FILE = "/cache/recovery/last_fota_result";
// We will try to apply the update pa
这篇关于在recovery模式的升级过程中创建文件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!