lainchan / λ
OS dev
Roy · 2020-11-24 18:19
How does one get into OS dev? I've been trying to get into it but I can't find resources that would give me good fundamentals of OS, isn't there any course or book that would teach you everything you need to know to build your own OS?
Everything I found is a little too advanced, I would like something beginner friendly.
list · 2020-11-24 18:39
I don't think it's really a beginner's task. Try maintaining a niche fork of some OS for a while & get the hang of it by doing. Then when you see the inherent flaws in the system you want to improve, build off of that. Mastering C and assembly for your target architecture is a good start.
Bobby Newmark · 2020-11-25 00:20
>>22498
>resources that would give me good fundamentals of OS
A really good resource is the book "Operating Systems: Three Easy Pieces": http://pages.cs.wisc.edu/~remzi/OSTEP/
If you want something that is more beginner friendly than this I'd suggest studying up on general computer science things beforehand.
In terms of OS dev specifically I'd love some resources as well. I don't really know how to get into it, like what OS to choose (e.g. Linux seems a bit big lol) and how to maintain it.
Unknown · 2020-11-25 01:24
You should, of course, be well acquainted with the target architecture and assembly language for it.
Go to osdev.org and read all you can, really.
And there is nothing like getting started. Luckily osdev has tutorials for absolute beginners. That should give you some momentum and some ideas for improvement.
Keep in mind osdev is a big topic, and not at all easy nor you should expect to get very far without a good deal of work. But it's likely one of the more engaging and fun ways to learn computer. A corollary is not to be afraid to make mistakes or discard stuff that doesn't work and try again.
BloodCat · 2020-11-26 03:40
Get into the HyperbolaBSD develolment, is a unique oportunity to learn from an existing codebase a (re)write small parts. And there is some handholding.
Tomohisa "Tom" Kanezaki · 2020-11-26 04:13
First study how a microprocessor works, how it uses ram, how it uses i/o. then use it to make a crude filesystem, then a cruse shell, then a crude editor and assembler. That will teach you more than reading an o/s book.
Nell · 2020-11-26 07:51
>>22551
I'll agree with this, just figure it out on your own.
Think about what windows or linux does.
how does it boot? the first thing that happens it a certain section of code is read everytime off of the same spot on any floppy, cd, usb, etc. you can put anything in at this section, this memory address and it will compute. But if you want it to run forever you need a loop. you want human interaction, you need interrupts, you want to save something to disk? you need a driver. Want virtual memory, figure it out.
The most important thing to know is how to program.
string · 2020-11-26 14:32
>>22508
LULz, github is full of OSes small and huge. If you want real life examples get MINIX 1.0 for start and try reading code and runing it in qemu. Or get 2.0 version or 3.0 - but keep in mid codebase grew a lot in these versions.
Agent Smith · 2020-11-26 14:37
>>22562
also alternative to minix may be code of early Linux around pre 1.0.
x<->y · 2020-11-26 18:39
>>22498
I've been doing it for a week now.
I just read stuff on wiki.osdev.org, it's a great resource.
Milner · 2020-11-26 22:21
>>22549
I may be interested in this. Where would I theoretically start here lainon?
Mentat · 2020-11-26 23:27
>>22579
The developers have a list of files to be replaced or reformat. Check their forum thread for the listing of files and latest news and their libregit repository to clone their kernel and the algorithms, then head to their irc channel on freenode (#hyperbola) and contact their developers.
John Doe · 2020-11-27 15:53
>>22498
Check out xv6 and the associated book. It's a reimplementation of UNIX version 6 on x86 with a book meant for Operating Systems classes that has exercises. If you play around with that and do the exercises it should give you a decent base in classic OS design.
synchronized · 2020-11-27 20:26
I've heard good things about this 'book'. Haven't personally tried it, though.
https://tuhdo.github.io/os01/
William Holtzer · 2020-11-27 21:09
>>22602
tuhdo is a nice guy. He has a emacs for C programmers tutorial that helped me a lot to get into emacs. Sadly, I can't comment on this guide/book.
anon · 2020-11-30 04:10
Modern Operating Systems by Andrew S. Tanenbaum (Creator of Minix) & Herbert Bos
TyrannusAres · 2020-11-30 17:22
>>22498
To start, you're undertaking a very vast task which will require much more than beginner skills, read information and research any topics you didn't understand. Regardless, here's some information you might like.
A very good book I've used, if a bit outdated. File Related.
https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf
A relating tutorial which is more recent and attempts to follow a bit with the book.
https://github.com/cfenollosa/os-tutorial
The OS Dev wiki is useful if you know what you're looking for.
For specific interrupt routines if you've glanced over the above and learned a bit, Wikipedia has a few pages relating, I may create a list of them there. I also use sites such as below.
https://stanislavs.org/helppc/
A kernel I've built upon in the past.
https://github.com/ultrtech/UKernel
There's plenty of other soykaf you can find on GitHub and in the derelict pages of past professors at universities.
Koichiro · 2020-12-03 00:14
Any resource on the internals of the BSD kernel? Already on the book Design and Implementation of the 3.4 BSD Operating System.
JARGON · 2020-12-03 06:46
>>22836
yes - it's called the source code and the man pages
Drano · 2020-12-03 16:30
>>22842
This rtfm to excuse lack of documentation is getting old
Junichi Fujiwara · 2020-12-03 16:47
>>22858
BSD kernel (which is not kFreeBSD, not kOpenBSd, not kNetBSD) was written by LSD fueled hippies back in 70s. You seriously expect them to leave documentation?
Drifter · 2020-12-03 18:59
>>22714
I followed that PDF, it's very good to get started - if you want a custom bootloader. It doesn't show you much other than how to make a bootloader. To be honest it's probably almost preferable to make your own bootloader because you end up with a lower complexity system where less stuff can go wrong, and you get used to programming very close to the hardware / without memory protection before starting on the kernel.
https://github.com/long-march/Akerios
Here is my operating system with good stuff like a textual shell with composable commands. It's quite primitive and unstable at the moment, I have to keep working on it.
Turner · 2020-12-04 09:34
>>22868
Bootloaders are skill that is valuable on embedded market. Colegue of mine from one of my former jobs currently works in the field of bootloaders for satelites.
Switch · 2020-12-05 12:33
>>22883
>Bootloaders are skill that is valuable on embedded market.
Didn't know that. I guess it helps that I'm learning about bootloaders right now
Cowboy · 2020-12-06 07:43
>>22928
Embedded software market tends to reuse code as much as possible. It's easy to do so between platforms that share same CPU or microcontroller if software is designed in certain ways that makes no assumptions about rest of hardware beside what executes code. It needs to receive such info from somewhere else. Here bootloader cames to action by setting some memory areas with needed data and then loading kernel. Check device trees concept https://en.wikipedia.org/wiki/Device_tree
Bootloader may also be responsible for initializing some hardware that kernel(s) is not aware of and does not need to be aware.
Imagine changing 30 different kernels (number taken out of my ass to illustrate my point) just to make them aware of some additional chassis fan that has to be set to a proper rotation speed to not cause this particular model of machine to overheat. Obviously modification in a single bootloader is faster and consumes less work.
Saved labor is saved money.
There are also bootloaders that on multicore/multi CPU systems load multiple operating systems at once - one per core/CPU. CPU's may be even of different models. They may be even of totally different architectures. Imagine you have to feed such machine with both kernels on for example removable SD card or USB stick. Bootloader would be responsible to load them into memory and set addressed to their entry points into specific areas of memory that every cpu expects. Such memory may be shared between CPUs and you pass to kernels info about what memory regions they are allowed to use. That way you can separate domains for each kernel and programs it runs (if kernel implements protection against writing/reading outside allowed region).
I can also enumerate many real life and imagined just as I write this words architectures that would need the custom bootloader while being at the same time able to run stock Linux or other kernels like FreeRTOS, kFreeBSD etc.
Some bootloaders may be very simple - literally few lines of assembly code. Other may be baroque beasts created to work on all boards from same producer. Other are working on boards from gazillions of producers and bazillions of architectures.
So I hope you get the point why hi tek may be interested in you writing bootloaders for them.
Leto Atreides I · 2020-12-06 16:37
>>22942
Thanks for the huge wall of text! It definitely makes sense, it's just nothing I've thought about yet.
I'll definitely keep looking into bootloaders a bit before starting on the kernel.
Yet Another Lainon · 2020-12-06 17:53
unironically dabble with TempleOS
Terry's early videos are full of insights & the entire operating system is literate programming's logical limit. I do not claim to fully understand TempleOS' compiler/jit runtime but it was fun to work with and write cool graphics demo with bird eye's view of how the entire system churns.
after understanding fundamentals, you can check out Shrine on github and excavate git commits to understand how others are trying to extend it to do some actual practical soykafs
William Holtzer · 2020-12-06 18:24
>>22962
If you are into ARM stuff you may be interested in Das U-boot bootloader if you not looked into it yet.
https://en.wikipedia.org/wiki/Das_U-Boot
It has a whole industry of companies around it using it in own products and contributing back into public development repo. Interesting stuff to read (code).
Roger Pollack · 2021-02-22 12:30
>>22498
How the fuarrrk has no one posted?
https://www.youtube.com/channel/UC15iQ_QzTPxB6yGzzifJfKA
This guy's videos are the best I've seen on the topic. I no longer care about OS development but if I did this would be great since it's better than anything else I could find.
Aristóteles Amadópulus · 2021-02-22 14:16
>>24580
>Video 1
>download uefi library, download kernel
>run make
Wow really teaches you a lot.
Hitomi · 2021-02-22 14:53
>I've been trying to get into it but I can't find resources
Try harder.
https://wiki.osdev.org/Books
Colmerauer · 2021-02-24 16:32
>>22498
You can't. Everything on the internet is just LARP **including Linux and BSD**. OS design courses and documents consist of teaching how an inode in Linux works.
Milner · 2021-06-23 22:14
>>22498
I tried making one and quit after getting keyboard and mouse inputs to be read
This soykaf is hard, and is made more difficult by the fact that the documentation is all over the place
Nameless · 2021-06-23 23:16
>>24595
Why did you spill the soykaf lainon? There's still quite a few books and university courses readily available online with enough to get the basics and come up with something on your own.
Or why not take some ideas from the LispOS papers? Or original Lisp Machines?
Zuse · 2021-07-08 20:25
>>22592
https://pdos.csail.mit.edu/6.828/2012/xv6/book-rev7.pdf
https://github.com/mit-pdos/xv6-public
string · 2021-07-22 04:10
>>22498
the serenity os dev had some videos on os dev
Koos van der Merwe · 2022-04-02 02:57
I've seen some places claiming you can spend many years working on that, is that an exaggeration?