There are following three important points to create a Prex boot floppy for x86-pc.
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.
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.
The following is the most easy step to hack the Prex kernel on x86-pc.
$ mcopy prexos a:\Or, it may be easy to copy it by mounting the FAT file system to the floppy if your OS supports it.
$ gunzip prex-X.X.X.i386-pc.img.gz
$ dd if=(your directory)/prex-X.X.X.i386-pc.img of=/dev/fd0
>rawritewin (your directory)/prex-X.X.X.i386-pc.img a:
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 http://bochs.sourceforge.net.
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.You can setup Bochs for Prex by the following steps:
$ gunzip prex-X.X.X.i386-pc.img.gz
floppya: 1_44=(your directory)/prex-X.X.X.i386-pc.img, status=inserted
$ bochs -q
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.
$ qemu -fda (your directory)/prex-X.X.X.i386-pc.img -localtime
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.
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 follows:
drive a: file="(your directory)/prex-X.X.X.i386-pc.img"Then, the file copy can be performed by:
$ mcopy -o prexos a:\
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.
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.
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:
floppya: 1_44=dos-boot.img, status=inserted floppyb: 1_44=(your directory)/prex-X.X.X.i386-pc.img, status=insertedThen, type:
a:\>mkboot b:Note: You had better download an Prex bootable image rather than this method.
Some special keys are defined by the keyboard driver.
|Ctrl+D||Pause until next key input|
|F1||Help for Fn dump keys|
|F2||Dump all threads|
|F3||Dump all tasks|
|F4||Dump memory information|
Bochs has a capability to output the character to the console via i/o port 0xe9. To get your printf() or sys_log() message in the console, you must configure and rebuild Bochs/Prex as follows.
The Bochs console is useful to debug kernel because you can browse or find the log message in the console window.
The Bochs internal debugger is also useful to debug kernel. It can be enabled with the following configuration.
$ ./configure --enable-debugger --enable-disasm --enable-port-e9-hack