Compile Kernel: Konfigurasi Kernel

From OnnoWiki
Revision as of 11:18, 3 April 2013 by Onnowpurbo (talk | contribs)
Jump to navigation Jump to search

Sumber: http://www.linuxchix.org/content/courses/kernel_hacking/lesson2


Linux kernel mempunyai beberapa tool konfigurasi. Setiap tool dapat di jalankan dengan menulis

make <something>config

di directory top-level dari source kernel. Semua perintah make harus di jalankan dari directory top-level dari source kernel.


  • make config - ini merupakan kerangka dasar dari tool konfigurasi. Ini akan menanya satu per satu dari pertanyaan konfigurasi secara berurut. Kernel Linux mempunyai amat sangat banyak pertanyaan konfigurasi. Jangan gunakan ini kecuali kita kurang kerjaan.
  • make oldconfig - ini akan membaca file konfigurasi .config dan akan bertanya konfigurasi yang belum di jawab di file tersebut. Cara ini biasanya digunakan untuk upgrade ke versi kernel yang lebih baru.
  • make menuconfig - ini merupakan konfigurasi yang banyak digunakan oleh kernel hacker. Perintah ini menggunakan pop up berbasis text dan konfigurator menu-style menggunakan library ncurses. Kita bisa masuk ke satu menu yang kita tertarik dan mengubah hanya konfigurasi yang kita inginkan saja.
  • make xconfig, make gconfig - jika kita menjalankan Xwindows, maka ini lebih cantik, lebih di klik dari menuconfig. Konfigurator ini tampaknya tidak sebaik menuconfig karena lebih sensitif pada input file konfigurasi yang ada bug-nya (di samping, karena memang lebih banyak orang menggunakan menuconfig). xconfig menggunakan library qt, sedang gconfig menggunakan library gtk.

Each of the configuration programs produces these end products:

  • A file named .config in the top-level directory containing all your configuration choices.
  • A file named autoconf.h in the include/linux/ directory defining (or not defining) the CONFIG_* symbols so that the C preprocessor knows whether or not they are turned on.

If you have a working .config file for your machine, just copy it into your kernel source directory and run make oldconfig. You should double check the configuration with make menuconfig. If you don't already have a .config file, you can create one by visiting each submenu and turning on or off the options you need. menuconfig and xconfig have a "Help" option that shows you the Configure.help entry for that option, which may help you decide whether or not it should be turned on. RedHat and other distributions often include sample .config files with their distribution specific kernel source in a subdirectory named configs in the top-level source directory. If you are compiling for PowerPC, you have a variety of default configs to choose from in arch/ppc/configs. make defconfig will copy the default ppc config file to .config. If you know another source of default configuration files, let us know.

Tips for configuring a kernel:

  • Always turn on "Prompt for development... drivers".
  • From kernel 2.6.8, you can add your own string (such as your initials) at "Local version - append to kernel release" to personalize your kernel version string (for older kernel versions, you have to edit the EXTRAVERSION line in the Makefile).
  • Always turn off module versioning, but always turn on kernel module loader, kernel modules and module unloading.
  • In the kernel hacking section, turn on all options except for "Use 4Kb for kernel stacks instead of 8Kb". If you have a slow machine, don't turn on "Debug memory allocations" either.
  • Turn off features you don't need.
  • Only use modules if you have a good reason to use a module. For example, if you are working on a driver, you'll want to load a new version of it without rebooting.
  • Be extra sure you selected the right processor type. Find out what processor you have now with cat /proc/cpuinfo.
  • Find out what PCI devices you have installed with lspci -v.
  • Find out what your current kernel has compiled in with dmesg | less. Most device drivers print out messages when they detect a device.

Jika semua gagal, copy file .config dari teman.




Referensi

Pranala Menarik