Compiling Linux
Yesterday I compiled my own Linux kernel and although it wasn’t actually that hard in hind sight, it did take a couple of days and many hours work. I am super proud of myself 🙂
What is the point of compiling your own copy of linux? Well many of the sites around babble on about increasing support for drivers or making your system quicker. But to be honest I don’t really know why you need a copy of linux you made yourself, the reason I did it was so I can work on directly programming to output ports on my computer (And to do so I need a few deleted files that can only be regained with a fresh compilation).
So here is how I did it (Not that anyone else will need to):
- Firstly I did everything on Ubuntu (12.04), I used a virtualised system so I didn’t mess up the computer I use everyday.
- Next I got Ncurses, it is used to make the menu where you decide what the new Linux will support.
- Download the kernel;Â I saved it to the desktop but in hindsight saving it to the home folder is probably better. Unzip it
- Next navigate your terminal to where you saved the the unzipped kernel.
- Type ‘make menuconfig’ this is where you say what hardware you have (to make sure your Linux doesn’t support extra stuff your computer doesn’t have).. Because I didn’t care what my kernel did I just exited straight away. The program then creates the .config file that will be read when creating the kernel.
- Type ‘make all’ this is where the computer reads all the source code you downloaded, matches it against the settings you created in the last step to create something the CPU can read. Note that if you downloaded the most recent kernel (3.6) you will see that it is around 80mb. THIS TAKES AGES TO COMPILE. Legit you type make all then wait like 6 hours while the computer does it’s thing (Depending on how fast your computer is).
- Wait some for it to compile.
- wait some more…
- Then it will finish compiling, you feel a rush of relief then you quickly do the next step before the computer decides to change it’s mind.
- Type ‘make modules_install install’ and wait like half an hour for it to finish installing.
- Restart your computer.
- Type ‘uname -r’ and notice you have the version of the kernel you downloaded.
- Bash head against wall..
After all this my Ubuntu actually ran slower and was more painful to use, but irregardless I have a copy of the Linux kernel that I compiled on my own.
Note: This is the tutorial I roughly followed.
Note2: What is a kernel? I actually am not sure myself, I think it is what programs talk to when they need to interact with hardware. I.e you press save in Microsoft Word and MS Word goes ‘Yo, Mr Kernel, I need to save this shit somewhere’. The kernel then goes ‘yer no worries mate’ and does all the work but is never recognised.