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