linuxlinux-kernelinstallationkernel

Change linux kernel installation directory


Is it possible to change default destination( /boot/ ) of make install at installing custom linux kernel.


Solution

  • Short answer

    You need to use INSTALL_PATH environment variable to change installation directory.

    Example:

    $ export INSTALL_PATH=/tmp
    $ make install
    

    Details

    From make help:

    install - Install kernel using

    • (your) ~/bin/installkernel or
    • (distribution) /sbin/installkernel or
    • install to $(INSTALL_PATH) and run lilo

    From Documentation/kbuild/kbuild.txt:

    INSTALL_PATH specifies where to place the updated kernel and system map images. Default is /boot, but you can set it to other values.

    Also, from Documentation/kbuild/makefiles.txt:

    INSTALL_PATH

    This variable defines a place for the arch Makefiles to install the resident kernel image and System.map file. Use this for architecture-specific install targets.

    Addendum

    Kernel modules could also be an important part of kernel installation. As @KJ7LNW mentioned, INSTALL_MOD_PATH environment variable can be used to specify the modules installation path, e.g.:

    $ make INSTALL_MOD_PATH=/tmp modules_install
    

    To control the headers installation path, one can use INSTALL_HDR_PATH:

    $ make INSTALL_HDR_PATH=/tmp headers_install
    

    Device tree binaries can be installed to INSTALL_DTBS_PATH:

    $ make INSTALL_DTBS_PATH=/tmp dtbs_install
    

    For more details, check out the Kbuild documentation.