• Andrew Morton's avatar
    [PATCH] kbuild: external module support · 07e58231
    Andrew Morton authored
    From: Sam Ravnborg <sam@ravnborg.org>
    
    Based on initial patch from Andreas Gruenbacher there is now better support
    for building external modules with kbuild.
    
    The preferred syntax is now:
    make -C $KERNELSRC M=$PWD
    
    but the old syntax:
    make -C $KERNELSRC SUBDIRS=$PWD modules
    will remain supported.
    
    The major differences compared to before are that:
    1) No attempt is made to neither check nor update any files in $KERNELSRC
    2) Module versions are now supported
    
    During stage 2 of kernel compilation where the modules are built, a new file
    Module.symvers is created.  This file contains the version for all symbols
    exported by the kernel and any module compiled within the kernel tree.
    
    When the external module is build the Module.symvers file is being read and
    symbol versions are used from that file.
    
    The purpose of avoiding any updates in the kernel src is that usually in a
    distribution the kernel src will be read-only, and there is no need to try to
    update it.  And when building an external module the focus is on the module,
    not the kernel.
    
    I expect the distributions will start using something like this:
    
    kernel src - with no generated files. Not even .config:
    /usr/src/linux-<version>
    
    Output from build:
    /lib/modules/linux-<version>/build
    
    where build is a real directory with relevant output files and the
    appropriate .config.
    
    I have some Documentation in the pipe-line, but wants to see how this
    approach is received before completing it.
    
    This patch is made on top of the previously posted patch to divide
    make clean in three steps.
    
    And you may need to edit the following line in the patch to make it apply:
     %docs: scripts_basic FORCE
    to
     %docs: scripts FORCE
    07e58231
modpost.h 2.16 KB