Skip to content
Snippets Groups Projects
  1. Aug 24, 2019
  2. Jun 04, 2019
  3. May 21, 2019
  4. Feb 28, 2019
  5. Feb 20, 2019
  6. Dec 01, 2018
  7. Apr 07, 2018
  8. 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
  9. 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
  10. Nov 14, 2017
    • Masahiro Yamada's avatar
      kbuild: rpm-pkg: do not force -jN in submake · 8a16a070
      Masahiro Yamada authored
      
      The spec file always passes %{?_smp_mflags}, but we have two
      problems here.
      
      [1] "make -jN rpm-pkg" emits the following warning message:
      
          make[2]: warning: -jN forced in submake: disabling jobserver mode.
      
      [2] We can not specify the number of jobs that run in parallel.
          Whether we give -jN or not from the top Makefile, the spec file
          always passes ${?_smp_mflags} to the build commands.
      
      ${?_smp_mflags} will be useful when we run rpmbuild by hand.  When we
      invoke it from Makefile, -jN is propagated down to submake; it should
      not be overridden because we want to respect the number of jobs given
      by the user.  Set _smp_mflags to empty string in this case.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      8a16a070
    • Masahiro Yamada's avatar
      kbuild: rpm-pkg: keep spec file until make mrproper · af60e207
      Masahiro Yamada authored
      
      If build fails during (bin)rpm-pkg, the spec file is not cleaned by
      anyone until the next successful build of the package.
      
      We do not have to immediately delete the spec file in case somebody
      may want to take a look at it.  Instead, make them ignored by git,
      and cleaned up by make mrproper.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      af60e207
    • Masahiro Yamada's avatar
      kbuild: rpm-pkg: fix jobserver unavailable warning · 606625be
      Masahiro Yamada authored
      
      If "make rpm-pkg" or "make binrpm-pkg" is run with -j[jobs] option,
      the following warning message is displayed.
      
        warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
      
      Follow the suggestion.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      606625be
  11. Sep 20, 2017
    • Masahiro Yamada's avatar
      kbuild: rpm-pkg: fix version number handling · 25b080bd
      Masahiro Yamada authored
      
      The "Release:" field of the spec file is determined based on the
      .version file.
      
      However, the .version file is not copied to the source tar file.
      So, when we build the kernel from the source package, the UTS_VERSION
      always indicates #1.  This does not match with "rpm -q".
      
      The kernel UTS_VERSION and "rpm -q" do not agree for binrpm-pkg, either.
      Please note the kernel has already been built before the spec file is
      created.  Currently, mkspec invokes mkversion.  This script returns an
      incremented version.  So, the "Release:" field of the spec file is
      greater than the version in the kernel by one.
      
      For the source package build (where .version file is missing), we can
      give KBUILD_BUILD_VERSION=%{release} to the build command.
      
      For the binary package build, we can simply read out the .version file
      because it contains the version number that was used for building the
      kernel image.
      
      We can remove scripts/mkversion because scripts/package/Makefile need
      not touch the .version file.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      25b080bd
  12. May 16, 2016
  13. Nov 24, 2015
    • Riku Voipio's avatar
      package Makefile: fix perf-tar targets when outdir is set · 4b63f603
      Riku Voipio authored
      
      building with $srctree != $objtree, perf-tar-* targets fail
      to read the MANIFEST file and add the PERF-VERSION-FILE needed
      by out-of-tree builds. The build errors and an incorrect tar is created:
      
      $ make O=build-x86 perf-targz-src-pkg
        TAR
      cat: ../tools/perf/MANIFEST: No such file or directory
      tar: perf-4.1.0-rc8/PERF-VERSION-FILE: Cannot stat: No such file or
      dir..
      tar: Exiting with failure status due to previous errors
      
      Kbuild sets objtree to "." and srctree to ".." The command to output
      MANIFEST becomes:
      
         $(cd ..; echo $(cat ../tools/perf/MANIFEST))
      
      Without MANIFEST, the entire kernel source tree is added to the perf
      source tarball. The *correct* fix is to keep the cd and remove srctree
      from cat command line since MANIFEST has wildcards that fail to expand
      working directory isn't srctree.
      
      Second, PERF-VERSION-FILE gets not added, because in-tree build path is
      hardcoded to Makefile:
      
         util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null)
      
      The PERF-VERSION-GEN needs to be run from tools/perf directory,
      and the output directory needs to be changed from relative to
      to absolute. This can be achieved using the $(CURDIR) variable.
      
      Also remove the error redirect to /dev/null which hid the error.
      
      Signed-off-by: default avatarRiku Voipio <riku.voipio@linaro.org>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      4b63f603
  14. Sep 04, 2015
  15. Jun 15, 2015
    • Jim Davis's avatar
      scripts/package/Makefile: rpmbuild is needed for rpm targets · 21a59991
      Jim Davis authored
      
      Before rpm release 4.1, in 2002, either the rpm command or the
      rpmbuild command could be used in the rpm-pkg or binrpm-pkg targets,
      and the Makefile chose the rpm command if the rpmbuild command wasn't
      found.
      
      After release 4.1, however, the rpm command could no longer be used in
      place of the rpmbuild command.  As the rpmbuild command is not
      installed by default, this can lead to failures with the rpm-pkg and
      binrpm-pkg targets:
      
      rpm --define "_builddir ." --target \
          x86_64 -bb ./binkernel.spec
          rpm --target: unknown option
          scripts/package/Makefile:60: recipe for target 'binrpm-pkg' failed
      
      Change the Makefile to use rpmbuild unconditionally to avoid this.
      
      Signed-off-by: default avatarJim Davis <jim.epost@gmail.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      21a59991
  16. Jun 09, 2014
  17. Nov 07, 2013
  18. May 16, 2013
  19. Apr 18, 2013
  20. Apr 08, 2013
  21. Oct 29, 2011
  22. Jun 24, 2011
  23. May 24, 2011
  24. May 04, 2011
  25. Mar 09, 2011
  26. Jul 21, 2010
  27. Jun 18, 2010
    • Michal Marek's avatar
      kbuild: Clean up and speed up the localversion logic · 09155120
      Michal Marek authored
      
      Now that we run scripts/setlocalversion during every build, it makes
      sense to move all the localversion logic there. This cleans up the
      toplevel Makefile and also makes sure that the script is called only
      once in 'make prepare' (previously, it would be called every time due to
      a variable expansion in an ifneq statement). No user-visible change is
      intended, unless one runs the setlocalversion script directly.
      
      Reported-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Thelen <gthelen@google.com>
      Cc: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      09155120
  28. Jun 05, 2010
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Make target to generate self contained source tarball · 8e5564e6
      Arnaldo Carvalho de Melo authored
      
      Useful for when people want to try some version of the perf tools and don't
      wants to download the kernel tarball.
      
      Here is a session using this new target:
      
        [root@emilia linux-2.6-tip]# make help | grep -i perf
          perf-tar-src-pkg    - Build perf-2.6.35-rc1.tar source tarball
          perf-targz-src-pkg  - Build perf-2.6.35-rc1.tar.gz source tarball
          perf-tarbz2-src-pkg - Build perf-2.6.35-rc1.tar.bz2 source tarball
        [root@emilia linux-2.6-tip]# make perf-tarbz2-src-pkg
          TAR
        [root@emilia linux-2.6-tip]# ls -la perf-2.6.35-rc1.tar.bz2
        -rw-r--r-- 1 root root 295731 May 31 11:18 perf-2.6.35-rc1.tar.bz2
        [root@emilia linux-2.6-tip]# tar xf perf-2.6.35-rc1.tar.bz2
        [root@emilia linux-2.6-tip]# cd perf-2.6.35-rc1
        [root@emilia perf-2.6.35-rc1]# ls
        arch  HEAD  include  lib  tools
        [root@emilia perf-2.6.35-rc1]# cd tools/perf
        [root@emilia perf]# make -j9 2>&1 | tail
            CC arch/x86/util/dwarf-regs.o
            CC util/probe-finder.o
            CC util/newt.o
            CC util/scripting-engines/trace-event-perl.o
            CC scripts/perl/Perf-Trace-Util/Context.o
            CC perf.o
            CC builtin-help.o
            AR libperf.a
            LINK perf
        rm .perf.dev.null
        [root@emilia perf]# ./perf record -a sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.262 MB perf.data (~11457 samples) ]
        [root@emilia perf]# ./perf report | head -12
        # Events: 6K cycles
        #
        # Overhead          Command       Shared Object  Symbol
        # ........  ...............  ..................  ......
        #
             4.73%             perf  [kernel.kallsyms]   [k] format_decode
             4.49%             perf  libc-2.12.so        [.] _IO_file_underflow_internal
             4.38%             init  [kernel.kallsyms]   [k] mwait_idle
             3.29%             perf  [kernel.kallsyms]   [k] vsnprintf
             2.38%             init  [kernel.kallsyms]   [k] sched_clock_local
             2.35%             init  [kernel.kallsyms]   [k] apic_timer_interrupt
             1.86%     sirq-timer/5  [kernel.kallsyms]   [k] find_busiest_group
        [root@emilia perf]#
      
      Acked-by: default avatarMichal Marek <mmarek@suse.cz>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <20100528185357.GA28009@ghostprotocols.net>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8e5564e6
  29. Dec 12, 2009
    • Jonathan Nieder's avatar
      scripts/package: deb-pkg: use fakeroot if available · db1d1865
      Jonathan Nieder authored
      
      Running "make deb-pkg" requires setting KBUILD_PKG_ROOTCMD or
      becoming root oneself or it errors out.  Unless already running
      as root or KBUILD_PKG_ROOTCMD is already set, use fakeroot as a
      good default.
      
      With this patch applied, you can run "make oldconfig deb-pkg" as
      an ordinary user to build a binary package for an updated kernel
      tree and it should just work.
      
      fakeroot is too zealous by default in treating files as owned by
      root.  Its wrapped stat() sets st_uid and st_gid to 0 for all
      files, which causes Git to go on a wild goose chase if
      CONFIG_LOCALVERSION_AUTO is set, checking if any file's content
      has changed along with its stat information.  Avoid this by
      telling fakeroot to use the actual owner and group for
      preexisting files, by passing it the -u option.
      
      Signed-off-by: default avatarJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      db1d1865
    • Jonathan Nieder's avatar
      scripts/package: add KBUILD_PKG_ROOTCMD variable · 05ba4488
      Jonathan Nieder authored
      
      Let the deb-pkg target acquire (fake) root privileges before
      running commands that need them.  Without such privileges,
      deb-pkg errors out because chown fails.
      
      The new KBUILD_PKG_ROOTCMD variable, if defined, is used as a
      command to run other commands with possibly fake elevated
      privileges.  Since this is not needed for the tar-pkg and rpm-pkg
      targets, it is only used by deb-pkg.  If it is not defined, the
      behavior is as before, and the user will have to rerun make as
      root.
      
      In other words, as a shortcut, instead of running 'make oldconfig &&
      make && fakeroot -u make deb-pkg', one can use the single command
      'make oldconfig deb-pkg KBUILD_PKG_ROOTCMD="fakeroot -u"'.
      
      Suggested-by: default avatarRyan Anderson <ryan@michonline.com>
      Signed-off-by: default avatarJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      05ba4488
  30. Oct 11, 2009
  31. Mar 07, 2009
    • Josh Hunt's avatar
      kbuild: fix 'make rpm' when CONFIG_LOCALVERSION_AUTO=y and using SCM tree · b925dbfe
      Josh Hunt authored
      
      Running 'make rpm' fails when CONFIG_LOCALVERSION_AUTO=y and using a kernel source
      tree under SCM.  This is due to KERNELRELEASE being different when the initial make
      is run and when make is run from rpmbuild.
      
      mkspec creates kernel.spec using KERNELRELEASE:
      
      <mkspec>
      echo "%files"
      echo '%defattr (-, root, root)'
      echo "%dir /lib/modules"
      echo "/lib/modules/$KERNELRELEASE"
      echo "/lib/firmware"
      echo "/boot/*"
      echo ""
      </mkspec>
      
      When CONFIG_LOCALVERSION_AUTO=y scripts/setlocalversion is called and grabs any
      additional version info from SCM.  Next, the srctree is tarred up and SCM
      information is excluded.
      
      rpmbuild reruns make and in the process generates a new include/config/kernel.release
      and thus a new KERNELRELEASE.  However this time the SCM information is gone so
      KERNELRELEASE no longer has the additional version information.  When "make modules_install"
      runs, it uses the new KERNELRELEASE value to determine where to install the modules.
      This conflicts with where the spec file assumes they are going because of the
      mis-matching KERNELRELEASE versions.
      
      <snippet>
      + INSTALL_MOD_PATH=/var/tmp/kernel-2.6.29rc4tip01479g5d85422-root
      + make -j16 modules_install
        INSTALL crypto/aead.ko
        INSTALL crypto/cbc.ko
        INSTALL crypto/chainiv.ko
        INSTALL crypto/crc32c.ko
        INSTALL crypto/crypto_algapi.ko
        INSTALL crypto/crypto_blkcipher.ko
        INSTALL crypto/crypto_hash.ko
        INSTALL crypto/cryptomgr.ko
        INSTALL crypto/ecb.ko
        INSTALL crypto/eseqiv.ko
        INSTALL crypto/krng.ko
        INSTALL crypto/md5.ko
        INSTALL crypto/pcbc.ko
        INSTALL crypto/rng.ko
        INSTALL drivers/block/cciss.ko
        INSTALL drivers/hid/hid-dummy.ko
        INSTALL drivers/scsi/iscsi_tcp.ko
        INSTALL drivers/scsi/libiscsi.ko
        INSTALL drivers/scsi/libiscsi_tcp.ko
        INSTALL drivers/scsi/scsi_transport_iscsi.ko
        INSTALL drivers/scsi/scsi_wait_scan.ko
        INSTALL fs/lockd/lockd.ko
        INSTALL fs/nfs/nfs.ko
        INSTALL fs/nfsd/nfsd.ko
        INSTALL lib/libcrc32c.ko
        INSTALL net/sunrpc/sunrpc.ko
        DEPMOD  2.6.29-rc4-tip
      + cp arch/x86/boot/bzImage
      /var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/boot/vmlinuz-2.6.29-rc4-tip-01479-g5d85422
      + cp System.map
      /var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/boot/System.map-2.6.29-rc4-tip-01479-g5d85422
      + cp .config
      /var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/boot/config-2.6.29-rc4-tip-01479-g5d85422
      + cp vmlinux vmlinux.orig
      + bzip2 -9 vmlinux
      + mv vmlinux.bz2
      /var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/boot/vmlinux-2.6.29-rc4-tip-01479-g5d85422.bz2
      + mv vmlinux.orig vmlinux
      + /usr/lib/rpm/brp-compress
      Processing files: kernel-2.6.29rc4tip01479g5d85422-2
      error: File not found:
      /var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/lib/modules/2.6.29-rc4-tip-01479-g5d85422
      
      RPM build errors:
          File not found:
      /var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/lib/modules/2.6.29-rc4-tip-01479-g5d85422
      make[1]: *** [rpm] Error 1
      make: *** [rpm] Error 2
      </snippet>
      
      I have tested this patch on git -tip, Linus' git tree, and the kernel.org tar files, both
      with and without CONFIG_LOCALVERSION_AUTO=y.
      
      Signed-off-by: default avatarJosh Hunt <josh@scalex86.org>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      ----
      b925dbfe
Loading