aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/mtd/src/seama.h
blob: 02683b6e98d1be37d3dc835b34d4221a1f73a677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* vi: set sw=4 ts=4: */
/*
 *	(SEA)ttle i(MA)ge is the image which used in project seattle.
 *
 *	Created by David Hsieh <david_hsieh@alphanetworks.com>
 *	Copyright (C) 2008-2009 Alpha Networks, Inc.
 *
 *	This file is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU Lesser General Public
 *	License as published by the Free Software Foundation; either'
 *	version 2.1 of the License, or (at your option) any later version.
 *
 *	The GNU C Library is distributed in the hope that it will be useful,'
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *	Lesser General Public License for more details.
 *
 *	You should have received a copy of the GNU Lesser General Public
 *	License along with the GNU C Library; if not, write to the Free
 *	Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 *	02111-1307 USA.
 */

#ifndef __SEAMA_HEADER_FILE__
#define __SEAMA_HEADER_FILE__

#include <stdint.h>

#define SEAMA_MAGIC		0x5EA3A417

/*
 *	SEAMA looks like the following map.
 *	All the data of the header should be in network byte order.
 *
 *  +-------------+-------------+------------
 *	| SEAMA magic               |     ^
 *  +-------------+-------------+     |
 *	| reserved    | meta size   |     |
 *  +-------------+-------------+   header
 *	| image size (0 bytes)      |     |
 *  +-------------+-------------+     |
 *	~ Meta data                 ~     v
 *  +-------------+-------------+------------
 *	| SEAMA magic               |   ^     ^
 *  +-------------+-------------+   |     |
 *	| reserved    | meta size   |   |     |
 *  +-------------+-------------+   |     |
 *	| image size                |   |     |
 *  +-------------+-------------+ header  |
 *	|                           |   |     |
 *	| 16 bytes of MD5 digest    |   |     |
 *	|                           |   |     |
 *	|                           |   |     |
 *  +-------------+-------------+   |     |
 *	~ Meta data                 ~   v     |
 *  +-------------+-------------+-------  |
 *	|                           |         |
 *	| Image of the 1st entity   |         |
 *	~                           ~ 1st entity
 *	|                           |         |
 *	|                           |         v
 *  +-------------+-------------+-------------
 *	| SEAMA magic               |   ^     ^
 *  +-------------+-------------+   |     |
 *	| reserved    | meta size   |   |     |
 *  +-------------+-------------+   |     |
 *	| image size                |   |     |
 *  +-------------+-------------+ header  |
 *	|                           |   |     |
 *	| 16 bytes of MD5 digest    |   |     |
 *	|                           |   |     |
 *	|                           |   |     |
 *  +-------------+-------------+   |     |
 *	~ Meta data                 ~   v     |
 *  +-------------+-------------+-------  |
 *	|                           |         |
 *	| Image of the 2nd entity   |         |
 *	~                           ~ 2nd entity
 *	|                           |         |
 *	|                           |         v
 *  +-------------+-------------+-------------
 */


/*
 *	SEAMA header
 *
 *	|<-------- 32 bits -------->|
 *  +-------------+-------------+
 *	| SEAMA magic               |
 *  +-------------+-------------+
 *	| reserved    | meta size   |
 *  +-------------+-------------+
 *	| image size                |
 *  +-------------+-------------+
 */
/* seama header */
typedef struct seama_hdr	seamahdr_t;
struct seama_hdr
{
	uint32_t	magic;			/* should always be SEAMA_MAGIC. */
	uint16_t	reserved;		/* reserved for  */
	uint16_t	metasize;		/* size of the META data */
	uint32_t	size;			/* size of the image */
} __attribute__ ((packed));


#endif