09 Sep, 2016

1 commit

  • Allow architectures to create arch/xxx/Makefile.postlink with targets
    for vmlinux, modules.ko, and clean, which will be invoked after final
    linking of vmlinux and modules.

    powerpc will use this to check vmlinux linker relocations for sanity,
    and may use it to fix up alternate instruction patch branch addresses.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Nicholas Piggin
     

06 Oct, 2015

1 commit

  • The section mismatch warning can be easy to miss during the kernel build
    process. Allow it to be marked as fatal to be easily caught and prevent
    bugs from slipping in.

    Setting CONFIG_SECTION_MISMATCH_WARN_ONLY=y causes these warnings to be
    non-fatal, since there are a number of section mismatches when using
    allmodconfig on some architectures, and we do not want to break these
    builds by default.

    Signed-off-by: Nicolas Boichat
    Change-Id: Ic346706e3297c9f0d790e3552aa94e5cff9897a6
    Signed-off-by: Rusty Russell

    Nicolas Boichat
     

23 Sep, 2013

1 commit

  • Commit ea4054a23 (modpost: handle huge numbers of modules) added
    support for building a large number of modules.

    Unfortunately, the commit changed the semantics of the makefile: Instead of
    passing only existing object files to modpost, make now passes all expected
    object files. If make was started with option -i, this results in a modpost
    error if a single file failed to build.

    Example with the current btrfs build falure on m68k:

    fs/btrfs/btrfs.o: No such file or directory
    make[1]: [__modpost] Error 1 (ignored)

    This error is followed by lots of errors such as:

    m68k-linux-gcc: error: arch/m68k/emu/nfcon.mod.c: No such file or directory
    m68k-linux-gcc: fatal error: no input files
    compilation terminated.
    make[1]: [arch/m68k/emu/nfcon.mod.o] Error 1 (ignored)

    This doesn't matter much for normal builds, but it is annoying for builds
    started with "make -i" due to the large number of secondary errors.
    Those errors unnececessarily clog any error log and make it difficult
    to find the real errors in the build.

    Fix the problem by adding a new parameter '-n' to modpost. If this parameter
    is specified, modpost reports but ignores missing object files.

    With this patch, error output from above problem is (with make -i):

    m68k-linux-ld: cannot find fs/btrfs/ioctl.o: No such file or directory
    make[2]: [fs/btrfs/btrfs.o] Error 1 (ignored)
    ...
    fs/btrfs/btrfs.o: No such file or directory (ignored)

    Cc: Rusty Russell
    Cc: Michael Marek
    Signed-off-by: Guenter Roeck
    Signed-off-by: Rusty Russell

    Guenter Roeck
     

05 Apr, 2013

