Live data from Hacker News

Learning operating system development using Linux kernel and Raspberry Pi

s-matyukevich.github.io

11–20 of 40 posts

Re: Learning operating system development using Linux kernel and Raspberry Pi

#11

Might be a bit controversial but I found writing drivers for Linux on my raspberry pi helped me understand kernels, virtual memory etc. I used Linux Device Drivers (ldd3) which is free online. The book was written for the 2.6 kernel but someone on GitHub updated the code for the latest kernels.

I've never written a driver myself, because all my hardware is supported. But I've certainly added new PCI IDs to existing drivers, and done that kind of low-level learning. I expect if I found a random piece of hardware that was close to an existing one that adding the driver, or updating things so that it worked on the new hardware would be possible. It's just not a situation I've come across. What I found useful/e…

You can just write char drivers that operate a slab of kernel memory, and implement all the syscalls like open, read, write on that piece of memory.

Re: Learning operating system development using Linux kernel and Raspberry Pi

#12

If you are looking to learn operating system concepts using RPi there is a new textbook by Prof. Vanderbauwhede, under ARM textbook initiative [1]. I think for educational purposes it will be very interesting and useful if someone develop from scratch a simple System V UNIX for RPi based on Bach's description in his seminal book on "The Design of the UNIX Operating System" [2]. The book also covers multi processors t…

does it go through the process?

Re: Learning operating system development using Linux kernel and Raspberry Pi

#13
In terms of teaching fundamentals of operating system theory and systems programming, is there such a thing as an operating system kernel written in Python or some language which is meant to be easy to hack on for educational purposes? I wonder how useful that would be for a CS student, taking the complexity of C, C++, or Rust out of the picture and just running a kernel in a VM for educational purposes.

Re: Learning operating system development using Linux kernel and Raspberry Pi

#14
post #9

Might be a bit controversial but I found writing drivers for Linux on my raspberry pi helped me understand kernels, virtual memory etc. I used Linux Device Drivers (ldd3) which is free online. The book was written for the 2.6 kernel but someone on GitHub updated the code for the latest kernels.

Why would it be controversial?

>Why would it be controversial?

Not OP but my perspective is that much of software development, engineering, and practices become cult like, often without theoretical or empirical basis.

I'm rarely surprised anymore when I see criticism of one approach over another. Someone may think "the way" to learn Linux kernel development isn't what OP suggested and there's a cult of people who agree who will adamantly concur to a fault.

Re: Learning operating system development using Linux kernel and Raspberry Pi

#15
post #13

In terms of teaching fundamentals of operating system theory and systems programming, is there such a thing as an operating system kernel written in Python or some language which is meant to be easy to hack on for educational purposes? I wonder how useful that would be for a CS student, taking the complexity of C, C++, or Rust out of the picture and just running a kernel in a VM for educational purposes.

IMO this topic is entangled with hardware, the student needs to do a course in hardware and how CPUs work, do some simple assembly coding, after that C is a natural progression. If C is too complex for some students then system programming and OS development is not for them. For educational and getting started I think https://www.nand2tetris.org is a good source material, the complexity or real world stuff is missing there so you can focus on essentials.

Re: Learning operating system development using Linux kernel and Raspberry Pi

#16
post #13

In terms of teaching fundamentals of operating system theory and systems programming, is there such a thing as an operating system kernel written in Python or some language which is meant to be easy to hack on for educational purposes? I wonder how useful that would be for a CS student, taking the complexity of C, C++, or Rust out of the picture and just running a kernel in a VM for educational purposes.

C is a language which is closer to hardware than Python, so you'll find it to be the language of OS programming. In fact, Python is written in C. I think trying to do OS programming in Python would actually be more difficult than learning C.

If you are a solid programmer who already knows Python, learning C would only take 2-4 weeks. The benefit is worth the investment.

https://stackoverflow.com/questions/10904721/is-it-possible-...

Re: Learning operating system development using Linux kernel and Raspberry Pi

#17

The offical Raspberry Pi distro of Linux is already called “Raspberry Pi OS”: https://www.raspberrypi.org/downloads/raspberry-pi-os/

I hope there is an official release of 64-bit version soon.

https://www.raspberrypi.org/forums/viewtopic.php?f=117&t=275...

Re: Learning operating system development using Linux kernel and Raspberry Pi

#18
post #13

In terms of teaching fundamentals of operating system theory and systems programming, is there such a thing as an operating system kernel written in Python or some language which is meant to be easy to hack on for educational purposes? I wonder how useful that would be for a CS student, taking the complexity of C, C++, or Rust out of the picture and just running a kernel in a VM for educational purposes.

There's no point abstracting away the nitty-gritty. OS dev is the nitty-gritty.

Re: Learning operating system development using Linux kernel and Raspberry Pi

#19
post #13

In terms of teaching fundamentals of operating system theory and systems programming, is there such a thing as an operating system kernel written in Python or some language which is meant to be easy to hack on for educational purposes? I wonder how useful that would be for a CS student, taking the complexity of C, C++, or Rust out of the picture and just running a kernel in a VM for educational purposes.

Actually using C or C++ is the most straightforward painless way to learn kernel dev. C is not complex at all. What you need to learn first is something like what nand2tetris offers, at least the first part. Usually you will have to do some variation of nand2tetris in the first or second year of undergrad.

Re: Learning operating system development using Linux kernel and Raspberry Pi

#20
post #13

In terms of teaching fundamentals of operating system theory and systems programming, is there such a thing as an operating system kernel written in Python or some language which is meant to be easy to hack on for educational purposes? I wonder how useful that would be for a CS student, taking the complexity of C, C++, or Rust out of the picture and just running a kernel in a VM for educational purposes.

There are actually plenty of languages that can lead you down this path, including some designed for the purpose.

For real world learning, C is still what you want. It is one of the easier roads through.

However, here's a just few languages that can let you build a kernel up quickly:

+ Forth. It is well suited for the purpose. A tiny bit of assembly, and then just a bunch of definitions and you've built it all from the ground up. But if you think C is too complex for learning, then the idea of moving to a stack-based language could get in the way.

+ Lisp. The Symbolic Lisp machines might be in the past, but the various versions of Lisp are still flexible enough to let you build an OS, and lots of CS students do.

+ Lua. It is only slightly higher level than C, but with fun things like coroutines, hash tables, dynamic typing and GC. Due to its C99 nature and the desire to keep the language constrained, it runs on bare metal great. You don't have to modify Lua to run it baremetal on a Pi. [0]

[0] http://lua-users.org/lists/lua-l/2020-01/msg00157.html

Post reply on HN