diff --git a/debian/changelog b/debian/changelog index 1c0ba16e6..c1dc33d4f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -241,6 +241,11 @@ linux (4.17.4-1) UNRELEASED; urgency=medium - powerpc/lib/sstep: Fix building for powerpcspe - powerpc/lib/Makefile: Don't pull in quad.o for 32-bit kernels - linux-perf: Disable building for powerpcspe + * [powerpc,powerpcspe,ppc64] Fix cross-build (Closes: #903096): + - Introduce linux-bootwrapper- package containing boot wrapper + tools for the host architecture + - linux-image: Install symlinks to boot wrapper tools instead of the + native tools built by kbuild -- Sjoerd Simons Wed, 04 Jul 2018 10:25:57 +0200 diff --git a/debian/rules.d/Makefile b/debian/rules.d/Makefile index c7506d3e4..4a252c5ca 100644 --- a/debian/rules.d/Makefile +++ b/debian/rules.d/Makefile @@ -6,6 +6,11 @@ SUBDIRS = \ scripts \ tools +DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) +ifneq ($(filter powerpc powerpcspe ppc64,$(DEB_HOST_ARCH)),) + SUBDIRS += arch/powerpc/boot +endif + include $(top_rulesdir)/Makefile.inc # Build userland headers first diff --git a/debian/rules.d/arch/powerpc/boot/Makefile b/debian/rules.d/arch/powerpc/boot/Makefile new file mode 100644 index 000000000..ab8e9d74f --- /dev/null +++ b/debian/rules.d/arch/powerpc/boot/Makefile @@ -0,0 +1,11 @@ +PROGS = \ + addnote \ + hack-coff \ + mktree + +SCRIPTS = \ + wrapper + +include $(top_rulesdir)/Makefile.inc + +CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 diff --git a/debian/rules.real b/debian/rules.real index 746d08ace..200ae026d 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -85,6 +85,9 @@ ifneq ($(DO_TOOLS_VERSIONED),False) binary-arch-arch: install-perf endif endif + ifneq ($(filter powerpc powerpcspe ppc64,$(DEB_HOST_ARCH)),) + binary-arch-arch: install-bootwrapper + endif endif ifneq ($(DO_TOOLS_UNVERSIONED),False) binary-arch-arch: install-usbip install-cpupower install-liblockdep @@ -455,10 +458,20 @@ ifneq ($(filter arm64 armel armhf,$(ARCH)),) +$(MAKE_CLEAN) -C $(DIR) dtbs_install INSTALL_DTBS_PATH=$(CURDIR)/$(DT_INSTALL_DIR) endif ifneq ($(filter powerpc powerpcspe 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 '$(DIR)_bootwrapper' +$(MAKE_CLEAN) -C '$(DIR)' bootwrapper_install \ - WRAPPER_OBJDIR='$(CURDIR)/$(DT_INSTALL_DIR)' \ - WRAPPER_DTSDIR='$(CURDIR)/$(DT_INSTALL_DIR)'/dts \ - WRAPPER_BINDIR='$(CURDIR)/$(DT_INSTALL_DIR)' + WRAPPER_OBJDIR='$(CURDIR)/$(DT_INSTALL_DIR)' \ + WRAPPER_DTSDIR='$(CURDIR)/$(DT_INSTALL_DIR)/dts' \ + WRAPPER_BINDIR='$(CURDIR)/$(DIR)_bootwrapper' + for prog in '$(DIR)_bootwrapper'/*; do \ + prog="$$(basename $$prog)"; \ + ln -s ../linux-bootwrapper-$(ABINAME)/$$prog \ + '$(DT_INSTALL_DIR)'/$$prog; \ + done endif install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_bug: @@ -765,4 +778,22 @@ endif dh_md5sums dh_builddeb +install-bootwrapper: PACKAGE_NAME = linux-bootwrapper-$(ABINAME) +install-bootwrapper: DH_OPTIONS = -p$(PACKAGE_NAME) +install-bootwrapper: DIR = $(CURDIR)/debian/$(PACKAGE_NAME) +install-bootwrapper: $(STAMPS_DIR)/build-tools + dh_testdir + dh_testroot + dh_prep + $(call make-tools,arch/powerpc/boot) install DESTDIR=$(DIR) installdir=/usr/lib/$(PACKAGE_NAME) + dh_installchangelogs + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + # vim: filetype=make diff --git a/debian/templates/control.image.in b/debian/templates/control.image.in index 266757f55..8fdabe60b 100644 --- a/debian/templates/control.image.in +++ b/debian/templates/control.image.in @@ -1,6 +1,6 @@ Package: linux-image-@abiname@@localversion@ Build-Profiles: -Depends: kmod, linux-base (>= 4.3~), ${misc:Depends} +Depends: kmod, linux-base (>= 4.3~), linux-bootwrapper-@abiname@ [powerpc powerpcspe ppc64], ${misc:Depends} Recommends: firmware-linux-free, ${kernel:Recommends} Suggests: linux-doc-@version@, debian-kernel-handbook Description: Linux @upstreamversion@ for @class@ diff --git a/debian/templates/control.tools-versioned.in b/debian/templates/control.tools-versioned.in index e104dacf8..3899c7669 100644 --- a/debian/templates/control.tools-versioned.in +++ b/debian/templates/control.tools-versioned.in @@ -22,3 +22,12 @@ Description: Performance analysis tools for Linux @version@ . The linux-base package contains a 'perf' command which will invoke the appropriate version for the running kernel. + +Package: linux-bootwrapper-@abiname@ +Build-Profiles: +Architecture: powerpc powerpcspe ppc64 +Depends: ${shlibs:Depends}, ${misc:Depends} +Multi-Arch: foreign +Description: Boot wrapper tools for Linux @version@ on PowerPC + This package provides the 'wrapper' script and related tools needed + to process the Linux kernel image for use with some PowerPC platforms.