home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / linux_bo / netboot.zoo / spec.doc < prev    next >
Encoding:
Text File  |  1993-05-06  |  13.3 KB  |  329 lines

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