Skip to content
Snippets Groups Projects
  1. Mar 24, 2023
  2. Mar 16, 2023
  3. Mar 15, 2023
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: use dh_listpackages to know enabled packages · 36862e14
      Masahiro Yamada authored
      
      Use dh_listpackages to get a list of all binary packages.
      
      With this, debian/control lists which binary packages will be produced.
      Previously, ARCH=um listed linux-libc-dev in debian/control, but it
      was not generated because each of mkdebian and builddeb independently
      maintained the if-conditionals.
      
      Another motivation is to allow scripts/package/builddeb to get the
      package name (linux-image-*, etc.) dynamically from debian/control.
      
      This will also allow the BuildProfile to control the generation of
      the binary packages.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      36862e14
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: split image and debug objects staging out into functions · b611daae
      Masahiro Yamada authored
      
      Prepare for the refactoring in the next commit.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      b611daae
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: set CROSS_COMPILE only when undefined · f50aa51c
      Masahiro Yamada authored
      
      Commit 3ab18a62 ("kbuild: deb-pkg: improve the usability of source
      package") set needless CROSS_COMPILE.
      
      For example, 'make allnoconfig bindeb-pkg' on a x86_64 system will set
      CROSS_COMPILE=i686-linux-gnu-, where the biarch compiler 'gcc' should
      work for building the i386 kernel.
      
        $ uname -m
        x86_64
        $ make allnoconfig bindeb-pkg >/dev/null
        dpkg-architecture: warning: specified GNU system type i686-linux-gnu does not match CC system type x86_64-linux-gnu, try setting a correct CC environment variable
         dpkg-source --before-build .
         debian/rules binary
        scripts/Kconfig.include:39: C compiler 'i686-linux-gnu-gcc' not found
        make[6]: *** [scripts/kconfig/Makefile:77: olddefconfig] Error 1
        make[5]: *** [Makefile:693: olddefconfig] Error 2
        make[4]: *** [Makefile:358: __build_one_by_one] Error 2
        make[3]: *** [debian/rules:7: build-arch] Error 2
        dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
        make[2]: *** [scripts/Makefile.package:127: bindeb-pkg] Error 2
        make[1]: *** [Makefile:1657: bindeb-pkg] Error 2
        make: *** [Makefile:358: __build_one_by_one] Error 2
      
      Check whether CROSS_COMPILE is defined, instead of whether it is non-empty.
      
      If you invoke debian/rules via Kbuild, CROSS_COMPILE is always defined
      in the top Makefile.
      
      Fixes: 3ab18a62 ("kbuild: deb-pkg: improve the usability of source package")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      f50aa51c
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: do not take KERNELRELEASE from the source version · 7a531c21
      Masahiro Yamada authored
      
      KERNELRELEASE does not need to match the package version in changelog.
      Rather, it conventially matches what is called 'ABINAME', which is a
      part of the binary package names.
      
      Both are the same by default, but the former might be overridden by
      KDEB_PKGVERSION. In this case, the resulting package would not boot
      because /lib/modules/$(uname -r) does not point the module directory.
      
      Partially revert 3ab18a62 ("kbuild: deb-pkg: improve the usability
      of source package").
      
      Reported-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
      Fixes: 3ab18a62 ("kbuild: deb-pkg: improve the usability of source package")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
      7a531c21
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: make debian source package working again · 2fd6c455
      Masahiro Yamada authored
      
      Since commit c5bf2efb ("kbuild: deb-pkg: fix binary-arch and clean
      in debian/rules"), the source package generated by 'make deb-pkg' fails
      to build.
      
      I terribly missed the fact that the intdeb-pkg target may regenerate
      include/config/kernel.release due to the following in the top Makefile:
      
        %pkg: include/config/kernel.release FORCE
      
      Restore KERNELRELEASE= option to avoid the kernel.release disagreement
      between build-arch and binary-arch.
      
      Fixes: c5bf2efb ("kbuild: deb-pkg: fix binary-arch and clean in debian/rules")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      2fd6c455
  4. Mar 13, 2023
  5. Mar 07, 2023
  6. Mar 05, 2023
  7. Mar 03, 2023
  8. Feb 26, 2023
  9. Feb 25, 2023
  10. Feb 22, 2023
    • Björn Töpel's avatar
      scripts/decodecode: Add support for RISC-V · 00b24250
      Björn Töpel authored
      RISC-V has some GNU disassembly quirks, e.g. it requires '-D' to
      properly disassemble .2byte directives similar to Arm [1]. Further,
      GNU objdump groups RISC-V instruction by 2 or 4 byte chunks, instead
      doing byte-for-byte.
      
      Add the required switches, and translate from short/word to bytes when
      ARCH is "riscv".
      
      An example how to invoke decodecode for RISC-V:
        $ echo 'Code: bf45 f793 1007 f7d9 50ef 37af d541 b7d9 7097 00c8 (80e7)
        6140' | AFLAGS="-march=rv64imac_zicbom_zihintpause"  \
        ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- ./scripts/decodecode
        Code: bf45 f793 1007 f7d9 50ef 37af d541 b7d9 7097 00c8 (80e7) 6140
        All code
        ========
           0:   bf45                    c.j     0xffffffffffffffb0
           2:   1007f793                andi    a5,a5,256
           6:   f7d9                    c.bnez  a5,0xffffffffffffff94
           8:   37af50ef                jal     ra,0xf5382
           c:   d541                    c.beqz  a0,0xffffffffffffff94
           e:   b7d9                    c.j     0xffffffffffffffd4
          10:   00c87097                auipc   ra,0xc87
          14:*  614080e7                jalr    ra,1556(ra) # 0xc87624          <-- trapping instruction
      
        Code starting with the faulting instruction
        ===========================================
           0:   614080e7                jalr    ra,1556(ra)
      
      [1] https://sourceware.org/bugzilla/show_bug.cgi?id=10263
      
      
      
      Signed-off-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
      Tested-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Link: https://lore.kernel.org/r/20230119074738.708301-3-bjorn@kernel.org
      
      
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      00b24250
  11. Feb 18, 2023
  12. Feb 17, 2023
  13. Feb 16, 2023
    • Carlos Llamas's avatar
      scripts/tags.sh: fix incompatibility with PCRE2 · 6ec363fc
      Carlos Llamas authored
      Starting with release 10.38 PCRE2 drops default support for using \K in
      lookaround patterns as described in [1]. Unfortunately, scripts/tags.sh
      relies on such functionality to collect all_compiled_soures() leading to
      the following error:
      
        $ make COMPILED_SOURCE=1 tags
          GEN     tags
        grep: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
      
      The usage of \K for this pattern was introduced in commit 4f491bb6
      ("scripts/tags.sh: collect compiled source precisely") which speeds up
      the generation of tags significantly.
      
      In order to fix this issue without compromising the performance we can
      switch over to an equivalent sed expression. The same matching pattern
      is preserved here except \K is replaced with a backreference \1.
      
      [1] https://www.pcre.org/current/doc/html/pcre2syntax.html#SEC11
      
      
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Jialu Xu <xujialu@vimux.org>
      Cc: Vipin Sharma <vipinsh@google.com>
      Cc: stable@vger.kernel.org
      Fixes: 4f491bb6 ("scripts/tags.sh: collect compiled source precisely")
      Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
      Link: https://lore.kernel.org/r/20230215183850.3353198-1-cmllamas@google.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ec363fc
    • Masahiro Yamada's avatar
      kbuild: add a tool to list files ignored by git · 5c3d1d0a
      Masahiro Yamada authored
      In short, the motivation of this commit is to build a source package
      without cleaning the source tree.
      
      The deb-pkg and (src)rpm-pkg targets first run 'make clean' before
      creating a source tarball. Otherwise build artifacts such as *.o,
      *.a, etc. would be included in the tarball. Yet, the tarball ends up
      containing several garbage files since 'make clean' does not clean
      everything.
      
      Cleaning the tree every time is annoying since it makes the incremental
      build impossible. It is desirable to create a source tarball without
      cleaning the tree.
      
      In fact, there are some ways to achieve this.
      
      The easiest solution is 'git archive'. 'make perf-tar*-src-pkg' uses
      it, but I do not like it because it works only when the source tree is
      managed by git, and all files you want in the tarball must be committed
      in advance.
      
      I want to make it work without relying on git. We can do this.
      
      Files that are ignored by git are generated files, so should be excluded
      from the source tarball. We can list them out by parsing the .gitignore
      files. Of course, .gitignore does not cover all the cases, but it works
      well enough.
      
      tar(1) claims to support it:
      
        --exclude-vcs-ignores
      
          Exclude files that match patterns read from VCS-specific ignore files.
          Supported files are: .cvsignore, .gitignore, .bzrignore, and .hgignore.
      
      The best scenario would be to use 'tar --exclude-vcs-ignores', but this
      option does not work. --exclude-vcs-ignore does not understand any of
      the negation (!), preceding slash, following slash, etc.. So, this option
      is just useless.
      
      Hence, I wrote this gitignore parser. The previous version [1], written
      in Python, was so slow. This version is implemented in C, so it works
      much faster.
      
      I imported the code from git (commit: 23c56f7bd5f1), so we get the same
      result.
      
      This tool traverses the source tree, parsing all .gitignore files, and
      prints file paths that are ignored by git.
      
      The output is similar to 'git ls-files --ignored --directory --others
      --exclude-per-directory=.gitignore', except
      
        [1] Not sorted
        [2] No trailing slash for directories
      
      [2] is intentional because tar's --exclude-from option cannot handle
      trailing slashes.
      
      [How to test this tool]
      
        $ git clean -dfx
        $ make -s -j$(nproc) defconfig all                       # or allmodconifg or whatever
        $ git archive -o ../linux1.tar --prefix=./ HEAD
        $ tar tf ../linux1.tar | LANG=C sort > ../file-list1     # files emitted by 'git archive'
        $ make scripts_package
          HOSTCC  scripts/list-gitignored
        $ scripts/list-gitignored  --prefix=./ -o ../exclude-list
        $ tar cf ../linux2.tar --exclude-from=../exclude-list .
        $ tar tf ../linux2.tar | LANG=C sort > ../file-list2     # files emitted by 'tar'
        $ diff  ../file-list1 ../file-list2 | grep -E '^(<|>)'
        < ./Documentation/devicetree/bindings/.yamllint
        < ./drivers/clk/.kunitconfig
        < ./drivers/gpu/drm/tests/.kunitconfig
        < ./drivers/hid/.kunitconfig
        < ./fs/ext4/.kunitconfig
        < ./fs/fat/.kunitconfig
        < ./kernel/kcsan/.kunitconfig
        < ./lib/kunit/.kunitconfig
        < ./mm/kfence/.kunitconfig
        < ./tools/testing/selftests/arm64/tags/
        < ./tools/testing/selftests/arm64/tags/.gitignore
        < ./tools/testing/selftests/arm64/tags/Makefile
        < ./tools/testing/selftests/arm64/tags/run_tags_test.sh
        < ./tools/testing/selftests/arm64/tags/tags_test.c
        < ./tools/testing/selftests/kvm/.gitignore
        < ./tools/testing/selftests/kvm/Makefile
        < ./tools/testing/selftests/kvm/config
        < ./tools/testing/selftests/kvm/settings
      
      The source tarball contains most of files that are tracked by git. You
      see some diffs, but it is just because some .gitignore files are wrong.
      
        $ git ls-files -i -c --exclude-per-directory=.gitignore
        Documentation/devicetree/bindings/.yamllint
        drivers/clk/.kunitconfig
        drivers/gpu/drm/tests/.kunitconfig
        drivers/hid/.kunitconfig
        fs/ext4/.kunitconfig
        fs/fat/.kunitconfig
        kernel/kcsan/.kunitconfig
        lib/kunit/.kunitconfig
        mm/kfence/.kunitconfig
        tools/testing/selftests/arm64/tags/.gitignore
        tools/testing/selftests/arm64/tags/Makefile
        tools/testing/selftests/arm64/tags/run_tags_test.sh
        tools/testing/selftests/arm64/tags/tags_test.c
        tools/testing/selftests/kvm/.gitignore
        tools/testing/selftests/kvm/Makefile
        tools/testing/selftests/kvm/config
        tools/testing/selftests/kvm/settings
      
      [1]: https://lore.kernel.org/all/20230128173843.765212-1-masahiroy@kernel.org/
      
      
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5c3d1d0a
  14. Feb 14, 2023
    • Masahiro Yamada's avatar
      setlocalversion: use only the correct release tag for git-describe · 6ab7e1f9
      Masahiro Yamada authored
      
      Currently, setlocalversion uses any annotated tag for git-describe.
      If we are at a tagged commit, it will not append the commit hash.
      
        $ git checkout v6.2-rc1^
        $ make -s defconfig kernelrelease
        6.1.0-14595-g292a089d78d3
        $ git tag -a foo -m foo
        $ make -s kernelrelease
        6.1.0
      
      If a local tag 'foo' exists, it pretends to be a released version
      '6.1.0', while there are many commits on top of it.
      
      The output should be consistent irrespective of such a local tag.
      Pass the correct release tag to --match option of git-describe.
      
      In the mainline kernel, the SUBLEVEL is always '0', which is omitted
      from the tag.
      
        KERNELVERSION      annotated tag
        6.1.0          ->  v6.1            (mainline)
        6.2.0-rc5      ->  v6.2-rc5        (mainline, release candidate)
        6.1.7          ->  v6.1.7          (stable)
      
      To preserve the behavior in linux-next, use the tag derived from
      localversion* files if exists. In linux-next, the local version is
      specified by the localversion-next file.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      6ab7e1f9
    • Alexei Starovoitov's avatar
      Revert "bpf: Add --skip_encoding_btf_inconsistent_proto, --btf_gen_optimized... · 1f5dfcc7
      Alexei Starovoitov authored
      Revert "bpf: Add --skip_encoding_btf_inconsistent_proto, --btf_gen_optimized to pahole flags for v1.25"
      
      This reverts commit 0243d3df.
      
      pahole 1.25 is too aggressive removing functions.
      With clang compiled kernel the following is seen:
      WARN: resolve_btfids: unresolved symbol tcp_reno_cong_avoid
      WARN: resolve_btfids: unresolved symbol dctcp_update_alpha
      WARN: resolve_btfids: unresolved symbol cubictcp_cong_avoid
      WARN: resolve_btfids: unresolved symbol bpf_xdp_metadata_rx_timestamp
      WARN: resolve_btfids: unresolved symbol bpf_xdp_metadata_rx_hash
      WARN: resolve_btfids: unresolved symbol bpf_task_kptr_get
      WARN: resolve_btfids: unresolved symbol bpf_task_acquire_not_zero
      WARN: resolve_btfids: unresolved symbol bpf_rdonly_cast
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_static_unused_arg
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_ref
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_pass_ctx
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_pass2
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_pass1
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_mem_len_pass1
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_mem_len_fail2
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_mem_len_fail1
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_kptr_get
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_fail3
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_fail2
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test_acquire
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test2
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_test1
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_memb_release
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_memb1_release
      WARN: resolve_btfids: unresolved symbol bpf_kfunc_call_int_mem_release
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      1f5dfcc7
  15. Feb 13, 2023
  16. Feb 09, 2023
  17. Feb 08, 2023
  18. Feb 06, 2023
Loading