OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [i386/] [pc386/] [tools/] [Spec.doc] - Blame information for rev 493

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
#
2
#  $Id: Spec.doc,v 1.2 1998/01/16 16:56:26 joel Exp $
3
#
4
 
5
                                                                2-28-1995 GK
6
 
7
In order to provide more functionality to the boot rom code I changed
8
Jamie's draft a little bit. All my changes have a bar sign (|) in the
9
79th column.
10
 
11
Gero Kuhlmann
12
 
13
===============================================================================
14
 
15
 
16
0. Numbering
17
 
18
This is Draft Net Boot Image Proposal 0.2, February 28, 1995                   |
19
 
20
 
21
1. Preamble - the why
22
 
23
Whilst researching what other boot proms do (at least those implementing
24
TCP/IP protocols) it is clear that each 'does their own thing' in
25
terms of what they expect in a boot image.
26
 
27
If we could all agree on working toward an open standard, O/S suppliers
28
and boot rom suppliers can build their products to this norm, and be confident
29
that they will work with each other.
30
 
31
This is a description of how I will implement the boot rom for
32
Linux. I  believe it to be flexible enough for any OS that will be loaded
33
when a PC boots from a network in the TCP/IP environment.
34
 
35
It would be good if this could be turned into some form of standard.
36
 
37
This is very much a first draft. I am inviting comment.
38
 
39
The ideas presented here should be independant of any implementation.
40
In the end, where there is a conflict between the final of this draft, and an
41
implementation, this description should prevail.
42
 
43
The terms I use are defined at the end.
44
 
45
 
46
2. The target
47
 
48
The target is to have a PC retrieve a boot image from a network in the TCP/IP
49
environment.
50
 
51
The boot may take place from a network adaptor rom, from a boot floppy, or
52
from a program in MSDOS.
53
 
54
 
55
3. Net Boot Process Description.
56
 
57
The net boot process can be started either as a result of the PC
58
boot process, or through normal DOS execution of a program. The net boot
59
program can reside on a rom, e.g. on an adaptor card, or in ram, either
60
as a result of reading off disk or transferred from ram.
61
 
62
The boot process may execute in any mode (e.g. 8086, 80386) it desires.
63
When it jumps to the start location in the boot image, it must be in
64
8086 mode and be capable of going into any mode supported by the
65
underlying processor.
66
 
67
The image cannot be loaded into address spaces below 10000h, or between
68
A0000h through FFFFFh, or between 98000h through 9FFFFh. Once the image
69
starts executing, all the memory is available to it, so it can relocate
70
parts of itself to these areas.
71
 
72
The boot process must be capable of loading the image into all other
73
memory locations. Specifically, where the machine supports this, this means
74
memory over 100000h.
75
 
76
The net boot process must execute the bootp protocol, followed by
77
the tftp protocol, as defined in the relevant rfc's.
78
 
79
The file name used in the tftp protocol must be that given by the bootp
80
record.
81
 
82
If less than 512 bytes are loaded, the net boot process attempts to display
83
on the screen any ascii data at the start of the image. The net boot
84
process then exits in the normal manner. For a boot prom, this will
85
allow normal disk booting. For DOS programs, this will mean a normal return
86
to DOS.
87
 
88
When the first 512 bytes have been loaded, the boot process checks
89
for an initial magic number, which is defined later. If this number
90
is present, the net process continues loading under the control
91
of the image format. The image, which is described later, tells the
92
net boot process where to put this record and all subsequent data.
93
 
94
If no initial magic number is present the net boot process checks for a second
95
magic number at offset 510. If the magic number 510 = 55h, 511 = AAh,
96
then the net process continues. If this second magic number is not
97
present, then the net boot process terminates the tftp protocol, displays
98
an error message and exits in the normal manner.
99
 
100
If no initial magic number is present and the second one is, the net boot
101
process relocates the 512 bytes to location 7c00h. The net boot process
102
continues to load any further image data to 10000h up. This data can overwrite
103
the first 512 boot bytes. If the image reaches 98000h, then any further data is
104
continued to be loaded above 100000h. When all the data has been loaded, the
105
net boot process jumps to location 0:7c00.
106
 
107
When the net boot process calls the image, it places 2 far pointers onto       |
108
the stack, in standard intel order (e.g. segment:offset representation).       |
109
The first far pointer which immediately follows the return address on          |
110
the stack, points to the loaded boot image header. The second far pointer      |
111
which is placed above the first one, shows to the memory area where the        |
112
net boot process saved the bootp reply.                                        |
113
 
