Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'kbuild-fixes-v6.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

- Drop debug info from purgatory objects again

- Document that kernel.org provides prebuilt LLVM toolchains

- Give up handling untracked files for source package builds

- Avoid creating corrupted cpio when KBUILD_BUILD_TIMESTAMP is given
with a pre-epoch data.

- Change panic_show_mem() to a macro to handle variable-length argument

- Compress tarballs on-the-fly again

* tag 'kbuild-fixes-v6.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
kbuild: do not create intermediate *.tar for tar packages
kbuild: do not create intermediate *.tar for source tarballs
kbuild: merge cmd_archive_linux and cmd_archive_perf
init/initramfs: Fix argument forwarding to panic() in panic_show_mem()
initramfs: Check negative timestamp to prevent broken cpio archive
kbuild: give up untracked files for source package builds
Documentation/llvm: Add a note about prebuilt kernel.org toolchains
purgatory: fix disabling debug info

+140 -141
+4
Documentation/kbuild/llvm.rst
··· 171 171 Getting LLVM 172 172 ------------- 173 173 174 + We provide prebuilt stable versions of LLVM on `kernel.org <https://kernel.org/pub/tools/llvm/>`_. 175 + Below are links that may be useful for building LLVM from source or procuring 176 + it through a distribution's package manager. 177 + 174 178 - https://releases.llvm.org/download.html 175 179 - https://github.com/llvm/llvm-project 176 180 - https://llvm.org/docs/GettingStarted.html
+1 -6
arch/riscv/purgatory/Makefile
··· 84 84 CFLAGS_REMOVE_ctype.o += $(PURGATORY_CFLAGS_REMOVE) 85 85 CFLAGS_ctype.o += $(PURGATORY_CFLAGS) 86 86 87 - AFLAGS_REMOVE_entry.o += -Wa,-gdwarf-2 88 - AFLAGS_REMOVE_memcpy.o += -Wa,-gdwarf-2 89 - AFLAGS_REMOVE_memset.o += -Wa,-gdwarf-2 90 - AFLAGS_REMOVE_strcmp.o += -Wa,-gdwarf-2 91 - AFLAGS_REMOVE_strlen.o += -Wa,-gdwarf-2 92 - AFLAGS_REMOVE_strncmp.o += -Wa,-gdwarf-2 87 + asflags-remove-y += $(foreach x, -g -gdwarf-4 -gdwarf-5, $(x) -Wa,$(x)) 93 88 94 89 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE 95 90 $(call if_changed,ld)
+1 -2
arch/x86/purgatory/Makefile
··· 69 69 CFLAGS_REMOVE_string.o += $(PURGATORY_CFLAGS_REMOVE) 70 70 CFLAGS_string.o += $(PURGATORY_CFLAGS) 71 71 72 - AFLAGS_REMOVE_setup-x86_$(BITS).o += -Wa,-gdwarf-2 73 - AFLAGS_REMOVE_entry64.o += -Wa,-gdwarf-2 72 + asflags-remove-y += $(foreach x, -g -gdwarf-4 -gdwarf-5, $(x) -Wa,$(x)) 74 73 75 74 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE 76 75 $(call if_changed,ld)
+2 -9
init/initramfs.c
··· 60 60 message = x; 61 61 } 62 62 63 - static void panic_show_mem(const char *fmt, ...) 64 - { 65 - va_list args; 66 - 67 - show_mem(0, NULL); 68 - va_start(args, fmt); 69 - panic(fmt, args); 70 - va_end(args); 71 - } 63 + #define panic_show_mem(fmt, ...) \ 64 + ({ show_mem(0, NULL); panic(fmt, ##__VA_ARGS__); }) 72 65 73 66 /* link hash */ 74 67
+34 -32
scripts/Makefile.package
··· 27 27 tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ 28 28 --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3) 29 29 30 - # tarball compression 31 - # --------------------------------------------------------------------------- 32 - 33 - %.tar.gz: %.tar 34 - $(call cmd,gzip) 35 - 36 - %.tar.bz2: %.tar 37 - $(call cmd,bzip2) 38 - 39 - %.tar.xz: %.tar 40 - $(call cmd,xzmisc) 41 - 42 - %.tar.zst: %.tar 43 - $(call cmd,zstd) 44 - 45 30 # Git 46 31 # --------------------------------------------------------------------------- 47 32 ··· 42 57 false; \ 43 58 fi 44 59 60 + git-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)" 61 + git-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)" 62 + git-config-tar.xz = -c tar.tar.xz.command="$(XZ)" 63 + git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)" 64 + 65 + quiet_cmd_archive = ARCHIVE $@ 66 + cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \ 67 + --output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args) 68 + 45 69 # Linux source tarball 46 70 # --------------------------------------------------------------------------- 47 71 48 - quiet_cmd_archive_linux = ARCHIVE $@ 49 - cmd_archive_linux = \ 50 - git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ $$(cat $<) 72 + linux-tarballs := $(addprefix linux, .tar.gz) 51 73 52 - targets += linux.tar 53 - linux.tar: .tmp_HEAD FORCE 54 - $(call if_changed,archive_linux) 74 + targets += $(linux-tarballs) 75 + $(linux-tarballs): archive-args = $$(cat $<) 76 + $(linux-tarballs): .tmp_HEAD FORCE 77 + $(call if_changed,archive) 55 78 56 79 # rpm-pkg 57 80 # --------------------------------------------------------------------------- ··· 87 94 $(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec 88 95 89 96 quiet_cmd_debianize = GEN $@ 90 - cmd_debianize = $(srctree)/scripts/package/mkdebian 97 + cmd_debianize = $(srctree)/scripts/package/mkdebian $(mkdebian-opts) 91 98 92 99 debian: FORCE 93 100 $(call cmd,debianize) ··· 96 103 debian-orig: private source = $(shell dpkg-parsechangelog -S Source) 97 104 debian-orig: private version = $(shell dpkg-parsechangelog -S Version | sed 's/-[^-]*$$//') 98 105 debian-orig: private orig-name = $(source)_$(version).orig.tar.gz 106 + debian-orig: mkdebian-opts = --need-source 99 107 debian-orig: linux.tar.gz debian 100 108 $(Q)if [ "$(df --output=target .. 2>/dev/null)" = "$(df --output=target $< 2>/dev/null)" ]; then \ 101 109 ln -f $< ../$(orig-name); \ ··· 139 145 $(Q)$(MAKE) -f $(srctree)/Makefile 140 146 +$(Q)$(srctree)/scripts/package/buildtar $@ 141 147 142 - quiet_cmd_tar = TAR $@ 143 - cmd_tar = cd $<; tar cf ../$@ --owner=root --group=root --sort=name * 148 + compress-tar.gz = -I "$(KGZIP)" 149 + compress-tar.bz2 = -I "$(KBZIP2)" 150 + compress-tar.xz = -I "$(XZ)" 151 + compress-tar.zst = -I "$(ZSTD)" 144 152 145 - linux-$(KERNELRELEASE)-$(ARCH).tar: tar-install 153 + quiet_cmd_tar = TAR $@ 154 + cmd_tar = cd $<; tar cf ../$@ $(compress-tar$(suffix $@)) --owner=root --group=root --sort=name * 155 + 156 + dir-tarballs := $(addprefix linux-$(KERNELRELEASE)-$(ARCH), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst) 157 + 158 + $(dir-tarballs): tar-install 146 159 $(call cmd,tar) 147 160 148 161 PHONY += dir-pkg ··· 181 180 .tmp_perf/PERF-VERSION-FILE: .tmp_HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN | .tmp_perf 182 181 $(call cmd,perf_version_file) 183 182 184 - quiet_cmd_archive_perf = ARCHIVE $@ 185 - cmd_archive_perf = \ 186 - git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ \ 187 - --add-file=$$(realpath $(word 2, $^)) \ 183 + perf-archive-args = --add-file=$$(realpath $(word 2, $^)) \ 188 184 --add-file=$$(realpath $(word 3, $^)) \ 189 185 $$(cat $(word 2, $^))^{tree} $$(cat $<) 190 186 191 - targets += perf-$(KERNELVERSION).tar 192 - perf-$(KERNELVERSION).tar: tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE 193 - $(call if_changed,archive_perf) 187 + 188 + perf-tarballs := $(addprefix perf-$(KERNELVERSION), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst) 189 + 190 + targets += $(perf-tarballs) 191 + $(perf-tarballs): archive-args = $(perf-archive-args) 192 + $(perf-tarballs): tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE 193 + $(call if_changed,archive) 194 194 195 195 PHONY += perf-tar-src-pkg 196 196 perf-tar-src-pkg: perf-$(KERNELVERSION).tar
+28 -36
scripts/package/gen-diff-patch
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0-only 3 3 4 - diff_patch="${1}" 5 - untracked_patch="${2}" 6 - srctree=$(dirname $0)/../.. 4 + diff_patch=$1 7 5 8 - rm -f ${diff_patch} ${untracked_patch} 6 + mkdir -p "$(dirname "${diff_patch}")" 9 7 10 - if ! ${srctree}/scripts/check-git; then 8 + git -C "${srctree:-.}" diff HEAD > "${diff_patch}" 9 + 10 + if [ ! -s "${diff_patch}" ] || 11 + [ -z "$(git -C "${srctree:-.}" ls-files --other --exclude-standard | head -n1)" ]; then 11 12 exit 12 13 fi 13 14 14 - mkdir -p "$(dirname ${diff_patch})" "$(dirname ${untracked_patch})" 15 - 16 - git -C "${srctree}" diff HEAD > "${diff_patch}" 17 - 18 - if [ ! -s "${diff_patch}" ]; then 19 - rm -f "${diff_patch}" 20 - exit 21 - fi 22 - 23 - git -C ${srctree} status --porcelain --untracked-files=all | 24 - while read stat path 25 - do 26 - if [ "${stat}" = '??' ]; then 27 - 28 - if ! diff -u /dev/null "${srctree}/${path}" > .tmp_diff && 29 - ! head -n1 .tmp_diff | grep -q "Binary files"; then 30 - { 31 - echo "--- /dev/null" 32 - echo "+++ linux/$path" 33 - cat .tmp_diff | tail -n +3 34 - } >> ${untracked_patch} 35 - fi 36 - fi 37 - done 38 - 39 - rm -f .tmp_diff 40 - 41 - if [ ! -s "${diff_patch}" ]; then 42 - rm -f "${diff_patch}" 43 - exit 44 - fi 15 + # The source tarball, which is generated by 'git archive', contains everything 16 + # you committed in the repository. If you have local diff ('git diff HEAD'), 17 + # it will go into ${diff_patch}. If untracked files are remaining, the resulting 18 + # source package may not be correct. 19 + # 20 + # Examples: 21 + # - You modified a source file to add #include "new-header.h" 22 + # but forgot to add new-header.h 23 + # - You modified a Makefile to add 'obj-$(CONFIG_FOO) += new-dirver.o' 24 + # but you forgot to add new-driver.c 25 + # 26 + # You need to commit them, or at least stage them by 'git add'. 27 + # 28 + # This script does not take care of untracked files because doing so would 29 + # introduce additional complexity. Instead, print a warning message here if 30 + # untracked files are found. 31 + # If all untracked files are just garbage, you can ignore this warning. 32 + echo >&2 "============================ WARNING ============================" 33 + echo >&2 "Your working tree has diff from HEAD, and also untracked file(s)." 34 + echo >&2 "Please make sure you did 'git add' for all new files you need in" 35 + echo >&2 "the source package." 36 + echo >&2 "================================================================="
+59 -44
scripts/package/mkdebian
··· 84 84 fi 85 85 } 86 86 87 + # Create debian/source/ if it is a source package build 88 + gen_source () 89 + { 90 + mkdir -p debian/source 91 + 92 + echo "3.0 (quilt)" > debian/source/format 93 + 94 + { 95 + echo "diff-ignore" 96 + echo "extend-diff-ignore = .*" 97 + } > debian/source/local-options 98 + 99 + # Add .config as a patch 100 + mkdir -p debian/patches 101 + { 102 + echo "Subject: Add .config" 103 + echo "Author: ${maintainer}" 104 + echo 105 + echo "--- /dev/null" 106 + echo "+++ linux/.config" 107 + diff -u /dev/null "${KCONFIG_CONFIG}" | tail -n +3 108 + } > debian/patches/config.patch 109 + echo config.patch > debian/patches/series 110 + 111 + "${srctree}/scripts/package/gen-diff-patch" debian/patches/diff.patch 112 + if [ -s debian/patches/diff.patch ]; then 113 + sed -i " 114 + 1iSubject: Add local diff 115 + 1iAuthor: ${maintainer} 116 + 1i 117 + " debian/patches/diff.patch 118 + 119 + echo diff.patch >> debian/patches/series 120 + else 121 + rm -f debian/patches/diff.patch 122 + fi 123 + } 124 + 87 125 rm -rf debian 126 + mkdir debian 127 + 128 + email=${DEBEMAIL-$EMAIL} 129 + 130 + # use email string directly if it contains <email> 131 + if echo "${email}" | grep -q '<.*>'; then 132 + maintainer=${email} 133 + else 134 + # or construct the maintainer string 135 + user=${KBUILD_BUILD_USER-$(id -nu)} 136 + name=${DEBFULLNAME-${user}} 137 + if [ -z "${email}" ]; then 138 + buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)} 139 + email="${user}@${buildhost}" 140 + fi 141 + maintainer="${name} <${email}>" 142 + fi 143 + 144 + if [ "$1" = --need-source ]; then 145 + gen_source 146 + fi 88 147 89 148 # Some variables and settings used throughout the script 90 149 version=$KERNELRELEASE ··· 163 104 debarch= 164 105 set_debarch 165 106 166 - email=${DEBEMAIL-$EMAIL} 167 - 168 - # use email string directly if it contains <email> 169 - if echo $email | grep -q '<.*>'; then 170 - maintainer=$email 171 - else 172 - # or construct the maintainer string 173 - user=${KBUILD_BUILD_USER-$(id -nu)} 174 - name=${DEBFULLNAME-$user} 175 - if [ -z "$email" ]; then 176 - buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)} 177 - email="$user@$buildhost" 178 - fi 179 - maintainer="$name <$email>" 180 - fi 181 - 182 107 # Try to determine distribution 183 108 if [ -n "$KDEB_CHANGELOG_DIST" ]; then 184 109 distribution=$KDEB_CHANGELOG_DIST ··· 173 130 distribution="unstable" 174 131 echo >&2 "Using default distribution of 'unstable' in the changelog" 175 132 echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly" 176 - fi 177 - 178 - mkdir -p debian/source/ 179 - echo "3.0 (quilt)" > debian/source/format 180 - 181 - { 182 - echo "diff-ignore" 183 - echo "extend-diff-ignore = .*" 184 - } > debian/source/local-options 185 - 186 - # Add .config as a patch 187 - mkdir -p debian/patches 188 - { 189 - echo "Subject: Add .config" 190 - echo "Author: ${maintainer}" 191 - echo 192 - echo "--- /dev/null" 193 - echo "+++ linux/.config" 194 - diff -u /dev/null "${KCONFIG_CONFIG}" | tail -n +3 195 - } > debian/patches/config 196 - echo config > debian/patches/series 197 - 198 - $(dirname $0)/gen-diff-patch debian/patches/diff.patch debian/patches/untracked.patch 199 - if [ -f debian/patches/diff.patch ]; then 200 - echo diff.patch >> debian/patches/series 201 - fi 202 - if [ -f debian/patches/untracked.patch ]; then 203 - echo untracked.patch >> debian/patches/series 204 133 fi 205 134 206 135 echo $debarch > debian/arch
+2 -9
scripts/package/mkspec
··· 19 19 mkdir -p rpmbuild/SOURCES 20 20 cp linux.tar.gz rpmbuild/SOURCES 21 21 cp "${KCONFIG_CONFIG}" rpmbuild/SOURCES/config 22 - $(dirname $0)/gen-diff-patch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch 23 - touch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch 22 + "${srctree}/scripts/package/gen-diff-patch" rpmbuild/SOURCES/diff.patch 24 23 fi 25 24 26 25 if grep -q CONFIG_MODULES=y include/config/auto.conf; then ··· 55 56 $S Source0: linux.tar.gz 56 57 $S Source1: config 57 58 $S Source2: diff.patch 58 - $S Source3: untracked.patch 59 59 Provides: $PROVIDES 60 60 $S BuildRequires: bc binutils bison dwarves 61 61 $S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex ··· 92 94 $S %prep 93 95 $S %setup -q -n linux 94 96 $S cp %{SOURCE1} .config 95 - $S if [ -s %{SOURCE2} ]; then 96 - $S patch -p1 < %{SOURCE2} 97 - $S fi 98 - $S if [ -s %{SOURCE3} ]; then 99 - $S patch -p1 < %{SOURCE3} 100 - $S fi 97 + $S patch -p1 < %{SOURCE2} 101 98 $S 102 99 $S %build 103 100 $S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE KBUILD_BUILD_VERSION=%{release}
+9 -3
usr/gen_init_cpio.c
··· 353 353 buf.st_mtime = 0xffffffff; 354 354 } 355 355 356 + if (buf.st_mtime < 0) { 357 + fprintf(stderr, "%s: Timestamp negative, clipping.\n", 358 + location); 359 + buf.st_mtime = 0; 360 + } 361 + 356 362 if (buf.st_size > 0xffffffff) { 357 363 fprintf(stderr, "%s: Size exceeds maximum cpio file size\n", 358 364 location); ··· 608 602 /* 609 603 * Timestamps after 2106-02-07 06:28:15 UTC have an ascii hex time_t 610 604 * representation that exceeds 8 chars and breaks the cpio header 611 - * specification. 605 + * specification. Negative timestamps similarly exceed 8 chars. 612 606 */ 613 - if (default_mtime > 0xffffffff) { 614 - fprintf(stderr, "ERROR: Timestamp too large for cpio format\n"); 607 + if (default_mtime > 0xffffffff || default_mtime < 0) { 608 + fprintf(stderr, "ERROR: Timestamp out of range for cpio format\n"); 615 609 exit(1); 616 610 } 617 611