summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-07-14 11:28:35 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-07-14 11:28:35 +0200
commite910de8475e456dfee0d299b799f597a503d9766 (patch)
treeb6299a8a0f69642c58f35e4e8ed83dcb75ee05c0
parent8b9b2922e529f2f524fa06b4d98390a6d3d5a75e (diff)
downloadwww-andreasbaumann-cc-e910de8475e456dfee0d299b799f597a503d9766.tar.gz
www-andreasbaumann-cc-e910de8475e456dfee0d299b799f597a503d9766.tar.bz2
added a drafted version of the AbaOS intro
-rw-r--r--content/blog/abaos-intro.md109
-rw-r--r--static/images/blog/abaos-intro/abaos.pngbin0 -> 65349 bytes
2 files changed, 109 insertions, 0 deletions
diff --git a/content/blog/abaos-intro.md b/content/blog/abaos-intro.md
new file mode 100644
index 0000000..d92c7b7
--- /dev/null
+++ b/content/blog/abaos-intro.md
@@ -0,0 +1,109 @@
++++
+title = "AbaOS - Intro"
+categories = [ "Operating System", "AbaOS", "Development" ]
+date = "2017-07-14T10:50:39+02:00"
+thumbnail = "/images/blog/abaos-intro/abaos.png"
+draft = true
+
++++
+
+## History
+
+It started with a question from a collegue at work: "Why
+are all operating systems nowadays written in C?".
+
+I wanted to dig deeper...
+
+## Resources
+
+Some years ago it would have been extremly tedious to write
+an operating system on your own. Don't get me wrong, it's still
+a tremendous task, and I don't think anybody should do it for
+the sake of proving the world, he is able to build the best
+operating system ever.
+
+PC emulators like [Qemu](http://www.qemu.org) and
+[Bochs](http://bochs.sourceforge.net) (to name two open-source ones)
+make testing really easy compared to dual-booting.
+
+Tutorials are around everywhere, especially nice are video tutorials
+of people who are actually implementing an operating system with
+you "live".
+
+I used two of them:
+
+- [Writing a Simple Operating System - from Scratch, Nick Blundell](https://www.youtube.com/watch?v=YvZhgRO7hL4)
+- [Write your own Operating System, Viktor Engelmann](http://wyoos.org/)
+
+Nice web page are, two pick two of them:
+
+- [OSDEV Wiki](http://wiki.osdev.org/Main_Page)
+- [Lowlevel.eu](http://lowelevel.eu)
+
+## Details
+
+I'm using standard C99 with either gcc, clang, tcc or pcc currently for
+the C parts. NASM for the assembly parts. No inline-assembly. I want
+to see clearly where the CPU/machine-dependent parts are.
+
+One goal is to write a minimal self-hosting operating system. This is
+a long way to go. Many tools like make, binutils, nasm, compilers require
+some part of a POSIX environment.
+
+So far the simplest explanation I have for everybody using C is simple:
+
+- the operating system has been written in C ages ago
+- every possible library build on top, and nobody wants to rewrite
+ everything all the time
+- the most prominent platform is Intel, and Intel has some special
+ "features" like I/O ports and alignment, packing of structures which
+ requires some low-level features from a language. C has those features
+ (alignment and packing). Other platforms may be less quirky and old
+ and be less demanding on the language to provide such features.
+- open API specification: Cdecl calling conversion is available everywhere.
+ The reason why so many scripting languages are popular, is that they
+ can reuse APIs via the Cdecl layer.
+- there is a lot documentation about how to do operating system tasks
+ in C, there are not so many around for other languages.
+
+This said, C++, D, Ada, Pascal are valid alternatives for building an
+operating system, to name two examples:
+
+- C++ has been used for [Haiku](https://www.haiku-os.org)
+- Pascal for [Ultibo](https://ultibo.org/) on RaspberryPi
+
+For embedded or special purpose operating systems it's more feasable
+to use another language than C.
+
+Don't be fooled, if I say C, this doesn't mean you cannot benefit early
+with from an object oriented design, as soon PCI with loadable drivers
+or a widget libary come into play. The following articles are useful
+to build simple-inheritance with C:
+
+- http://www.drdobbs.com/extending-c-for-object-oriented-programm/184402731
+- https://www.state-machine.com/doc/AN_OOP_in_C.pdf
+- https://www.cs.rit.edu/~ats/books/ooc.pdf
+- https://dmitryfrank.com/articles/oop_in_c
+
+And, yes, the Linux kernel applies exactly this principle, as we can see
+in https://lwn.net/Articles/444910/.
+
+## Status
+
+I'm following the Wyoss guide and try to do almost everything in C which
+was done in C++ in the tutorial. I'm also deviating a little bit by:
+
+- having my own small little C library (src/libc)
+- I wrote a boot loader (yes, I know the comments on OsDev regarding
+ writing one). Nevertheless it's informational and has some historic
+ value.
+- I try to use as many compilers and cross-compilers as possible not
+ just one toolchain.
+
+## Sources
+
+As always you can find the sources of the project on my person git
+repository at:
+
+http://git.andreasbaumann.cc/cgit/abaos/
+
diff --git a/static/images/blog/abaos-intro/abaos.png b/static/images/blog/abaos-intro/abaos.png
new file mode 100644
index 0000000..83364b7
--- /dev/null
+++ b/static/images/blog/abaos-intro/abaos.png
Binary files differ