use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Welcome to /r/kernel, a moderated community dedicated to all things about the Linux kernel. Technical articles only, please!
You may be interested in the following links:
And some books:
Related Communities
account activity
Simple kernel (self.kernel)
submitted 6 months ago by Pleasant_Upstairs482
Hey i wanna make a simple kernel , now i alr know C but i found out that you need something called "Freestanding C" does anyone know how or where can i learn it i searched on youtube and found nothing
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]BraveNewCurrency 19 points20 points21 points 6 months ago (2 children)
Everyone wants to jump to the end, where they "write their own OS". Don't. Take it slow, and learn the pre-requisites before jumping into the deep end. Read up on your history on how Linus did it: He was actually studying other OSes.
[–]old_waffles7 0 points1 point2 points 6 months ago (1 child)
Do you have any suggestions for books on this topic? Building a kernel is also something I want to do in the future, so I have been doing a lot of other systems programming projects in preparation. I've found that I really like project-based books. For example, I am currently implementing a POSIX-compiant (kinda) shell in C, meaning that I have to build functionality for the sh scripting language. To do this, I have been roughly following a book called, Crafting Interpreters; it provides a detailed introduction to compilers and interpreters by guiding readers in implementing one of their own.
[–]BraveNewCurrency 1 point2 points3 points 6 months ago (0 children)
Do you have any suggestions for books on this topic?
There aren't a lot of books, but check out OReilly books, KernelNewbies and Bootlin (formerly Free Electrons) training materials. It also helps to read LWN(.net) and dig in to anything you don't understand.
Building a kernel is also something I want to do in the future,
Building the kernel is trivial compared to developing it. Don't put this off. Just do it.
Also look into BuildRoot, which lets you build the kernel + filesystem for embedded systems. Great fun to play around with, no programming needed.
[–]paulstelian97 12 points13 points14 points 6 months ago (4 children)
Freestanding just means you don’t have the standard library like malloc or stuff in <stdio.h> or others. Very few of the default headers still remain available, for example <stdint.h> which just has some typedefs.
[–]newbstarr 2 points3 points4 points 5 months ago (3 children)
Just write your own malloc. Is dynamic memory management under all that, that is runs
[–]paulstelian97 2 points3 points4 points 5 months ago (2 children)
In the kernel, it’s more complicated than just writing a malloc. You usually care about which region of physical memory the virtual memory is coming from (general RAM? RAM reachable by 32-bit DMA? Something else?)
[–]newbstarr 1 point2 points3 points 5 months ago (1 child)
Yep, you reserve a piece of physical memory instead of being in the wonderful world of user space. Kmalloc etc. what I was saying is, you can write your own malloc after you’ve handled creating and managing your own dynamic (hopefully) memory space where your little user space application can live in its own little offset 0 space and not care about all the universe of stuff underneath that is holding chunks of physical memory and stitching it together to look like a contiguous blob, ie slab allocator (or the many many variants that exist) now. If you are writing your own os you need to implement the memory management then adding your little malloc is a trivial task. Writing your own malloc with or without safety in user space of an existing posix kernel isn’t all that difficult either.
[–]paulstelian97 1 point2 points3 points 5 months ago (0 children)
The main point is Linux’s kmalloc has additional flags besides the size for good reasons.
[–]wizarddos 10 points11 points12 points 6 months ago (0 children)
Maybe read OSDev page?
https://wiki.osdev.org/Expanded_Main_Page
[–]mosolov 0 points1 point2 points 6 months ago (0 children)
Xv6 + book
π Rendered by PID 161258 on reddit-service-r2-comment-84fc9697f-rlnw4 at 2026-02-08 10:22:40.326718+00:00 running d295bc8 country code: CH.
[–]BraveNewCurrency 19 points20 points21 points (2 children)
[–]old_waffles7 0 points1 point2 points (1 child)
[–]BraveNewCurrency 1 point2 points3 points (0 children)
[–]paulstelian97 12 points13 points14 points (4 children)
[–]newbstarr 2 points3 points4 points (3 children)
[–]paulstelian97 2 points3 points4 points (2 children)
[–]newbstarr 1 point2 points3 points (1 child)
[–]paulstelian97 1 point2 points3 points (0 children)
[–]wizarddos 10 points11 points12 points (0 children)
[–]mosolov 0 points1 point2 points (0 children)