Skip to content

cadaniluk/kernel32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overall Description
-------------------

This is the `README' file of my small kernel and bootloader, all merged
into one project. It aims to be a POSIX-compliant (this may take decades to
accomplish, though) kernel, which can run at least GNU user space programs.
Moreover, that should be guaranteed through POSIX compliance.
Naturally, this project utilizes the GNU toolchain, including GCC, as, make,
ld, m4, objdump, objcopy, and some more.
The kernel sets out to be a microkernel. Microkernels seem more interesting
than monolithic kernels, which would be my other option.

Rules
-----

1.
Use K&R style for C code.
2.
The C preprocessor is the preprocessor of choice. Use it for everything
but complex macros, in which case you may use m4. m4 may only be used for
defining and invoking macros, though, never for anything else.
3.
The definition of `__ASSEMBLER__' and `__C__' indicates whether the code
segment should be read only by the assembler or C compiler, respectively.
`#ifdef' is convenient here. 
4.
All C code is C11-compliant. Mainly to support variable definitions within
for-loops and to enable use of the `static_assert' feature.
5.
The number of columns of a source file is limited to 80.
6.
One indentation level amounts to one tab (with preferably eight spaces).
7.
A multi-line comment should look like this:
	/* 
	 * TEXT STARTS HERE
	 * ...
	 * TEXT ENDS HERE
	 */

Parts
-----

The whole project is split into two parts: the part responsible for booting
and the actual kernel. These two parts are to be kept split; do not create
dependencies between those, only clean interfaces.

The booting part includes the first-stage bootloader and the boot system,
which basically prepares the load of the kernel into memory and its final
execution: they determine data (memory size, hardware available, etc.), load the
corresponding next stage (and eventually the kernel), move I/O-mapped memory,
program controllers, and whatever. It is written in assembler because GCC
currently does not support real 16-bit code; it just emits 32-bit and adds size
override prefixes, which can get really lengthy. Also, not all x86 instructions
can be expressed directly in C, especially those for system programming.
Primary bootloader is a synonym for first-stage bootloader.
Secondary or second-stage bootloader is a synonym for boot system

The kernel is, well, the kernel. It is the central part of the operating system.


Directories
-----------

These are the directories and the fields they are supposed to cover.

`/':
The root directory. It contains all other directories and configuration
files, linker scripts, makefiles, etc., which concern the
the project as a whole.

`boot/':
Contains the bootloader and the secondary bootloader. Basically, the whole
boot system.

`kernel/':
Contains all files related to the kernel.

`include/':
The header files. There isn't a clean split between boot system and kernel
headers. I'm not sure if there ever will be one.

`/tools':
It contains scripts/programs that help managing, building, and developing
the project.

About

Small kernel project for learning purposes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published