全志V5平台升级bootlogo
不多说,先直接贴代码
#include
#include
#include
#include
#include
#include
#include #define INT8 char
#define INT32 int#define FILE_NAME "/mnt/nfs/test3app/writebootlogo/bootlogo.bmp"
#define PARTITION_NAME "/dev/mmcblk0p11"int mywrite(char * FileName,char * DevName)
{FILE *fp = NULL;int flash_handle = 0;INT8 *ptBuff = NULL;INT32 niReadLen = 0;INT32 niWriteLen = 0;if(FileName == NULL || DevName == NULL){printf("UpdateExt4File input invalid!!!\n");return -1;}ptBuff = (INT8 *)malloc(1024*1024);if(ptBuff){fp = fopen(FileName, "r");if (NULL != fp){flash_handle = open(DevName,O_RDWR);if(flash_handle < 0){printf("open %s failed!!!\n",DevName);}while(!feof(fp)){niReadLen =fread(ptBuff,1,1024*1024,fp);if(niReadLen > 0){niWriteLen = write(flash_handle,ptBuff,niReadLen);}}}fdatasync(flash_handle);close(flash_handle);fclose(fp);}else{printf("UpdateExt4File fopen %s failed!!!\n",FileName);return -3;}free(ptBuff);ptBuff = NULL;printf("write bootlogo Partition OK !! \n");}else{printf("UpdateExt4File malloc failed!!!\n");return -2;}return 0;
}int main(int argc, char **argv)
{printf("Main start !!\n");mywrite(FILE_NAME,PARTITION_NAME);return 0;
}
全志平台的bootlogo是以文件的形式直接存放到/dev/mmcblk0p11这个分区上的(此分区只存放bootlogo.bmp文件),所以我们直接将要替换的图片以文件的形式写到此分区对应的设备上就行了
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
