1 #ifndef _IPXE_GZIP_H 2 #define _IPXE_GZIP_H 3 4 /** @file 5 * 6 * gzip compressed images 7 * 8 */ 9 10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); 11 12 #include <stdint.h> 13 #include <ipxe/image.h> 14 15 /** gzip header */ 16 struct gzip_header { 17 /** Magic ID */ 18 uint16_t magic; 19 /** Compression method */ 20 uint8_t method; 21 /** Flags */ 22 uint8_t flags; 23 /** Modification time */ 24 uint32_t mtime; 25 /** Extra flags */ 26 uint8_t extra; 27 /** Operating system */ 28 uint8_t os; 29 } __attribute__ (( packed )); 30 31 /** Magic ID */ 32 #define GZIP_MAGIC 0x1f8b 33 34 /** Compression method */ 35 #define GZIP_METHOD_DEFLATE 0x08 36 37 /** CRC header is present */ 38 #define GZIP_FL_HCRC 0x02 39 40 /** Extra header is present */ 41 #define GZIP_FL_EXTRA 0x04 42 43 /** File name is present */ 44 #define GZIP_FL_NAME 0x08 45 46 /** File comment is present */ 47 #define GZIP_FL_COMMENT 0x10 48 49 /** gzip extra header */ 50 struct gzip_extra_header { 51 /** Extra header length (excluding this field) */ 52 uint16_t len; 53 } __attribute__ (( packed )); 54 55 /** gzip CRC header */ 56 struct gzip_crc_header { 57 /** CRC-16 */ 58 uint16_t crc; 59 } __attribute__ (( packed )); 60 61 /** gzip footer */ 62 struct gzip_footer { 63 /** CRC-32 */ 64 uint32_t crc; 65 /** Uncompressed size (modulo 2^32) */ 66 uint32_t len; 67 } __attribute__ (( packed )); 68 69 extern struct image_type gzip_image_type __image_type ( PROBE_NORMAL ); 70 71 #endif /* _IPXE_GZIP_H */ 72