114
 
115
4. Image Format with Initial Magic Number.
116
 
117
The first 512 bytes of the image file contain the image header,
118
and image loading information records. This contains all the
119
information needed by the net boot process as to where data
120
is to be loaded.
121
 
122
The magic number (in time-honoured tradition (well why not?)) is:
123
 
124
 
125
        1 = 13h
126
        2 = 03h
127
        3 = 1Bh
128
 
129
Apart from the two magic numbers, all words and double words are in PC
130
native endian.
131
 
132
Including the initial magic number the header record is:
133
 
134
        +---------------------+
135
        |                     |
136
        | Initial Magic No.   |  4 bytes
137
        +---------------------+
138
        |                     |
139
        | Flags and length    |  double word
140
        +---------------------+
141
        |                     |
142
        | Location Address    |  double word in ds:bx format
143
        +---------------------+
144
        |                     |
145
        | Execute Address     |  double word in cs:ip format
146
        +---------------------+
147
 
148
The Location address is where to place the 512 bytes. The net boot
149
process does this before loading the rest of the image. The location
150
address cannot be one of the reserved locations mentioned above, but
151
must be an address lower than 100000h.
152
 
153
The rest of the image must not overwrite these initial 512 bytes, placed
154
at the required location. The writing of data by the net boot process
155
into these 512 bytes is deprecated. These 512 bytes must be available for
156
the image to interogate once it is loaded and running.
157
 
158
The execute address is the location in cs:ip of the initial instruction
159
once the full image has been loaded. This must be lower than 100000h,
160
since the initial instructions will be executed in 8086 mode. When the
161
jump (actaully a far call) is made to the boot image, the stack contains a
162
far return address, with a far pointer parameter above that, pointing
163
to the location of this header.
164
 
165
The flags and length field is broken up in the following way:
166
 
167
Bits 0 to 3 (lowest 4 bits) define the length of the non vendor header in
168
double words. Currently the value is 4.
169
 
170
Bits 4 to 7 define the length required by the vendor extra information
171
in double words. A value of zero indicates no extra vendor information.
172
 
173
Bits 8 to 31 are reserved for future use and must be set to zero.
174
 
175
After this header, and any vendor header, come the image loading information
176
records. These specify where data is to be loaded, how long it is, and
177
communicates to the loaded image what sort of data it is.
178
 
179
The format of each image loading information record is :
180
 
181
 
182
          +---------------------+
183
          | Flags, tags and     |  double word
184
          | lengths             |
185
          +---------------------+
186
          |                     |
187
          | Load Address        |  double word
188
          +---------------------+
189
          |                     |
190
          | Image Length        |  double word
191
          +---------------------+
192
          |                     |
193
          | Memory Length       |  double word
194
          +---------------------+
195
 
196
Each image loading information record follows the previous, or the header.
197
 
198
The memory length, image length and load address fields are unsigned 32
199
numbers. They do not have the segment:offset format used by the 8086.
200
 
201
The flags, tags and lengths field is broken up as follows:
202
 
203
Bits 0 to 3 (lowest 4 bits) are the length of the non vendor part of this
204
header in double words. Currently this value is 4.
205
 
206
Bits 4 to 7 indicate the length of any vendor information, in double words.
207
 
208
Bits 8 to 15 are for vendor's tags. The vendor tag is a private number that
209
the loaded image can use to determine what sort of image is at this particular
210
location.
211
 
212
Bits 16 to 23 are for future expansion and should be set to zero.
213
 
214
Bits 24 to 31 are for flags, which are defined later.
215
 
216
Vendors may place further information after this information record, and
217
before the next. Each information record may have a different vendor
218
length.
219
 
220
There are two restrictions on vendor information.
221
 
222
One is that the header and all information records that the net boot process
223
is to use fall within the first 512 bytes.
224
 
225
The second restriction is that the net boot process must ignore all
226
vendor additions. The net boot process may not overwrite vendor supplied
227
information, or other undefined data in the initial 512 bytes.
228
 
229
The flags are used to modify the load address field, and to indicate
230
that this is the last information record that the net boot process should
231
use.
232
 
233
Bit 24 works in conjunction with bit 25 to specify the meaning of the
234
load address.
235
 
236
          B24    B25
237
 
238
 
239
 
240
           1     0    add the load address to the location one past the last byte
241
                      of the memory area required by the last image loaded.
