Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just to learn, I want to recompile some OS.

  • I don't want a list of steps to be taken to do it because with that I will not be learning a lot, which would defeat the purpose.
  • I also do not want to be stuck indefinitely since this would be my first such try.

I think any of you Linux gurus would have a fair idea of where I should be starting with. I have some basic Linux experience.

share|improve this question

migrated from Aug 31 '10 at 0:44

This question came from our site for professional and enthusiast programmers.

Your question is too vague. Under Gentoo, you might emerge gentoo-sources, eselect kernel, and then cd /usr/src/linux; make menuconfig; make. – tc. Aug 13 '10 at 19:13
Agreed, this is much too vague. In particular, the term "OS" is vague: Do you just want to recompile a kernel, or an entire bootable system? And you aren't going to learn much by just compiling an OS (as several of the answers here point out, it basically comes down to running make) -- to really learn you'll need to get into the actual source code. – Daniel Pryden Aug 13 '10 at 19:37

LFS - Linux From Scratch (LFS) is a project that provides you with step-by-step instructions for building your own custom Linux system, entirely from source code.

Also, most GNU/Linux distros provide tools to compile a kernel their own way.

Reading Modern Operating Systems by Tanenbaum won't hurt either...

share|improve this answer
+1 for LFS - as the OP mentions recompiling his OS, I assume what he means is building his own, home-brewed distribution and LFS shows you how to do things like building a gcc compiler for your new system then adding all the bits to it, including but not limited to the Linux Kernel. – user26996 Aug 13 '10 at 19:35
+1 I learned a lot about Linux doing this (that I later forgot a good chunk of when getting thrown back into Windows). – Merlyn Morgan-Graham Aug 13 '10 at 19:39
There is also Gentoo stage 1 installation mainly used for development now. – rebus Aug 13 '10 at 19:54

There's not much fun in just recompiling a kernel. You invoke some script, magic happens, compile output rolls over your screen, and *ding*, you have a kernel.

In the case of the Linux kernel in particular, something like this:

make menuconfig # shows a menu where you can configure thousands of kernel options
make # do the compiling

It's not very interesting, but that's the place to start. Fiddling with the kernel options, and actually booting into your own, unique, home-baked kernel, that's where the real fun begins.

If you want to learn more about the compilation process itself, study the provided Makefile. In-depth knowledge about GNU make syntax will be helpful.

On the other end of the spectrum, there's doing everything by hand: invoking gcc for each source file, passing in the right compiler options. You would just be replicating the steps that the Makefile is doing for you. That is a nightmare, and not very educational either.

share|improve this answer
+1, very true, although in my experience I didn't even get a ding so much as stuff stopped happening. Most undramatic. The resultant kernel didn't even boot, either... – user26996 Aug 13 '10 at 19:32

Start at I can't pretend to say that I've done it, but that is a good place to start.

share|improve this answer

In OpenBSD, it is documented here:

You get a secure operating system thrown in, as well.

Have fun

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.