• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/firmware-utils/src/fw.h

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  *  * Copyright (C) 2007 Ubiquiti Networks, Inc.
  4  */
  5 
  6 #ifndef FW_INCLUDED
  7 #define FW_INCLUDED
  8 
  9 #include <stdint.h>
 10 #include <sys/types.h>
 11 
 12 #define MAGIC_HEADER    "OPEN"
 13 #define MAGIC_PART      "PART"
 14 #define MAGIC_END       "END."
 15 #define MAGIC_ENDS      "ENDS"
 16 
 17 #define MAGIC_LENGTH    4
 18 #define PART_NAME_LENGTH 16
 19 
 20 typedef struct header {
 21         char magic[MAGIC_LENGTH];
 22         char version[256];
 23         u_int32_t crc;
 24         u_int32_t pad;
 25 } __attribute__ ((packed)) header_t;
 26 
 27 typedef struct part {
 28         char magic[MAGIC_LENGTH];
 29         char name[PART_NAME_LENGTH];
 30         uint8_t pad[12];
 31         u_int32_t memaddr;
 32         u_int32_t index;
 33         u_int32_t baseaddr;
 34         u_int32_t entryaddr;
 35         u_int32_t data_size;
 36         u_int32_t part_size;
 37 } __attribute__ ((packed)) part_t;
 38 
 39 typedef struct part_crc {
 40         u_int32_t crc;
 41         u_int32_t pad;
 42 } __attribute__ ((packed)) part_crc_t;
 43 
 44 typedef struct signature {
 45         uint8_t magic[MAGIC_LENGTH];
 46         u_int32_t crc;
 47         u_int32_t pad;
 48 } __attribute__ ((packed)) signature_t;
 49 
 50 typedef struct signature_rsa {
 51         uint8_t magic[MAGIC_LENGTH];
 52 //      u_int32_t crc;
 53         unsigned char rsa_signature[256];
 54         u_int32_t pad;
 55 } __attribute__ ((packed)) signature_rsa_t;
 56 
 57 #define VERSION "1.2"
 58 
 59 #define INFO(...) fprintf(stdout, __VA_ARGS__)
 60 #define ERROR(...) fprintf(stderr, "ERROR: "__VA_ARGS__)
 61 #define WARN(...) fprintf(stderr, "WARN: "__VA_ARGS__)
 62 #define DEBUG(...) do {\
 63         if (debug) \
 64                 fprintf(stdout, "DEBUG: "__VA_ARGS__); \
 65 } while (0);
 66 
 67 #endif
 68 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt