[BACK]Return to pc.html CVS log [TXT][DIR] Up to [local] / prex-old / doc / html / doc

File: [local] / prex-old / doc / html / doc / pc.html (download) (as text)

Revision 1.1, Tue Jun 3 09:38:43 2008 UTC (15 years, 11 months ago) by nbrk
Branch point for: MAIN

Initial revision

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>Prex/i386 PC - Documentation</title>
  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
  <meta name="keywords" content="Prex, embedded, real-time, operating system, RTOS, open source, free">
  <meta name="author" content="Kohsuke Ohtani">
  <link rel="stylesheet" type="text/css" href="../default.css" media="screen">
  <link rel="stylesheet" type="text/css" href="../print.css" media="print">
</head>
<body>
<div id="top">
</div>
<div id="middle">

<table id="content" cellpadding="0" cellspacing="0">
  <tbody>

    <tr>
      <td id="header" colspan="2" valign="top">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td id="logo">
            <a href="http://prex.sourceforge.net/">
            <img alt="Prex logo" src="../img/logo.gif" border="0"
            style="width: 281px; height: 56px;"></a>
          </td>
          <td id="brief" align="right" valign="bottom">
            An Open Source, Royalty-free,<br>
	    Real-time Operating System
          </td>
        </tr>
        </table>
      </td>
    </tr>

    <tr>
      <td id="directory" style="vertical-align: top;">
      <a href="http://prex.sourceforge.net/">Prex Home</a> >
      <a href="index.html">Document Index</a> >
      i386 PC
    </tr>
    <tr><td class="pad" colspan="2" style="vertical-align: top;"></td></tr>

    <tr>
      <td id="main" style="vertical-align: top;">
      <h1>Prex/i386 PC - Documentation</h1>

<i>Version 1.3, 2005/09/05</i><br>

<h3>Table of Contents</h3>



<b>HOWTO</b>
<ul>
  <li><a href="#quick">Quick Hacking Guide</a></li>
  <li><a href="#floppy">How to create a Prex demo floppy?</a></li>
  <li><a href="#bochs">How to run Prex with Bochs?</a></li>
  <li><a href="#qemu">How to run Prex with Qemu?</a></li>
  <li><a href="#image">How to modify the OS boot image?</a></li>
  <li><a href="#boot">How to install the boot sector?</a></li>
</ul>

<b>Technical Note</b>
<ul>
  <li><a href="#keys">Keyboard Interface</a></li>
  <li><a href="#dbg">Debugging with Bochs</a></li>
</ul>
<br>

<h2 id="quick">Quick Hacking Guide</h2>
<p>
There are following three important points to create a Prex boot floppy 
for i386-pc.
</p> 
<ol>
  <li>Format the floppy disk with FAT file system.</li>
  <li>Write the Prex boot sector (bootsect.bin) to the 1st sector.</li>
  <li>Copy the Prex kernel image (prexos) to the root directory
   of the floppy.</li>
</ol>
<p>
Here, the difficult step is 2. To write the boot sector, some special 
tool will be needed. Currently, only DOS utility (mkboot.com) is 
available in the Prex distribution.
</p> 
<p>
So, I recommend you to create the bootable demo floppy at first. Then, 
you can replace the kernel image to your own kernel in the demo floppy.
</p>
<p>
The following is the most easy step to hack the Prex kernel on i386-pc.
</p>
<ol>
  <li>Build your own kernel. Please refer to
  <a href="build.html">"Prex Build Guide"</a>.
  </li>

  <li>Create the demo floppy. Please refer to
  <a href="#floppy">"How to create a Prex demo floppy?"</a>
  </li>

  <li>Replace the kernel image (prexos) in the demo floppy by your own 
  image. You can use mtools to do it.
  <pre class="terminal"> $ mcopy prexos a:\</pre>
  Or, it may be easy to copy it by mounting the FAT file system to the floppy
  if your OS supports it. 
  </li>

  <li>Boot PC with a created floppy disk.
  If the system does not boot with the floppy,
  you should check the BIOS settings for the boot device order.
  </li>
</ol>



<h2 id="floppy">How to create a Prex demo floppy?</h2>

<ol>
 <li>Download the binary file(*.img.gz) for the latest Prex boot floppy from
 the following web page.<br>
 <a href="http://prex.sourceforge.net/downloads.html">
 http://prex.sourceforge.net/downloads.htm</a>
 </li>

 <li>Unpack the image
 <pre class="terminal">$ gunzip prex-X.X.X.i386-pc.img.gz</pre>
 </li>

 <li>Create the floppy
 <ul>
   <li>Unix:
   <pre class="terminal">$ dd if=(your directory)/prex-X.X.X.i386-pc.img of=/dev/fd0</pre>
   </li>
   <li>Windows
   <pre class="terminal">>rawritewin (your directory)/prex-X.X.X.i386-pc.img a:</pre>
   </li>
 </ul>
 </li>
</ol>


<h2 id="bochs">How to run Prex with Bochs?</h2>

<h3>Installing Bochs</h3>
<p>
Bochs is an open-source x86 pc emulator, and you can run Prex with
Bochs ons Windows/Linux.
The Bochs latest release can be downloaded from
<a href="http://bochs.sourceforge.net">
http://bochs.sourceforge.net</a>.
</p>

<h3>Setting up for Bochs</h3>
<p>
The Prex demo disk is available for download.
The disk image is 1.44M floppy
image with FAT file format. And, this image can be used as a Bochs floppy image.
</p>
 You can setup Bochs for Prex by the following steps:

