-
Notifications
You must be signed in to change notification settings - Fork 0
Home
When your OS will have first sparks of life, you are going to have some interface to interact with. The first and most powerful user interface is CLI: Command Line Interface (command console).
FORTH is old programming language was designed by Charles Moore in 70th for automation purposes (radiotelescope control). Here we will use FORTH as first intro to interpreter (and compiler) design thanks to its terrible simplicity. In fact FORTH has no lot of things must be implemented in programing language implementation so we focus on whole feel of interpreter.
In this chapter you can see very basic examples on using standard flex/bison tools able to generate code you can embed into your OS and get command console with required syntax.
Then we'll see in detail more complex flex/bison application -- bytecode compiler for FVM, as sample of assembler you can write yourself from scratch.
And finally we'll implement full-featured Interpreter with infix pythonic syntax, dynamic memory with garbage collection, and SmallTalk-like live object system with message passing, works as OS kernel itself.
So if you still want to run our system on real hardware or under some virtualization engine, it's time to write some lowlevel code will bind our interpreter to Bare Metal
Clone latest master
branch from GitHub via command
linux:somewhere$ cd ~ ; git clone -o gh https://github.com/ponyatov/osdev/ ; cd osdev
If you want to give your users visual tool for preconfigure your OS, use kconfig
linux:~/osdev$ make clean menuconfig
For your work you may need selfbuild compiler and tools -- GNU toolchain. Typically, a typical distribution for your working OS is sufficient. But sometimes you may need the latest compiler version or some special build with an atypical set of options.
linux:~/osdev$ make cross
Under Windows for development for i386 it is sufficient to use mingw32 and one of the emulators QEMU/bochs. But you may need a cross compiler for some other processor, or a special build, such as a multitarget cross-compiler for a set of target platforms). Trying to do this under Windows (using MSYS or Cygwin) will kill your brain. Therefore, you will have to install Linux at least in virtual machine and compile your toolchain from sources using a rather complex BUILD-HOST-TARGET scheme called canadian cross.
All modern boot loaders and QEMU with it's -kernel
option supports Multiboot specification: you must compile OS kernel into ELF format, add special header, and any loader/QEMU/bochs will load your kernel without any questions, and also give you some information about system you run (RAM size,...).
syslinux is compact powerful bootloader, can boot your OS from CD, USB, HDD and network
Raspberry Pi is widely available non-Intel platform, so you can be interested to make your port on Cortex-A/ARM architecture
This project uses big Makefile which implements all build & run tasks, so you need some info how to run project elememnts, and how to use GNU Make and GNU Autotools to do your projects build tasks.
If you want to play with optimizing compiler development, or run into computational tasks that require real machine code and hard optimization, then you may need to build the LLVM for your tasks. It is not realistic to do this under Windows. The use of LLVM also requires decent knowledge, so in this section you can find the information you need to get started.