1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#ifndef _INCLUDE_MAIN_H_
#define _INCLUDE_MAIN_H_
#include "hash.h"
#include "nolo.h"
#include "os.h"
#define _FILE_OFFSET_BITS 64
#define _GNU_SOURCE
// Forward declaration for use in function arguments.
struct devices;
int queue_mode();
int reverse_extract_pieces(char *dir);
void flash_image(char *filename, char *piece, char *version);
int fiasco_read_image(char *file);
void check_nolo_order();
extern struct usb_dev_handle *dev;
unsigned long get_file_size(char *file);
void progressbar(unsigned long long part, unsigned long long total);
const char *fpid_file(const char *filename);
int add_piece(char *piece);
void eprintf(const char *format, ...);
#include <limits.h>
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
#if HAVE_USB
#include <usb.h>
extern struct usb_device *device;
extern struct usb_dev_handle *dev;
int is_valid_device(struct usb_device_descriptor *udd);
void list_valid_devices();
int usb_device_found(struct usb_device_descriptor *udd, struct devices *it_device);
int console(const char *device);
int connect_via_usb();
#endif
int console_prompt();
//
void cmd_info(char *line);
int check_badblocks(char *mtddev);
int dump_config();
extern int verbose;
#define D if (verbose)
#define CMD_WRITE 64
#define CMD_QUERY 192
struct piece_t {
char *name;
char *type;
char *vers;
};
struct devices {
char *name;
unsigned short vendor_id;
unsigned short product_id;
unsigned short flags;
};
#define SUPPORTED_DEVICES 6
extern struct devices supported_devices[SUPPORTED_DEVICES];
extern int pcs_n;
extern struct piece_t pcs[10];
enum {
PIECE_XLOADER = 0,
PIECE_2ND,
PIECE_SECONDARY,
PIECE_KERNEL,
PIECE_INITFS,
PIECE_ROOTFS,
PIECE_OMAPNAND,
PIECE_LAST
};
struct header_t {
int fd;
char fwname[128];
char name[128];
char version[128];
unsigned short hash;
unsigned int size;
unsigned char *data;
};
extern char *pieces[];
extern char *modes[];
extern char *root_devices[];
// fiasco
int openfiasco(char *name);
int fiasco_new(const char *filename, const char *name);
void fiasco_data_read(struct header_t *header);
int fiasco_add_eof(int fd);
extern void (*fiasco_callback)(struct header_t *header);
int fiasco_add(int fd, const char *name, const char *file, const char *version);
int fiasco_pack(int optind, char *argv[]);
int nanddump(char *mtddev, unsigned long start_addr, unsigned long length, char *dumpfile, int isbl, int ioob);
#endif
|