You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB
C

// partition header structure description
#ifndef WIN32
struct __attribute__ ((__packed__)) pheader {
#else
#pragma pack(push,1)
struct pheader {
#endif
int32_t magic; // 0xa55aaa55
uint32_t hdsize; // header size
uint32_t hdversion;
uint8_t unlock[8];
uint32_t code; // partition type
uint32_t psize; // data field size
uint8_t date[16];
uint8_t time[16]; // date of firmware build
uint8_t version[32]; // firmware version
uint16_t crc; // CRC header
uint32_t blocksize; // size of CRC block of firmware image
};
#ifdef WIN32
#pragma pack(pop)
#endif
// partition table structure description
struct ptb_t{
unsigned char pname[20]; // alphabetic name of the partition
struct pheader hd; // header image
uint16_t* csumblock; // checksum block
uint8_t* pimage; // partition image
uint32_t offset; // offset in file before start of partition
uint32_t zflag; // flag of a compressed partition
uint8_t ztype; // compression type
};
//******************************************************
//* External arrays to store the partition table
//******************************************************
extern struct ptb_t ptable[];
extern int npart; // number of partitions in table
extern uint32_t errflag;
int findparts(FILE* in);
void find_pname(unsigned int id,unsigned char* pname);
void findfiles (char* fdir);
uint32_t psize(int n);
extern int dload_id;