|
Revision 12368, 1.4 kB
(checked in by BrainSlayer, 5 months ago)
|
tftp server added, supports wiligear, ubiquiti and dd-wrt webflash format
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
#ifndef __ubnt_fw__ |
|---|
| 3 |
#define __ubnt_fw__ |
|---|
| 4 |
|
|---|
| 5 |
#define MAGIC_HEADER "OPEN" |
|---|
| 6 |
#define MAGIC_PART "PART" |
|---|
| 7 |
#define MAGIC_END "END." |
|---|
| 8 |
|
|---|
| 9 |
#define MAGIC_LENGTH 4 |
|---|
| 10 |
|
|---|
| 11 |
typedef unsigned int u_int32_t; |
|---|
| 12 |
|
|---|
| 13 |
typedef struct header { |
|---|
| 14 |
char magic[MAGIC_LENGTH]; |
|---|
| 15 |
char version[256]; |
|---|
| 16 |
u_int32_t crc; |
|---|
| 17 |
u_int32_t pad; |
|---|
| 18 |
} __attribute__((packed)) header_t; |
|---|
| 19 |
|
|---|
| 20 |
typedef struct part { |
|---|
| 21 |
char magic[MAGIC_LENGTH]; |
|---|
| 22 |
char name[16]; |
|---|
| 23 |
char pad[12]; |
|---|
| 24 |
u_int32_t memaddr; |
|---|
| 25 |
u_int32_t index; |
|---|
| 26 |
u_int32_t baseaddr; |
|---|
| 27 |
u_int32_t entryaddr; |
|---|
| 28 |
u_int32_t data_size; |
|---|
| 29 |
u_int32_t part_size; |
|---|
| 30 |
} __attribute__((packed)) part_t; |
|---|
| 31 |
|
|---|
| 32 |
typedef struct part_crc { |
|---|
| 33 |
u_int32_t crc; |
|---|
| 34 |
u_int32_t pad; |
|---|
| 35 |
} __attribute__((packed)) part_crc_t; |
|---|
| 36 |
|
|---|
| 37 |
typedef struct signature { |
|---|
| 38 |
char magic[MAGIC_LENGTH]; |
|---|
| 39 |
u_int32_t crc; |
|---|
| 40 |
u_int32_t pad; |
|---|
| 41 |
} __attribute__((packed)) signature_t; |
|---|
| 42 |
|
|---|
| 43 |
extern int fw_check_image_ubnt(unsigned char *addr, unsigned long maxlen, |
|---|
| 44 |
int do_flash); |
|---|
| 45 |
|
|---|
| 46 |
/***********************************************************************************/ |
|---|
| 47 |
|
|---|
| 48 |
/* fwupdate.bin size */ |
|---|
| 49 |
#define MAX_IMAGE_SIZE 0x7E0000 /* 4mb - 64k */ |
|---|
| 50 |
|
|---|
| 51 |
/* max size for single partition - typicaly this is cramfs size */ |
|---|
| 52 |
#define MAX_PART_SIZE 0x800000 /* 3mb - valid only for ar531x */ |
|---|
| 53 |
|
|---|
| 54 |
/* these variables will be initialized in do_tftpd() */ |
|---|
| 55 |
CYG_ADDRWORD BASE_ADDR; |
|---|
| 56 |
CYG_ADDRWORD FW_TEMP_BASE; |
|---|
| 57 |
/***********************************************************************************/ |
|---|
| 58 |
|
|---|
| 59 |
#endif /* __wilibox_fw__ */ |
|---|