242
                      If the first image, then add to 512 plus the location
243
                      where the 512 bytes were placed
244
 
245
 
246
                      last writeable location in memory. Thus 1 would
247
                      be the last location one could write in memory.
248
 
249
           1     1    load address is subtracted from the start of
250
                      the last image loaded. If the first image, then
251
                      subtract from the start of where the 512 bytes were
252
                      placed
253
 
254
(For convenience bit 24 is byte 0 of the flag field)
255
 
256
Bit 26 is the end marker for the net boot process. It is set when
257
this is the last information record the net boot process should
258
look at. More records may be present, but the net boot process will not
259
look at them. (Vendors can continue information records out past the 512
260
boundary for private use in this manner).
261
 
262
The image length tells the net boot process how many bytes are to be loaded.
263
Zero is a valid value. This can be used to mark memory areas such as
264
shared memory for interprocessor communication, flash eproms, data in eproms.
265
 
266
The image length can also be different from the memory length. This allows
267
decompression programs to fluff up the kernel image. It also allows a file
268
system to be larger then the loaded file system image.
269
 
270
Bits 27 through 31 are not defined as yet and must be set to zero until
271
they are.
272
 
273
 
274
6. Boot prom entry points.
275
 
276
I have not defined boot entry points, and means of obtaining them.
277
It could be useful to down load part of an image, and have that image
278
load more of itself by using handy parts of the net boot program.
279
 
280
This can be considered 'for further study'.
281
 
282
 
283
7. Example of a boot image.
284
 
285
Here is an example of how the boot image would look for Linux:
286
 
287
          0x1B031336,  /* magic number */
288
          0x4,         /* length of header is 16 bytes, no vendor info */
289
          0x90000000,  /* location in ds:bx format */
290
          0x90000200,  /* execute address in cs:ip format */
291
 
292
                       /* 2048 setup.S bytes */
293
          0x4,         /* flags, not end, absolute address, 16 bytes this
294
                          record, no vendor info */
295
          0x90200,     /* load address - note format */
296
          0x800,       /* 4 8 512 byte blocks for linux */
297
          0x800,
298
 
299
                       /* kernel image */
300
          0x4,         /* flags, not end, absolute address, 16 bytes this
301
                          record, no vendor info */
302
          0x10000,     /* load address - note format */
303
          0x80000,     /* 512K (this could be shorter */
304
          0x80000,
305
 
306
                       /* ramdisk for root file system */
307
          0x04000004,  /* flags = last, absolute address, 16 bytes this
308
                          record, no vendor info *//
309
          0x100000,    /* load address - in extended memory */
310
          0x80000,     /* 512K for instance */
311
          0x80000,
312
 
313
                       /* Then follows linux specific information */
314
 
315
 
316
8. Terms
317
 
318
When I say 'the net boot process', I mean the act of loading the image into
319
memory, setting up any tables, up until the jump to the required location
320
in the image.
321
 
322
The net booting program executes the net boot process. The net boot program
323
may be a rom, but not neccassarily. It is a set of instructions and data
324
residing on the booting machine.
325
 
326
The image, or boot image,  consists of the data loaded by the net boot process.
327
 
328
When I say 'the PC boot process', I mean the general PC rom bios boot process,
329
the setting up of hardware, the scanning for adaptor roms, the execution
330
of adaptor roms, the loading in of the initial boot track. The PC boot
331
process will include the net boot process, if one is present.
332
 
333
When I say client, I mean the PC booting up.
334
 
335
When I say 'image host', I mean the host where the boot image is comming from.
336
This may not have the same architecture as the client.
337
 
338
The bootp protocol is defined in RFC951 and RFC1084. The tftp protocol
339
is defined in RFC783. These are available on many sites.
340
See Comer 1991 for details on how to obtain them.
341
 
342
A bootp server is the machine that answers the bootp request. It is not
343
neccassarily the image host.
344
 
345
'Can' and 'may' means doesn't have to, but is allowed to and might.
346
'Must' means just that. 'Cannot' means must not.
347
 
348
 
349
9 References
350
 
351
Comer, D.E. 1991, Internetworking with TCP/IP Vol I: Principles, Protocols,
352
and Architecture Second Edition, Prentice Hall, Englewood Cliffs, N.J., 1991
353
 
354
Stevens, W.R 1990, Unix Network Programming, Prentice Hall,
355
Englewood Cliffs, N.J., 1990
356
 
357
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.