]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - debian/rules.d/2-binary-arch.mk
UBUNTU: [Debian] handle dts directories
[mirror_ubuntu-zesty-kernel.git] / debian / rules.d / 2-binary-arch.mk
CommitLineData
356bd1e1
LO
1# We don't want make removing intermediary stamps
2.SECONDARY :
3
4# Prepare the out-of-tree build directory
5ifeq ($(do_full_source),true)
6build_cd = cd $(builddir)/build-$*; #
7build_O =
8else
9build_cd =
10build_O = O=$(builddir)/build-$*
11endif
12
e4bc6fcd
TG
13# Typically supplied from the arch makefile, e.g., debian.master/control.d/armhf.mk
14ifneq ($(gcc),)
15kmake += CC=$(CROSS_COMPILE)$(gcc)
16endif
17
356bd1e1
LO
18$(stampdir)/stamp-prepare-%: config-prepare-check-%
19 @echo Debug: $@
20 @touch $@
21$(stampdir)/stamp-prepare-tree-%: target_flavour = $*
22$(stampdir)/stamp-prepare-tree-%: $(commonconfdir)/config.common.$(family) $(archconfdir)/config.common.$(arch) $(archconfdir)/config.flavour.%
23 @echo Debug: $@
24 install -d $(builddir)/build-$*
25 touch $(builddir)/build-$*/ubuntu-build
26 [ "$(do_full_source)" != 'true' ] && true || \
27 rsync -a --exclude debian --exclude debian.master --exclude $(DEBIAN) * $(builddir)/build-$*
28 cat $^ | sed -e 's/.*CONFIG_VERSION_SIGNATURE.*/CONFIG_VERSION_SIGNATURE="Ubuntu $(release)-$(revision)-$* $(raw_kernelversion)"/' > $(builddir)/build-$*/.config
29 find $(builddir)/build-$* -name "*.ko" | xargs rm -f
30 $(build_cd) $(kmake) $(build_O) -j1 silentoldconfig prepare scripts
31 touch $@
32
33# Used by developers as a shortcut to prepare a tree for compilation.
34prepare-%: $(stampdir)/stamp-prepare-%
35 @echo Debug: $@
36# Used by developers to allow efficient pre-building without fakeroot.
37build-%: $(stampdir)/stamp-build-%
38 @echo Debug: $@
39
40# Do the actual build, including image and modules
41$(stampdir)/stamp-build-%: target_flavour = $*
1654c4a0 42$(stampdir)/stamp-build-%: bldimg = $(call custom_override,build_image,$*)
638ad766 43$(stampdir)/stamp-build-%: dtb_target = $(dtb_files_$*)
356bd1e1 44$(stampdir)/stamp-build-%: $(stampdir)/stamp-prepare-%
1654c4a0 45 @echo Debug: $@ build_image $(build_image) bldimg $(bldimg)
3a5dffbc 46 $(build_cd) $(kmake) $(build_O) $(conc_level) $(bldimg) modules $(if $(dtb_target),dtbs)
356bd1e1
LO
47 @touch $@
48
49# Install the finished build
50install-%: pkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*
51install-%: pkgdir_ex = $(CURDIR)/debian/$(extra_pkg_name)-$*
52install-%: bindoc = $(pkgdir)/usr/share/doc/$(bin_pkg_name)-$*
53install-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym
8546fa06 54install-%: signed = $(CURDIR)/debian/$(bin_pkg_name)-signed
7a15fdcc 55install-%: toolspkgdir = $(CURDIR)/debian/$(tools_flavour_pkg_name)-$*
d974f731 56install-%: cloudpkgdir = $(CURDIR)/debian/$(cloud_flavour_pkg_name)-$*
356bd1e1 57install-%: basepkg = $(hdrs_pkg_name)
24ce9f98 58install-%: indeppkg = $(indep_hdrs_pkg_name)
1654c4a0
BC
59install-%: kernfile = $(call custom_override,kernel_file,$*)
60install-%: instfile = $(call custom_override,install_file,$*)
356bd1e1
LO
61install-%: hdrdir = $(CURDIR)/debian/$(basepkg)-$*/usr/src/$(basepkg)-$*
62install-%: target_flavour = $*
638ad766 63install-%: dtb_files = $(dtb_files_$*)
185d905b
TG
64install-%: CONFIG_MODULE_SIG_HASH=sha512
65install-%: MODSECKEY=$(builddir)/build-$*/signing_key.priv
66install-%: MODPUBKEY=$(builddir)/build-$*/signing_key.x509
356bd1e1 67install-%: checks-%
1654c4a0 68 @echo Debug: $@ kernel_file $(kernel_file) kernfile $(kernfile) install_file $(install_file) instfile $(instfile)
356bd1e1
LO
69 dh_testdir
70 dh_testroot
71 dh_clean -k -p$(bin_pkg_name)-$*
72 dh_clean -k -p$(hdrs_pkg_name)-$*
1654c4a0 73ifneq ($(skipdbg),true)
356bd1e1 74 dh_clean -k -p$(dbg_pkg_name)-$*
1654c4a0 75endif
356bd1e1
LO
76
77 # The main image
78 # compress_file logic required because not all architectures
79 # generate a zImage automatically out of the box
80ifeq ($(compress_file),)
1654c4a0
BC
81 install -m600 -D $(builddir)/build-$*/$(kernfile) \
82 $(pkgdir)/boot/$(instfile)-$(abi_release)-$*
356bd1e1
LO
83else
84 install -d $(pkgdir)/boot
1654c4a0
BC
85 gzip -c9v $(builddir)/build-$*/$(kernfile) > \
86 $(pkgdir)/boot/$(instfile)-$(abi_release)-$*
87 chmod 600 $(pkgdir)/boot/$(instfile)-$(abi_release)-$*
356bd1e1
LO
88endif
89
57fd1ec6 90ifeq ($(uefi_signed),true)
8546fa06
AW
91 install -d $(signed)/$(release)-$(revision)
92 # Check to see if this supports handoff, if not do not sign it.
93 # Check the identification area magic and version >= 0x020b
f722d17d 94 handoff=`dd if="$(pkgdir)/boot/$(instfile)-$(abi_release)-$*" bs=1 skip=514 count=6 2>/dev/null | od -s | gawk '($$1 == 0 && $$2 == 25672 && $$3 == 21362 && $$4 >= 523) { print "GOOD" }'`; \
c8ff1457 95 if [ "$$handoff" = "GOOD" ]; then \
1654c4a0
BC
96 cp -p $(pkgdir)/boot/$(instfile)-$(abi_release)-$* \
97 $(signed)/$(release)-$(revision)/$(instfile)-$(abi_release)-$*.efi; \
c8ff1457 98 fi
8546fa06
AW
99endif
100
356bd1e1
LO
101 install -m644 $(builddir)/build-$*/.config \
102 $(pkgdir)/boot/config-$(abi_release)-$*
103 install -m644 $(abidir)/$* \
104 $(pkgdir)/boot/abi-$(abi_release)-$*
105 install -m600 $(builddir)/build-$*/System.map \
106 $(pkgdir)/boot/System.map-$(abi_release)-$*
638ad766 107 if [ "$(dtb_files)" ]; then \
356bd1e1 108 install -d $(pkgdir)/lib/firmware/$(abi_release)-$*/device-tree; \
638ad766 109 for dtb_file in $(dtb_files); do \
3a5dffbc 110 install -d `dirname $(pkgdir)/lib/firmware/$(abi_release)-$*/device-tree/$$dtb_file`; \
638ad766
PP
111 install -m644 $(builddir)/build-$*/arch/$(build_arch)/boot/dts/$$dtb_file \
112 $(pkgdir)/lib/firmware/$(abi_release)-$*/device-tree/$$dtb_file; \
34e3e9dd
TG
113 echo "device-tree/$$dtb_file ?" >> $(DEBIAN)/d-i/firmware/kernel-image; \
114 done; \
356bd1e1
LO
115 fi
116ifeq ($(no_dumpfile),)
117 makedumpfile -g $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$* \
118 -x $(builddir)/build-$*/vmlinux
119 chmod 0600 $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$*
120endif
121
d974f731 122 $(build_cd) $(kmake) $(build_O) $(conc_level) modules_install $(vdso) \
356bd1e1
LO
123 INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=$(pkgdir)/ \
124 INSTALL_FW_PATH=$(pkgdir)/lib/firmware/$(abi_release)-$*
125
03a6a968 126ifeq ($(do_extras_package),true)
356bd1e1
LO
127 #
128 # Remove all modules not in the inclusion list.
129 #
130 if [ -f $(DEBIAN)/control.d/$(target_flavour).inclusion-list ] ; then \
131 mkdir -p $(pkgdir_ex)/lib/modules/$(abi_release)-$*; \
132 mv $(pkgdir)/lib/modules/$(abi_release)-$*/kernel \
133 $(pkgdir_ex)/lib/modules/$(abi_release)-$*/kernel; \
134 $(SHELL) $(DROOT)/scripts/module-inclusion --master \
135 $(pkgdir_ex)/lib/modules/$(abi_release)-$*/kernel \
136 $(pkgdir)/lib/modules/$(abi_release)-$*/kernel \
137 $(DEBIAN)/control.d/$(target_flavour).inclusion-list 2>&1 | \
138 tee $(target_flavour).inclusion-list.log; \
139 /sbin/depmod -b $(pkgdir) -ea -F $(pkgdir)/boot/System.map-$(abi_release)-$* \
140 $(abi_release)-$* 2>&1 |tee $(target_flavour).depmod.log; \
2a6b01a0
SB
141 if [ `grep -c 'unknown symbol' $(target_flavour).depmod.log` -gt 0 ]; then \
142 echo "EE: Unresolved module dependencies in base package!"; \
143 exit 1; \
144 fi \
356bd1e1 145 fi
03a6a968 146endif
356bd1e1
LO
147
148ifeq ($(no_dumpfile),)
149 makedumpfile -g $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$* \
150 -x $(builddir)/build-$*/vmlinux
151 chmod 0600 $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$*
152endif
153 rm -f $(pkgdir)/lib/modules/$(abi_release)-$*/build
154 rm -f $(pkgdir)/lib/modules/$(abi_release)-$*/source
155
156 # Some initramfs-tools specific modules
157 install -d $(pkgdir)/lib/modules/$(abi_release)-$*/initrd
158 if [ -f $(pkgdir)/lib/modules/$(abi_release)-$*/kernel/drivers/video/vesafb.ko ]; then\
f8e4778e 159 $(LN) $(pkgdir)/lib/modules/$(abi_release)-$*/kernel/drivers/video/vesafb.ko \
356bd1e1
LO
160 $(pkgdir)/lib/modules/$(abi_release)-$*/initrd/; \
161 fi
162
163 # Now the image scripts
164 install -d $(pkgdir)/DEBIAN
165 for script in postinst postrm preinst prerm; do \
1654c4a0 166 sed -e 's/=V/$(abi_release)-$*/g' -e 's/=K/$(instfile)/g' \
356bd1e1
LO
167 -e 's/=L/$(loader)/g' -e 's@=B@$(build_arch)@g' \
168 $(DROOT)/control-scripts/$$script > $(pkgdir)/DEBIAN/$$script; \
169 chmod 755 $(pkgdir)/DEBIAN/$$script; \
170 done
03a6a968 171ifeq ($(do_extras_package),true)
356bd1e1
LO
172 # Install the postinit/postrm scripts in the extras package.
173 if [ -f $(DEBIAN)/control.d/$(target_flavour).inclusion-list ] ; then \
174 install -d $(pkgdir_ex)/DEBIAN; \
175 for script in postinst postrm ; do \
1654c4a0 176 sed -e 's/=V/$(abi_release)-$*/g' -e 's/=K/$(instfile)/g' \
356bd1e1 177 -e 's/=L/$(loader)/g' -e 's@=B@$(build_arch)@g' \
ed79bb03 178 debian/control-scripts/extra-post > $(pkgdir_ex)/DEBIAN/$$script; \
356bd1e1
LO
179 chmod 755 $(pkgdir_ex)/DEBIAN/$$script; \
180 done; \
181 fi
03a6a968 182endif
356bd1e1
LO
183
184 # Install the full changelog.
185ifeq ($(do_doc_package),true)
186 install -d $(bindoc)
187 cat $(DEBIAN)/changelog $(DEBIAN)/changelog.historical | \
188 gzip -9 >$(bindoc)/changelog.Debian.old.gz
189 chmod 644 $(bindoc)/changelog.Debian.old.gz
190endif
191
192ifneq ($(skipsub),true)
193 for sub in $($(*)_sub); do \
194 if ! (TO=$$sub FROM=$* ABI_RELEASE=$(abi_release) $(SHELL) \
195 $(DROOT)/scripts/sub-flavour); then exit 1; fi; \
196 /sbin/depmod -b debian/$(bin_pkg_name)-$$sub \
197 -ea -F debian/$(bin_pkg_name)-$$sub/boot/System.map-$(abi_release)-$* \
198 $(abi_release)-$*; \
199 install -d debian/$(bin_pkg_name)-$$sub/DEBIAN; \
200 for script in postinst postrm preinst prerm; do \
201 sed -e 's/=V/$(abi_release)-$*/g' \
1654c4a0 202 -e 's/=K/$(instfile)/g' \
356bd1e1
LO
203 -e 's/=L/$(loader)/g' \
204 -e 's@=B@$(build_arch)@g' \
205 $(DROOT)/control-scripts/$$script > \
206 debian/$(bin_pkg_name)-$$sub/DEBIAN/$$script;\
207 chmod 755 debian/$(bin_pkg_name)-$$sub/DEBIAN/$$script;\
208 done; \
209 done
210endif
211
212ifneq ($(skipdbg),true)
213 # Debug image is simple
214 install -m644 -D $(builddir)/build-$*/vmlinux \
215 $(dbgpkgdir)/usr/lib/debug/boot/vmlinux-$(abi_release)-$*
d974f731 216 $(build_cd) $(kmake) $(build_O) modules_install $(vdso) \
356bd1e1
LO
217 INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
218 # Add .gnu_debuglink sections to each stripped .ko
219 # pointing to unstripped verson
220 find $(pkgdir) -name '*.ko' | sed 's|$(pkgdir)||'| while read module ; do \
221 if [[ -f "$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \
222 $(CROSS_COMPILE)objcopy \
223 --add-gnu-debuglink=$(dbgpkgdir)/usr/lib/debug/$$module \
224 $(pkgdir)/$$module; \
185d905b
TG
225 scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODSECKEY) $(MODPUBKEY) \
226 $(pkgdir)/$$module; \
356bd1e1
LO
227 fi; \
228 done
229 rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/build
230 rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/source
231 rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/modules.*
232 rm -fr $(dbgpkgdir)/usr/lib/debug/lib/firmware
233endif
234
235 # The flavour specific headers image
236 # TODO: Would be nice if we didn't have to dupe the original builddir
237 install -d -m755 $(hdrdir)
238 cat $(builddir)/build-$*/.config | \
239 sed -e 's/.*CONFIG_DEBUG_INFO=.*/# CONFIG_DEBUG_INFO is not set/g' > \
240 $(hdrdir)/.config
241 chmod 644 $(hdrdir)/.config
242 $(kmake) O=$(hdrdir) -j1 silentoldconfig prepare scripts
243 # We'll symlink this stuff
244 rm -f $(hdrdir)/Makefile
a680add4 245 rm -rf $(hdrdir)/include2 $(hdrdir)/source
356bd1e1
LO
246 # Copy over the compilation version.
247 cp "$(builddir)/build-$*/include/generated/compile.h" \
248 "$(hdrdir)/include/generated/compile.h"
d974f731
TG
249 # Add UTS_UBUNTU_RELEASE_ABI since UTS_RELEASE is difficult to parse.
250 echo "#define UTS_UBUNTU_RELEASE_ABI $(abinum)" >> $(hdrdir)/include/generated/utsrelease.h
251 # powerpc kernel arch seems to need some .o files for external module linking. Add them in.
252ifeq ($(build_arch),powerpc)
356bd1e1
LO
253 mkdir -p $(hdrdir)/arch/powerpc/lib
254 cp $(builddir)/build-$*/arch/powerpc/lib/*.o $(hdrdir)/arch/powerpc/lib
255endif
256 # Script to symlink everything up
24ce9f98 257 $(SHELL) $(DROOT)/scripts/link-headers "$(hdrdir)" "$(indeppkg)" "$*"
356bd1e1
LO
258 # The build symlink
259 install -d debian/$(basepkg)-$*/lib/modules/$(abi_release)-$*
f8e4778e 260 $(LN) /usr/src/$(basepkg)-$* \
356bd1e1
LO
261 debian/$(basepkg)-$*/lib/modules/$(abi_release)-$*/build
262 # And finally the symvers
263 install -m644 $(builddir)/build-$*/Module.symvers \
264 $(hdrdir)/Module.symvers
265
266 # Now the header scripts
267 install -d $(CURDIR)/debian/$(basepkg)-$*/DEBIAN
268 for script in postinst; do \
1654c4a0 269 sed -e 's/=V/$(abi_release)-$*/g' -e 's/=K/$(instfile)/g' \
356bd1e1
LO
270 $(DROOT)/control-scripts/headers-$$script > \
271 $(CURDIR)/debian/$(basepkg)-$*/DEBIAN/$$script; \
272 chmod 755 $(CURDIR)/debian/$(basepkg)-$*/DEBIAN/$$script; \
273 done
274
275 # At the end of the package prep, call the tests
276 DPKG_ARCH="$(arch)" KERN_ARCH="$(build_arch)" FLAVOUR="$*" \
277 VERSION="$(abi_release)" REVISION="$(revision)" \
278 PREV_REVISION="$(prev_revision)" ABI_NUM="$(abinum)" \
279 PREV_ABI_NUM="$(prev_abinum)" BUILD_DIR="$(builddir)/build-$*" \
280 INSTALL_DIR="$(pkgdir)" SOURCE_DIR="$(CURDIR)" \
43dc2315 281 run-parts -v $(DROOT)/tests-build
356bd1e1
LO
282
283 #
284 # Remove files which are generated at installation by postinst,
285 # except for modules.order and modules.builtin
286 #
287 # NOTE: need to keep this list in sync with postrm
288 #
289 mkdir $(pkgdir)/lib/modules/$(abi_release)-$*/_
290 mv $(pkgdir)/lib/modules/$(abi_release)-$*/modules.order \
291 $(pkgdir)/lib/modules/$(abi_release)-$*/_
292 if [ -f $(pkgdir)/lib/modules/$(abi_release)-$*/modules.builtin ] ; then \
293 mv $(pkgdir)/lib/modules/$(abi_release)-$*/modules.builtin \
294 $(pkgdir)/lib/modules/$(abi_release)-$*/_; \
295 fi
296 rm -f $(pkgdir)/lib/modules/$(abi_release)-$*/modules.*
297 mv $(pkgdir)/lib/modules/$(abi_release)-$*/_/* \
298 $(pkgdir)/lib/modules/$(abi_release)-$*
299 rmdir $(pkgdir)/lib/modules/$(abi_release)-$*/_
300
d974f731
TG
301ifeq ($(do_linux_tools),true)
302 # Create the linux-tools tool links
303 install -d $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
e66f5b2a 304ifeq ($(do_tools_usbip),true)
f8e4778e
TG
305 $(LN) ../../$(src_pkg_name)-tools-$(abi_release)/usbip $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
306 $(LN) ../../$(src_pkg_name)-tools-$(abi_release)/usbipd $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
e66f5b2a 307endif
d974f731 308ifeq ($(do_tools_cpupower),true)
f8e4778e 309 $(LN) ../../$(src_pkg_name)-tools-$(abi_release)/cpupower $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
d974f731
TG
310endif
311ifeq ($(do_tools_perf),true)
f8e4778e 312 $(LN) ../../$(src_pkg_name)-tools-$(abi_release)/perf $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
d974f731
TG
313endif
314ifeq ($(do_tools_x86),true)
f8e4778e
TG
315 $(LN) ../../$(src_pkg_name)-tools-$(abi_release)/x86_energy_perf_policy $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
316 $(LN) ../../$(src_pkg_name)-tools-$(abi_release)/turbostat $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
d974f731
TG
317endif
318endif
319ifeq ($(do_cloud_tools),true)
320ifeq ($(do_tools_hyperv),true)
321 # Create the linux-hyperv tool links
322 install -d $(cloudpkgdir)/usr/lib/linux-tools/$(abi_release)-$*
f8e4778e
TG
323 $(LN) ../../$(src_pkg_name)-tools-$(abi_release)/hv_kvp_daemon $(cloudpkgdir)/usr/lib/linux-tools/$(abi_release)-$*
324 $(LN) ../../$(src_pkg_name)-tools-$(abi_release)/hv_vss_daemon $(cloudpkgdir)/usr/lib/linux-tools/$(abi_release)-$*
325 $(LN) ../../$(src_pkg_name)-tools-$(abi_release)/hv_fcopy_daemon $(cloudpkgdir)/usr/lib/linux-tools/$(abi_release)-$*
d974f731
TG
326endif
327endif
7a15fdcc 328
356bd1e1
LO
329headers_tmp := $(CURDIR)/debian/tmp-headers
330headers_dir := $(CURDIR)/debian/linux-libc-dev
331
332hmake := $(MAKE) -C $(CURDIR) O=$(headers_tmp) \
333 KERNELVERSION=$(abi_release) INSTALL_HDR_PATH=$(headers_tmp)/install \
334 SHELL="$(SHELL)" ARCH=$(header_arch)
335
336install-arch-headers:
337 @echo Debug: $@
338 dh_testdir
339 dh_testroot
340 dh_clean -k -plinux-libc-dev
341
342 rm -rf $(headers_tmp)
343 install -d $(headers_tmp) $(headers_dir)/usr/include/
344
345 $(hmake) $(defconfig)
346 mv $(headers_tmp)/.config $(headers_tmp)/.config.old
347 sed -e 's/^# \(CONFIG_MODVERSIONS\) is not set$$/\1=y/' \
348 -e 's/.*CONFIG_LOCALVERSION_AUTO.*/# CONFIG_LOCALVERSION_AUTO is not set/' \
349 $(headers_tmp)/.config.old > $(headers_tmp)/.config
350 $(hmake) silentoldconfig
02debf28 351 $(hmake) headers_install
356bd1e1
LO
352
353 ( cd $(headers_tmp)/install/include/ && \
354 find . -name '.' -o -name '.*' -prune -o -print | \
355 cpio -pvd --preserve-modification-time \
356 $(headers_dir)/usr/include/ )
357 mkdir $(headers_dir)/usr/include/$(DEB_HOST_MULTIARCH)
358 mv $(headers_dir)/usr/include/asm $(headers_dir)/usr/include/$(DEB_HOST_MULTIARCH)/
359
360 rm -rf $(headers_tmp)
361
362binary-arch-headers: install-arch-headers
363 @echo Debug: $@
364 dh_testdir
365 dh_testroot
366ifeq ($(do_libc_dev_package),true)
367ifneq ($(DEBIAN),debian.master)
368 echo "non-master branch building linux-libc-dev, aborting"
369 exit 1
370endif
371 dh_installchangelogs -plinux-libc-dev
372 dh_installdocs -plinux-libc-dev
373 dh_compress -plinux-libc-dev
374 dh_fixperms -plinux-libc-dev
375 dh_installdeb -plinux-libc-dev
376 $(lockme) dh_gencontrol -plinux-libc-dev -- $(libc_dev_version)
377 dh_md5sums -plinux-libc-dev
378 dh_builddeb -plinux-libc-dev
379endif
380
381binary-%: pkgimg = $(bin_pkg_name)-$*
382binary-%: pkgimg_ex = $(extra_pkg_name)-$*
383binary-%: pkghdr = $(hdrs_pkg_name)-$*
384binary-%: dbgpkg = $(bin_pkg_name)-$*-dbgsym
385binary-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym
7a15fdcc 386binary-%: pkgtools = $(tools_flavour_pkg_name)-$*
d974f731 387binary-%: pkgcloud = $(cloud_flavour_pkg_name)-$*
356bd1e1
LO
388binary-%: target_flavour = $*
389binary-%: install-%
390 @echo Debug: $@
391 dh_testdir
392 dh_testroot
393
394 dh_installchangelogs -p$(pkgimg)
395 dh_installdocs -p$(pkgimg)
396 dh_compress -p$(pkgimg)
397 dh_fixperms -p$(pkgimg) -X/boot/
398 dh_installdeb -p$(pkgimg)
399 dh_shlibdeps -p$(pkgimg)
400 $(lockme) dh_gencontrol -p$(pkgimg)
401 dh_md5sums -p$(pkgimg)
402 dh_builddeb -p$(pkgimg) -- -Zbzip2 -z9
403
03a6a968 404ifeq ($(do_extras_package),true)
356bd1e1
LO
405 if [ -f $(DEBIAN)/control.d/$(target_flavour).inclusion-list ] ; then \
406 dh_installchangelogs -p$(pkgimg_ex); \
407 dh_installdocs -p$(pkgimg_ex); \
408 dh_compress -p$(pkgimg_ex); \
409 dh_fixperms -p$(pkgimg_ex) -X/boot/; \
410 dh_installdeb -p$(pkgimg_ex); \
411 dh_shlibdeps -p$(pkgimg_ex); \
412 $(lockme) dh_gencontrol -p$(pkgimg_ex); \
413 dh_md5sums -p$(pkgimg_ex); \
414 dh_builddeb -p$(pkgimg_ex) -- -Zbzip2 -z9; \
415 fi
03a6a968 416endif
356bd1e1
LO
417
418 dh_installchangelogs -p$(pkghdr)
419 dh_installdocs -p$(pkghdr)
420 dh_compress -p$(pkghdr)
421 dh_fixperms -p$(pkghdr)
422 dh_shlibdeps -p$(pkghdr)
423 dh_installdeb -p$(pkghdr)
424 $(lockme) dh_gencontrol -p$(pkghdr)
425 dh_md5sums -p$(pkghdr)
426 dh_builddeb -p$(pkghdr)
427
428ifneq ($(skipsub),true)
429 @set -e; for sub in $($(*)_sub); do \
430 pkg=$(bin_pkg_name)-$$sub; \
431 dh_installchangelogs -p$$pkg; \
432 dh_installdocs -p$$pkg; \
433 dh_compress -p$$pkg; \
434 dh_fixperms -p$$pkg -X/boot/; \
435 dh_shlibdeps -p$$pkg; \
436 dh_installdeb -p$$pkg; \
437 $(lockme) dh_gencontrol -p$$pkg; \
438 dh_md5sums -p$$pkg; \
439 dh_builddeb -p$$pkg; \
440 done
441endif
442
443ifneq ($(skipdbg),true)
444 dh_installchangelogs -p$(dbgpkg)
445 dh_installdocs -p$(dbgpkg)
446 dh_compress -p$(dbgpkg)
447 dh_fixperms -p$(dbgpkg)
448 dh_installdeb -p$(dbgpkg)
449 $(lockme) dh_gencontrol -p$(dbgpkg)
450 dh_md5sums -p$(dbgpkg)
451 dh_builddeb -p$(dbgpkg)
452
453 # Hokay...here's where we do a little twiddling...
454 # Renaming the debug package prevents it from getting into
455 # the primary archive, and therefore prevents this very large
456 # package from being mirrored. It is instead, through some
457 # archive admin hackery, copied to http://ddebs.ubuntu.com.
458 #
459 mv ../$(dbgpkg)_$(release)-$(revision)_$(arch).deb \
460 ../$(dbgpkg)_$(release)-$(revision)_$(arch).ddeb
461 set -e; \
462 ( \
463 $(lockme_cmd) 9 || exit 1; \
464 if grep -qs '^Build-Debug-Symbols: yes$$' /CurrentlyBuilding; then \
465 sed -i '/^$(dbgpkg)_/s/\.deb /.ddeb /' debian/files; \
466 else \
467 grep -v '^$(dbgpkg)_.*$$' debian/files > debian/files.new; \
468 mv debian/files.new debian/files; \
469 fi; \
470 ) 9>$(lockme_file)
471 # Now, the package wont get into the archive, but it will get put
472 # into the debug system.
473endif
7a15fdcc 474
d974f731 475ifeq ($(do_linux_tools),true)
7a15fdcc
AW
476 dh_installchangelogs -p$(pkgtools)
477 dh_installdocs -p$(pkgtools)
478 dh_compress -p$(pkgtools)
479 dh_fixperms -p$(pkgtools)
480 dh_shlibdeps -p$(pkgtools)
481 dh_installdeb -p$(pkgtools)
482 $(lockme) dh_gencontrol -p$(pkgtools)
483 dh_md5sums -p$(pkgtools)
484 dh_builddeb -p$(pkgtools)
485endif
d974f731
TG
486ifeq ($(do_cloud_tools),true)
487 dh_installchangelogs -p$(pkgcloud)
488 dh_installdocs -p$(pkgcloud)
489 dh_compress -p$(pkgcloud)
490 dh_fixperms -p$(pkgcloud)
491 dh_shlibdeps -p$(pkgcloud)
492 dh_installdeb -p$(pkgcloud)
493 $(lockme) dh_gencontrol -p$(pkgcloud)
494 dh_md5sums -p$(pkgcloud)
495 dh_builddeb -p$(pkgcloud)
496endif
7a15fdcc 497
356bd1e1
LO
498ifneq ($(full_build),false)
499 # Clean out this flavours build directory.
500 rm -rf $(builddir)/build-$*
501 # Clean out the debugging package source directory.
502 rm -rf $(dbgpkgdir)
503endif
504
505#
506# per-architecture packages
507#
508builddirpa = $(builddir)/tools-perarch
509
510$(stampdir)/stamp-prepare-perarch:
511 @echo Debug: $@
d974f731 512ifeq ($(do_any_tools),true)
356bd1e1
LO
513 rm -rf $(builddirpa)
514 install -d $(builddirpa)
f8e4778e 515 for i in *; do $(LN) $(CURDIR)/$$i $(builddirpa); done
356bd1e1
LO
516 rm $(builddirpa)/tools
517 rsync -a tools/ $(builddirpa)/tools/
518endif
519 touch $@
520
d974f731 521$(stampdir)/stamp-build-perarch: $(stampdir)/stamp-prepare-perarch install-arch-headers
356bd1e1 522 @echo Debug: $@
d974f731 523ifeq ($(do_linux_tools),true)
e66f5b2a
TG
524ifeq ($(do_tools_usbip),true)
525 chmod 755 $(builddirpa)/tools/usb/usbip/autogen.sh
526 cd $(builddirpa)/tools/usb/usbip && ./autogen.sh
527 chmod 755 $(builddirpa)/tools/usb/usbip/configure
528 cd $(builddirpa)/tools/usb/usbip && ./configure --prefix=$(builddirpa)/tools/usb/usbip/bin
529 cd $(builddirpa)/tools/usb/usbip && make install CFLAGS="-g -O2 -static" CROSS_COMPILE=$(CROSS_COMPILE)
530endif
d974f731 531ifeq ($(do_tools_cpupower),true)
9d8d17a0
KM
532 # Allow for multiple installed versions of cpupower and libcpupower.so:
533 # Override LIB_MIN in order to to generate a versioned .so named
534 # libcpupower.so.$(abi_release) and link cpupower with that.
535 make -C $(builddirpa)/tools/power/cpupower \
536 CROSS_COMPILE=$(CROSS_COMPILE) \
537 LIB_MIN=$(abi_release) CPUFREQ_BENCH=false
d974f731 538endif
7c7ab896 539ifeq ($(do_tools_perf),true)
356bd1e1 540 cd $(builddirpa)/tools/perf && \
cd38174a 541 make prefix=/usr HAVE_CPLUS_DEMANGLE=1 CROSS_COMPILE=$(CROSS_COMPILE) NO_LIBPYTHON=1 NO_LIBPERL=1 PYTHON=python2.7
7c7ab896 542endif
0a571ec9
AW
543ifeq ($(do_tools_x86),true)
544 cd $(builddirpa)/tools/power/x86/x86_energy_perf_policy && make CROSS_COMPILE=$(CROSS_COMPILE)
545 cd $(builddirpa)/tools/power/x86/turbostat && make CROSS_COMPILE=$(CROSS_COMPILE)
546endif
d974f731
TG
547endif
548ifeq ($(do_cloud_tools),true)
0a571ec9 549ifeq ($(do_tools_hyperv),true)
d974f731 550 cd $(builddirpa)/tools/hv && make CFLAGS="-I$(headers_dir)/usr/include -I$(headers_dir)/usr/include/$(DEB_HOST_MULTIARCH)" CROSS_COMPILE=$(CROSS_COMPILE) hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
0a571ec9 551endif
356bd1e1
LO
552endif
553 @touch $@
554
555install-perarch: toolspkgdir = $(CURDIR)/debian/$(tools_pkg_name)
d974f731 556install-perarch: cloudpkgdir = $(CURDIR)/debian/$(cloud_pkg_name)
356bd1e1
LO
557install-perarch: $(stampdir)/stamp-build-perarch
558 @echo Debug: $@
559 # Add the tools.
d974f731 560ifeq ($(do_linux_tools),true)
9d8d17a0 561 install -d $(toolspkgdir)/usr/lib
7a15fdcc 562 install -d $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
e66f5b2a
TG
563ifeq ($(do_tools_usbip),true)
564 install -m755 $(builddirpa)/tools/usb/usbip/bin/sbin/usbip \
565 $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
566 install -m755 $(builddirpa)/tools/usb/usbip/bin/sbin/usbipd \
567 $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
568endif
d974f731 569ifeq ($(do_tools_cpupower),true)
9d8d17a0 570 install -m755 $(builddirpa)/tools/power/cpupower/cpupower \
7a15fdcc 571 $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
9d8d17a0
KM
572 # Install only the full versioned libcpupower.so.$(abi_release), not
573 # the usual symlinks to it.
574 install -m644 $(builddirpa)/tools/power/cpupower/libcpupower.so.$(abi_release) \
575 $(toolspkgdir)/usr/lib/
d974f731 576endif
7c7ab896 577ifeq ($(do_tools_perf),true)
7a15fdcc 578 install -m755 $(builddirpa)/tools/perf/perf $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
7c7ab896 579endif
0a571ec9
AW
580ifeq ($(do_tools_x86),true)
581 install -m755 $(builddirpa)/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy \
7a15fdcc 582 $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
0a571ec9 583 install -m755 $(builddirpa)/tools/power/x86/turbostat/turbostat \
7a15fdcc 584 $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
0a571ec9 585endif
d974f731
TG
586endif
587ifeq ($(do_cloud_tools),true)
0a571ec9 588ifeq ($(do_tools_hyperv),true)
d974f731
TG
589 install -d $(cloudpkgdir)/usr/lib
590 install -d $(cloudpkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
0a571ec9 591 install -m755 $(builddirpa)/tools/hv/hv_kvp_daemon \
d974f731 592 $(cloudpkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
4031e55e 593 install -m755 $(builddirpa)/tools/hv/hv_vss_daemon \
d974f731
TG
594 $(cloudpkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
595 install -m755 $(builddirpa)/tools/hv/hv_fcopy_daemon \
596 $(cloudpkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
0a571ec9 597endif
356bd1e1
LO
598endif
599
600binary-perarch: toolspkg = $(tools_pkg_name)
d974f731 601binary-perarch: cloudpkg = $(cloud_pkg_name)
356bd1e1
LO
602binary-perarch: install-perarch
603 @echo Debug: $@
d974f731 604ifeq ($(do_linux_tools),true)
673fa39f 605 dh_strip -p$(toolspkg)
356bd1e1
LO
606 dh_installchangelogs -p$(toolspkg)
607 dh_installdocs -p$(toolspkg)
608 dh_compress -p$(toolspkg)
609 dh_fixperms -p$(toolspkg)
610 dh_shlibdeps -p$(toolspkg)
611 dh_installdeb -p$(toolspkg)
612 $(lockme) dh_gencontrol -p$(toolspkg)
613 dh_md5sums -p$(toolspkg)
614 dh_builddeb -p$(toolspkg)
615endif
d974f731
TG
616ifeq ($(do_cloud_tools),true)
617 dh_strip -p$(cloudpkg)
618 dh_installchangelogs -p$(cloudpkg)
619 dh_installdocs -p$(cloudpkg)
620 dh_compress -p$(cloudpkg)
621 dh_fixperms -p$(cloudpkg)
622 dh_shlibdeps -p$(cloudpkg)
623 dh_installdeb -p$(cloudpkg)
624 $(lockme) dh_gencontrol -p$(cloudpkg)
625 dh_md5sums -p$(cloudpkg)
626 dh_builddeb -p$(cloudpkg)
627endif
356bd1e1 628
8546fa06
AW
629binary-debs: signed = $(CURDIR)/debian/$(bin_pkg_name)-signed
630binary-debs: signedv = $(CURDIR)/debian/$(bin_pkg_name)-signed/$(release)-$(revision)
631binary-debs: signed_tar = $(src_pkg_name)_$(release)-$(revision)_$(arch).tar.gz
356bd1e1
LO
632binary-debs: binary-perarch $(addprefix binary-,$(flavours))
633 @echo Debug: $@
57fd1ec6 634ifeq ($(uefi_signed),true)
8546fa06
AW
635 echo $(release)-$(revision) > $(signedv)/version
636 cd $(signedv) && ls *.efi >flavours
637 cd $(signed) && tar czvf ../../../$(signed_tar) .
638 dpkg-distaddfile $(signed_tar) raw-uefi -
639endif
356bd1e1
LO
640
641build-arch-deps-$(do_flavour_image_package) += $(addprefix $(stampdir)/stamp-build-,$(flavours))
642build-arch: $(build-arch-deps-true)
643 @echo Debug: $@
644
645ifeq ($(AUTOBUILD),)
646binary-arch-deps-$(do_flavour_image_package) += binary-udebs
647else
648binary-arch-deps-$(do_flavour_image_package) = binary-debs
649endif
650binary-arch-deps-$(do_libc_dev_package) += binary-arch-headers
651ifneq ($(do_common_headers_indep),true)
652binary-arch-deps-$(do_flavour_header_package) += binary-headers
653endif
654binary-arch: $(binary-arch-deps-true)
655 @echo Debug: $@
656