Skip to content
Snippets Groups Projects
  1. Jul 09, 2019
    • Masahiro Yamada's avatar
      kbuild: do not create wrappers for header-test-y · c93a0368
      Masahiro Yamada authored
      
      header-test-y does not work with headers in sub-directories.
      
      For example, you may want to write a Makefile, like this:
      
      include/linux/Kbuild:
      
        header-test-y += mtd/nand.h
      
      This entry will create a wrapper include/linux/mtd/nand.hdrtest.c
      with the following content:
      
        #include "mtd/nand.h"
      
      To make this work, we need to add $(srctree)/include/linux to the
      header search path. It would be tedious to add ccflags-y.
      
      Instead, we could change the *.hdrtest.c rule to wrap:
      
        #include "nand.h"
      
      This works for in-tree build since #include "..." searches in the
      relative path from the header with this directive. For O=... build,
      we need to add $(srctree)/include/linux/mtd to the header search path,
      which will be even more tedious.
      
      After all, I thought it would be handier to compile headers directly
      without creating wrappers.
      
      I added a new build rule to compile %.h into %.h.s
      
      The target is %.h.s instead of %.h.o because it is slightly faster.
      Also, as for GCC, an empty assembly is smaller than an empty object.
      
      I wrote the build rule:
      
        $(CC) $(c_flags) -S -o $@ -x c /dev/null -include $<
      
      instead of:
      
        $(CC) $(c_flags) -S -o $@ -x c $<
      
      Both work fine with GCC, but the latter is bad for Clang.
      
      This comes down to the difference in the -Wunused-function policy.
      GCC does not warn about unused 'static inline' functions at all.
      Clang does not warn about the ones in included headers, but does
      about the ones in the source. So, we should handle headers as
      headers, not as source files.
      
      In fact, this has been hidden since commit abb2ea7d ("compiler,
      clang: suppress warning for unused static inline functions"), but we
      should not rely on that.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Tested-by: default avatarJani Nikula <jani.nikula@intel.com>
      c93a0368
  2. Jun 15, 2019
  3. Jun 04, 2019
  4. May 21, 2019
  5. Mar 17, 2019
    • Arseny Maslennikov's avatar
      kbuild: deb-pkg: avoid implicit effects · f6d9db63
      Arseny Maslennikov authored
      
      * The man page for dpkg-source(1) notes:
      
      >      -b, --build directory [format-specific-parameters]
      >             Build  a  source  package  (--build since dpkg 1.17.14).
      >             <...>
      >
      >             dpkg-source will build the source package with the first
      >             format found in this ordered list: the format  indicated
      >             with  the  --format  command  line  option,  the  format
      >             indicated in debian/source/format, “1.0”.  The  fallback
      >             to “1.0” is deprecated and will be removed at some point
      >             in the future, you should always  document  the  desired
      >             source   format  in  debian/source/format.  See  section
      >             SOURCE PACKAGE FORMATS for an extensive  description  of
      >             the various source package formats.
      
        Thus it would be more foolproof to explicitly use 1.0 (as we always
        did) than to rely on dpkg-source's defaults.
      
      * In a similar vein, debian/rules is not made executable by mkdebian,
        and dpkg-source warns about that but still silently fixes the file.
        Let's be explicit once again.
      
      Signed-off-by: default avatarArseny Maslennikov <ar@cs.msu.ru>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      f6d9db63
  6. Mar 13, 2019
  7. Feb 28, 2019
  8. Feb 20, 2019
  9. Dec 01, 2018
  10. Nov 11, 2018
    • Rob Herring's avatar
      builddeb: Fix inclusion of dtbs in debian package · d5615e47
      Rob Herring authored
      
      Commit 37c8a5fa ("kbuild: consolidate Devicetree dtb build rules")
      moved the location of 'dtbs_install' target which caused dtbs to not be
      installed when building debian package with 'bindeb-pkg' target. Update
      the builddeb script to use the same logic that determines if there's a
      'dtbs_install' target which is presence of the arch dts directory. Also,
      use CONFIG_OF_EARLY_FLATTREE instead of CONFIG_OF as that's a better
      indication of whether we are building dtbs.
      
      This commit will also have the side effect of installing dtbs on any
      arch that has dts files. Previously, it was dependent on whether the
      arch defined 'dtbs_install'.
      
      Fixes: 37c8a5fa ("kbuild: consolidate Devicetree dtb build rules")
      Reported-by: default avatarNuno Gonçalves <nunojpg@gmail.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      d5615e47
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: fix too low build version number · bbcde0a7
      Masahiro Yamada authored
      
      Since commit b41d920a ("kbuild: deb-pkg: split generating packaging
      and build"), the build version of the kernel contained in a deb package
      is too low by 1.
      
      Prior to the bad commit, the kernel was built first, then the number
      in .version file was read out, and written into the debian control file.
      
      Now, the debian control file is created before the kernel is actually
      compiled, which is causing the version number mismatch.
      
      Let the mkdebian script pass KBUILD_BUILD_VERSION=${revision} to require
      the build system to use the specified version number.
      
      Fixes: b41d920a ("kbuild: deb-pkg: split generating packaging and build")
      Reported-by: default avatarDoug Smythies <dsmythies@telus.net>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: default avatarDoug Smythies <dsmythies@telus.net>
      bbcde0a7
  11. Nov 05, 2018
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: fix bindeb-pkg breakage when O= is used · 02826a6b
      Masahiro Yamada authored
      
      Ard Biesheuvel reports bindeb-pkg with O= option is broken in the
      following way:
      
        ...
          LD [M]  sound/soc/rockchip/snd-soc-rk3399-gru-sound.ko
          LD [M]  sound/soc/rockchip/snd-soc-rockchip-pcm.ko
          LD [M]  sound/soc/rockchip/snd-soc-rockchip-rt5645.ko
          LD [M]  sound/soc/rockchip/snd-soc-rockchip-spdif.ko
          LD [M]  sound/soc/sh/rcar/snd-soc-rcar.ko
         fakeroot -u debian/rules binary
        make KERNELRELEASE=4.19.0-12677-g19beffaf7a99-dirty ARCH=arm64 KBUILD_SRC= intdeb-pkg
        /bin/bash /home/ard/linux/scripts/package/builddeb
        Makefile:600: include/config/auto.conf: No such file or directory
        ***
        *** Configuration file ".config" not found!
        ***
        *** Please run some configurator (e.g. "make oldconfig" or
        *** "make menuconfig" or "make xconfig").
        ***
        make[12]: *** [syncconfig] Error 1
        make[11]: *** [syncconfig] Error 2
        make[10]: *** [include/config/auto.conf] Error 2
        make[9]: *** [__sub-make] Error 2
        ...
      
      Prior to commit 80463f1b ("kbuild: add --include-dir flag only
      for out-of-tree build"), both srctree and objtree were added to
      --include-dir redundantly, and the wrong code '$MAKE image_name'
      was working by relying on that. Now, the potential issue that had
      previously been hidden just showed up.
      
      '$MAKE image_name' recurses to the generated $(objtree)/Makefile and
      ends up with running in srctree, which is incorrect. It should be
      invoked with '-f $srctree/Makefile' (or KBUILD_SRC=) to be executed
      in objtree.
      
      Fixes: 80463f1b ("kbuild: add --include-dir flag only for out-of-tree build")
      Reported-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      02826a6b
    • Masahiro Yamada's avatar
      kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used · 21b42eb4
      Masahiro Yamada authored
      
      Zhenzhong Duan reported that running 'make O=/build/kernel binrpm-pkg'
      failed with the following errors:
      
        Running 'make O=/build/kernel binrpm-pkg' failed with below two errors.
      
        Makefile:600: include/config/auto.conf: No such file or directory
      
        + cp make -C /mnt/root/kernel O=/build/kernel image_name make -f
        /mnt/root/kernel/Makefile ...
        cp: invalid option -- 'C'
        Try 'cp --help' for more information.
      
      Prior to commit 80463f1b ("kbuild: add --include-dir flag only
      for out-of-tree build"), both srctree and objtree were added to
      --include-dir redundantly, and the wrong code 'make image_name'
      was working by relying on that. Now, the potential issue that had
      previously been hidden just showed up.
      
      'make image_name' recurses to the generated $(objtree)/Makefile and
      ends up with running in srctree, which is incorrect. It should be
      invoked with '-f $srctree/Makefile' (or KBUILD_SRC=) to be executed
      in objtree.
      
      Fixes: 80463f1b ("kbuild: add --include-dir flag only for out-of-tree build")
      Reported-by: default avatarZhenzhong Duan <zhenzhong.duan@oracle.com>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      21b42eb4
  12. Jul 28, 2018
  13. Jul 18, 2018
  14. May 17, 2018
    • Riku Voipio's avatar
      kbuild: deb-pkg improve maintainer address generation · d5940c60
      Riku Voipio authored
      
      There is multiple issues with the genaration of maintainer string
      
      It uses DEBEMAIL and EMAIL enviroment variables, which may contain angle brackets,
      creating invalid maintainer strings. The documented KBUILD_BUILD_USER and
      KBUILD_BUILD_HOST variables are not used. Undocumented and uncommon NAME
      variable is used. Refactor the Maintainer string to:
      
      - use EMAIL or DEBEMAIL directly if they are in form "name <user@host>"
      - use KBUILD_BUILD_USER and KBUILD_BUILD_HOST if set before falling
        back to autodetection
      - no longer use NAME variable or the useless Anonymous string
      
      The logic is switched from multiline if/then/fi statements to compact
      shell variable substition commands.
      
      Reported-by: default avatarMathieu Malaterre <malat@debian.org>
      Signed-off-by: default avatarRiku Voipio <riku.voipio@linaro.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      d5940c60
  15. Apr 13, 2018
  16. Apr 07, 2018
  17. Mar 27, 2018
  18. Dec 12, 2017
    • Masahiro Yamada's avatar
      kbuild: pkg: make out-of-tree rpm/deb-pkg build immediately fail · 262dad68
      Masahiro Yamada authored
      
      We do not support out-of-tree building of rpm-pkg / deb-pkg.  If O=
      is given, the build should be terminated, but the "false" command is
      not effective since it is not the last command in the cmd_src_tar.
      Then, rpm-pkg / deb-pkg tries to continue building, and fails for a
      different reason.
      
      Set -e option so that the "false" terminates the building immediately.
      
      I also put the error messages to stderr, and made it stand out more.
      
      For example, "make O=foo rpm-pkg" will fail as follows:
      
        /bin/bash ../scripts/package/mkspec >./kernel.spec
          TAR     kernel-4.15.0_rc2+.tar.gz
      
          ERROR:
          Building source tarball is not possible outside the
          kernel source tree. Don't set KBUILD_OUTPUT, or use the
          binrpm-pkg or bindeb-pkg target instead.
      
        ../scripts/package/Makefile:53: recipe for target 'rpm-pkg' failed
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: default avatarJim Davis <jim.epost@gmail.com>
      262dad68
    • Paolo Pisati's avatar
      scripts/package: snap-pkg target · 5704d455
      Paolo Pisati authored
      Following in footsteps of other targets like 'deb-pkg, 'rpm-pkg' and 'tar-pkg',
      this patch adds a 'snap-pkg' target for the creation of a Linux kernel snap
      package using the kbuild infrastructure.
      
      A snap, in its general form, is a self contained, sandboxed, universal package
      and it is intended to work across multiple distributions and/or devices. A snap
      package is distributed as a single compressed squashfs filesystem.
      
      A kernel snap is a snap package carrying the Linux kernel, kernel modules,
      accessory files (DTBs, System.map, etc) and a manifesto file.  The purpose of a
      kernel snap is to carry the Linux kernel during the creation of a system image,
      eg. Ubuntu Core, and its subsequent upgrades.
      
      For more information on snap packages: https://snapcraft.io/docs/
      
      
      
      Signed-off-by: default avatarPaolo Pisati <paolo.pisati@canonical.com>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      5704d455
  19. Nov 23, 2017
    • Masahiro Yamada's avatar
      kbuild: rpm: prompt to use "rpm-pkg" if "rpm" target is used · ebaad7d3
      Masahiro Yamada authored
      
      The "rpm" has been kept for backward compatibility since pre-git era.
      I am planning to remove it after the Linux 4.18 release.  Annouce the
      end of the support, prompting to use "rpm-pkg" instead.
      
      If you use "rpm", it will work like "rpm-pkg", but warning messages
      will be displayed as follows:
      
        WARNING: "rpm" target will be removed after Linux 4.18
                 Please use "rpm-pkg" instead.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      ebaad7d3
    • Masahiro Yamada's avatar
      kbuild: pkg: use --transform option to prefix paths in tar · 2dbc644a
      Masahiro Yamada authored
      
      For rpm-pkg and deb-pkg, a source tar file is created.  All paths in
      the archive must be prefixed with the base name of the tar so that
      everything is contained in the directory when you extract it.
      
      Currently, scripts/package/Makefile uses a symlink for that, and
      removes it after the tar is created.
      
      If you terminate the build during the tar creation, the symlink is
      left over.  Then, at the next package build, you will see a warning
      like follows:
      
        ln: '.' and 'kernel-4.14.0+/.' are the same file
      
      It is possible to fix it by adding -n (--no-dereference) option to
      the "ln" command, but a cleaner way is to use --transform option
      of "tar" command.  This option is GNU extension, but it should not
      hurt to use it in the Linux build system.
      
      The 'S' flag is needed to exclude symlinks from the path fixup.
      Without it, symlinks in the kernel are broken.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      2dbc644a
  20. Nov 14, 2017
Loading