User Tools

Site Tools


progress

Progress

At first

To start off my project I started searching for information I might need. I found some references to similar projects, but found them difficult to implement. Mostly because they did not do a good job of documenting what, why and how. You will also find it quite common that these so-called walk-throughs leave out things that can be located elsewhere, making progress painfully slow as you need to find all that missing information.
My breakthrough came when I found OSDev.org. There you will find a lot of useful information on topics you need to know, and enough code examples to get you going. However, OSDev.org do suffer quite a bit from having been written by programmers and as such it does leave quite a few holes in its “how-to” explanations.

Setting everything up

Bash in Windows 10

You will find a very good article and walk-through on this subject here.
With this done you can start adding Linux tools and set up an environment for kernel development.

NASM

In Bash, run:
sudo apt-get install nasm
You may be prompted to further specify the package name. If so, a list will be provided for you.

Compiler, assembler and more

We'll be using the GNU tools, and you will need to build them from scratch to support your own system. Not your Windows or Linux or what-have-you, but the one you are about to create.
These tools will run on your current system and create output for your new system. This is called cross compiling, and you need to create these tools yourself.
OSDev have an excellent article about this that walks you through the process.
I installed GCC 6.3.0, and for me this was the most time-consuming part by far. Partly because no two systems are alike, so you will run into problems which does not have readily available answers all on the same page. Get ready for some web surfing.
Remember to enable 64-bit for your compiler should you require it, as there's a big chance it's not enabled by default.

Eventually you will have your Linux tools for your new operating system installed under Windows 10 Bash.

Your code

Create a directory in the Windows directory structure for your project. My project is located at d:\os. You will most likely type this a lot, so be lazy and make it short. This will become /mnt/d/os in Wind10 bash.
Within my project directory I have kernel, and inside that I have mbr and isodir.
The first thing you will do is work on the MBR1), so at the very least create a separate directory for this code.

At this point you'll need to decide what parts should do what. My MBR simply copies itself to a different location, and then loads a somewhat bigger piece of code and executes it.
This next piece of code will do a little more work. First it sets the CPU in protected 64-bit long mode which will also be our final working mode. Interrupts are set up, and the next chunk of code will be read and executed.
This final piece of code will be from C source, and thus generated by our cross compiler. Because of that, this stage of the code also requires an ELF loader.

1)
Master Boot Record: 512 bytes of code loaded by the BIOS which is where your code will take control of the computer.
progress.txt · Last modified: 2017/03/30 08:48 by admin