1 commit

  • strace shows:
    72102 execve("/bin/sh", ["/bin/sh", "-c", "echo ' scripts/mod/modpost -m -a
    -o /cc/wfg/sound-compiletest/Module.symvers -s'; scripts/
    mod/modpost -m -a -o /cc/wfg/sound-compiletest/Module.symvers -s vmlinux
    arch/x86/crypto/ablk_helper.o arch/x86/crypto/aes-i586.o arch
    /x86/crypto/aesni-intel.o arch/x86/crypto/crc32-pclmul.o
    ...
    drivers/ata/sata_promise.o "...], [/* 119 vars */]
    71827 wait4(-1,
    72102 ) = -1 E2BIG (Argument list too long)

    So we re-run the shell command which produces the list and feed it into modpost -T -.

    Reported-by: Fengguang Wu
    Signed-off-by: Rusty Russell

    Rusty Russell
     

25 Jan, 2013

1 commit


19 Oct, 2012

1 commit

  • Linus deleted the old code and put signing on the install command,
    I fixed it to extract the keyid and signer-name within sign-file
    and cleaned up that script now it always signs in-place.

    Some enthusiast should convert sign-key to perl and pull
    x509keyid into it.

    Signed-off-by: Rusty Russell
    Signed-off-by: Linus Torvalds

    Rusty Russell
     

15 Oct, 2012

1 commit

  • Pull module signing support from Rusty Russell:
    "module signing is the highlight, but it's an all-over David Howells frenzy..."

    Hmm "Magrathea: Glacier signing key". Somebody has been reading too much HHGTTG.

    * 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (37 commits)
    X.509: Fix indefinite length element skip error handling
    X.509: Convert some printk calls to pr_devel
    asymmetric keys: fix printk format warning
    MODSIGN: Fix 32-bit overflow in X.509 certificate validity date checking
    MODSIGN: Make mrproper should remove generated files.
    MODSIGN: Use utf8 strings in signer's name in autogenerated X.509 certs
    MODSIGN: Use the same digest for the autogen key sig as for the module sig
    MODSIGN: Sign modules during the build process
    MODSIGN: Provide a script for generating a key ID from an X.509 cert
    MODSIGN: Implement module signature checking
    MODSIGN: Provide module signing public keys to the kernel
    MODSIGN: Automatically generate module signing keys if missing
    MODSIGN: Provide Kconfig options
    MODSIGN: Provide gitignore and make clean rules for extra files
    MODSIGN: Add FIPS policy
    module: signature checking hook
    X.509: Add a crypto key parser for binary (DER) X.509 certificates
    MPILIB: Provide a function to read raw data into an MPI
    X.509: Add an ASN.1 decoder
    X.509: Add simple ASN.1 grammar compiler
    ...

    Linus Torvalds
     

10 Oct, 2012

1 commit

  • If CONFIG_MODULE_SIG is set, then this patch will cause all modules files to
    to have signatures added. The following steps will occur:

    (1) The module will be linked to foo.ko.unsigned instead of foo.ko

    (2) The module will be stripped using both "strip -x -g" and "eu-strip" to
    ensure minimal size for inclusion in an initramfs.

    (3) The signature will be generated on the stripped module.

    (4) The signature will be appended to the module, along with some information
    about the signature and a magic string that indicates the presence of the
    signature.

    Step (3) requires private and public keys to be available. By default these
    are expected to be found in files:

    signing_key.priv
    signing_key.x509

    in the base directory of the build. The first is the private key in PEM form
    and the second is the X.509 certificate in DER form as can be generated from
    openssl:

    openssl req \
    -new -x509 -outform PEM -out signing_key.x509 \
    -keyout signing_key.priv -nodes \
    -subj "/CN=H2G2/O=Magrathea/CN=Slartibartfast"

    If the secret key is not found then signing will be skipped and the unsigned
    module from (1) will just be copied to foo.ko.

    If signing occurs, lines like the following will be seen:

    LD [M] fs/foo/foo.ko.unsigned
    STRIP [M] fs/foo/foo.ko.stripped
    SIGN [M] fs/foo/foo.ko

    will appear in the build log. If the signature step will be skipped and the
    following will be seen:

    LD [M] fs/foo/foo.ko.unsigned
    STRIP [M] fs/foo/foo.ko.stripped
    NO SIGN [M] fs/foo/foo.ko

    NOTE! After the signature step, the signed module _must_not_ be passed through
    strip. The unstripped, unsigned module is still available at the name on the
    LD [M] line. This restriction may affect packaging tools (such as rpmbuild)
    and initramfs composition tools.

    Signed-off-by: David Howells
    Signed-off-by: Rusty Russell

    David Howells
     

31 Aug, 2012

1 commit

  • This error may happen when the user's id or path includes .ko string.
    For example, user's id is xxx.ko and building test.ko module,
    the test.mod file lists ko name and all object files.
    /home/xxx.ko/kernel_dev/device/drivers/test.ko
    /home/xxx.ko/kernel_dev/device/drivers/test_main.o
    /home/xxx.ko/kernel_dev/device/drivers/test_io.o ...
    Current Makefile.modpost and Makefile.modinst find and list up not
    only test.ko but also other object files.
    because all of object file's path includes .ko string.
    This is a patch to fix it.

    Signed-off-by: Gunho Lee
    Signed-off-by: Michal Marek

    이건호
     

07 Jun, 2011

1 commit


25 May, 2011

1 commit


31 Mar, 2011

1 commit


03 Aug, 2010

2 commits

  • Signed-off-by: Uwe Kleine-König
    Signed-off-by: Michal Marek

    Uwe Kleine-König
     
  • It is now possible to assign options to AS, CC and LD
    on the command line - which is only used when building modules.

    {A,C,LD}FLAGS_MODULE was all used both in the top-level Makefile
    in the arch makefiles, thus users had no way to specify
    additional options to AS, CC, LD when building modules
    without overriding the original value.

    Introduce a new set of variables KBUILD_{A,C,LD}FLAGS_MODULE
    that is used by arch specific files and free up
    {A,C,LD}FLAGS_MODULE so they can be assigned on
    the command line.

    All arch Makefiles that used the old variables has been updated.

    Note: Previously we had a MODFLAGS variable for both
    AS and CC. But in favour of consistency this was dropped.
    So in some cases arch Makefile has one assignmnet replaced by
    two assignmnets.

    Note2: MODFLAGS was not documented and is dropped
    without any notice. I do not expect much/any breakage
    from this.

    Signed-off-by: Sam Ravnborg
    Cc: Denys Vlasenko
    Cc: Haavard Skinnemoen
    Cc: Mike Frysinger
    Cc: Tony Luck
    Cc: Geert Uytterhoeven
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Martin Schwidefsky
    Cc: Chen Liqin
    Acked-by: Mike Frysinger [blackfin]
    Acked-by: Haavard Skinnemoen [avr32]
    Signed-off-by: Michal Marek

    Sam Ravnborg
     

19 Sep, 2009

1 commit

  • Now that the last users of markers have migrated to the event
    tracer we can kill off the (now orphan) support code.

    Signed-off-by: Christoph Hellwig
    Acked-by: Mathieu Desnoyers
    Cc: Steven Rostedt
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Christoph Hellwig
     

30 Oct, 2008

1 commit

  • Taken from http://bugzilla.kernel.org/show_bug.cgi?id=11567

    If you even define KBUILD_EXTRA_SYMBOLS in Makefile it will not be expanded
    into command line argument for modpost.

    Signed-off-by: Andrew Morton
    Signed-off-by: Sam Ravnborg

    Peter Volkov
     

23 Jul, 2008

1 commit

  • When a kernel was rebuilt, the previous Module.markers was not cleared.
    It caused markers with different format strings to appear as duplicates
    when a markers was changed. This problem is present since
    scripts/mod/modpost.c started to generate Module.markers, commit
    b2e3e658b344c6bcfb8fb694100ab2f2b5b2edb0

    It therefore applies to 2.6.25, 2.6.26 and linux-next.

    I merely merged the patches from Roland, Wenji and Takashi here.

    Credits to
    Roland McGrath
    Wenji Huang
    and
    Takashi Nishiie

    for providing the individual fixes.

    - Changelog :
    - Integrated Takashi's Makefile modification to clear Module.markers upon
    make clean.

    Signed-off-by: Mathieu Desnoyers
    Cc: Roland McGrath
    Cc: Wenji Huang
    Cc: Takashi Nishiie
    Cc: [2.6.25.x, 2.6.26.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mathieu Desnoyers
     

01 Jun, 2008

1 commit

  • When we introduced support for KBUILD_EXTRA_SYMBOLS
    we started to include the externam module's kbuild
    file when doing the final modpost step.

    As external modules often do:
    ccflags-y := -I$(src)

    We had problems because $(src) was unassinged and
    gcc then used the next parameter for -I resulting in
    strange build failures.

    Fix is to assign $(src) and $(obj) when building
    external modules.

    This fixes: http://bugzilla.kernel.org/show_bug.cgi?id=10798

    Signed-off-by: Sam Ravnborg
    Cc: Tvrtko
    Cc: Andrea Arcangeli
    Cc: "Rafael J. Wysocki"

    Sam Ravnborg
     

27 Apr, 2008

1 commit


26 Apr, 2008

1 commit

  • This patch adds a new (Kbuild) Makefile variable KBUILD_EXTRA_SYMBOLS.
    The space separated list of file names assigned to KBUILD_EXTRA_SYMBOLS
    is used when calling scripts/mod/modpost during stage 2 of the Kbuild
    process for non-kernel-tree modules.

    Signed-off-by: Richard Hacker
    Signed-off-by: Sam Ravnborg

    Richard Hacker
     

24 Mar, 2008

1 commit

  • The module alias support in the kernel have a consistency
    check where it is checked that the size of a structure
    in the kernel and on the build host are the same.
    For cross builds this check does not make sense so detect
    when we do cross builds and silently skip the check in these
    situations.
    This fixes a build bug for a wireless driver when cross building
    for arm.

    Acked-by: Michael Buesch
    Tested-by: Gordon Farquharson
    Signed-off-by: Sam Ravnborg
    Cc: stable@kernel.org

    Sam Ravnborg
     

14 Feb, 2008

1 commit

  • This adds some new magic in the MODPOST phase for CONFIG_MARKERS. Analogous
    to the Module.symvers file, the build will now write a Module.markers file
    when CONFIG_MARKERS=y is set. This file lists the name, defining module, and
    format string of each marker, separated by \t characters. This simple text
    file can be used by offline build procedures for instrumentation code,
    analogous to how System.map and Module.symvers can be useful to have for
    kernels other than the one you are running right now.

    The strings are made easy to extract by having the __trace_mark macro define
    the name and format together in a single array called __mstrtab_* in the
    __markers_strings section. This is straightforward and reliable as long as
    the marker structs are always defined by this macro. It is an unreasonable
    amount of hairy work to extract the string pointers from the __markers section
    structs, which entails handling a relocation type for every machine under the
    sun.

    Mathieu :
    - Ran through checkpatch.pl

    Signed-off-by: Roland McGrath
    Signed-off-by: Mathieu Desnoyers
    Cc: David Smith
    Cc: Sam Ravnborg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mathieu Desnoyers
     

29 Jan, 2008

1 commit

  • If the config option CONFIG_SECTION_MISMATCH is not set and
    we see a Section mismatch present the following to the user:

    modpost: Found 1 section mismatch(es).
    To see additional details select "Enable full Section mismatch analysis"
    in the Kernel Hacking menu (CONFIG_SECTION_MISMATCH).

    If the option CONFIG_SECTION_MISMATCH is selected
    then be verbose in the Section mismatch reporting from mdopost.
    Sample outputs:

    WARNING: o-x86_64/vmlinux.o(.text+0x7396): Section mismatch in reference from the function discover_ebda() to the variable .init.data:ebda_addr
    The function discover_ebda() references
    the variable __initdata ebda_addr.
    This is often because discover_ebda lacks a __initdata
    annotation or the annotation of ebda_addr is wrong.

    WARNING: o-x86_64/vmlinux.o(.data+0x74d58): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_plx9050_exit()
    The variable pci_serial_quirks references
    the function __devexit pci_plx9050_exit()
    If the reference is valid then annotate the
    variable with __exit* (see linux/init.h) or name the variable:
    *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

    WARNING: o-x86_64/vmlinux.o(__ksymtab+0x630): Section mismatch in reference from the variable __ksymtab_arch_register_cpu to the function .cpuinit.text:arch_register_cpu()
    The symbol arch_register_cpu is exported and annotated __cpuinit
    Fix this by removing the __cpuinit annotation of arch_register_cpu or drop the export.

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

26 Jul, 2007

2 commits


17 Jul, 2007

1 commit

  • Previously we did do the check on the .o files used to link
    vmlinux but that failed to find questionable references across
    the .o files.
    Create a dedicated vmlinux.o file used only for section mismatch checks
    that uses the defualt linker script so section does not get renamed.

    The vmlinux.o may later be used as part of the the final link of vmlinux
    but for now it is used fo section mismatch only.
    For a defconfig build this is instant but for an allyesconfig this
    add two minutes to a full build (that anyways takes ~2 hours).

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

03 May, 2007

1 commit


17 Oct, 2006

1 commit

  • Some people want to do crazy things like pass multiple directories as the
    value of $(SUBDIRS) or $M. Mostly this kinda works, except that
    Makefile.modpost constructs a modpost commandline which fails modpost's
    argument parsing. This patch fixes that little wrinkle.

    Signed-off-by: Greg Banks
    Cc: Sam Ravnborg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Greg Banks
     

01 Oct, 2006

1 commit

  • On request from Al Viro make modpost processing configurable.

    KBUILD_MODPOST_WARN can be set to make modpost warn instead of
    error out in case on unresolved symbols in final module link.

    KBUILD_MODPOST_NOFINAL can be set to avoid the final and timeconsuming
    .c file generation and link of .ko files. This is solely useful for
    speeding up when doing compile checks with for example allmodconfig

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

25 Sep, 2006

2 commits

  • At stage 2 modpost utility is used to check modules. In case of unresolved
    symbols modpost only prints warning.

    IMHO it is a good idea to fail compilation process in case of unresolved
    symbols (at least in modules coming with kernel), since usually such errors
    are left unnoticed, but kernel modules are broken.

    - new option '-w' is added to modpost:
    if option is specified, modpost only warns about unresolved symbols

    - modpost is called with '-w' for external modules in Makefile.modpost

    Signed-off-by: Andrey Mirkin
    Signed-off-by: Kirill Korotaev
    Signed-off-by: Andrew Morton
    Signed-off-by: Sam Ravnborg

    Kirill Korotaev
     
  • Based on patch from: Magnus Damm
    This has the advantage that all section mismatch checks are run regardless
    of modules being enabled or not.

    When running modpost on vmlinux output:
    MODPOST vmlinux

    When running modpost on modules output count of modules like this:
    MODPOST 5 modules

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

01 Aug, 2006

1 commit


01 Jul, 2006

1 commit

  • kbuild used $¤(*F to get filename of target without extension.
    This was used in several places all over kbuild, but introducing
    make -rR broke his for all cases where we specified full path to
    target/prerequsite. It is assumed that make -rR disables old style
    suffix-rules which is why is suddenly failed.

    ia64 was impacted by this change because several div* routines in
    arch/ia64/lib are build using explicit paths and then kbuild failed.

    Thanks to David Mosberger-Tang for an explanation
    what was the root-cause and for testing on ia64.

    This patch also fixes two uses of $(*F) in arch/um

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

27 Jun, 2006

1 commit

  • This reverts commit e5c44fd88c146755da6941d047de4d97651404a9.

    Thanks to Daniel Ritz and Michal Piotrowski for noticing the problem.

    Daniel says:

    "[The] reason is a recent change that made modules always shows as
    module.mod. it breaks modprobe and probably many scripts..besides
    lsmod looking horrible

    stuff like this in modprobe.conf:
    install pcmcia_core /sbin/modprobe --ignore-install pcmcia_core; /sbin/modprobe pcmcia
    makes modprobe fork/exec endlessly calling itself...until oom
    interrupts it"

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

25 Jun, 2006

1 commit

  • make failed to supply the filename when using make -rR and using $(*F)
    to get target filename without extension.
    This bug was not reproduceable in small scale but using:
    $(basename $(notdir $@)) fixes it with same functionality.

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

09 Jun, 2006

1 commit

  • This fixes one of the worst kbuild warts left - the broken dependencies used
    to check and regenerate the .config file. This was done via an indirect
    dependency and the .config itself had an empty command, which can cause make
    not to reread the changed .config file.

    Instead of this we generate now a new file include/config/auto.conf from
    .config, which is used for kbuild and has the proper dependencies. It's also
    the main make target now for all files generated during this step (and thus
    replaces include/linux/autoconf.h).

    This also means we can now relax the syntax requirements for the .config file
    and we don't have to rewrite it all the time, i.e. silentoldconfig only
    writes .config now when it's necessary to keep it in sync with the Kconfig
    files and even this can be suppressed by setting the environment variable
    KCONFIG_NOSILENTUPDATE, so the update can (and must) be done manually.

    Signed-off-by: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Sam Ravnborg

    Roman Zippel
     

26 Mar, 2006

1 commit

  • * master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild: (46 commits)
    kbuild: remove obsoleted scripts/reference_* files
    kbuild: fix make help & make *pkg
    kconfig: fix time ordering of writes to .kconfig.d and include/linux/autoconf.h
    Kconfig: remove the CONFIG_CC_ALIGN_* options
    kbuild: add -fverbose-asm to i386 Makefile
    kbuild: clean-up genksyms
    kbuild: Lindent genksyms.c
    kbuild: fix genksyms build error
    kbuild: in makefile.txt note that Makefile is preferred name for kbuild files
    kbuild: replace PHONY with FORCE
    kbuild: Fix bug in crc symbol generating of kernel and modules
    kbuild: change kbuild to not rely on incorrect GNU make behavior
    kbuild: when warning symbols exported twice now tell user this is the problem
    kbuild: fix make dir/file.xx when asm symlink is missing
    kbuild: in the section mismatch check try harder to find symbols
    kbuild: fix section mismatch check for unwind on IA64
    kbuild: kill false positives from section mismatch warnings for powerpc
    kbuild: kill trailing whitespace in modpost & friends
    kbuild: small update of allnoconfig description
    kbuild: make namespace.pl CROSS_COMPILE happy
    ...

    Trivial conflict in arch/ppc/boot/Makefile manually fixed up

    Linus Torvalds
     

25 Mar, 2006

1 commit


06 Mar, 2006

1 commit

  • The kbuild system takes advantage of an incorrect behavior in GNU make.
    Once this behavior is fixed, all files in the kernel rebuild every time,
    even if nothing has changed. This patch ensures kbuild works with both
    the incorrect and correct behaviors of GNU make.

    For more details on the incorrect behavior, see:

    http://lists.gnu.org/archive/html/bug-make/2006-03/msg00003.html

    Changes in this patch:
    - Keep all targets that are to be marked .PHONY in a variable, PHONY.
    - Add .PHONY: $(PHONY) to mark them properly.
    - Remove any $(PHONY) files from the $? list when determining whether
    targets are up-to-date or not.

    Signed-off-by: Paul Smith
    Signed-off-by: Sam Ravnborg

    Paul Smith
     

19 Feb, 2006

1 commit

  • With following patch a second option is enabled to obtain
    symbol information from a second external module when a
    external module is build.
    The recommended approach is to use a common kbuild file but
    that may be impractical in certain cases.
    With this patch one can copy over a Module.symvers from one
    external module to make symbols (and symbol versions) available
    for another external module.

    Updated documentation in Documentation/kbuild/modules.txt

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg