Skip to content
  • Masahiro Yamada's avatar
    kbuild: do not update config when running install targets · e8b53e57
    Masahiro Yamada authored
    [ Upstream commit d7942413
    
     ]
    
    "make syncconfig" is automatically invoked when any of the following
    happens:
    
     - .config is updated
     - any of Kconfig files is updated
     - any of environment variables referenced in Kconfig is changed
    
    Then, it updates configuration files such as include/config/auto.conf
    include/generated/autoconf.h, etc.
    
    Even install targets (install, modules_install, etc.) are no exception.
    However, they should never ever modify the source tree.  Install
    targets are often run with root privileges.  Once those configuration
    files are owned by root, "make mrproper" would end up with permission
    error.
    
    Install targets should just copy things blindly.  They should not care
    whether the configuration is up-to-date or not.  This makes more sense
    because we are interested in the configuration that was used in the
    previous kernel building.
    
    This issue has existed since before, but rarely happened.  I expect
    more chance where people are hit by this; with the new Kconfig syntax
    extension, the .config now contains the compiler information.  If you
    cross-compile the kernel with CROSS_COMPILE, but forget to pass it
    for "make install", you meet "any of environment variables referenced
    in Kconfig is changed" because $(CC) is referenced in Kconfig.
    Another scenario is the compiler upgrade before the installation.
    
    Install targets need the configuration.  "make modules_install" refer
    to CONFIG_MODULES etc.  "make dtbs_install" also needs CONFIG_ARCH_*
    to decide which dtb files to install.  However, the auto-update of
    the configuration files should be avoided.  We already do this for
    external modules.
    
    Now, Make targets are categorized into 3 groups:
    
    [1] Do not need the kernel configuration at all
    
        help, coccicheck, headers_install etc.
    
    [2] Need the latest kernel configuration
    
        If new config options are added, Kconfig will show prompt to
        ask user's selection.
    
        Build targets such as vmlinux, in-kernel modules are the cases.
    
    [3] Need the kernel configuration, but do not want to update it
    
        Install targets except headers_install, and external modules
        are the cases.
    
    Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    e8b53e57