Thursday, November 22, 2012

building linux kernel outside of source tree

This articles tells you about building the linux kernel outside the linux kernel source directory. Since if we build linux kernel from root directory of the kernel source code, compiled build  and header files are generated in the linux source tree itself. To remain linux kernel source code intact of auto generated files, we are expected to build it outside the tree. It is not very difficult to build it outside the tree. You just have to provide only one flag,
                            O=< obsolute_path_of_the_build_directory >
Here obsolute_path_of_the_build_directory  is the path of directory where you want the all the build and auto generated files. Most of the people forget to provide "O=" flag while generating the .config file. But that is the serious error and you are expected to provide it while building .config file with utilities such as menuconfig, gconfig, xconfig.

So here is a detailed process,

suppose my linux source tree  is in directory /home/rahul/linux_2.32.9
and I want to build kernel in directory /home/rahul/build, then

1> first  $cd /home/rahul/linux_2.32.9

2> /home/rahul/linux_2.32.9$ make O=/home/rahul/build menuconfig

3> /home/rahul/linux_2.32.9$ make O=/home/rahul/build

4> /home/rahul/linux_2.32.9$ make O=/home/rahul/build modules_install

5> /home/rahul/linux_2.32.9$ make O=/home/rahul/build menuconfig install

And as I think you have installed new kernel as of now. Enjoy.

No comments:

Post a Comment