diff options
Diffstat (limited to 'debian/rules.real')
-rw-r--r-- | debian/rules.real | 564 |
1 files changed, 564 insertions, 0 deletions
diff --git a/debian/rules.real b/debian/rules.real new file mode 100644 index 00000000..df90946f --- /dev/null +++ b/debian/rules.real @@ -0,0 +1,564 @@ +# +# 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 +DEB_HOST_ARCH := $(shell dpkg-architecture -a'$(ARCH)' -qDEB_HOST_ARCH) +DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -a'$(ARCH)' -qDEB_HOST_GNU_TYPE) +DEB_BUILD_ARCH := $(shell dpkg-architecture -a'$(ARCH)' -qDEB_BUILD_ARCH) +UPLOADER := $(shell dpkg-parsechangelog | sed -ne 's,^Maintainer: .[^<]*<\([^>]*\)>,\1,p') + +export PYTHONPATH = $(CURDIR)/debian/lib/python +export DH_OPTIONS +export DEB_HOST_ARCH DEB_HOST_GNU_TYPE DEB_BUILD_ARCH + +include debian/rules.defs + +stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@ + +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + DEBIAN_KERNEL_JOBS := $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) +endif +ifdef DEBIAN_KERNEL_JOBS + JOBS_ARG = -j$(DEBIAN_KERNEL_JOBS) +endif + +setup_env := env -u ABINAME -u ARCH -u FEATURESET -u FLAVOUR -u VERSION -u LOCALVERSION +setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTION_UPLOADER=$(UPLOADER) DISTRIBUTION_VERSION="$(SOURCEVERSION)" + +MAKE_CLEAN = $(setup_env) $(MAKE) +MAKE_SELF := $(MAKE) -f debian/rules.real $(MAKEOVERRIDES) +MAKEOVERRIDES = +MAKE_PERF_VARS = prefix=/usr perfexecdir=share/perf_$(VERSION)-core NO_PERL=1 V=2 + +# +# Targets +# +binary-arch-arch: install-headers_$(ARCH) +binary-arch-arch: install-libc-dev_$(ARCH) +ifdef BUILD_TOOLS +ifneq ($(filter alpha amd64 armel hppa i386 powerpc s390 sh4 sparc sparc64,$(ARCH)),) + binary-arch-arch: install-tools_$(ARCH) +endif +endif +binary-arch-featureset: install-headers_$(ARCH)_$(FEATURESET) +binary-arch-flavour: install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE) +ifeq ($(DEBUG),True) + binary-arch-flavour: install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR) +endif +ifeq ($(MODULES),True) + binary-arch-flavour: install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR) +endif + +binary-indep: install-source +binary-indep: install-linux-base +ifdef BUILD_DOCUMENTATION +binary-indep: install-doc +binary-indep: install-manual +binary-indep: install-patch +binary-indep: install-support +binary-indep: install-firmware +else +binary-indep: +endif + +build: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE) + +setup-flavour: $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR) + +source-arch: $(STAMPS_DIR)/source +source-featureset: $(STAMPS_DIR)/source_$(ARCH)_$(FEATURESET) + +$(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(KCONFIG) + python debian/bin/kconfig.py '$@' $(KCONFIG) $(KCONFIG_OPTIONS) + +$(BUILD_DIR)/linux-source-$(UPSTREAMVERSION).tar.bz2: SOURCE_DIR=$(BUILD_DIR)/source +$(BUILD_DIR)/linux-source-$(UPSTREAMVERSION).tar.bz2: DIR = $(BUILD_DIR)/linux-source-$(UPSTREAMVERSION) +$(BUILD_DIR)/linux-source-$(UPSTREAMVERSION).tar.bz2: $(STAMPS_DIR)/source + rm -rf '$@' '$(DIR)' + cp -al '$(SOURCE_DIR)' '$(DIR)' + chmod -R u+rw,go=rX '$(DIR)' + cd '$(BUILD_DIR)'; tar -cjf 'linux-source-$(UPSTREAMVERSION).tar.bz2' 'linux-source-$(UPSTREAMVERSION)' + rm -rf '$(DIR)' + +define patch_cmd +cd '$(DIR)'; python '$(CURDIR)/debian/bin/patch.apply' --overwrite-home='$(CURDIR)/debian/patches' +endef + +$(STAMPS_DIR)/source: SOURCE_FILES = $(filter-out debian, $(wildcard * .[^.]*)) +$(STAMPS_DIR)/source: DIR = $(BUILD_DIR)/source +$(STAMPS_DIR)/source: + rm -rf '$(DIR)' + mkdir -p '$(DIR)' + cp -al $(SOURCE_FILES) '$(DIR)' + $(patch_cmd) + # Suppress trailing '+' in utsrelease + touch '$(DIR)/.scmversion' + @$(stamp) + +$(STAMPS_DIR)/source_$(ARCH)_$(FEATURESET): SOURCE_DIR=$(BUILD_DIR)/source +$(STAMPS_DIR)/source_$(ARCH)_$(FEATURESET): DIR=$(BUILD_DIR)/source_$(ARCH)_$(FEATURESET) +$(STAMPS_DIR)/source_$(ARCH)_$(FEATURESET): $(STAMPS_DIR)/source + rm -rf '$(DIR)' + cp -al '$(SOURCE_DIR)' '$(DIR)' + $(patch_cmd) -a $(ARCH) -f $(FEATURESET) + @$(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_$(ARCH)_$(FEATURESET) +$(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) +$(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/source_$(ARCH)_$(FEATURESET) $(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR) + rm -rf '$(DIR)' + mkdir '$(DIR)' + cp '$(CONFIG)' '$(DIR)/.config' + echo '$(ABINAME)$(LOCALVERSION_IMAGE)' > '$(DIR)/localversion' + echo 'override ARCH = $(KERNEL_ARCH)' >> '$(DIR)/.kernelvariables' + echo 'CCACHE = ccache' >> '$(DIR)/.kernelvariables' + echo 'CC = $$(if $$(DEBIAN_KERNEL_USE_CCACHE),$$(CCACHE)) $$(CROSS_COMPILE)$(COMPILER)' >> '$(DIR)/.kernelvariables' +# 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 CFLAGS_KERNEL + echo 'CFLAGS += $(CFLAGS_KERNEL)' >> '$(DIR)/.kernelvariables' +endif + +$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' reportoldconfig + +$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' $(JOBS_ARG) prepare + + @$(stamp) + +$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): DIR=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) +$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR) + +$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-s390-tape: BUILD_TARGET = image + +$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain \ +$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-s390-tape \ +$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-xen: + +$(MAKE_CLEAN) -C '$(DIR)' $(JOBS_ARG) modules + +$(MAKE_CLEAN) -C '$(DIR)' $(JOBS_ARG) uImage + python debian/bin/buildcheck.py $(DIR) $(ARCH) $(FEATURESET) $(FLAVOUR) + @$(stamp) + +$(STAMPS_DIR)/build-tools_$(ARCH): SOURCE_DIR=$(BUILD_DIR)/source +$(STAMPS_DIR)/build-tools_$(ARCH): DIR=$(BUILD_DIR)/build-tools_$(ARCH) +$(STAMPS_DIR)/build-tools_$(ARCH): $(STAMPS_DIR)/source + rm -rf $(DIR) + cp -al $(SOURCE_DIR) $(DIR) + +$(MAKE_CLEAN) -C '$(DIR)/tools/perf' $(JOBS_ARG) $(MAKE_PERF_VARS) all man + @$(stamp) + +$(STAMPS_DIR)/build-doc: SOURCE_DIR=$(BUILD_DIR)/source +$(STAMPS_DIR)/build-doc: DIR=$(BUILD_DIR)/build-doc +$(STAMPS_DIR)/build-doc: $(STAMPS_DIR)/source + rm -rf $(DIR) + mkdir $(DIR) + +$(MAKE_CLEAN) -C $(SOURCE_DIR) O='$(CURDIR)/$(DIR)' $(JOBS_ARG) xmldocs + +$(MAKE_CLEAN) -C $(SOURCE_DIR) O='$(CURDIR)/$(DIR)' $(JOBS_ARG) htmldocs mandocs + @$(stamp) + +install-base: + dh_installchangelogs + dh_installdocs + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol -- $(GENCONTROL_ARGS) + dh_md5sums + dh_builddeb -- $(BUILDDEB_ARGS) + +install-dummy: + dh_testdir + dh_testroot + dh_prep + +$(MAKE_SELF) install-base + +install-doc: PACKAGE_NAME = linux-doc-$(VERSION) +install-doc: DIR = $(BUILD_DIR)/build-doc +install-doc: SOURCE_DIR = $(BUILD_DIR)/source +install-doc: PACKAGE_DIR = debian/$(PACKAGE_NAME) +install-doc: OUT_DIR = $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME) +install-doc: DH_OPTIONS = -p$(PACKAGE_NAME) +install-doc: $(STAMPS_DIR)/build-doc + dh_prep + mkdir -p $(OUT_DIR) + cp -a $(addprefix $(SOURCE_DIR)/, CREDITS MAINTAINERS README REPORTING-BUGS Documentation) $(OUT_DIR) + rm -rf $(OUT_DIR)/Documentation/DocBook + cd $(DIR)/Documentation/DocBook; \ + find * -name '*.html' -print \ + | \ + cpio -pd --preserve-modification-time '$(CURDIR)/$(OUT_DIR)/html' + gzip -9qfr $(OUT_DIR)/Documentation + +$(MAKE_SELF) install-base + +install-manual: PACKAGE_NAME = linux-manual-$(VERSION) +install-manual: DIR=$(BUILD_DIR)/build-doc +install-manual: DH_OPTIONS = -p$(PACKAGE_NAME) +install-manual: $(STAMPS_DIR)/build-doc + dh_prep + find $(DIR)/Documentation/DocBook/man/ -name '*.9' | xargs dh_installman + +$(MAKE_SELF) install-base + +install-headers_$(ARCH): PACKAGE_NAMES = linux-headers-$(UPSTREAMVERSION)$(ABINAME)-all linux-headers-$(UPSTREAMVERSION)$(ABINAME)-all-$(ARCH) +install-headers_$(ARCH): DH_OPTIONS = $(foreach p, $(PACKAGE_NAMES), -p$(p)) +install-headers_$(ARCH): + dh_testdir + dh_testroot + +$(MAKE_SELF) install-base GENCONTROL_ARGS='-Vkernel:Arch=$(ARCH)' + +install-headers_$(ARCH)_$(FEATURESET): PACKAGE_NAME = linux-headers-$(UPSTREAMVERSION)$(ABINAME)-common$(LOCALVERSION_HEADERS) +install-headers_$(ARCH)_$(FEATURESET): PACKAGE_NAME_KBUILD = linux-kbuild-$(VERSION) +install-headers_$(ARCH)_$(FEATURESET): DH_OPTIONS = -p$(PACKAGE_NAME) +install-headers_$(ARCH)_$(FEATURESET): BASE_DIR = /usr/src/$(PACKAGE_NAME) +install-headers_$(ARCH)_$(FEATURESET): SOURCE_DIR = $(BUILD_DIR)/source_$(ARCH)_$(FEATURESET) +install-headers_$(ARCH)_$(FEATURESET): DIR = debian/$(PACKAGE_NAME)/$(BASE_DIR) +install-headers_$(ARCH)_$(FEATURESET): $(STAMPS_DIR)/source_$(ARCH)_$(FEATURESET) + dh_testdir + dh_testroot + dh_prep + + cd $(SOURCE_DIR); \ + ( \ + echo Makefile; \ + find arch/$(KERNEL_ARCH) -maxdepth 1 -name 'Makefile*' -print; \ + find arch/$(KERNEL_ARCH) -name 'module.lds' -print; \ + find $$(find arch/$(KERNEL_ARCH) \( -name include -o -name scripts \) -type d -print) -print; \ + find include -name 'asm*' -prune -o -print; \ + find include/asm-generic -print; \ + ) \ + | \ + cpio -pd --preserve-modification-time '$(CURDIR)/$(DIR)' + + dh_link \ + /usr/lib/$(PACKAGE_NAME_KBUILD)/Kbuild $(BASE_DIR)/Kbuild \ + /usr/lib/$(PACKAGE_NAME_KBUILD)/scripts $(BASE_DIR)/scripts + + +$(MAKE_SELF) install-base + +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): REAL_VERSION = $(UPSTREAMVERSION)$(ABINAME)$(LOCALVERSION) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME = linux-headers-$(REAL_VERSION) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME_COMMON = linux-headers-$(UPSTREAMVERSION)$(ABINAME)-common$(LOCALVERSION_HEADERS) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME_KBUILD = linux-kbuild-$(VERSION) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DH_OPTIONS = -p$(PACKAGE_NAME) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): BASE_DIR = /usr/src/$(PACKAGE_NAME) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): BASE_DIR_COMMON = /usr/src/$(PACKAGE_NAME_COMMON) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): SOURCE_DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): REF_DIR = $(BUILD_DIR)/source_$(ARCH)_$(FEATURESET) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_DIR = debian/$(PACKAGE_NAME) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR = $(PACKAGE_DIR)/$(BASE_DIR) +install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE) + 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)/kernel/asm-offsets.s $(DIR)/arch/$(KERNEL_ARCH)/kernel + +ifeq ($(ARCH),powerpc) + 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 +endif + + @echo 'VERSION = 2' > $(DIR)/Makefile + @echo 'PATCHLEVEL = 6' >> $(DIR)/Makefile + + @echo 'MAKEARGS := -C $(BASE_DIR_COMMON) O=$(BASE_DIR)' >> $(DIR)/Makefile + @echo 'MAKEFLAGS += --no-print-directory' >> $(DIR)/Makefile + + @echo '.PHONY: all $$(MAKECMDGOALS)' >> $(DIR)/Makefile + @echo 'cmd := $$(filter-out all Makefile,$$(MAKECMDGOALS))' >> $(DIR)/Makefile + @echo 'all:' >> $(DIR)/Makefile + @echo ' @$$(MAKE) $$(MAKEARGS) $$(cmd)' >> $(DIR)/Makefile + @echo 'Makefile:;' >> $(DIR)/Makefile + @echo '$$(cmd) %/: all' >> $(DIR)/Makefile + @echo ' @:' >> $(DIR)/Makefile + + dh_link /usr/lib/$(PACKAGE_NAME_KBUILD)/scripts $(BASE_DIR)/scripts + + mkdir -p $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION) + ln -s /usr/src/$(PACKAGE_NAME) $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/build + ln -s /usr/src/$(PACKAGE_NAME_COMMON) $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/source + + install -d $(PACKAGE_DIR)/DEBIAN + sed -e 's/=V/$(REAL_VERSION)/g' \ + debian/templates/temp.headers.plain/postinst \ + > $(PACKAGE_DIR)/DEBIAN/postinst + chmod 755 $(PACKAGE_DIR)/DEBIAN/postinst + + +$(MAKE_SELF) install-base + +install-libc-dev_$(ARCH): PACKAGE_NAME = linux-libc-dev +install-libc-dev_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME) +install-libc-dev_$(ARCH): SOURCE_DIR = $(BUILD_DIR)/source +install-libc-dev_$(ARCH): DIR = $(BUILD_DIR)/build-libc-dev +install-libc-dev_$(ARCH): OUT_DIR = debian/$(PACKAGE_NAME)/usr +install-libc-dev_$(ARCH): + dh_testdir + dh_testroot + dh_prep + rm -rf '$(DIR)' + mkdir $(DIR) + +$(MAKE_CLEAN) -C $(SOURCE_DIR) O='$(CURDIR)/$(DIR)' headers_check ARCH=$(KERNEL_ARCH) + +$(MAKE_CLEAN) -C $(SOURCE_DIR) O='$(CURDIR)/$(DIR)' headers_install ARCH=$(KERNEL_ARCH) INSTALL_HDR_PATH='$(CURDIR)'/$(OUT_DIR) + + find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) -execdir rm {} + + + +$(MAKE_SELF) install-base + +install-support: PACKAGE_NAME = linux-support-$(UPSTREAMVERSION)$(ABINAME) +install-support: DH_OPTIONS = -p$(PACKAGE_NAME) +install-support: PACKAGE_DIR = debian/$(PACKAGE_NAME) +install-support: PACKAGE_ROOT = /usr/share/$(PACKAGE_NAME) +install-support: + dh_testdir + dh_testroot + dh_prep + dh_installdirs $(PACKAGE_ROOT)/lib/python/debian_linux $(PACKAGE_ROOT)/modules + cp debian/config.defines.dump $(PACKAGE_DIR)$(PACKAGE_ROOT) + cp debian/lib/python/debian_linux/*.py $(PACKAGE_DIR)$(PACKAGE_ROOT)/lib/python/debian_linux + cp debian/modules/* $(PACKAGE_DIR)$(PACKAGE_ROOT)/modules + chmod a+x $(PACKAGE_DIR)$(PACKAGE_ROOT)/modules/gencontrol.py + dh_pysupport + dh_link $(PACKAGE_ROOT) /usr/src/$(PACKAGE_NAME) + +$(MAKE_SELF) install-base + +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): REAL_VERSION = $(UPSTREAMVERSION)$(ABINAME)$(LOCALVERSION) +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): PACKAGE_NAME = linux-image-$(REAL_VERSION) +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): PACKAGE_DIR = debian/$(PACKAGE_NAME) +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): INSTALL_DIR = $(PACKAGE_DIR)/boot +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): DH_OPTIONS = -p$(PACKAGE_NAME) +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE) + +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain: + dh_testdir + dh_testroot + dh_prep + dh_installdirs 'boot' + +$(MAKE_SELF) \ + install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_image \ + DIR='$(DIR)' PACKAGE_DIR='$(PACKAGE_DIR)' INSTALL_DIR='$(INSTALL_DIR)' REAL_VERSION='$(REAL_VERSION)' +ifeq ($(MODULES),True) + +$(MAKE_CLEAN) -C $(DIR) modules_install INSTALL_MOD_PATH='$(CURDIR)'/$(PACKAGE_DIR) +ifeq ($(DEBUG),True) + find $(PACKAGE_DIR) -name '*.ko' | sed 's|$(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/kernel/||' | while read module ; do \ + objcopy --add-gnu-debuglink=$(DIR)/$$module $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/kernel/$$module || exit; \ + done +endif + cp $(DIR)/.config $(PACKAGE_DIR)/boot/config-$(REAL_VERSION) + cp $(DIR)/System.map $(PACKAGE_DIR)/boot/System.map-$(REAL_VERSION) + rm $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/{build,source,modules.*} + rm $(PACKAGE_DIR)/lib/firmware -rf +endif + +$(MAKE_SELF) \ + install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_templates \ + PACKAGE_NAME='$(PACKAGE_NAME)' PACKAGE_DIR='$(PACKAGE_DIR)' REAL_VERSION='$(REAL_VERSION)' + +$(MAKE_SELF) \ + install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_bug \ + PACKAGE_DIR='$(PACKAGE_DIR)' PACKAGE_NAME='$(PACKAGE_NAME)' REAL_VERSION='$(REAL_VERSION)' + +$(MAKE_SELF) install-base + +install-image_arm_$(FEATURESET)_$(FLAVOUR)_plain_image \ +install-image_armel_$(FEATURESET)_$(FLAVOUR)_plain_image \ +install-image_sparc_$(FEATURESET)_$(FLAVOUR)_plain_image \ +install-image_sparc64_$(FEATURESET)_$(FLAVOUR)_plain_image \ +install-image_sh4_$(FEATURESET)_$(FLAVOUR)_plain_image: + install -m644 '$(DIR)/arch/$(KERNEL_ARCH)/boot/uImage' $(INSTALL_DIR)/uImage + +install-image_amd64_$(FEATURESET)_$(FLAVOUR)_plain_image \ +install-image_i386_$(FEATURESET)_$(FLAVOUR)_plain_image: + install -m644 '$(DIR)/arch/$(KERNEL_ARCH)/boot/bzImage' $(INSTALL_DIR)/vmlinuz-$(REAL_VERSION) + +install-image_alpha_$(FEATURESET)_$(FLAVOUR)_plain_image: + install -m644 '$(DIR)/arch/$(KERNEL_ARCH)/boot/vmlinux.gz' $(INSTALL_DIR)/vmlinuz-$(REAL_VERSION) + +install-image_ia64_$(FEATURESET)_$(FLAVOUR)_plain_image \ +install-image_m68k_$(FEATURESET)_$(FLAVOUR)_plain_image: + install -m644 '$(DIR)/vmlinux.gz' $(INSTALL_DIR)/vmlinuz-$(REAL_VERSION) + +install-image_hppa_$(FEATURESET)_$(FLAVOUR)_plain_image \ +install-image_mips_$(FEATURESET)_$(FLAVOUR)_plain_image \ +install-image_mipsel_$(FEATURESET)_$(FLAVOUR)_plain_image: + install -m644 '$(DIR)/vmlinux' $(INSTALL_DIR)/vmlinux-$(REAL_VERSION) + +install-image_powerpc_$(FEATURESET)_$(FLAVOUR)_plain_image: WRAPPER_INSTALL_DIR = '$(CURDIR)'/$(PACKAGE_DIR)/usr/lib/linux-image-$(REAL_VERSION) +install-image_powerpc_$(FEATURESET)_$(FLAVOUR)_plain_image: + install -m644 '$(DIR)/vmlinux' $(INSTALL_DIR)/vmlinux-$(REAL_VERSION) + +$(MAKE_CLEAN) -C '$(DIR)' bootwrapper_install \ + WRAPPER_OBJDIR='$(WRAPPER_INSTALL_DIR)' \ + WRAPPER_DTSDIR='$(WRAPPER_INSTALL_DIR)'/dts \ + WRAPPER_BINDIR='$(WRAPPER_INSTALL_DIR)' + +install-image_s390_$(FEATURESET)_$(FLAVOUR)_plain_image: + install -m644 '$(DIR)/arch/s390/boot/image' $(INSTALL_DIR)/vmlinuz-$(REAL_VERSION) + +ifneq ($(INITRAMFS),False) +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_templates: ARG_INITRD = YES +endif + +ARG_KIMAGE = vmlinuz +install-image_hppa_$(FEATURESET)_$(FLAVOUR)_plain_templates \ +install-image_mips_$(FEATURESET)_$(FLAVOUR)_plain_templates \ +install-image_mipsel_$(FEATURESET)_$(FLAVOUR)_plain_templates \ +install-image_powerpc_$(FEATURESET)_$(FLAVOUR)_plain_templates: ARG_KIMAGE = vmlinux + +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_templates: + for i in $(wildcard debian/templates/temp.image.plain/*); do \ + sed \ + -e 's@=B@$(KERNEL_ARCH)@g' \ + -e 's/=I/$(ARG_INITRD)/g' \ + -e 's/=K/$(ARG_KIMAGE)/g' \ + -e 's@=MK@$(INITRD_CMD)@g' \ + -e 's/=V/$(REAL_VERSION)/g' \ + $$i > debian/$(PACKAGE_NAME).$$(basename $$i) || exit; \ + done + mkdir -p debian/$(PACKAGE_NAME).po + for i in $(wildcard debian/po/*.po); do \ + sed \ + -e 's/=V/$(REAL_VERSION)/g' \ + $$i > debian/$(PACKAGE_NAME).po/$$(basename $$i) || exit; \ + done + mkdir -p debian/$(PACKAGE_NAME)/DEBIAN + po2debconf --podir debian/$(PACKAGE_NAME).po \ + -o debian/$(PACKAGE_NAME)/DEBIAN/templates \ + debian/$(PACKAGE_NAME).templates + +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_bug: + dh_installdirs usr/share/bug/$(PACKAGE_NAME) + dh_install debian/templates/image.plain.bug/* usr/share/bug/$(PACKAGE_NAME) + chmod 755 $(PACKAGE_DIR)/usr/share/bug/$(PACKAGE_NAME)/script + echo "RELEASE='$(REAL_VERSION)'" > $(PACKAGE_DIR)/usr/share/bug/$(PACKAGE_NAME)/info + +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-s390-tape: + dh_testdir + dh_testroot + dh_prep + dh_installdirs 'boot' + install -m644 '$(DIR)/arch/s390/boot/image' $(PACKAGE_DIR)/boot/vmlinuz-$(REAL_VERSION) + +$(MAKE_SELF) install-base + +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-xen: MODULES_PACKAGE_NAME = linux-modules-$(REAL_VERSION) +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-xen: MODULES_PACKAGE_DIR = debian/$(MODULES_PACKAGE_NAME) +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-xen: DH_OPTIONS = +install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-xen: + dh_testdir + dh_testroot + dh_prep + dh_installdirs -p$(PACKAGE_NAME) boot 'var/lib/$(PACKAGE_NAME)' + dh_installdirs -p$(MODULES_PACKAGE_NAME) boot + cp '$(DIR)'/arch/$(KERNEL_ARCH)/boot/vmlinuz $(INSTALL_DIR)/vmlinuz-$(REAL_VERSION) + +$(MAKE_CLEAN) -C $(DIR) modules_install INSTALL_MOD_PATH='$(CURDIR)'/$(MODULES_PACKAGE_DIR) + cp $(DIR)/.config $(MODULES_PACKAGE_DIR)/boot/config-$(REAL_VERSION) + cp $(DIR)/System.map $(MODULES_PACKAGE_DIR)/boot/System.map-$(REAL_VERSION) + rm $(MODULES_PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/{build,source} + dh_installmodules -p$(MODULES_PACKAGE_NAME) + for i in $(XEN_VERSIONS); do echo $$i; done > $(PACKAGE_DIR)/var/lib/$(PACKAGE_NAME)/xen-versions + install -d $(PACKAGE_DIR)/DEBIAN + echo /var/lib/$(PACKAGE_NAME)/xen-versions >> $(PACKAGE_DIR)/DEBIAN/conffiles + +$(MAKE_SELF) install-base DH_OPTIONS='-p$(PACKAGE_NAME) -p$(MODULES_PACKAGE_NAME)' + +install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): REAL_VERSION = $(UPSTREAMVERSION)$(ABINAME)$(LOCALVERSION) +install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME = linux-image-$(REAL_VERSION)-dbg +install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_DIR = debian/$(PACKAGE_NAME) +install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DEBUG_DIR = $(PACKAGE_DIR)/usr/lib/debug +install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) +install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DH_OPTIONS = -p$(PACKAGE_NAME) +install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE) + dh_testdir + dh_testroot + dh_prep + dh_installdirs usr/lib/debug usr/lib/debug/boot usr/share/lintian/overrides/ + sed -e 's/=V/$(REAL_VERSION)/g' \ + debian/templates/image-dbg.lintian-override.in \ + > $(PACKAGE_DIR)/usr/share/lintian/overrides/$(PACKAGE_NAME) + install -m644 $(DIR)/vmlinux $(DEBUG_DIR)/boot/vmlinux-$(REAL_VERSION) +ifeq ($(MODULES),True) + +$(MAKE_CLEAN) -C $(DIR) modules_install INSTALL_MOD_PATH='$(CURDIR)'/$(DEBUG_DIR) + rm $(DEBUG_DIR)/lib/modules/*/{build,source,modules.*} + rm $(DEBUG_DIR)/lib/firmware -rf +endif + +$(MAKE_SELF) install-base BUILDDEB_ARGS="-Zbzip2" + +install-tools_$(ARCH): PACKAGE_NAME = linux-tools-$(VERSION) +install-tools_$(ARCH): PACKAGE_DIR = debian/$(PACKAGE_NAME) +install-tools_$(ARCH): DIR = $(BUILD_DIR)/build-tools_$(ARCH) +install-tools_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME) +install-tools_$(ARCH): $(STAMPS_DIR)/build-tools_$(ARCH) + dh_testdir + dh_testroot + dh_prep + dh_installdirs usr/bin + +$(MAKE_CLEAN) -C '$(DIR)/tools/perf' $(MAKE_PERF_VARS) \ + DESTDIR='$(CURDIR)/$(PACKAGE_DIR)' install install-man + # Rename command and manual pages to include version + mv $(PACKAGE_DIR)/usr/bin/perf $(PACKAGE_DIR)/usr/bin/perf_$(VERSION) + for manpage in $(PACKAGE_DIR)/usr/share/man/*/*; do \ + mv "$$manpage" "$$(echo "$$manpage" | sed 's,/perf,&_$(VERSION),')" || exit; \ + done + # Fix up cross-references + sed -i '/^\.SH "SEE ALSO"/,/^\.SH/ { s/perf-/perf_$(VERSION)-/g }' \ + $(PACKAGE_DIR)/usr/share/man/*/* + dh_perl /usr/share/perf_$(VERSION)-core/scripts/perl/Perf-Trace-Util/lib/ + dh_pysupport /usr/share/perf_$(VERSION)-core/scripts/python/Perf-Trace-Util/lib/ + +$(MAKE_SELF) install-base + +install-patch: PACKAGE = linux-patch-debian-$(VERSION) +install-patch: pbase := /usr/src/kernel-patches/all/$(UPSTREAMVERSION) +install-patch: pfull := debian/$(PACKAGE)$(pbase) +install-patch: DH_OPTIONS = -p$(PACKAGE) +install-patch: + dh_testdir + dh_testroot + dh_prep + dh_installdirs '$(pbase)/apply' '$(pbase)/debian' '$(pbase)/unpatch' + dh_install -X.svn debian/patches/* '$(pbase)/debian' + install debian/bin/patch.apply '$(pfull)/apply/debian' + install debian/templates/patch.unpatch '$(pfull)/unpatch/debian' + find '$(pfull)/debian' ! -path '*/series/*' -type f -execdir bzip2 '{}' ';' -execdir chmod 644 '{}.bz2' ';' + +$(MAKE_SELF) install-base + +install-source: DH_OPTIONS = -plinux-source-$(VERSION) +install-source: $(BUILD_DIR)/linux-source-$(UPSTREAMVERSION).tar.bz2 + dh_testdir + dh_testroot + dh_install '$<' /usr/src + +$(MAKE_SELF) install-base + +install-firmware: PACKAGE_NAME = firmware-linux-free +install-firmware: DIR = $(BUILD_DIR)/build-firmware +install-firmware: SOURCE_DIR = $(BUILD_DIR)/source +install-firmware: PACKAGE_DIR = debian/$(PACKAGE_NAME) +install-firmware: DH_OPTIONS := -p$(PACKAGE_NAME) +install-firmware: $(STAMPS_DIR)/source + dh_testdir + dh_testroot + dh_prep + rm -rf '$(DIR)' + mkdir '$(DIR)' + +$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' INSTALL_MOD_PATH='$(CURDIR)'/$(PACKAGE_DIR) firmware_install + +$(MAKE_SELF) install-base + +install-linux-base: PACKAGE_NAME = linux-base +install-linux-base: DH_OPTIONS := -p$(PACKAGE_NAME) +install-linux-base: + dh_testdir + dh_testroot + dh_prep + dh_install debian/bin/perf /usr/bin + dh_installman debian/perf.1 + dh_installdebconf + +$(MAKE_SELF) install-base + +# vim: filetype=make |