summaryrefslogtreecommitdiff
path: root/utils/mkimxboot/mkimxboot.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/mkimxboot/mkimxboot.h')
-rw-r--r--utils/mkimxboot/mkimxboot.h116
1 files changed, 116 insertions, 0 deletions
diff --git a/utils/mkimxboot/mkimxboot.h b/utils/mkimxboot/mkimxboot.h
new file mode 100644
index 0000000000..6bf0415e9c
--- /dev/null
+++ b/utils/mkimxboot/mkimxboot.h
@@ -0,0 +1,116 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 by Amaury Pouly
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef MKIMXBOOT_H
23#define MKIMXBOOT_H
24
25#include <stdbool.h>
26#include <stdint.h>
27#include <sys/types.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33enum imx_error_t
34{
35 IMX_SUCCESS = 0,
36 IMX_ERROR = -1,
37 IMX_OPEN_ERROR = -2,
38 IMX_READ_ERROR = -3,
39 IMX_NO_MATCH = -4,
40 IMX_BOOT_INVALID = -5,
41 IMX_BOOT_MISMATCH = -6,
42 IMX_BOOT_CHECKSUM_ERROR = -7,
43 IMX_DONT_KNOW_HOW_TO_PATCH = -8,
44 IMX_VARIANT_MISMATCH = -9,
45 IMX_WRITE_ERROR = -10,
46 IMX_FIRST_SB_ERROR = -11,
47 IMX_MODEL_MISMATCH = -12,
48};
49
50enum imx_output_type_t
51{
52 IMX_DUALBOOT = 0,
53 IMX_RECOVERY,
54 IMX_SINGLEBOOT,
55 IMX_CHARGE,
56 IMX_ORIG_FW,
57};
58
59/* Supported models */
60enum imx_model_t
61{
62 MODEL_UNKNOWN = 0,
63 MODEL_FUZEPLUS,
64 MODEL_ZENXFI2,
65 MODEL_ZENXFI3,
66 MODEL_ZENXFISTYLE,
67 MODEL_ZENSTYLE, /* Style 100 and Style 300 */
68 MODEL_NWZE370,
69 MODEL_NWZE360,
70 /* Last */
71 MODEL_COUNT
72};
73
74/* Supported firmware variants */
75enum imx_firmware_variant_t
76{
77 VARIANT_DEFAULT = 0,
78 /* For the Creative ZEN X-Fi2 */
79 VARIANT_ZENXFI2_NAND,
80 VARIANT_ZENXFI2_SD,
81 VARIANT_ZENXFI2_RECOVERY,
82 /* For the Creative X-Fi Style */
83 VARIANT_ZENXFISTYLE_RECOVERY,
84 /* For the Creative Zen Style 100/300 */
85 VARIANT_ZENSTYLE_RECOVERY,
86 /* Last */
87 VARIANT_COUNT
88};
89
90struct imx_option_t
91{
92 bool debug;
93 enum imx_model_t model;
94 enum imx_output_type_t output;
95 enum imx_firmware_variant_t fw_variant;
96 const char *force_version; // set to NULL to ignore
97};
98
99/* Print internal information to stdout about device database */
100void dump_imx_dev_info(const char *prefix);
101/* Build a SB image from an input firmware and a bootloader, input firmware
102 * can either be a firmware update or another SB file produced by this tool */
103enum imx_error_t mkimxboot(const char *infile, const char *bootfile,
104 const char *outfile, struct imx_option_t opt);
105/* Compute MD5 sum of an entire file */
106enum imx_error_t compute_md5sum(const char *file, uint8_t file_md5sum[16]);
107/* Compute "soft" MD5 sum of a SB file */
108enum imx_error_t compute_soft_md5sum(const char *file, uint8_t soft_md5sum[16]);
109/* Translate error */
110const char *imx_error_to_string(enum imx_error_t err);
111
112#ifdef __cplusplus
113}
114#endif
115#endif
116