<ol>
 <li>Download the binary file(*.img.gz) for the latest Prex boot floppy from
 the following web page.<br>
 <a href="http://prex.sourceforge.net/downloads.html">
 http://prex.sourceforge.net/downloads.htm</a>
 </li>

 <li>Unpack the image.
 <pre class="terminal">$ gunzip prex-X.X.X.i386-pc.img.gz</pre></li>

 <li>Set the path for the floppy image in your Bochs setting file "bochsrc", like:
 <pre>floppya: 1_44=(your directory)/prex-X.X.X.i386-pc.img, status=inserted</pre>
 </li>

 <li>Set the bootable device in "bochsrc".
 <pre>boot: floppy</pre></li>

 <li>Run Bochs.
 <pre class="terminal">$ bochs -q</pre></li>
</ol>

<h2 id="qemu">How to run Prex with QEMU?</h2>
<p>
 If you are using QEMU, the same image created for Bochs with above info
 can be used.
 You can simply try Prex with QEMU by the following command.
</p>
<pre class="terminal">$ qemu -fda (your directory)/prex-X.X.X.i386-pc.img -localtime</pre>



<h2 id="image">How to modify the OS boot image?</h2>
<p>
If you compile the Prex source with "make" command, the OS boot image is created
as "prexos" in "img" directory. The file "prexos" must be placed in the root directory
of the Prex disk. You can test your own Prex image by replacing the "prexos" in
the floppy image.
</p>
<p>
To replace the file in the floppy image, "mtools" is useful. Before using
"mcopy", the drive A must be point to the image file in "mtools.conf" as follow:
</p>
<pre>drive a: file="(your directory)/prex-X.X.X.i386-pc.img"</pre>
Then, the file copy can be performed by:
<pre class="terminal"> $ mcopy -o prexos a:\</pre>
<p>
You can use this customized Prex image with Bochs, or you can create an actual
bootable floppy disk and test it with the real PC hardware.
</p>



<h2 id="boot">How to install the boot sector?</h2>
<p>
In order to boot from the floppy disk, you must install the Prex boot sector
named "bootsect.bin" into the 1st sector.
The DOS program named "mkboot.com" is available to write this boot sector.
You can create the Prex bootable floppy by the following steps.
</p>
<ol>
 <li>Prepare a blank floppy disk. This must be formatted with 1.44M FAT file system.</li>
 <li>Boot DOS, and put "bootsect.bin" and "mkboot.com" in the same directory.</li>
 <li> Type as follow:</li>
</ol>
<pre class="terminal">a:\>mkboot a:</pre>

<p>
 You can perform these steps within Bochs if you have a DOS bootable image for
 Bochs. In this case, you have to specify the drive setting of Bochs as follow:
</p>
<pre>floppya: 1_44=dos-boot.img, status=inserted
floppyb: 1_44=(your directory)/prex-X.X.X.i386-pc.img, status=inserted</pre>

 Then, type:
<pre class="terminal">a:\>mkboot b:</pre>

Note: You had better download an Prex bootable image rather than this method.


<h2 id="keys">Keyboard Interface</h2>
<p>
Some special keys are defined by the keyboard driver.
</p>

<i><b>Table 1. PC Special Keys</b></i>
<table width="80%" border="1" cellspacing="0">
<tbody>
<tr>
  <th width="150">Key</th>
  <th>Function</th>
</tr>

  <tr>
    <td>Alt+Ctrl+Del</td>
    <td>Reboot</td>
  </tr>
  <tr>
    <td>Ctrl+C</td>
    <td>Breakpoint</td>
  </tr>
  <tr>
    <td>Ctrl+D</td>
    <td>Pause until next key input</td>
  </tr>
  <tr>
    <td>F1</td>
    <td>Help for Fn dump keys</td>
  </tr>
  <tr>
    <td>F2</td>
    <td>Dump all threads</td>
  </tr>
  <tr>
    <td>F3</td>
    <td>Dump all tasks</td>
  </tr>
  <tr>
    <td>F4</td>
    <td>Dump all objects</td>
  </tr>
  <tr>
    <td>F5</td>
    <td>Dump all timers</td>
  </tr>
  <tr>
    <td>F6</td>
    <td>Dump all interrupts</td>
  </tr>
  <tr>
    <td>F7</td>
    <td>Dump all devices</td>
  </tr>
  <tr>
    <td>F8</td>
    <td>Dump memory information</td>
  </tr>

</tbody>
</table>



<h2 id="dbg">Debugging with Bochs</h2>
<p>
 Bochs has a capability to output the character to the console via i/o port 0xe9.
 To get your printk() or sys_log() message in the console, you must configure and
 rebuild Bochs/Prex as follow.
</p>
<ol>
  <li>Bochs must be built with "--enable-port-e9-hack" option.</li>
  <li>Prex must be built with enabling "BOCHS_OUTPUT" flag in
 "prex/src/arch/i386/diag.c".</li>
</ol>
<p>
The Bochs console is useful to debug kernel because you can browse or find the log message in
the console window.
</p>
<p>
The Bochs internal debugger is also useful to debug kernel. It can be
enabled with the following configuration.
</p>
<pre class="terminal">$ ./configure --enable-debugger --enable-disasm --enable-port-e9-hack</pre>


      </td>
    </tr>
    <tr>
      <td id="footer" colspan="2" style="vertical-align: top;">
        <a href="http://sourceforge.net">
        <img src="http://sourceforge.net/sflogo.php?group_id=132028&amp;type=1"
        alt="SourceForge.net Logo" border="0" height="31" width="88"></a><br>
        Copyright&copy; 2005-2007 Kohsuke Ohtani
      </td>
    </tr>

  </tbody>
</table>

</div>
<div id="bottom"></div>

</body>
</html>