Annotation of prex/doc/html/doc/pc.html, Revision 1.1.1.1
1.1 nbrk 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2: <html>
3: <head>
4: <title>Prex/i386 PC - Documentation</title>
5: <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
6: <meta name="keywords" content="Prex, embedded, real-time, operating system, RTOS, open source, free">
7: <meta name="author" content="Kohsuke Ohtani">
8: <link rel="stylesheet" type="text/css" href="../default.css" media="screen">
9: <link rel="stylesheet" type="text/css" href="../print.css" media="print">
10: </head>
11: <body>
12: <div id="top">
13: </div>
14: <div id="middle">
15:
16: <table id="content" cellpadding="0" cellspacing="0">
17: <tbody>
18:
19: <tr>
20: <td id="header" colspan="2" valign="top">
21: <table width="100%" border="0" cellspacing="0" cellpadding="0">
22: <tr>
23: <td id="logo">
24: <a href="http://prex.sourceforge.net/">
25: <img alt="Prex logo" src="../img/logo.gif" border="0"
26: style="width: 250px; height: 54px;"></a>
27: </td>
28: <td id="brief" align="right" valign="bottom">
29: An Open Source, Royalty-free,<br>
30: Real-time Operating System
31: </td>
32: </tr>
33: </table>
34: </td>
35: </tr>
36:
37: <tr>
38: <td id="directory" style="vertical-align: top;">
39: <a href="http://prex.sourceforge.net/">Prex Home</a> >
40: <a href="index.html">Document Index</a> >
41: i386 PC
42: </tr>
43: <tr><td class="pad" colspan="2" style="vertical-align: top;"></td></tr>
44:
45: <tr>
46: <td id="doc" style="vertical-align: top;">
47: <h1>Prex/i386 PC - Documentation</h1>
48:
49: <i>Version 1.3, 2005/09/05</i><br>
50:
51: <h3>Table of Contents</h3>
52:
53:
54:
55: <b>HOWTO</b>
56: <ul>
57: <li><a href="#quick">Quick Hacking Guide</a></li>
58: <li><a href="#floppy">How to create a Prex demo floppy?</a></li>
59: <li><a href="#bochs">How to run Prex with Bochs?</a></li>
60: <li><a href="#qemu">How to run Prex with Qemu?</a></li>
61: <li><a href="#image">How to modify the OS boot image?</a></li>
62: <li><a href="#boot">How to install the boot sector?</a></li>
63: </ul>
64:
65: <b>Technical Note</b>
66: <ul>
67: <li><a href="#keys">Keyboard Interface</a></li>
68: <li><a href="#dbg">Debugging with Bochs</a></li>
69: </ul>
70: <br>
71:
72: <h2 id="quick">Quick Hacking Guide</h2>
73: <p>
74: There are following three important points to create a Prex boot floppy
75: for i386-pc.
76: </p>
77: <ol>
78: <li>Format the floppy disk with FAT file system.</li>
79: <li>Write the Prex boot sector (bootsect.bin) to the 1st sector.</li>
80: <li>Copy the Prex kernel image (prexos) to the root directory
81: of the floppy.</li>
82: </ol>
83: <p>
84: Here, the difficult step is 2. To write the boot sector, some special
85: tool will be needed. Currently, only DOS utility (mkboot.com) is
86: available in the Prex distribution.
87: </p>
88: <p>
89: So, I recommend you to create the bootable demo floppy at first. Then,
90: you can replace the kernel image to your own kernel in the demo floppy.
91: </p>
92: <p>
93: The following is the most easy step to hack the Prex kernel on i386-pc.
94: </p>
95: <ol>
96: <li>Build your own kernel. Please refer to
97: <a href="build.html">"Prex Build Guide"</a>.
98: </li>
99:
100: <li>Create the demo floppy. Please refer to
101: <a href="#floppy">"How to create a Prex demo floppy?"</a>
102: </li>
103:
104: <li>Replace the kernel image (prexos) in the demo floppy by your own
105: image. You can use mtools to do it.
106: <pre class="terminal"> $ mcopy prexos a:\</pre>
107: Or, it may be easy to copy it by mounting the FAT file system to the floppy
108: if your OS supports it.
109: </li>
110:
111: <li>Boot PC with a created floppy disk.
112: If the system does not boot with the floppy,
113: you should check the BIOS settings for the boot device order.
114: </li>
115: </ol>
116:
117:
118:
119: <h2 id="floppy">How to create a Prex demo floppy?</h2>
120:
121: <ol>
122: <li>Download the binary file(*.img.gz) for the latest Prex boot floppy from
123: the following web page.<br>
124: <a href="http://prex.sourceforge.net/downloads.html">
125: http://prex.sourceforge.net/downloads.htm</a>
126: </li>
127:
128: <li>Unpack the image
129: <pre class="terminal">$ gunzip prex-X.X.X.i386-pc.img.gz</pre>
130: </li>
131:
132: <li>Create the floppy
133: <ul>
134: <li>Unix:
135: <pre class="terminal">$ dd if=(your directory)/prex-X.X.X.i386-pc.img of=/dev/fd0</pre>
136: </li>
137: <li>Windows
138: <pre class="terminal">>rawritewin (your directory)/prex-X.X.X.i386-pc.img a:</pre>
139: </li>
140: </ul>
141: </li>
142: </ol>
143:
144:
145: <h2 id="bochs">How to run Prex with Bochs?</h2>
146:
147: <h3>Installing Bochs</h3>
148: <p>
149: Bochs is an open-source x86 pc emulator, and you can run Prex with
150: Bochs ons Windows/Linux.
151: The Bochs latest release can be downloaded from
152: <a href="http://bochs.sourceforge.net">
153: http://bochs.sourceforge.net</a>.
154: </p>
155:
156: <h3>Setting up for Bochs</h3>
157: <p>
158: The Prex demo disk is available for download.
159: The disk image is 1.44M floppy
160: image with FAT file format. And, this image can be used as a Bochs floppy image.
161: </p>
162: You can setup Bochs for Prex by the following steps:
163:
164: <ol>
165: <li>Download the binary file(*.img.gz) for the latest Prex boot floppy from
166: the following web page.<br>
167: <a href="http://prex.sourceforge.net/downloads.html">
168: http://prex.sourceforge.net/downloads.htm</a>
169: </li>
170:
171: <li>Unpack the image.
172: <pre class="terminal">$ gunzip prex-X.X.X.i386-pc.img.gz</pre></li>
173:
174: <li>Set the path for the floppy image in your Bochs setting file "bochsrc", like:
175: <pre>floppya: 1_44=(your directory)/prex-X.X.X.i386-pc.img, status=inserted</pre>
176: </li>
177:
178: <li>Set the bootable device in "bochsrc".
179: <pre>boot: floppy</pre></li>
180:
181: <li>Run Bochs.
182: <pre class="terminal">$ bochs -q</pre></li>
183: </ol>
184:
185: <h2 id="qemu">How to run Prex with QEMU?</h2>
186: <p>
187: If you are using QEMU, the same image created for Bochs with above info
188: can be used.
189: You can simply try Prex with QEMU by the following command.
190: </p>
191: <pre class="terminal">$ qemu -fda (your directory)/prex-X.X.X.i386-pc.img -localtime</pre>
192:
193:
194:
195: <h2 id="image">How to modify the OS boot image?</h2>
196: <p>
197: If you compile the Prex source with "make" command, the OS boot image is created
198: as "prexos" in "img" directory. The file "prexos" must be placed in the root directory
199: of the Prex disk. You can test your own Prex image by replacing the "prexos" in
200: the floppy image.
201: </p>
202: <p>
203: To replace the file in the floppy image, "mtools" is useful. Before using
204: "mcopy", the drive A must be point to the image file in "mtools.conf" as follow:
205: </p>
206: <pre>drive a: file="(your directory)/prex-X.X.X.i386-pc.img"</pre>
207: Then, the file copy can be performed by:
208: <pre class="terminal"> $ mcopy -o prexos a:\</pre>
209: <p>
210: You can use this customized Prex image with Bochs, or you can create an actual
211: bootable floppy disk and test it with the real PC hardware.
212: </p>
213:
214:
215:
216: <h2 id="boot">How to install the boot sector?</h2>
217: <p>
218: In order to boot from the floppy disk, you must install the Prex boot sector
219: named "bootsect.bin" into the 1st sector.
220: The DOS program named "mkboot.com" is available to write this boot sector.
221: You can create the Prex bootable floppy by the following steps.
222: </p>
223: <ol>
224: <li>Prepare a blank floppy disk. This must be formatted with 1.44M FAT file system.</li>
225: <li>Boot DOS, and put "bootsect.bin" and "mkboot.com" in the same directory.</li>
226: <li> Type as follow:</li>
227: </ol>
228: <pre class="terminal">a:\>mkboot a:</pre>
229:
230: <p>
231: You can perform these steps within Bochs if you have a DOS bootable image for
232: Bochs. In this case, you have to specify the drive setting of Bochs as follow:
233: </p>
234: <pre>floppya: 1_44=dos-boot.img, status=inserted
235: floppyb: 1_44=(your directory)/prex-X.X.X.i386-pc.img, status=inserted</pre>
236:
237: Then, type:
238: <pre class="terminal">a:\>mkboot b:</pre>
239:
240: Note: You had better download an Prex bootable image rather than this method.
241:
242:
243: <h2 id="keys">Keyboard Interface</h2>
244: <p>
245: Some special keys are defined by the keyboard driver.
246: </p>
247:
248: <i><b>Table 1. PC Special Keys</b></i>
249: <table width="80%" border="1" cellspacing="0">
250: <tbody>
251: <tr>
252: <th width="150">Key</th>
253: <th>Function</th>
254: </tr>
255:
256: <tr>
257: <td>Alt+Ctrl+Del</td>
258: <td>Reboot</td>
259: </tr>
260: <tr>
261: <td>Ctrl+C</td>
262: <td>Breakpoint</td>
263: </tr>
264: <tr>
265: <td>Ctrl+D</td>
266: <td>Pause until next key input</td>
267: </tr>
268: <tr>
269: <td>F1</td>
270: <td>Help for Fn dump keys</td>
271: </tr>
272: <tr>
273: <td>F2</td>
274: <td>Dump all threads</td>
275: </tr>
276: <tr>
277: <td>F3</td>
278: <td>Dump all tasks</td>
279: </tr>
280: <tr>
281: <td>F4</td>
282: <td>Dump all objects</td>
283: </tr>
284: <tr>
285: <td>F5</td>
286: <td>Dump all timers</td>
287: </tr>
288: <tr>
289: <td>F6</td>
290: <td>Dump all interrupts</td>
291: </tr>
292: <tr>
293: <td>F7</td>
294: <td>Dump all devices</td>
295: </tr>
296: <tr>
297: <td>F8</td>
298: <td>Dump memory information</td>
299: </tr>
300:
301: </tbody>
302: </table>
303:
304:
305:
306: <h2 id="dbg">Debugging with Bochs</h2>
307: <p>
308: Bochs has a capability to output the character to the console via i/o port 0xe9.
309: To get your printf() or sys_log() message in the console, you must configure and
310: rebuild Bochs/Prex as follow.
311: </p>
312: <ol>
313: <li>Bochs must be built with "--enable-port-e9-hack" option.</li>
314: <li>Prex must be built with enabling "BOCHS_OUTPUT" flag in
315: "prex/src/arch/i386/diag.c".</li>
316: </ol>
317: <p>
318: The Bochs console is useful to debug kernel because you can browse or find the log message in
319: the console window.
320: </p>
321: <p>
322: The Bochs internal debugger is also useful to debug kernel. It can be
323: enabled with the following configuration.
324: </p>
325: <pre class="terminal">$ ./configure --enable-debugger --enable-disasm --enable-port-e9-hack</pre>
326:
327:
328: </td>
329: </tr>
330: <tr>
331: <td id="footer" colspan="2" style="vertical-align: top;">
332: <a href="http://sourceforge.net">
333: <img src="http://sourceforge.net/sflogo.php?group_id=132028&type=1"
334: alt="SourceForge.net Logo" border="0" height="31" width="88"></a><br>
335: Copyright© 2005-2007 Kohsuke Ohtani
336: </td>
337: </tr>
338:
339: </tbody>
340: </table>
341:
342: </div>
343: <div id="bottom"></div>
344:
345: </body>
346: </html>
CVSweb