boot.html (6051B)
1 <HTML> 2 <HEAD> 3 <TITLE>Booting 'n Stuff</TITLE> 4 </HEAD> 5 <BODY BGCOLOR="#ffffff"> 6 7 <CENTER> 8 <TABLE WIDTH=600> 9 10 11 <TR BGCOLOR="#a0a0a0"><TD><B>About uBoot</B></TD></TR> 12 <TR><TD><BR> 13 The uBoot system is intended to provide a simple mechanism for booting 14 microkernel OS's from one self-contained file in various environments. 15 <UL> 16 <LI>From a remote network host 17 <LI>From the boot sector of a floppy disk 18 <LI>From a file on a DOS partition 19 </UL> 20 The boot image is not simply an executable file, but a 'filesystem' of sorts, 21 containing a 2nd stage bootstrap, and whatever other images are needed by 22 the target system. A utility (bootmaker) is used to create this boot 23 image from a description file and various components. 24 <BR><BR><BR></TD></TR> 25 26 <TR BGCOLOR="#a0a0a0"><TD><B>Boot Environment</B></TD></TR> 27 <TR><TD><BR> 28 29 <TABLE BORDER=1> 30 <TR><TH>member</TH><TH>type</TH><TH>description</TH></TR> 31 <TR><TD>be_name</TD><TD>char[32]</TD><TD> 32 Name of the object. Zero terminated ASCII. Entry 0 is always named 33 "SBBB/Directory". 34 </TD></TR> 35 <TR><TD>be_offset</TD><TD>uint32</TD><TD> 36 Offset (in 4K pages) from the start of the image to the start of this 37 entry. 38 </TD></TR> 39 <TR><TD>be_type</TD><TD>uint32</TD><TD> 40 The object type of the entry. One of the defined types listed below, 41 or a system-specific type. Entry 0 must be BE_TYPE_DIRECTORY and entry 1 42 must be BE_TYPE_BOOTSTRAP. 43 </TD></TR> 44 <TR><TD>be_size</TD><TD>uint32</TD><TD> 45 The size (in 4K pages) of this entry in the image. 46 </TD></TR> 47 <TR><TD>be_vsize</TD><TD>uint32</TD><TD> 48 The size (in 4K pages) that this entry would like when mapped into memory. 49 </TD></TR> 50 <TR><TD>be_extra0</TD><TD>uint32</TD><TD> 51 extra field 52 </TD></TR> 53 <TR><TD>be_extra1</TD><TD>uint32</TD><TD> 54 extra field 55 </TD></TR> 56 <TR><TD>be_extra2</TD><TD>uint32</TD><TD> 57 extra field 58 </TD></TR> 59 <TR><TD>be_extra3</TD><TD>uint32</TD><TD> 60 extra field 61 </TD></TR> 62 </TABLE> 63 64 <UL> 65 <LI>The boot image will be located starting at 0x100000. 66 <LI>The boot directory (64 entries) will be located at offset 0 of the 67 boot image (also 0x100000. 68 <LI>Entry 0 in the directory must be the directory itself (be_offset = 0, 69 be_type = BE_TYPE_DIRECTORY, be_size = 1, be_vsize = 1) 70 <LI>Entry 1 in the directory must be the 2nd stage loader (or kernel if 71 the kernel is sufficiently simple). be_offset = 1, be_type = BE_TYPE_BOOTSTRAP 72 <LI>Once the Image is loaded, control is transferred to 73 boot_dir->bd_entry[1].be_extra1 + 0x101000; 74 <LI>The bootstrap entry point looks like:<BR> 75 <TT>void _start(uint32 mem, char *params, boot_dir *bd);</TT><BR> 76 mem = system memory size (in bytes), params = zero terminate parameter 77 string, bd = 0x100000 78 <LI>The last entry will be of type BE_TYPE_NONE to indicate the end of 79 the directory 80 </UL> 81 <PRE> 82 83 typedef struct { 84 char be_name[32]; /* asciiZ */ 85 unsigned int be_offset; /* 4K pages */ 86 unsigned int be_type; /* BE_* */ 87 unsigned int be_size; /* 4K pages */ 88 unsigned int be_vsize; /* 4K pages */ 89 unsigned int be_extra0; 90 unsigned int be_extra1; 91 unsigned int be_extra2; 92 unsigned int be_extra3; 93 } boot_entry; 94 95 typedef struct { 96 boot_entry bd_entry[64]; 97 } boot_dir; 98 99 #define BE_TYPE_NONE 0 /* empty entry */ 100 #define BE_TYPE_DIRECTORY 1 /* directory (entry 0) */ 101 #define BE_TYPE_BOOTSTRAP 2 /* bootstrap code object */ 102 #define BE_TYPE_CODE 3 /* executable code object */ 103 #define BE_TYPE_DATA 4 /* raw data object */ 104 #define BE_TYPE_ELF32 5 /* 32bit ELF object */ 105 106 /* for BE_TYPE_CODE / BE_TYPE_BOOTSTRAP */ 107 #define be_code_vaddr be_extra0 /* virtual address (rel offset 0) */ 108 #define be_code_ventr be_extra1 /* virtual entry point (rel offset 0) */ 109 </PRE> 110 <BR></TD></TR> 111 112 <TR BGCOLOR="#a0a0a0"><TD><B>BootMaker (building the image)</B></TD></TR> 113 <TR><TD><BR> 114 115 The bootmaker util reads description file that looks like: 116 117 <PRE> 118 # Boot Image for stock OpenBLT 119 # 120 121 [bootstrap] 122 type=boot 123 file=boot/boot.bin 124 ventry=128 125 126 [kernel] 127 type=code 128 file=kernel/kernel.bin 129 130 [namer] 131 type=code 132 file=srv/namer/namer.bin 133 134 [console] 135 type=code 136 file=srv/console/console.bin 137 </PRE> 138 139 Each section (headed by a name in []'s) is an entry in the boot directory, 140 starting with entry 1 (entry 0 being the directory itself). Each entry 141 must have a valid type and a valid file to load. Some entry types will 142 allow extra params (eg ventry in a type=boot entry). Valid types are 143 boot -> BE_TYPE_BOOTSTRAP, code -> BE_TYPE_CODE, elf32 -> BE_TYPE_ELF32, 144 data -> BE_TYPE_DATA. 145 <P> A mechanism for defining your own types and meanings 146 for the extra[0123] fields will be available soon. The name in the []'s 147 starting the section will be placed in be_name. The first entry should 148 be a bootstrap entry (as the bootloader will transfer control into it 149 whether it is or no. 150 <P> 151 <P> 152 <TT>bootmaker <descr_file> <bootimage_file> [ -floppy ]</TT><P> 153 The bootmaker util reads the descr_file, writes the bootimage_file, and 154 if the optional -floppy flag is specified, the bootimage_file will be 155 a disk image suitable for rawriting or copying with dd. 156 157 <BR><BR><BR></TD></TR> 158 159 <TR BGCOLOR="#a0a0a0"><TD><B>boot.com (loading the image)</B></TD></TR> 160 <TR><TD><BR> 161 The DOS bootloader (boot.com) can be invoked in two ways: 162 <P> 163 <TT>boot.com bootfile</TT><BR> 164 Will load the boot image in bootfile to 0x100000 and transfer control 165 to it as described above. 166 <P> 167 <TT>boot.com net=ip=x.y.z.w</TT><BR> 168 Will load the netboot bootstrap out of netboot.bin (this will be bundled 169 in boot.com in the next revision) and start a netboot server, waiting for 170 a unix netboot client to send it a boot image file (see below). 171 172 <BR><BR><BR></TD></TR> 173 174 <TR BGCOLOR="#a0a0a0"><TD><B>NetBoot Client</B></TD></TR> 175 <TR><TD><BR> 176 <TT>netboot <bootfile> <ip_address></TT><BR> 177 netboot will send the specified bootfile to the netboot server at the 178 specified ip address. 179 180 <BR><BR><BR></TD></TR> 181 182 <TR BGCOLOR="#a0a0a0"><TD><B>BootMaker (building the image)</B></TD></TR> 183 <TR><TD><BR> 184 <BR></TD></TR> 185 186 187 </TABLE> 188 </CENTER> 189 </BODY> 190 </HTML>