summaryrefslogtreecommitdiffstats
path: root/debian/rules.real
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/rules.real761
1 files changed, 761 insertions, 0 deletions
diff --git a/debian/rules.real b/debian/rules.real
new file mode 100644
index 000000000..98ee4ac7a
--- /dev/null
+++ b/debian/rules.real
@@ -0,0 +1,761 @@
+#
+# This Makefile executes the unpack/build/binary targets for a single
+# subarch, which is passed in the subarch variable. Empty subarch
+# variable means that we are building for an arch without the subarch.
+# Additionally, variables version, abiname and ltver are
+# expected to be available (need to be exported from the parent process).
+#
+SHELL := bash -e
+MAINTAINER := $(shell sed -ne 's,^Maintainer: .[^<]*<\([^>]*\)>,\1,p' debian/control)
+DISTRIBUTION := $(shell dpkg-parsechangelog -SDistribution)
+SOURCE_DATE := $(shell dpkg-parsechangelog -SDate)
+SOURCE_DATE_UTC_ISO := $(shell date -u -d '$(SOURCE_DATE)' +%Y-%m-%d)
+
+DISTRIBUTOR := $(shell lsb_release -is 2>/dev/null)
+ifeq ($(DISTRIBUTOR),)
+DISTRIBUTOR := Debian
+endif
+
+include debian/rules.defs
+
+ifdef ARCH
+ ifneq ($(DEB_HOST_ARCH),$(ARCH))
+ $(error Attempting to build a $(ARCH) target but host architecture is $(DEB_HOST_ARCH). Use dpkg-architecture to override the host architecture)
+ endif
+endif
+
+ifdef OVERRIDE_HOST_TYPE
+ CROSS_COMPILE := $(OVERRIDE_HOST_TYPE)-
+else ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+ CROSS_COMPILE := $(DEB_HOST_GNU_TYPE)-
+else
+ CROSS_COMPILE :=
+endif
+export CROSS_COMPILE
+
+export DH_OPTIONS
+export DEB_HOST_ARCH DEB_HOST_GNU_TYPE DEB_BUILD_ARCH
+export DEB_BUILD_PATH = $(CURDIR) # for dpkg-buildflags
+export LC_ALL = C.UTF-8
+undefine LANGUAGE
+
+stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@
+
+setup_env := env -u ABINAME -u ARCH -u FEATURESET -u FLAVOUR -u VERSION -u LOCALVERSION
+setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTOR="$(DISTRIBUTOR)" DISTRIBUTION_VERSION="$(SOURCEVERSION)" KBUILD_BUILD_TIMESTAMP="$(SOURCE_DATE)" KBUILD_BUILD_VERSION_TIMESTAMP="$(DISTRIBUTOR) $(SOURCEVERSION) ($(SOURCE_DATE_UTC_ISO))" KBUILD_BUILD_USER="$(word 1,$(subst @, ,$(MAINTAINER)))" KBUILD_BUILD_HOST="$(word 2,$(subst @, ,$(MAINTAINER)))"
+setup_env += KBUILD_VERBOSE=$(if $(filter terse,$(DEB_BUILD_OPTIONS)),0,1)
+
+MAKE_CLEAN = $(setup_env) $(MAKE) KCFLAGS=-fdebug-prefix-map=$(CURDIR)/= KBUILD_HOSTCFLAGS='$(CFLAGS) $(CPPFLAGS)' HOSTCFLAGS='$(CFLAGS) $(CPPFLAGS)' KBUILD_HOSTLDFLAGS='$(LDFLAGS)'
+MAKE_SELF := $(MAKE) -f debian/rules.real $(MAKEOVERRIDES)
+MAKEOVERRIDES =
+
+BUILDDEB_ARGS := -Zxz $(if $(filter pkg.linux.quick,$(DEB_BUILD_PROFILES)),-z0)
+
+#
+# Targets
+#
+
+packages_enabled := $(shell dh_listpackages)
+define if_package
+$(if $(filter $(1),$(packages_enabled)),$(2))
+endef
+define if_profile
+$(if $(filter $(1),$(DEB_BUILD_PROFILES)),$(2))
+endef
+
+source: $(STAMPS_DIR)/source_$(FEATURESET)
+
+$(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(KCONFIG)
+ mkdir -p '$(dir $@)'
+ debian/bin/kconfig.py '$@' $(KCONFIG) $(KCONFIG_OPTIONS) \
+ $(call if_profile, pkg.linux.nokerneldbginfo pkg.linux.quick,-o DEBUG_INFO_NONE=y -o DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=n)
+
+define copy_source
+mkdir -p '$(1)'
+cp -al $(filter-out debian .pc .svk .svn .git, $(wildcard * .[^.]*)) '$(1)'
+endef
+
+$(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz: DIR = $(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION)
+$(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz: $(STAMPS_DIR)/source
+ rm -rf '$@' '$(DIR)'
+ $(call copy_source,$(DIR))
+ chmod -R u+rw,go=rX '$(DIR)'
+ find '$(DIR)' -depth -newermt '$(SOURCE_DATE)' -print0 | \
+ xargs -0r touch --no-dereference --date='$(SOURCE_DATE)'
+ cd '$(BUILD_DIR)'; \
+ find '$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION)' \
+ -name '*.pyc' -prune -o \
+ -print0 | \
+ sort -z | \
+ tar --owner=root --group=root --numeric-owner \
+ --no-recursion --null -T - -c | xz -T0 > '$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz'
+ rm -rf '$(DIR)'
+
+$(BUILD_DIR)/linux-patch-$(UPSTREAMVERSION)-%.patch.xz: $(STAMPS_DIR)/source_none $(STAMPS_DIR)/source_%
+ set -o pipefail; \
+ (cd '$(BUILD_DIR)'; \
+ set +e; \
+ diff -urN -p -x debian -x .pc -x .svk -x .svn -x .git -x '*.pyc' source_none source_$*; \
+ test $$? -eq 1) | \
+ filterdiff --remove-timestamps --strip=1 --addoldprefix=a/ --addnewprefix=b/ | \
+ xz -c >$@ || \
+ (rm -f $@; exit 1)
+
+$(STAMPS_DIR)/source:
+ test -d .pc
+ set +e; QUILT_PC=.pc quilt unapplied --quiltrc - >/dev/null && echo 'Patch series not fully applied'; test $$? -eq 1
+ @$(stamp)
+
+$(STAMPS_DIR)/source_%: SOURCE_DIR=$(BUILD_DIR)/source
+$(STAMPS_DIR)/source_%: DIR=$(BUILD_DIR)/source_$*
+$(STAMPS_DIR)/source_%: $(STAMPS_DIR)/source
+ mkdir -p '$(BUILD_DIR)'
+ rm -rf '$(DIR)'
+ $(call copy_source,$(DIR))
+ cd '$(DIR)' && QUILT_PATCHES='$(CURDIR)/debian/patches-$*' QUILT_PC=.pc quilt push --quiltrc - -a -q --fuzz=0
+ @$(stamp)
+.PRECIOUS: $(STAMPS_DIR)/source_%
+
+$(STAMPS_DIR)/source_none: DIR=$(BUILD_DIR)/source_none
+$(STAMPS_DIR)/source_none: $(STAMPS_DIR)/source
+ mkdir -p '$(BUILD_DIR)'
+ rm -f '$(DIR)'
+ ln -s '$(CURDIR)' '$(DIR)'
+ @$(stamp)
+
+$(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): CONFIG=$(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+$(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): SOURCE_DIR=$(BUILD_DIR)/source_$(FEATURESET)
+$(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+$(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/source_$(FEATURESET) $(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+ rm -rf '$(DIR)'
+ mkdir '$(DIR)'
+ cp '$(CONFIG)' '$(DIR)/.config'
+ echo 'override ARCH = $(KERNEL_ARCH)' >> '$(DIR)/.kernelvariables'
+ echo 'override KERNELRELEASE = $(ABINAME)$(LOCALVERSION_IMAGE)' >> '$(DIR)/.kernelvariables'
+ echo 'CCACHE = ccache' >> '$(DIR)/.kernelvariables'
+ifeq (./,$(dir $(COMPILER)))
+ echo 'CC = $$(if $$(DEBIAN_KERNEL_USE_CCACHE),$$(CCACHE)) $$(CROSS_COMPILE)$(COMPILER)' >> '$(DIR)/.kernelvariables'
+else
+# To allow for cross-compiles, we want to split up the configured
+# compiler filename and prepend the directory to $PATH. For a native
+# compile, so long as the configured compiler is installed it should
+# always be found first.
+# However, $PATH changes don't work consistently in make (bug #895835).
+# Instead we do the path lookup here and generate a new absolute
+# filename.
+ echo 'CC = $$(if $$(DEBIAN_KERNEL_USE_CCACHE),$$(CCACHE)) $$(word 1,$$(foreach dir,$(dir $(COMPILER)) $$(subst :, ,$$(PATH)),$$(wildcard $$(dir)/$$(CROSS_COMPILE)$(notdir $(COMPILER)))))' >> '$(DIR)/.kernelvariables'
+endif
+# TODO: Should we set CROSS_COMPILE always?
+ifdef OVERRIDE_HOST_TYPE
+ echo 'override CROSS_COMPILE = $(OVERRIDE_HOST_TYPE)-' >> '$(DIR)/.kernelvariables'
+else
+ echo 'ifneq ($$(DEB_BUILD_ARCH),$$(DEB_HOST_ARCH))' >> '$(DIR)/.kernelvariables'
+ echo 'override CROSS_COMPILE = $$(DEB_HOST_GNU_TYPE)-' >> '$(DIR)/.kernelvariables'
+ echo 'endif' >> '$(DIR)/.kernelvariables'
+endif
+ifdef KCFLAGS
+ echo 'KCFLAGS += $(KCFLAGS)' >> '$(DIR)/.kernelvariables'
+endif
+ echo 'DEBIAN_KERNEL_NO_CC_VERSION_CHECK = y' >> '$(DIR)/.kernelvariables'
+ +$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' listnewconfig
+ +yes "" | $(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' oldconfig >/dev/null
+ @$(stamp)
+
+$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+
+$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR):
+ +$(MAKE_CLEAN) -C '$(DIR)'
+ debian/bin/buildcheck.py $(DIR) $(ARCH) $(FEATURESET) $(FLAVOUR)
+ @$(stamp)
+
+$(STAMPS_DIR)/build-doc: DIR=$(BUILD_DIR)/build-doc
+# sphinx commands in /usr/bin are managed by the alternatives system.
+# Change $PATH to make sure we consistently use the Python 3 version.
+$(STAMPS_DIR)/build-doc: PATH:=/usr/share/sphinx/scripts/python3:$(PATH)
+$(STAMPS_DIR)/build-doc: $(STAMPS_DIR)/source
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ mkdir -p '$(BUILD_DIR)'
+ rm -rf '$(DIR)'
+ $(call copy_source,$(DIR))
+ +$(MAKE_CLEAN) -C '$(DIR)' PYTHON=python3 xmldocs
+ +$(MAKE_CLEAN) -C '$(DIR)' PYTHON=python3 htmldocs
+endif
+ @$(stamp)
+
+install-base:
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ dh_installdocs $(if $(INSTALLDOCS_LINK_DOC),--link-doc=$(INSTALLDOCS_LINK_DOC))
+endif
+ dh_installchangelogs
+ dh_bugfiles
+ dh_lintian
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol -- $(GENCONTROL_ARGS)
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_meta:
+
+binary_meta install-dummy:
+ dh_testdir
+ dh_testroot
+ dh_prep
+ +$(MAKE_SELF) install-base
+
+build_doc: $(STAMPS_DIR)/build-doc
+
+binary_doc: DIR = $(BUILD_DIR)/build-doc
+binary_doc: OUT_DIR = $(DESTDIR)/usr/share/doc/$(PACKAGE_NAME)
+binary_doc: $(STAMPS_DIR)/build-doc
+ dh_prep
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ mkdir -p $(OUT_DIR)
+ set -o pipefail; \
+ find CREDITS MAINTAINERS README Documentation \
+ -name '.gitignore' -prune -o -name DocBook -prune -o \
+ -path Documentation/media -prune -o \
+ -path Documentation/sphinx -prune -o \
+ -name 'Makefile*' -prune -o \
+ -print | \
+ cpio -pd --preserve-modification-time '$(OUT_DIR)'
+ set -o pipefail; \
+ cd $(DIR)/Documentation/output; \
+ find * -name '*.rst' -prune -o -name objects.inv -prune \
+ -o -name xml -prune -o -print | \
+ cpio -pd --preserve-modification-time '$(OUT_DIR)/html'
+ find $(OUT_DIR)/Documentation -type f | xargs gzip -9n
+# Fix up symlinks to gzipped docs
+ cd $(OUT_DIR)/Documentation; \
+ find -type l | while read link; do \
+ dest="$$(readlink -f "$$link")"; \
+ if [ -f "$$dest.gz" ]; then \
+ rm -f "$$link"; \
+ ln -sr "$$dest.gz" "$$link.gz"; \
+ fi; \
+ done
+endif
+ +$(MAKE_SELF) install-base
+
+build_headers-common:
+
+binary_headers-common: PACKAGE_NAME_KBUILD = linux-kbuild-$(VERSION)
+binary_headers-common: BASE_DIR = /usr/src/$(PACKAGE_NAME)
+binary_headers-common: SOURCE_DIR = $(BUILD_DIR)/source_$(FEATURESET)
+binary_headers-common: DIR = $(DESTDIR)/$(BASE_DIR)
+binary_headers-common: $(STAMPS_DIR)/source_$(FEATURESET)
+ dh_testdir
+ dh_testroot
+ dh_prep
+
+ set -o pipefail; \
+ cd $(SOURCE_DIR); \
+ ( \
+ echo Makefile; \
+ for arch in $(ALL_KERNEL_ARCHES); do \
+ find arch/$$arch -maxdepth 1 -name 'Makefile*' -print; \
+ find arch/$$arch \( -name 'Kbuild.platforms' -o -name 'Platform' \) -print; \
+ find $$(find arch/$$arch \( -name include -o -name scripts \) -type d -print) -print; \
+ done; \
+ find include -print; \
+ ) \
+ | \
+ cpio -pd --preserve-modification-time '$(DIR)'
+
+ dh_link /usr/lib/$(PACKAGE_NAME_KBUILD)/scripts $(BASE_DIR)/scripts
+ dh_link /usr/lib/$(PACKAGE_NAME_KBUILD)/tools $(BASE_DIR)/tools
+
+ +$(MAKE_SELF) install-base
+
+build_headers:
+
+binary_headers: REAL_VERSION = $(ABINAME)$(LOCALVERSION)
+binary_headers: PACKAGE_NAME_COMMON = linux-headers-$(ABINAME)-common$(LOCALVERSION_HEADERS)
+binary_headers: PACKAGE_NAME_KBUILD = linux-kbuild-$(VERSION)
+binary_headers: BASE_DIR = /usr/src/$(PACKAGE_NAME)
+binary_headers: BASE_DIR_COMMON = /usr/src/$(PACKAGE_NAME_COMMON)
+binary_headers: SOURCE_DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+binary_headers: REF_DIR = $(BUILD_DIR)/source_$(FEATURESET)
+binary_headers: DIR = $(DESTDIR)/$(BASE_DIR)
+binary_headers: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+ dh_testdir
+ dh_testroot
+ dh_prep
+
+ mkdir -p $(DIR)/arch/$(KERNEL_ARCH)/kernel
+ cp -a $(SOURCE_DIR)/{.config,.kernel*,Module.symvers,include} $(DIR)
+ cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/include $(DIR)/arch/$(KERNEL_ARCH)
+ find $(DIR) -name '*.cmd' -delete
+
+ if [ -f $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/lib/crtsavres.o ]; then \
+ mkdir $(DIR)/arch/$(KERNEL_ARCH)/lib; \
+ cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/lib/crtsavres.o $(DIR)/arch/$(KERNEL_ARCH)/lib; \
+ fi
+
+ cp -a $(SOURCE_DIR)/scripts/module.lds $(DIR)/arch/$(KERNEL_ARCH)
+
+ @echo 'include $(BASE_DIR_COMMON)/Makefile' >> $(DIR)/Makefile
+
+ dh_link /usr/lib/$(PACKAGE_NAME_KBUILD)/scripts $(BASE_DIR)/scripts
+ dh_link /usr/lib/$(PACKAGE_NAME_KBUILD)/tools $(BASE_DIR)/tools
+
+ mkdir -p $(DESTDIR)/lib/modules/$(REAL_VERSION)
+ ln -s /usr/src/$(PACKAGE_NAME) $(DESTDIR)/lib/modules/$(REAL_VERSION)/build
+ ln -s /usr/src/$(PACKAGE_NAME_COMMON) $(DESTDIR)/lib/modules/$(REAL_VERSION)/source
+
+ +$(MAKE_SELF) install-base
+
+build_libc-dev:
+
+binary_libc-dev: DIR = $(BUILD_DIR)/build-libc-dev
+binary_libc-dev: OUT_DIR = debian/$(PACKAGE_NAME)/usr
+binary_libc-dev:
+ dh_testdir
+ dh_testroot
+ dh_prep
+ rm -rf '$(DIR)'
+ mkdir -p $(DIR)
+ +$(MAKE_CLEAN) O='$(CURDIR)/$(DIR)' headers_install ARCH=$(KERNEL_ARCH) INSTALL_HDR_PATH='$(CURDIR)'/$(OUT_DIR)
+
+ rm -rf $(OUT_DIR)/include/drm $(OUT_DIR)/include/scsi
+ find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) -execdir rm {} +
+
+# Move include/asm to arch-specific directory
+ mkdir -p $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)
+ mv $(OUT_DIR)/include/asm $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
+ test ! -d $(OUT_DIR)/include/arch || \
+ mv $(OUT_DIR)/include/arch $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
+
+ +$(MAKE_SELF) install-base
+
+build_support:
+
+binary_support: PACKAGE_ROOT = /usr/share/$(PACKAGE_NAME)
+binary_support:
+ dh_testdir
+ dh_testroot
+ dh_prep
+ dh_installdirs $(PACKAGE_ROOT)/lib/python/debian_linux $(PACKAGE_ROOT)/modules
+ cp debian/config.defines.dump $(DESTDIR)$(PACKAGE_ROOT)
+ cp -R debian/installer $(DESTDIR)$(PACKAGE_ROOT)/installer
+ cp debian/lib/python/debian_linux/*.py $(DESTDIR)$(PACKAGE_ROOT)/lib/python/debian_linux
+ dh_python3
+ dh_link $(PACKAGE_ROOT) /usr/src/$(PACKAGE_NAME)
+ +$(MAKE_SELF) install-base
+
+setup_image: $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+
+build_image: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+
+binary_image: REAL_VERSION = $(ABINAME)$(LOCALVERSION)
+binary_image: INSTALL_DIR = $(DESTDIR)/boot
+binary_image: DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+binary_image: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+binary_image:
+ dh_testdir
+ dh_testroot
+ dh_prep
+ dh_installdirs 'boot'
+ifeq ($(IMAGE_FILE),vmlinux)
+# This is the unprocessed ELF image, so we need to strip debug symbols
+ $(CROSS_COMPILE)objcopy --strip-debug '$(DIR)/vmlinux' $(INSTALL_DIR)/$(IMAGE_INSTALL_STEM)-$(REAL_VERSION)
+else
+ install -m644 '$(DIR)/$(IMAGE_FILE)' $(INSTALL_DIR)/$(IMAGE_INSTALL_STEM)-$(REAL_VERSION)
+endif
+ +$(MAKE_SELF) \
+ binary_image_dt \
+ DIR='$(DIR)' DESTDIR='$(DESTDIR)' REAL_VERSION='$(REAL_VERSION)'
+ +$(MAKE_CLEAN) -C $(DIR) modules_install DEPMOD='$(CURDIR)/debian/bin/no-depmod' INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_STRIP=1
+ifeq ($(call if_package,linux-image-$(ABINAME)$(LOCALVERSION)-dbg,y),y)
+# We are building debug info, so add debug links
+ set -o pipefail; \
+ find $(DESTDIR) -name '*.ko' | sed 's|$(DESTDIR)/lib/modules/$(REAL_VERSION)/kernel/||' | while read module ; do \
+ $(CROSS_COMPILE)objcopy --add-gnu-debuglink=$(DIR)/$$module $(DESTDIR)/lib/modules/$(REAL_VERSION)/kernel/$$module || exit; \
+ done
+# stripping the modules removes signatures as well - if automated signing is enabled with
+# an ephemeral key, re-do the sign step
+ +if grep -qs '^CONFIG_MODULE_SIG_ALL=y' $(DIR)/.config; then \
+ $(MAKE_CLEAN) -C $(DIR) modules_sign INSTALL_MOD_PATH=$(DESTDIR); \
+ fi
+endif
+ sed '/CONFIG_\(MODULE_SIG_\(ALL\|KEY\)\|SYSTEM_TRUSTED_KEYS\|BUILD_SALT\)[ =]/d' $(DIR)/.config > $(DESTDIR)/boot/config-$(REAL_VERSION)
+ echo "ffffffffffffffff B The real System.map is in the linux-image-<version>-dbg package" \
+ > $(DESTDIR)/boot/System.map-$(REAL_VERSION)
+ rm -f $(DESTDIR)/lib/modules/$(REAL_VERSION)/build
+ rm -f $(DESTDIR)/lib/modules/$(REAL_VERSION)/source
+ rm $(DESTDIR)/lib/firmware -rf
+ +$(MAKE_SELF) \
+ binary_image_bug \
+ DESTDIR='$(DESTDIR)' PACKAGE_NAME='$(PACKAGE_NAME)' REAL_VERSION='$(REAL_VERSION)'
+ dh_strip --no-automatic-dbgsym -Xvmlinux -Xvmlinuz
+ ln -sf linux-image.NEWS debian/$(PACKAGE_NAME).NEWS
+ +$(MAKE_SELF) install-base
+
+binary_image_dt: DT_INSTALL_DIR = $(DESTDIR)/usr/lib/linux-image-$(REAL_VERSION)
+binary_image_dt:
+ifneq ($(filter arm64 armel armhf mipsr6 mipsr6el mips64r6 mips64r6el riscv64,$(ARCH)),)
+ +$(MAKE_CLEAN) -C $(DIR) dtbs
+ +$(MAKE_CLEAN) -C $(DIR) dtbs_install INSTALL_DTBS_PATH=$(DT_INSTALL_DIR)
+ # dtbs_install sets the executable bit on dtb files, which they shouldn't have
+ find $(DT_INSTALL_DIR) -type f -name '*.dtb' -exec chmod 644 {} \;
+endif
+ifneq ($(filter powerpc ppc64,$(ARCH)),)
+# Install wrapper code and DT source, but not the wrapper script or
+# the executables it calls. Kbuild will always build these executable
+# as native code, which is wrong for a cross-built package. Install
+# symlinks to the versions in the linux-bootwrapper package instead.
+ rm -rf '$(BUILD_DIR)/bootwrapper_$(ARCH)_$(FEATURESET)_$(FLAVOUR)'
+ +$(MAKE_CLEAN) -C '$(DIR)' bootwrapper_install DESTDIR= \
+ WRAPPER_OBJDIR='$(DT_INSTALL_DIR)' \
+ WRAPPER_DTSDIR='$(DT_INSTALL_DIR)/dts' \
+ WRAPPER_BINDIR='$(CURDIR)/$(BUILD_DIR)/bootwrapper_$(ARCH)_$(FEATURESET)_$(FLAVOUR)'
+ for prog in '$(BUILD_DIR)/bootwrapper_$(ARCH)_$(FEATURESET)_$(FLAVOUR)'/*; do \
+ prog="$$(basename $$prog)"; \
+ ln -s ../linux-bootwrapper-$(ABINAME)/$$prog \
+ '$(DT_INSTALL_DIR)'/$$prog; \
+ done
+endif
+
+binary_image_bug:
+ dh_installdirs usr/share/bug/$(PACKAGE_NAME)
+ dh_install debian/templates/image.bug/* usr/share/bug/$(PACKAGE_NAME)
+ chmod 755 $(DESTDIR)/usr/share/bug/$(PACKAGE_NAME)/script
+ printf "RELEASE='$(REAL_VERSION)'\nDISTRIBUTOR='$(DISTRIBUTOR)'\nSOURCEVERSION='$(SOURCEVERSION)'\nPACKAGE_NAME='$(PACKAGE_NAME)'\nPACKAGE_VERSION='$(SOURCEVERSION)'" > $(DESTDIR)/usr/share/bug/$(PACKAGE_NAME)/info
+
+build_image-dbg: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+
+binary_image-dbg: REAL_VERSION = $(ABINAME)$(LOCALVERSION)
+binary_image-dbg: DEBUG_DIR = $(DESTDIR)/usr/lib/debug
+binary_image-dbg: DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+binary_image-dbg: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
+ dh_testdir
+ dh_testroot
+ dh_prep
+ dh_installdirs usr/lib/debug usr/lib/debug/boot usr/share/lintian/overrides/
+ install -m644 $(DIR)/vmlinux $(DEBUG_DIR)/boot/vmlinux-$(REAL_VERSION)
+ install -m644 $(DIR)/System.map $(DEBUG_DIR)/boot/System.map-$(REAL_VERSION)
+ +$(MAKE_CLEAN) -C $(DIR) modules_install DEPMOD='$(CURDIR)/debian/bin/no-depmod' INSTALL_MOD_PATH=$(DEBUG_DIR)
+ find $(DEBUG_DIR)/lib/modules/$(REAL_VERSION)/ -mindepth 1 -maxdepth 1 \! -name kernel -exec rm {} \+
+ rm $(DEBUG_DIR)/lib/firmware -rf
+ifeq ($(VDSO),True)
+ +$(MAKE_CLEAN) -C $(DIR) vdso_install INSTALL_MOD_PATH=$(DEBUG_DIR)
+# Create .build-id links. Some architectures already do so, but in the
+# wrong place, so delete those first.
+ rm -rf $(DEBUG_DIR)/lib/modules/$(REAL_VERSION)/vdso/.build-id
+ find $(DEBUG_DIR)/lib/modules/$(REAL_VERSION)/vdso/ -type f | while read vdso; do \
+ if buildid="$$(readelf -n "$$vdso" | sed -rne 's/^\s+Build ID: (.*)$$/\1/p')" && [ "$$buildid" ]; then \
+ mkdir -p "$(DEBUG_DIR)/.build-id/$${buildid:0:2}"; \
+ ln -s -r "$$vdso" "$(DEBUG_DIR)/.build-id/$${buildid:0:2}/$${buildid:2}.debug"; \
+ fi; \
+ done
+endif
+# Add symlinks to vmlinux from the locations expected by kdump-tools,
+# systemtap and others
+ ln -s boot/vmlinux-$(REAL_VERSION) $(DEBUG_DIR)/
+ mkdir -p $(DEBUG_DIR)/lib/modules/$(REAL_VERSION)
+ ln -s ../../../boot/vmlinux-$(REAL_VERSION) $(DEBUG_DIR)/lib/modules/$(REAL_VERSION)/vmlinux
+ +$(MAKE_SELF) install-base
+
+build_signed-template:
+
+binary_signed-template: CODE_SIGNING_DIR = $(DESTDIR)/usr/share/code-signing/$(PACKAGE_NAME)
+binary_signed-template:
+ dh_testdir
+ dh_testroot
+ dh_prep
+ rm -rf $(CODE_SIGNING_DIR)
+ mkdir -p $(CODE_SIGNING_DIR)
+ PYTHONHASHSEED=0 debian/bin/gencontrol_signed.py $(ARCH)
+ cp -R debian/copyright \
+ debian/linux-image.NEWS \
+ debian/signing_templates/README.source \
+ debian/signing_templates/rules \
+ debian/signing_templates/rules.real \
+ debian/signing_templates/sign-file-attach \
+ debian/signing_templates/source \
+ $(CODE_SIGNING_DIR)/source-template/debian/
+ +$(MAKE_SELF) install-base
+
+build_udeb:
+build_udeb_test:
+
+binary_udeb binary_udeb_test: export KW_DEFCONFIG_DIR=debian/installer
+binary_udeb binary_udeb_test: export KW_CONFIG_DIR=debian/installer
+
+binary_udeb:
+ dh_testdir
+ dh_prep
+ kernel-wedge install-files $(ABINAME)
+ kernel-wedge check $(PACKAGE_NAMES)
+ dh_fixperms
+ dh_gencontrol
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+# Want only to run if all build profiles are fulfilled
+binary_udeb_test: DEB_BUILD_PROFILES += pkg.linux.udeb-unsigned-test-build
+binary_udeb_test:
+ if [ -n "$$(dh_listpackages)" ]; then \
+ kernel-wedge install-files $(ABINAME); \
+ kernel-wedge check $(PACKAGE_NAMES); \
+ fi
+
+build_source:
+
+binary_source: $(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz $(foreach FEATURESET,$(filter-out none,$(ALL_FEATURESETS)),$(BUILD_DIR)/linux-patch-$(UPSTREAMVERSION)-$(FEATURESET).patch.xz)
+ dh_testdir
+ dh_testroot
+ dh_install $^ /usr/src
+ +$(MAKE_SELF) install-base BUILDDEB_ARGS='-Zxz -z0'
+
+build_config:
+
+binary_config: TRIPLETS = $(subst $(BUILD_DIR)/build_,,$(wildcard $(BUILD_DIR)/build_$(ARCH)_*_*))
+binary_config:
+ dh_testdir
+ dh_testroot
+ dh_installdirs /usr/src/linux-config-$(UPSTREAMVERSION)
+# Fix the module signing configuration to work for custom kernels. Also delete
+# CONFIG_BUILD_SALT which makes no sense for custom kernels.
+ for triplet in $(TRIPLETS); do \
+ sed '/CONFIG_\(MODULE_SIG_\(ALL\|KEY\)\|SYSTEM_TRUSTED_KEYS\|BUILD_SALT\)[ =]/d' $(BUILD_DIR)/build_$$triplet/.config | xz -c >debian/$(PACKAGE_NAME)/usr/src/linux-config-$(UPSTREAMVERSION)/config.$$triplet.xz; \
+ done
+ +$(MAKE_SELF) install-base
+
+define make-tools
++mkdir -p $(BUILD_DIR)/build-tools/$(1) && $(MAKE_CLEAN) -C $(BUILD_DIR)/build-tools/$(1) -f $(CURDIR)/debian/rules.d/$(1)/Makefile top_srcdir=$(CURDIR) top_rulesdir=$(CURDIR)/debian/rules.d OUTDIR=$(1) VERSION=$(VERSION) KERNEL_ARCH=$(KERNEL_ARCH)
+endef
+
+$(STAMPS_DIR)/build-tools-headers:
+ mkdir -p $(BUILD_DIR)/build-tools/headers-tools
+ $(MAKE) ARCH=$(KERNEL_ARCH) O=$(BUILD_DIR)/build-tools/headers-tools \
+ INSTALL_HDR_PATH=$(CURDIR)/$(BUILD_DIR)/build-tools \
+ headers_install
+ @$(stamp)
+
+build_bpftool: $(STAMPS_DIR)/build-tools-headers
+ $(call make-tools,tools/bpf/bpftool)
+
+binary_bpftool: build_bpftool
+ dh_testdir
+ dh_testroot
+ dh_prep
+ $(call make-tools,tools/bpf/bpftool) install
+ dh_installchangelogs
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ dh_installdocs
+endif
+ dh_lintian
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ VERSION="$$(($$(sed -ne 's,^#define LIBBPF_MAJOR_VERSION \(.*\)$$,\1,p' tools/lib/bpf/libbpf_version.h) + 6)).$$(sed -ne 's,^#define LIBBPF_MINOR_VERSION \(.*\)$$,\1,p' tools/lib/bpf/libbpf_version.h).$$(sed -ne 's,^#define BPFTOOL_PATCH_VERSION \(.*\)$$,\1,p' tools/bpf/bpftool/main.c)" && \
+ test -n "$$VERSION" -a -n "$(DEB_VERSION)" && \
+ dh_gencontrol -- -v$$VERSION+$(DEB_VERSION)
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_kbuild: $(STAMPS_DIR)/build-tools-headers
+ $(call make-tools,certs)
+ $(call make-tools,scripts)
+ $(call make-tools,tools/objtool)
+
+binary_kbuild: PREFIX_DIR = /usr/lib/$(PACKAGE_NAME)
+binary_kbuild: build_kbuild
+ dh_testdir
+ dh_testroot
+ dh_prep
+ $(call make-tools,certs) install prefix=$(PREFIX_DIR)
+ $(call make-tools,scripts) install prefix=$(PREFIX_DIR)
+ $(call make-tools,tools/objtool) install prefix=$(PREFIX_DIR)
+ dh_link $(PREFIX_DIR) /usr/src/$(PACKAGE_NAME)
+ dh_installchangelogs
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ dh_installdocs
+endif
+ dh_lintian
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_cpupower: $(STAMPS_DIR)/build-tools-headers
+ $(call make-tools,tools/power/cpupower)
+ifneq ($(filter i386 amd64 x32,$(DEB_HOST_ARCH)),)
+ $(call make-tools,tools/power/x86)
+endif
+
+binary_cpupower: DIR = $(CURDIR)/debian/cpupower-tmp
+binary_cpupower: build_cpupower
+ dh_testdir
+ dh_testroot
+ dh_prep
+ $(call make-tools,tools/power/cpupower) install DESTDIR=$(DIR)
+ifneq ($(filter i386 amd64 x32,$(DEB_HOST_ARCH)),)
+ $(call make-tools,tools/power/x86) install DESTDIR=$(DIR)
+ echo >> debian/linux-cpupower.substvars 'cpupower:Arch-Description='\
+'The turbostat command reports topology, frequency, idle power-state$${Newline}'\
+'statistics, temperature and power consumption information as provided$${Newline}'\
+'by the CPU.$${Newline}'\
+'$${Newline}'\
+'The x86_energy_perf_policy command sets a general policy on some Intel$${Newline}'\
+'CPU models for the relative importance of performance versus energy$${Newline}'\
+'savings.'
+endif
+ dh_install --sourcedir=$(DIR)
+ dh_installchangelogs
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ dh_installdocs
+ dh_installman
+endif
+ dh_lintian
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_perf: $(STAMPS_DIR)/build-tools-headers
+ $(call make-tools,tools/perf)
+
+binary_perf: build_perf
+ dh_testdir
+ dh_testroot
+ dh_prep
+ $(call make-tools,tools/perf) install
+ # do not ship python2 script
+ rm -f $(DIR)/usr/lib/perf-core/scripts/python/call-graph-from-sql.py
+ dh_perl /usr/lib/perf-core/scripts/perl/Perf-Trace-Util/lib/
+ dh_python3 /usr/lib/perf-core/scripts/python/Perf-Trace-Util/lib/
+ dh_installchangelogs
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ dh_installdocs
+endif
+ dh_lintian
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps -Xperf-read-vdso
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_usbip: $(STAMPS_DIR)/build-tools-headers
+ $(call make-tools,tools/usb/usbip)
+
+binary_usbip: DIR = $(CURDIR)/debian/usbip-tmp
+binary_usbip: build_usbip
+ dh_testdir
+ dh_testroot
+ dh_prep
+ $(call make-tools,tools/usb/usbip) install DESTDIR=$(DIR)
+ dh_install --sourcedir=$(DIR)
+ dh_installchangelogs
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ dh_installdocs
+ dh_installman
+endif
+ dh_lintian
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ VERSION=$$(sed -ne 's,^#define PACKAGE_VERSION "\(.*\)"$$,\1,p' $(BUILD_DIR)/build-tools/tools/usb/usbip/config.h) && \
+ test -n "$$VERSION" -a -n "$(DEB_VERSION)" && \
+ dh_gencontrol -- -v$$VERSION+$(DEB_VERSION)
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_hyperv-daemons: $(STAMPS_DIR)/build-tools-headers
+ $(call make-tools,tools/hv)
+
+binary_hyperv-daemons: build_hyperv-daemons
+ dh_testdir
+ dh_testroot
+ dh_prep
+ $(call make-tools,tools/hv) install
+ dh_install
+ dh_installchangelogs
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ dh_installdocs
+endif
+ for service in fcopy kvp vss; do \
+ dh_installsystemd --name hv-$$service-daemon --no-enable --no-start \
+ || break; \
+ dh_installinit --name hv-$$service-daemon \
+ || break; \
+ done
+ dh_installudev
+ dh_lintian
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_bootwrapper: $(STAMPS_DIR)/build-tools-headers
+ $(call make-tools,arch/powerpc/boot)
+
+binary_bootwrapper: build_bootwrapper
+ dh_testdir
+ dh_testroot
+ dh_prep
+ $(call make-tools,arch/powerpc/boot) install installdir=/usr/lib/$(PACKAGE_NAME)
+ dh_installchangelogs
+ dh_lintian
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_rtla: $(STAMPS_DIR)/build-tools-headers
+ $(call make-tools,tools/tracing/rtla)
+
+binary_rtla: build_rtla
+ dh_testdir
+ dh_testroot
+ dh_prep
+ $(call make-tools,tools/tracing/rtla) install
+ dh_install
+ dh_link
+ dh_installchangelogs
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ dh_installdocs
+ dh_installman
+endif
+ dh_lintian
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+setup_%:
+ @:
+
+.PHONY: binary_% build_% setup_% binary-% build-% install-% setup-% source
+
+# vim: filetype=make