blob: 255d47b529859f0830075d0e5560f38174289567 [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
lh758261d2023-07-13 05:52:04 -070019// #define FOTA_PACKAGE_FILE "/cache/zte_fota_ab/upgrade.package"
lh9ed821d2023-04-07 01:36:19 -070020
lh758261d2023-07-13 05:52:04 -070021
22typedef enum
23{
24 UPGRADE_STATUS_UNKNOWN = -1,
25 UPGRADE_STATUS_VERIFING = 0,
26 UPGRADE_STATUS_VERIFY_SUCCESS,
27 UPGRADE_STATUS_VERIFY_FAIL,
28 UPGRADE_STATUS_UPDATING,
29 UPGRADE_STATUS_UPDATE_SUCCESS,
30 UPGRADE_STATUS_UPDATE_FAIL,
31 UPGRADE_STATUS_NO_NEED_UPDATE,
32 UPGRADE_STATUS_NEED_UPDATE
lh9ed821d2023-04-07 01:36:19 -070033} upgrade_status_s_type;
34
lh758261d2023-07-13 05:52:04 -070035typedef struct
36{
37 int upgrage_package_file_desc; // upgrade package file description
38 unsigned int upgrade_data_offset; // upgrade package offset in file
39 unsigned int upgrade_file_size; // upgrade package file size
40} partition_upgrade_package_info_t;
lh9ed821d2023-04-07 01:36:19 -070041
42
lh758261d2023-07-13 05:52:04 -070043typedef struct
44{
45 char partition_name[PARTITION_NAME_LEN];
46 int partition_type;
47 long long len;
48 int offset;
49 int zipped;
50 char hash[HASH_MAX_LEN];
51 int index;
52 int partition_total_count;
53 partition_upgrade_package_info_t pkg_info;
54 partition_mtd_info_t mtd_info;
lh9ed821d2023-04-07 01:36:19 -070055} device_data_t;
56
57int upi_update(z_upgrade_flush_status_t* flush_status);
58
59
60#endif /*UPI_UPDATE_H*/