I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Monday 26 May 2008

Kernel Makefile

In this post, I sum up the main Makefile parameters and targets, right now it mainly corresponds to $make help but I might edit this entry to add useful information.

First of all use (if in the directory of the kernel sources)

$ make help
or if you are not in the directory of the kernel sources (then located in )
$ make -C help

This more or less gives the following information.

This outputs a list of possible target and supplementary information:

  • a few variable can be set
      ARCH=um ... for the corresponding architecture V=1 > means verbose build V=2 > gives reason for rebuild of target O=dir > is the output directory of the build including .config file C=1 or C=2 > checking (resp force check) of c sources
  • Documentation
    • make [htmldocs|mandocs|pdfdocs|psdocs|xmldocs] ->>> build the corresponding docs
  • Packages
    • make rpm-pkg > allows to build src and binary rpm packages
    • make binrpm-pkg > allows to build binary rpm packages
    • make deb-pkg > allows to build deb packages
    • make tar-pkg > allows to build uncompressed tarball
    • make targz-pkg > allows to build gzipped compressed tarball
    • make tarbz2-pkg > allows to build bzip2 compressed tarball
  • Cleaning targets:
    • clean - Remove most generated files but keep the config and enough build support to build external modules
    • mrproper - Remove all generated files + config + various backup files
    • distclean - mrproper + remove editor backup and patch files
    Note that it can be useful to use ARCH=... in the cleaning process
  • Kernel Configuration targets:
    • config - Update current config utilising a line-oriented program
    • menuconfig - Update current config utilising a menu based program
    • xconfig - Update current config utilising a QT based front-end
    • gconfig - Update current config utilising a GTK based front-end
    • oldconfig - Update current config utilising a provided .config as base
    • silentoldconfig - Same as oldconfig, but quietly
    • randconfig - New config with random answer to all options
    • defconfig - New config with default answer to all options
    • allmodconfig - New config selecting modules when possible
    • allyesconfig - New config where all options are accepted with yes
    • allnoconfig - New config where all options are answered with no
  • Other useful targets:
    • prepare - Set up for building external modules
    • all - Build all targets marked with [*]
      • * vmlinux - Build the bare kernel
      • * modules - Build all modules
      • modules_install - Install all modules to INSTALL_MOD_PATH (default: /)
    • dir/ - Build all files in dir and below
    • dir/file.[ois] - Build specified target only
    • dir/file.ko - Build module including final link

Note that there are also some little things about tags for editors, but I am not so sure what it really brings.