Writing an Operating System - Environment Setup
I’ve been reading The little book about OS development and wiki.osdev.org and took some notes along the line. Here’s what I wrote on environment setup.
Environment setup
You’ll need a cross compile toolchain consisting of GNU Binutils and gcc. The osdev wiki has a great page on setting up a cross compilation toolchain.
It took me a few times because I didn’t read the instructions properly. It is important to unpack the sources for binutils and gcc and have separate build directories, gcc-4.2 and gcc-build for example. Then, for building gcc, make sure the newly built binutils are on your path.
And finally, when building gcc, make sure you run make all-gcc, make all-target-libgcc, make install-gcc, and make install-target-libgcc instead of just make all like I did.
Also, running make with -j 4 or any value larger than 1 greatly sped up the build on my machine. Multicore for the win!
Once you’ve built both binutils and gcc you’re ready to start building your kernel!