Skip to content
Search

Linux:Kernel:Basic

lastmod 2018-08-17created 2015-02-1315 edits

A summary of how to compile and debug the kernel for analysis, plus basic information.

How to compile

A simple way to compile the kernel.

  1. First, install an existing Linux distribution.
  2. Download the kernel source from kernel.org.
  3. Install the required packages.
    • sudo yum -y install gcc bc perl
  4. Create the configuration file.
    • If a previously applied configuration exists, remove it with make mrproper.
    • To apply the default configuration, use make defconfig.
    • If you use a GUI-environment tool, you can create the configuration file using the ncurses library
      • make menuconfig
    • For reference, make localmodconfig creates a config file selecting only the modules currently in use. <- recommended
  5. Build. make 1
  6. Install the modules. sudo make modules_install
  7. Install the generated kernel image. sudo make install

Afterwards, check /boot/grub/grub.conf2 and you can see that the compiled kernel version is registered.

Kernel ctags & cscope

The kernel Makefile provides options to generate ctags and cscope, so there is no need to run mkcscope.sh; you can generate them by entering the following. (See the iamroot lecture/tip posts)

$ make ARCH=arm tags cscope

If you want absolute paths instead of relative paths, modify the tags file as shown below.

## $KERN_DIR 에 커널소스의 경로를 입력.
$ cat tags | sed -e 's;^\([^!][^\t]*\)\t;\1\t'"$KERN_DIR"'/;' > tags.absolute_path

See also

Favorite site

References


  1. Older versions require running make def for dependency management. ↩

  2. For grub 2.x, it is located at /boot/grub2/grub.conf. ↩

  3. How_does_a_start_kernel_call.pdf ↩