blob: 486707e3d9d5a5b92fc268e780c379db9d036bfb [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#ifndef UPI_UPDATE_H
2#define UPI_UPDATE_H
3
4#define _GNU_SOURCE
5#include <stdio.h>
6#include <stdlib.h>
7#include <sys/types.h>
8#include <sys/stat.h>
9#include <fcntl.h>
10#include <sys/reboot.h>
11
12
13#include "upi_public.h"
14#include "upi_img_interface.h"
15//#include "upi_mtd.h"
16#include "zxic_fota_ab_upgrade.h"
17
18
19#define FOTA_PACKAGE_FILE "/cache/zte_fota_ab/upgrade.package"
20
21typedef enum {
22 UPGRADE_STATUS_UNKNOWN = -1,
23 UPGRADE_STATUS_VERIFING = 0,
24 UPGRADE_STATUS_VERIFY_SUCCESS,
25 UPGRADE_STATUS_VERIFY_FAIL,
26 UPGRADE_STATUS_UPDATING,
27 UPGRADE_STATUS_UPDATE_SUCCESS,
28 UPGRADE_STATUS_UPDATE_FAIL,
29 UPGRADE_STATUS_NO_NEED_UPDATE,
30 UPGRADE_STATUS_NEED_UPDATE
31} upgrade_status_s_type;
32
33typedef struct {
34 int upgrage_package_file_desc; // upgrade package file description
35 unsigned int upgrade_data_offset; // upgrade package offset in file
36 unsigned int upgrade_file_size; // upgrade package file size
37}partition_upgrade_package_info_t;
38
39
40typedef struct {
41 char partition_name[PARTITION_NAME_LEN];
42 int partition_type;
43 long long len;
44 int offset;
45 int zipped;
46 char hash[HASH_MAX_LEN];
47 int index;
48 int partition_total_count;
49 partition_upgrade_package_info_t pkg_info;
50 partition_mtd_info_t mtd_info;
51} device_data_t;
52
53int upi_update(z_upgrade_flush_status_t* flush_status);
54
55
56#endif /*UPI_UPDATE_H*/