/*
 * atl-release.h
 *
 * Matthew Millman
 */


#ifndef __RELEASE_H__
#define __RELEASE_H__

#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endif

/* ARE YOU ABOUT TO MODIFY THIS?
 * THIS IS A VERY SERIOUS THING TO BE CHANGING!
 *
 * Note that this definition exists in 3 places.
 *
 * 1: Linux
 * 2: U-Boot
 * 3: mkrelease  
 */
 
typedef struct
{
	uint32_t	magic1; /* ALLI */
	uint32_t	magic2; /* EDWA */
	uint32_t	magic3; /* REPL */
	uint32_t	magic4; /* US\0\0*/
	
	uint16_t	header_version;
	uint16_t	header_size;
	
	uint32_t	header_crc32;
		
	uint32_t	kernel_offset;
	uint32_t	kernel_size;
	uint32_t	kernel_inflated_size;
	uint32_t	kernel_load_addr;
	uint32_t	kernel_entry_point;
	uint32_t	kernel_checksum;
	
	uint32_t	initrd_offset;
	uint32_t	initrd_size;
	uint32_t	initrd_inflated_size;
	uint32_t	initrd_ramdisk_size;
	uint32_t	initrd_checksum;
	uint32_t	initrd_filesystem;
	
	uint8_t		kernel_compression_type;
	uint8_t		initrd_compression_type;
	
	uint16_t	intended_family;
	
	uint16_t	check_type;
	uint16_t	version_type;
	
	uint8_t		version_major;
	uint8_t		version_mid;
	uint8_t 	version_minor;
	uint8_t 	version_rc;

	uint32_t	build_time;
	
	uint32_t	release_special;
	
	uint32_t 	spare[7];
} release_header;

#define RELEASE_TYPE_DEVELOPER 			0
#define RELEASE_TYPE_SYSTEST			1
#define RELEASE_TYPE_QC				2
#define RELEASE_TYPE_CUSTOMER			3

#define CHECK_TYPE_NONE				0
#define CHECK_TYPE_CHECKSUM16			1
#define CHECK_TYPE_CHECKSUM32			2
#define CHECK_TYPE_CRC16			3
#define CHECK_TYPE_CRC32			4

#define FILESYSTEM_TYPE_EXT2_CLASSIC_INITRD	0
#define FILESYSTEM_TYPE_CRAMFS			1
#define FILESYSTEM_TYPE_SQUASHFS		2
#define FILESYSTEM_TYPE_BASTARDISED		3

#define MAGIC1					0x414C4C49
#define MAGIC2					0x45445741
#define MAGIC3					0x5245504C
#define MAGIC4					0x55530000

#define COMPRESSION_TYPE_NONE			0
#define COMPRESSION_TYPE_GZIP			1
#define COMPRESSION_TYPE_BZIP2			2
#define COMPRESSION_TYPE_LZMA			3

#ifdef __KERNEL__
void init_release(void *initrd_start, void *initrd_end);
#endif

#endif /* __RELEASE_H__ */
