File: loader.h

package info (click to toggle)
vmelilo 1.1.1-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 360 kB
  • ctags: 761
  • sloc: ansic: 7,361; makefile: 98
file content (167 lines) | stat: -rw-r--r-- 5,307 bytes parent folder | download
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 *	VME Linux/m68k Loader
 *
 *	(c) Copyright 1997 by Nick Holgate
 *
 *	This file is subject to the terms and conditions of the GNU General Public
 *	License.  See the file COPYING for more details.
 */

/*--------------------------------------------------------------------------*/

#define LILO_ID					(0x4C494C4F)	/* `LILO'					*/
#define LILO_MAPDATAID			(0x4D415044)	/* `MAPD'					*/

#define TRUE					(1)
#define FALSE					(0)

#define arraysize(x)			(sizeof(x) / sizeof(*(x)))

/*--------------------------------------------------------------------------*/
/* File Map Entry Definition
 */
typedef struct {
	unsigned long	offset;				/* Device byte offset				*/
	unsigned long	length;				/* Length in bytes					*/

} FILEMAP;

#define MAP_FILESIZE(map)	(map[0].offset)
#define MAP_NUMFRAGS(map)	(map[0].length)
#define MAP_FIRSTFRAG(map)	(&map[1])
#define MAP_MAPSIZE(map)	((MAP_NUMFRAGS(map) + 1) * sizeof(FILEMAP))

/*--------------------------------------------------------------------------*/
/*		Tag Record
 *
 *		The Map File consists of a concatenation of Tag Records
 *
 *			Tag							Size	Data
 *			---							----	----
 *
 *		File Identification:
 *
 *			TAG_LILO					0		-
 *
 *		Boot Options:
 *
 *			TAG_HEADER					0		-
 *			TAG_DEFAULT							char []
 *			TAG_MESSAGE							char []
 *			TAG_PROMPT					4		unsigned long
 *			TAG_DELAY					4		unsigned long
 *			TAG_DEBUG					4		unsigned long
 *			TAG_HEADER_END				0		-
 *
 *		Boot Records:
 *
 *			TAG_BOOT_RECORD						char []
 *			TAG_ALIAS							char []
 *			TAG_KERNEL							char []
 *			TAG_ARGUMENTS						char []
 *			TAG_PASSWORD						char []
 *			TAG_RAMDISK							char []
 *			TAG_SYMTAB							char []
 *			TAG_MEMSIZE					4		unsigned long
 *			TAG_BOOT_RECORD_END			0		-
 *
 *		File Records:
 *
 *			TAG_FILE_DEF						char []
 *			TAG_FILEMAP							unsigned long []
 *			TAG_FILE_DEF_END			0		-
 *
 *		End of File:
 *
 *			TAG_EOF						0		-
 *
 */

typedef struct
{
	unsigned long	tagid;				/* Tag Identifier					*/
	unsigned long	size;				/* Must be a multiple of 4 bytes	*/
	unsigned long	data[0];			/* Size bytes of Tag Data			*/
} TAGRECORD;

/*--------------------------------------------------------------------------*/
/* Tag Identifiers
 */

#define TAG_LILO				LILO_ID /* File Identification				*/
#define TAG_EOF					(0)		/* End of File						*/

#define TAG_HEADER				(1000)	/* Start of Header					*/
#define TAG_HEADER_END			(1001)	/* End of Header					*/
#define TAG_DEFAULT				(1002)	/* Default Boot Image				*/
#define TAG_PROMPT				(1003)	/* Force Boot Prompt Flag			*/
#define TAG_DELAY				(1004)	/* Delay Value						*/
#define TAG_TIMEOUT				(1005)	/* Timeout Value					*/
#define TAG_DEBUG				(1006)	/* Debug Flag						*/
#define TAG_MESSAGE				(1007)	/* Boot message file name			*/

#define TAG_BOOT_RECORD			(2000)	/* Start of Boot Record				*/
#define TAG_BOOT_RECORD_END		(2001)	/* End of Boot Record 				*/
#define TAG_ALIAS				(2002)	/* Alias Label Name					*/
#define TAG_KERNEL				(2003)	/* Kernel Image						*/
#define TAG_ARGUMENTS			(2004)	/* Boot Arguments					*/
#define TAG_PASSWORD			(2005)	/* Password							*/
#define TAG_RESTRICTED			(2006)	/* Need Password For CmdLine Args	*/
#define TAG_RAMDISK				(2007)	/* Ramdisk Image					*/
#define	TAG_MEMSIZE				(2008)	/* DRAM RAM size in bytes			*/
#define TAG_SYMTAB				(2009)	/* Symbol table file (MAP)			*/
#define TAG_CALLMONITOR			(2010)	/* Call ROM monitor before boot		*/

#define TAG_FILE_DEF			(3000)	/* Start of File Definition			*/
#define TAG_FILE_DEF_END		(3001)	/* End of File Definition			*/
#define TAG_FILEMAP				(3002)	/* File Map							*/

/*--------------------------------------------------------------------------*/
/*	Global Boot Options
 */

typedef struct
{
	const char			*boot_default;	/* Default Boot Image				*/
	const unsigned long	*boot_prompt;	/* Force Boot Prompt Flag			*/
	const unsigned long	*boot_delay;	/* In Seconds, Zero no delay		*/
	const unsigned long	*boot_timeout;	/* In Seconds, Zero no timout		*/
	const unsigned long	*boot_debug;	/* Debug Flag						*/
	const char			*boot_message;	/* Boot message file name			*/

} BOOTOPTIONS;

/*--------------------------------------------------------------------------*/
/* Boot Record Definitions
 */

typedef struct bootrecord
{
	struct bootrecord	*next;			/* Next Boot Record					*/
	const char			*label;			/* Boot Record Label				*/
	const char			*alias;			/* Alias Label Name					*/
	const char			*kernel;		/* Kernel Image						*/
	const char			*args;			/* Boot Arguments					*/
	const char			*append;		/* Extra Boot Arguments				*/
	const char			*password;		/* Password							*/
	const char			*ramdisk;		/* Ramdisk							*/
	const char			*symtab;		/* Symbol Table						*/
	const unsigned long	*memsize;		/* DRAM RAM size in bytes			*/
	const unsigned long	*restricted;	/* Need password for boot cmdline	*/
	const unsigned long	*callmonitor;	/* Enter debugger prior to boot		*/

} BOOTRECORD;

/*--------------------------------------------------------------------------*/
/* File Definition
 */

typedef struct filedef
{
	struct filedef	*next;				/* Next File Definition				*/
	const char		*path;				/* File Path						*/
	const FILEMAP	*map;				/* File Map							*/

} FILEDEF;

/*-----------------------------< end of file >------------------------------*/