Something went wrong. Try again.
(I'm so sorry!) Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287# SPDX-License-Identifier: GPL-2.0-only# Makefile for the different targets used to generate full packages of a kernel
include $(srctree)/scripts/Kbuild.includeinclude $(srctree)/scripts/Makefile.lib
# Git# ---------------------------------------------------------------------------
filechk_HEAD = git -C $(srctree) rev-parse --verify HEAD 2>/dev/null
.tmp_HEAD: check-git FORCE $(call filechk,HEAD)
PHONY += check-gitcheck-git: @if ! $(srctree)/scripts/check-git; then \ echo >&2 "error: creating source package requires git repository"; \ false; \ fi
git-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)"git-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)"git-config-tar.lzma = -c tar.tar.lzma.command="$(LZMA)"git-config-tar.xz = -c tar.tar.xz.command="$(XZ)"git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)"
quiet_cmd_archive = ARCHIVE $@ cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \ --output=$$(realpath $@) $(archive-args)
suffix-gzip := .gzsuffix-bzip2 := .bz2suffix-lzma := .lzmasuffix-xz := .xz
# Linux source tarball# ---------------------------------------------------------------------------
linux-tarballs := $(addprefix linux, .tar.gz .tar.bz2 .tar.lzma .tar.xz)
targets += $(linux-tarballs)$(linux-tarballs): archive-args = --prefix=linux/ $$(cat $<)$(linux-tarballs): .tmp_HEAD FORCE $(call if_changed,archive)
# rpm-pkg srcrpm-pkg binrpm-pkg# ---------------------------------------------------------------------------
quiet_cmd_mkspec = GEN $@ cmd_mkspec = $(srctree)/scripts/package/mkspec $@
rpmbuild/SPECS/kernel.spec: FORCE $(call cmd,mkspec)
PHONY += rpm-sourcesrpm-sources: linux.tar.gz $(Q)mkdir -p rpmbuild/SOURCES $(Q)ln -f linux.tar.gz rpmbuild/SOURCES/linux.tar.gz $(Q)cp $(KCONFIG_CONFIG) rpmbuild/SOURCES/config $(Q)$(srctree)/scripts/package/gen-diff-patch rpmbuild/SOURCES/diff.patch
PHONY += rpm-pkg srcrpm-pkg binrpm-pkg
ifneq ($(CC),$(HOSTCC))rpm-no-devel = --without=develendif
rpm-pkg: private build-type := asrcrpm-pkg: private build-type := sbinrpm-pkg: private build-type := b
rpm-pkg srcrpm-pkg: rpm-sourcesrpm-pkg srcrpm-pkg binrpm-pkg: rpmbuild/SPECS/kernel.spec +$(strip rpmbuild -b$(build-type) rpmbuild/SPECS/kernel.spec \ --define='_topdir $(abspath rpmbuild)' \ $(if $(filter a b, $(build-type)), \ --target $(UTS_MACHINE)-linux --build-in-place --noprep --define='_smp_mflags %{nil}' \ $$(rpm -q rpm >/dev/null 2>&1 || echo --nodeps) \ $(rpm-no-devel)) \ $(RPMOPTS))
# deb-pkg srcdeb-pkg bindeb-pkg# ---------------------------------------------------------------------------
KDEB_SOURCE_COMPRESS ?= gzip
supported-deb-source-compress := gzip bzip2 lzma xz
PHONY += linux.tar.unsupported-deb-src-compresslinux.tar.unsupported-deb-src-compress: @echo "error: KDEB_SOURCE_COMPRESS=$(KDEB_SOURCE_COMPRESS) is not supported. The supported values are: $(supported-deb-source-compress)" >&2 @false
debian-orig-suffix := \ $(strip $(if $(filter $(supported-deb-source-compress), $(KDEB_SOURCE_COMPRESS)), \ $(suffix-$(KDEB_SOURCE_COMPRESS)),.unsupported-deb-src-compress))
quiet_cmd_debianize = GEN $@ cmd_debianize = $(srctree)/scripts/package/mkdebian $(mkdebian-opts)
debian: FORCE $(call cmd,debianize)
PHONY += debian-origdebian-orig: private source = $(shell dpkg-parsechangelog -S Source)debian-orig: private version = $(shell dpkg-parsechangelog -S Version | sed 's/-[^-]*$$//')debian-orig: private orig-name = $(source)_$(version).orig.tar$(debian-orig-suffix)debian-orig: mkdebian-opts = --need-sourcedebian-orig: linux.tar$(debian-orig-suffix) debian $(Q)if [ "$$(df --output=target .. 2>/dev/null)" = "$$(df --output=target $< 2>/dev/null)" ]; then \ ln -f $< ../$(orig-name); \ else \ cp $< ../$(orig-name); \ fi
PHONY += deb-pkg srcdeb-pkg bindeb-pkg
deb-pkg: private build-type := source,binarysrcdeb-pkg: private build-type := sourcebindeb-pkg: private build-type := binary
deb-pkg srcdeb-pkg: debian-origbindeb-pkg: debiandeb-pkg srcdeb-pkg bindeb-pkg: +$(strip dpkg-buildpackage \ --build=$(build-type) --no-pre-clean --unsigned-changes \ $(if $(findstring source, $(build-type)), \ --unsigned-source --compression=$(KDEB_SOURCE_COMPRESS)) \ $(if $(findstring binary, $(build-type)), \ -R'$(MAKE) -f debian/rules' -j1 -a$$(cat debian/arch), \ --no-check-builddeps) \ $(DPKG_FLAGS))
# snap-pkg# ---------------------------------------------------------------------------PHONY += snap-pkgsnap-pkg: rm -rf $(objtree)/snap mkdir $(objtree)/snap $(MAKE) clean sed "s@KERNELRELEASE@$(KERNELRELEASE)@; \ s@SRCTREE@$(realpath $(srctree))@" \ $(srctree)/scripts/package/snapcraft.template > \ $(objtree)/snap/snapcraft.yaml cd $(objtree)/snap && \ snapcraft --target-arch=$(UTS_MACHINE)
# pacman-pkg# ---------------------------------------------------------------------------
PHONY += pacman-pkgpacman-pkg: @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD +BUILDDIR="$(realpath $(objtree))/pacman" \ CARCH="$(UTS_MACHINE)" \ KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \ KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \ makepkg $(MAKEPKGOPTS)
# dir-pkg tar*-pkg - tarball targets# ---------------------------------------------------------------------------
tar-install: FORCE $(Q)$(MAKE) -f $(srctree)/Makefile +$(Q)$(srctree)/scripts/package/buildtar $@
compress-tar.gz = -I "$(KGZIP)"compress-tar.bz2 = -I "$(KBZIP2)"compress-tar.xz = -I "$(XZ)"compress-tar.zst = -I "$(ZSTD)"
quiet_cmd_tar = TAR $@ cmd_tar = cd $<; tar cf ../$@ $(compress-tar$(suffix $@)) --owner=root --group=root --sort=name *
dir-tarballs := $(addprefix linux-$(KERNELRELEASE)-$(ARCH), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst)
$(dir-tarballs): tar-install $(call cmd,tar)
PHONY += dir-pkgdir-pkg: tar-install @echo "Kernel tree successfully created in $<"
PHONY += tar-pkgtar-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar @:
tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE @:
# modules-cpio-pkg - generate an initramfs with the modules# ---------------------------------------------------------------------------
.tmp_modules_cpio: FORCE $(Q)$(MAKE) -f $(srctree)/Makefile $(Q)rm -rf $@ $(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@/$(INSTALL_MOD_PATH) modules_install
quiet_cmd_cpio = CPIO $@ cmd_cpio = $(CONFIG_SHELL) $(srctree)/usr/gen_initramfs.sh -o $@ $<
modules-$(KERNELRELEASE)-$(ARCH).cpio: .tmp_modules_cpio $(call cmd,cpio)
PHONY += modules-cpio-pkgmodules-cpio-pkg: modules-$(KERNELRELEASE)-$(ARCH).cpio @:
# perf-tar*-src-pkg - generate a source tarball with perf source# ---------------------------------------------------------------------------
.tmp_perf: $(Q)mkdir .tmp_perf
.tmp_perf/HEAD: .tmp_HEAD | .tmp_perf $(call cmd,copy)
quiet_cmd_perf_version_file = GEN $@ cmd_perf_version_file = cd $(srctree)/tools/perf; util/PERF-VERSION-GEN $(dir $(abspath $@))
# PERF-VERSION-FILE and .tmp_HEAD are independent, but this avoids updating the# timestamp of PERF-VERSION-FILE.# The best is to fix tools/perf/util/PERF-VERSION-GEN..tmp_perf/PERF-VERSION-FILE: .tmp_HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN | .tmp_perf $(call cmd,perf_version_file)
perf-archive-args = --add-file=$$(realpath $(word 2, $^)) \ --add-file=$$(realpath $(word 3, $^)) \ $$(cat $(word 2, $^))^{tree} $$(cat $<)
perf-tarballs := $(addprefix perf-$(KERNELVERSION), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst)
targets += $(perf-tarballs)$(perf-tarballs): archive-args = --prefix=perf-$(KERNELVERSION)/ $(perf-archive-args)$(perf-tarballs): tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE $(call if_changed,archive)
PHONY += perf-tar-src-pkgperf-tar-src-pkg: perf-$(KERNELVERSION).tar @:
perf-tar%-src-pkg: perf-$(KERNELVERSION).tar.% FORCE @:
# Help text displayed when executing 'make help'# ---------------------------------------------------------------------------PHONY += helphelp: @echo ' rpm-pkg - Build both source and binary RPM kernel packages' @echo ' srcrpm-pkg - Build only the source kernel RPM package' @echo ' binrpm-pkg - Build only the binary kernel RPM package' @echo ' deb-pkg - Build both source and binary deb kernel packages' @echo ' srcdeb-pkg - Build only the source kernel deb package' @echo ' bindeb-pkg - Build only the binary kernel deb package' @echo ' snap-pkg - Build only the binary kernel snap package' @echo ' (will connect to external hosts)' @echo ' pacman-pkg - Build only the binary kernel pacman package' @echo ' dir-pkg - Build the kernel as a plain directory structure' @echo ' tar-pkg - Build the kernel as an uncompressed tarball' @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' @echo ' tarxz-pkg - Build the kernel as a xz compressed tarball' @echo ' tarzst-pkg - Build the kernel as a zstd compressed tarball' @echo ' modules-cpio-pkg - Build the kernel modules as cpio archive' @echo ' (uses INSTALL_MOD_PATH inside the archive)' @echo ' perf-tar-src-pkg - Build the perf source tarball with no compression' @echo ' perf-targz-src-pkg - Build the perf source tarball with gzip compression' @echo ' perf-tarbz2-src-pkg - Build the perf source tarball with bz2 compression' @echo ' perf-tarxz-src-pkg - Build the perf source tarball with xz compression' @echo ' perf-tarzst-src-pkg - Build the perf source tarball with zst compression'
PHONY += FORCEFORCE:
# Read all saved command lines and dependencies for the $(targets) we# may be building above, using $(if_changed{,_dep}). As an# optimization, we don't need to read them if the target does not# exist, we will rebuild anyway in that case.
existing-targets := $(wildcard $(sort $(targets)))
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
.PHONY: $(PHONY)