1 # We don't want make removing intermediary stamps
4 # Prepare the out-of-tree build directory
5 ifeq ($(do_full_source
),true
)
6 build_cd
= cd
$(builddir
)/build-
$*; #
10 build_O
= O
=$(builddir
)/build-
$*
13 # Typically supplied from the arch makefile, e.g., debian.master/control.d/armhf.mk
15 kmake
+= CC
=$(CROSS_COMPILE
)$(gcc
)
18 shlibdeps_opts
= $(if
$(CROSS_COMPILE
),-- -l
$(CROSS_COMPILE
:%-=/usr
/%)/lib
)
20 debian
/scripts
/fix-filenames
: debian
/scripts
/fix-filenames.c
23 $(stampdir
)/stamp-prepare-
%: config-prepare-check-
%
26 $(stampdir
)/stamp-prepare-tree-
%: target_flavour
= $*
27 $(stampdir
)/stamp-prepare-tree-
%: $(commonconfdir
)/config.common.
$(family
) $(archconfdir
)/config.common.
$(arch
) $(archconfdir
)/config.flavour.
% debian
/scripts
/fix-filenames
29 install -d
$(builddir
)/build-
$*
30 touch
$(builddir
)/build-
$*/ubuntu-build
31 [ "$(do_full_source)" != 'true' ] && true || \
32 rsync
-a
--exclude debian
--exclude debian.master
--exclude
$(DEBIAN
) * $(builddir
)/build-
$*
33 cat
$^ | sed
-e
's/.*CONFIG_VERSION_SIGNATURE.*/CONFIG_VERSION_SIGNATURE="Ubuntu $(release)-$(revision)-$* $(raw_kernelversion)"/' > $(builddir
)/build-
$*/.config
34 find
$(builddir
)/build-
$* -name
"*.ko" | xargs
rm -f
35 $(build_cd
) $(kmake
) $(build_O
) -j1 syncconfig prepare scripts
38 # Used by developers as a shortcut to prepare a tree for compilation.
39 prepare-
%: $(stampdir
)/stamp-prepare-
%
41 # Used by developers to allow efficient pre-building without fakeroot.
42 build-
%: $(stampdir
)/stamp-build-
%
45 # Do the actual build, including image and modules
46 $(stampdir
)/stamp-build-
%: target_flavour
= $*
47 $(stampdir
)/stamp-build-
%: bldimg
= $(call custom_override
,build_image
,$*)
48 $(stampdir
)/stamp-build-
%: $(stampdir
)/stamp-prepare-
%
49 @echo Debug
: $@ build_image
$(build_image
) bldimg
$(bldimg
)
50 $(build_cd
) $(kmake
) $(build_O
) $(conc_level
) $(bldimg
) modules
$(if
$(filter true
,$(do_dtbs
)),dtbs
)
54 define build_dkms_sign
=
55 $(shell set
-x
; if grep
-q CONFIG_MODULE_SIG
=y
$(1)/.config
; then
56 echo
$(1)/scripts
/sign-file
$(MODHASHALGO
) $(MODSECKEY
) $(MODPUBKEY
);
63 CROSS_COMPILE
=$(CROSS_COMPILE
) $(SHELL
) $(DROOT
)/scripts
/dkms-build
$(dkms_dir
) $(abi_release
)-$* '$(call build_dkms_sign,$(builddir)/build-$*)' $(1) $(2) $(3) $(4) $(5)
66 define install_control
=
69 template
="$(DROOT)/templates/$(2).$$which.in"; \
70 script
="$(DROOT)/$(1).$$which"; \
71 sed
-e
's/@abiname@/$(abi_release)/g' \
72 -e
's/@localversion@/-$*/g' \
73 -e
's/@image-stem@/$(instfile)/g' \
74 <"$$template" >"$$script"; \
78 # Ensure the directory prefix is exactly 100 characters long so pathnames are the
79 # exact same length in any binary files produced by the builds. These will be
81 dkms_20d
=....................
82 dkms_100d
=$(dkms_20d
)$(dkms_20d
)$(dkms_20d
)$(dkms_20d
)$(dkms_20d
)
83 dkms_100c
=$(shell echo
'$(dkms_100d)' | sed
-e
's/\./_/g')
84 define dkms_dir_prefix
=
85 $(shell echo
$(1)/$(dkms_100c
) | \
86 sed
-e
's/\($(dkms_100d)\).*/\1/' -e
's/^\(.*\)....$$/\1dkms/')
89 # Install the finished build
90 install-
%: pkgdir_bin
= $(CURDIR
)/debian
/$(bin_pkg_name
)-$*
91 install-
%: pkgdir
= $(CURDIR
)/debian
/$(mods_pkg_name
)-$*
92 install-
%: pkgdir_ex
= $(CURDIR
)/debian
/$(mods_extra_pkg_name
)-$*
93 install-
%: pkgdir_bldinfo
= $(CURDIR
)/debian
/$(bldinfo_pkg_name
)-$*
94 install-
%: bindoc
= $(pkgdir
)/usr
/share
/doc
/$(bin_pkg_name
)-$*
95 install-
%: dbgpkgdir
= $(CURDIR
)/debian
/$(bin_pkg_name
)-$*-dbgsym
96 install-
%: signingv
= $(CURDIR
)/debian
/$(bin_pkg_name
)-signing
/$(release
)-$(revision
)
97 install-
%: toolspkgdir
= $(CURDIR
)/debian
/$(tools_flavour_pkg_name
)-$*
98 install-
%: cloudpkgdir
= $(CURDIR
)/debian
/$(cloud_flavour_pkg_name
)-$*
99 install-
%: basepkg
= $(hdrs_pkg_name
)
100 install-
%: indeppkg
= $(indep_hdrs_pkg_name
)
101 install-
%: kernfile
= $(call custom_override
,kernel_file
,$*)
102 install-
%: instfile
= $(call custom_override
,install_file
,$*)
103 install-
%: hdrdir
= $(CURDIR
)/debian
/$(basepkg
)-$*/usr
/src
/$(basepkg
)-$*
104 install-
%: target_flavour
= $*
105 install-
%: MODHASHALGO
=sha512
106 install-
%: MODSECKEY
=$(builddir
)/build-
$*/certs
/signing_key.pem
107 install-
%: MODPUBKEY
=$(builddir
)/build-
$*/certs
/signing_key.x509
108 install-
%: build_dir
=$(builddir
)/build-
$*
109 install-
%: dkms_dir
=$(call dkms_dir_prefix
,$(builddir
)/build-
$*)
110 install-
%: enable_zfs
= $(call custom_override
,do_zfs
,$*)
111 install-
%: dbgpkgdir_zfs
= $(if
$(filter true
,$(skipdbg
)),"",$(dbgpkgdir
)/usr
/lib
/debug
/lib
/modules
/$(abi_release
)-$*/kernel
)
112 install-
%: $(stampdir
)/stamp-build-
% install-headers
113 @echo Debug
: $@ kernel_file
$(kernel_file
) kernfile
$(kernfile
) install_file
$(install_file
) instfile
$(instfile
)
116 dh_prep
-p
$(bin_pkg_name
)-$*
117 dh_prep
-p
$(mods_pkg_name
)-$*
118 dh_prep
-p
$(hdrs_pkg_name
)-$*
119 ifneq ($(skipdbg
),true
)
120 dh_prep
-p
$(bin_pkg_name
)-$*-dbgsym
124 # compress_file logic required because not all architectures
125 # generate a zImage automatically out of the box
126 ifeq ($(compress_file
),)
127 install -m600
-D
$(builddir
)/build-
$*/$(kernfile
) \
128 $(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$*
130 install -d
$(pkgdir_bin
)/boot
131 gzip
-c9v
$(builddir
)/build-
$*/$(kernfile
) > \
132 $(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$*
133 chmod
600 $(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$*
136 ifeq ($(uefi_signed
),true
)
137 install -d
$(signingv
)
138 # gzipped kernel images must be decompressed for signing
139 if
[[ "$(kernfile)" =~ \.gz
$$ ]]; then \
140 < $(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$* \
141 gunzip
-cv
> $(signingv
)/$(instfile
)-$(abi_release
)-$*.efi
; \
142 cp
-p
--attributes-only
$(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$* \
143 $(signingv
)/$(instfile
)-$(abi_release
)-$*.efi
; \
144 echo
"GZIP=1" >> $(signingv
)/$(instfile
)-$(abi_release
)-$*.efi.vars
; \
146 cp
-p
$(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$* \
147 $(signingv
)/$(instfile
)-$(abi_release
)-$*.efi
; \
150 ifeq ($(opal_signed
),true
)
151 install -d
$(signingv
)
152 cp
-p
$(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$* \
153 $(signingv
)/$(instfile
)-$(abi_release
)-$*.opal
;
155 ifeq ($(sipl_signed
),true
)
156 install -d
$(signingv
)
157 cp
-p
$(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$* \
158 $(signingv
)/$(instfile
)-$(abi_release
)-$*.sipl
;
161 install -d
$(pkgdir
)/boot
162 install -m644
$(builddir
)/build-
$*/.config \
163 $(pkgdir
)/boot
/config-
$(abi_release
)-$*
164 install -m600
$(builddir
)/build-
$*/System.map \
165 $(pkgdir
)/boot
/System.map-
$(abi_release
)-$*
166 if
[ "$(filter true,$(do_dtbs))" ]; then \
167 $(build_cd
) $(kmake
) $(build_O
) $(conc_level
) dtbs_install \
168 INSTALL_DTBS_PATH
=$(pkgdir
)/lib
/firmware
/$(abi_release
)-$*/device-tree
; \
169 ( cd
$(pkgdir
)/lib
/firmware
/$(abi_release
)-$*/ && find device-tree
-print ) | \
170 while read dtb_file
; do \
171 echo
"$$dtb_file ?" >> $(DEBIAN
)/d-i
/firmware
/$(arch
)/kernel-image
; \
174 ifeq ($(no_dumpfile
),)
175 makedumpfile
-g
$(pkgdir
)/boot
/vmcoreinfo-
$(abi_release
)-$* \
176 -x
$(builddir
)/build-
$*/vmlinux
177 chmod
0600 $(pkgdir
)/boot
/vmcoreinfo-
$(abi_release
)-$*
180 $(build_cd
) $(kmake
) $(build_O
) $(conc_level
) modules_install
$(vdso
) \
181 INSTALL_MOD_STRIP
=1 INSTALL_MOD_PATH
=$(pkgdir
)/ \
182 INSTALL_FW_PATH
=$(pkgdir
)/lib
/firmware
/$(abi_release
)-$*
185 # Build module blacklists:
186 # - blacklist all watchdog drivers (LP:1432837)
188 install -d
$(pkgdir
)/lib
/modprobe.d
189 echo
"# Kernel supplied blacklist for $(src_pkg_name) $(abi_release)-$* $(arch)" \
190 >$(pkgdir
)/lib
/modprobe.d
/blacklist_
$(src_pkg_name
)_
$(abi_release
)-$*.conf
191 for conf in
$(arch
)-$* $(arch
) common.conf
; do \
192 if
[ -f
$(DEBIAN
)/modprobe.d
/$$conf ]; then \
193 echo
"# modprobe.d/$$conf"; \
194 cat
$(DEBIAN
)/modprobe.d
/$$conf; \
196 done
>>$(pkgdir
)/lib
/modprobe.d
/blacklist_
$(src_pkg_name
)_
$(abi_release
)-$*.conf
197 echo
"# Autogenerated watchdog blacklist" \
198 >>$(pkgdir
)/lib
/modprobe.d
/blacklist_
$(src_pkg_name
)_
$(abi_release
)-$*.conf
199 ls
-1 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/kernel
/drivers
/watchdog
/ | \
200 grep
-v
'^bcm2835_wdt$$' | \
201 sed
-e
's/^/blacklist /' -e
's/.ko$$//' | \
203 >>$(pkgdir
)/lib
/modprobe.d
/blacklist_
$(src_pkg_name
)_
$(abi_release
)-$*.conf
205 ifeq ($(do_extras_package
),true
)
207 # Remove all modules not in the inclusion list.
209 if
[ -f
$(DEBIAN
)/control.d
/$(target_flavour
).inclusion-list
] ; then \
210 /sbin
/depmod
-v
-b
$(pkgdir
) $(abi_release
)-$* | \
211 sed
-e
"s@$(pkgdir)/lib/modules/$(abi_release)-$*/kernel/@@g" | \
212 awk
'{ print $$1 " " $$NF}' >$(build_dir
)/module-inclusion.depmap
; \
213 mkdir
-p
$(pkgdir_ex
)/lib
/modules
/$(abi_release
)-$*; \
214 mv
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/kernel \
215 $(pkgdir_ex
)/lib
/modules
/$(abi_release
)-$*/kernel
; \
216 $(SHELL
) $(DROOT
)/scripts
/module-inclusion
--master \
217 $(pkgdir_ex
)/lib
/modules
/$(abi_release
)-$*/kernel \
218 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/kernel \
219 $(DEBIAN
)/control.d
/$(target_flavour
).inclusion-list \
220 $(build_dir
)/module-inclusion.depmap
2>&1 | \
221 tee
$(target_flavour
).inclusion-list.log
; \
222 /sbin
/depmod
-b
$(pkgdir
) -ea
-F
$(pkgdir
)/boot
/System.map-
$(abi_release
)-$* \
223 $(abi_release
)-$* 2>&1 |tee
$(target_flavour
).depmod.log
; \
224 if
[ `grep -c 'unknown symbol' $(target_flavour).depmod.log` -gt
0 ]; then \
225 echo
"EE: Unresolved module dependencies in base package!"; \
231 ifeq ($(no_dumpfile
),)
232 makedumpfile
-g
$(pkgdir
)/boot
/vmcoreinfo-
$(abi_release
)-$* \
233 -x
$(builddir
)/build-
$*/vmlinux
234 chmod
0600 $(pkgdir
)/boot
/vmcoreinfo-
$(abi_release
)-$*
236 rm -f
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/build
237 rm -f
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/source
239 # Some initramfs-tools specific modules
240 install -d
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/initrd
241 if
[ -f
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/kernel
/drivers
/video
/vesafb.ko
]; then\
242 $(LN
) $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/kernel
/drivers
/video
/vesafb.ko \
243 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/initrd
/; \
246 echo
"interest linux-update-$(abi_release)-$*" >"$(DROOT)/$(bin_pkg_name)-$*.triggers"
247 install -d
$(pkgdir_bin
)/usr
/lib
/linux
/triggers
248 $(call install_control
,$(bin_pkg_name
)-$*,image
,postinst postrm preinst prerm
)
249 install -d
$(pkgdir
)/usr
/lib
/linux
/triggers
250 $(call install_control
,$(mods_pkg_name
)-$*,extra
,postinst postrm
)
251 ifeq ($(do_extras_package
),true
)
252 # Install the postinit/postrm scripts in the extras package.
253 if
[ -f
$(DEBIAN
)/control.d
/$(target_flavour
).inclusion-list
] ; then \
254 install -d
$(pkgdir_ex
)/usr
/lib
/linux
/triggers
; \
255 $(call install_control
,$(mods_extra_pkg_name
)-$*,extra
,postinst postrm
); \
259 # Install the full changelog.
260 ifeq ($(do_doc_package
),true
)
262 cat
$(DEBIAN
)/changelog
$(DEBIAN
)/changelog.historical | \
263 gzip
-9 >$(bindoc
)/changelog.Debian.old.gz
264 chmod
644 $(bindoc
)/changelog.Debian.old.gz
267 ifneq ($(skipsub
),true
)
268 for sub in
$($(*)_sub
); do \
269 if
! (TO
=$$sub FROM
=$* ABI_RELEASE
=$(abi_release
) $(SHELL
) \
270 $(DROOT
)/scripts
/sub-flavour
); then exit
1; fi
; \
271 /sbin
/depmod
-b debian
/$(bin_pkg_name
)-$$sub \
272 -ea
-F debian
/$(bin_pkg_name
)-$$sub/boot
/System.map-
$(abi_release
)-$* \
274 $(call install_control
,$(bin_pkg_name
)--$$sub,image
,postinst postrm preinst prerm
); \
278 ifneq ($(skipdbg
),true
)
279 # Debug image is simple
280 install -m644
-D
$(builddir
)/build-
$*/vmlinux \
281 $(dbgpkgdir
)/usr
/lib
/debug
/boot
/vmlinux-
$(abi_release
)-$*
282 $(build_cd
) $(kmake
) $(build_O
) modules_install
$(vdso
) \
283 INSTALL_MOD_PATH
=$(dbgpkgdir
)/usr
/lib
/debug
284 # Add .gnu_debuglink sections only after all/DKMS modules are built.
285 rm -f
$(dbgpkgdir
)/usr
/lib
/debug
/lib
/modules
/$(abi_release
)-$*/build
286 rm -f
$(dbgpkgdir
)/usr
/lib
/debug
/lib
/modules
/$(abi_release
)-$*/source
287 rm -f
$(dbgpkgdir
)/usr
/lib
/debug
/lib
/modules
/$(abi_release
)-$*/modules.
*
288 rm -fr
$(dbgpkgdir
)/usr
/lib
/debug
/lib
/firmware
291 # The flavour specific headers image
292 # TODO: Would be nice if we didn't have to dupe the original builddir
293 install -d
-m755
$(hdrdir
)
294 cat
$(builddir
)/build-
$*/.config | \
295 sed
-e
's/.*CONFIG_DEBUG_INFO=.*/# CONFIG_DEBUG_INFO is not set/g' > \
297 chmod
644 $(hdrdir
)/.config
298 $(kmake
) O
=$(hdrdir
) -j1 syncconfig prepare scripts
299 # We'll symlink this stuff
300 rm -f
$(hdrdir
)/Makefile
301 rm -rf
$(hdrdir
)/include2
$(hdrdir
)/source
302 # We do not need the retpoline information.
303 find
$(hdrdir
) -name \
*.o.ur-\
* | xargs
rm -f
304 # Copy over the compilation version.
305 cp
"$(builddir)/build-$*/include/generated/compile.h" \
306 "$(hdrdir)/include/generated/compile.h"
307 # Add UTS_UBUNTU_RELEASE_ABI since UTS_RELEASE is difficult to parse.
308 echo
"#define UTS_UBUNTU_RELEASE_ABI $(abinum)" >> $(hdrdir
)/include/generated
/utsrelease.h
309 # powerpc kernel arch seems to need some .o files for external module linking. Add them in.
310 ifeq ($(build_arch
),powerpc
)
311 mkdir
-p
$(hdrdir
)/arch
/powerpc
/lib
312 cp
$(builddir
)/build-
$*/arch
/powerpc
/lib
/*.o
$(hdrdir
)/arch
/powerpc
/lib
314 # Copy over the new retpoline extractor.
315 cp scripts
/ubuntu-retpoline-extract-one
$(hdrdir
)/scripts
316 # Script to symlink everything up
317 $(SHELL
) $(DROOT
)/scripts
/link-headers
"$(hdrdir)" "$(indeppkg)" "$*"
319 install -d debian
/$(basepkg
)-$*/lib
/modules
/$(abi_release
)-$*
320 $(LN
) /usr
/src
/$(basepkg
)-$* \
321 debian
/$(basepkg
)-$*/lib
/modules
/$(abi_release
)-$*/build
322 # And finally the symvers
323 install -m644
$(builddir
)/build-
$*/Module.symvers \
324 $(hdrdir
)/Module.symvers
326 # Now the header scripts
327 $(call install_control
,$(hdrs_pkg_name
)-$*,headers
,postinst
)
329 # At the end of the package prep, call the tests
330 DPKG_ARCH
="$(arch)" KERN_ARCH
="$(build_arch)" FLAVOUR
="$*" \
331 VERSION
="$(abi_release)" REVISION
="$(revision)" \
332 PREV_REVISION
="$(prev_revision)" ABI_NUM
="$(abinum)" \
333 PREV_ABI_NUM
="$(prev_abinum)" BUILD_DIR
="$(builddir)/build-$*" \
334 INSTALL_DIR
="$(pkgdir)" SOURCE_DIR
="$(CURDIR)" \
335 run-parts
-v
$(DROOT
)/tests-build
338 # Remove files which are generated at installation by postinst,
339 # except for modules.order and modules.builtin
341 # NOTE: need to keep this list in sync with postrm
343 mkdir
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
344 mv
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/modules.order \
345 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
346 if
[ -f
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/modules.builtin
] ; then \
347 mv
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/modules.builtin \
348 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
; \
350 rm -f
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/modules.
*
351 mv
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
/* \
352 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*
353 rmdir
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
355 ifeq ($(do_linux_tools
),true
)
356 # Create the linux-tools tool links
357 install -d
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
358 ifeq ($(do_tools_usbip
),true
)
359 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/usbip
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
360 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/usbipd
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
362 ifeq ($(do_tools_acpidbg
),true
)
363 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/acpidbg
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
365 ifeq ($(do_tools_cpupower
),true
)
366 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/cpupower
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
368 ifeq ($(do_tools_perf
),true
)
369 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/perf
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
370 ifeq ($(do_tools_perf_jvmti
),true
)
371 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/libperf-jvmti.so
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
374 ifeq ($(do_tools_bpftool
),true
)
375 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/bpftool
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
377 ifeq ($(do_tools_x86
),true
)
378 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/x86_energy_perf_policy
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
379 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/turbostat
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
382 ifeq ($(do_cloud_tools
),true
)
383 ifeq ($(do_tools_hyperv
),true
)
384 # Create the linux-hyperv tool links
385 install -d
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
386 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/hv_kvp_daemon
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
387 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/hv_vss_daemon
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
388 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/hv_fcopy_daemon
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
389 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/lsvmbus
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
393 # Build a temporary "installed headers" directory.
394 install -d
$(dkms_dir
) $(dkms_dir
)/headers
$(dkms_dir
)/build
$(dkms_dir
)/source
395 cp
-rp
"$(hdrdir)" "$(indep_hdrdir)" "$(dkms_dir)/headers"
397 $(if
$(filter true
,$(enable_zfs
)),$(call build_dkms
, $(mods_pkg_name
)-$*, $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/kernel
, $(dbgpkgdir_zfs
), zfs
, pool
/universe
/z
/zfs-linux
/zfs-dkms_
$(dkms_zfs_linux_version
)_all.deb
))
399 ifeq ($(do_dkms_nvidia
),true
)
400 $(call build_dkms
, $(bldinfo_pkg_name
)-$*, $(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*/signatures
, "", nvidia-390
, pool
/restricted
/n
/nvidia-graphics-drivers-390
/nvidia-kernel-source-390_
$(dkms_nvidia_390_version
)_
$(arch
).deb pool
/restricted
/n
/nvidia-graphics-drivers-390
/nvidia-dkms-390_
$(dkms_nvidia_390_version
)_
$(arch
).deb
)
401 $(call build_dkms
, $(bldinfo_pkg_name
)-$*, $(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*/signatures
, "", nvidia-430
, pool
/restricted
/n
/nvidia-graphics-drivers-430
/nvidia-kernel-source-430_
$(dkms_nvidia_430_version
)_
$(arch
).deb pool
/restricted
/n
/nvidia-graphics-drivers-430
/nvidia-dkms-430_
$(dkms_nvidia_430_version
)_
$(arch
).deb
)
402 $(call build_dkms
, $(bldinfo_pkg_name
)-$*, $(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*/signatures
, "", nvidia-435
, pool
/restricted
/n
/nvidia-graphics-drivers-435
/nvidia-kernel-source-435_
$(dkms_nvidia_435_version
)_
$(arch
).deb pool
/restricted
/n
/nvidia-graphics-drivers-435
/nvidia-dkms-435_
$(dkms_nvidia_435_version
)_
$(arch
).deb
)
405 ifeq ($(do_extras_package
),true
)
406 $(if
$(filter true
,$(do_dkms_vbox
)),$(call build_dkms
, $(mods_pkg_name
)-$*, $(pkgdir_ex
)/lib
/modules
/$(abi_release
)-$*/kernel
, "", virtualbox-guest
, pool
/multiverse
/v
/virtualbox
/virtualbox-guest-dkms_
$(dkms_vbox_guest_version
)_all.deb
))
409 ifneq ($(skipdbg
),true
)
410 # Add .gnu_debuglink sections to each stripped .ko
411 # pointing to unstripped verson
413 $(if
$(filter true
,$(do_extras_package
)),$(pkgdir_ex
)) \
414 -name
'*.ko' | while read path_module
; do \
415 module
="/lib/modules/$${path_module#*/lib/modules/}"; \
416 if
[[ -f
"$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \
417 while IFS
= read
-r
-d
'' signature
< <(tail
-c
28 "$$path_module"); do \
420 $(CROSS_COMPILE
)objcopy \
421 --add-gnu-debuglink
=$(dbgpkgdir
)/usr
/lib
/debug
/$$module \
423 if grep
-q CONFIG_MODULE_SIG
=y
$(builddir
)/build-
$*/.config
&& \
424 [ "$$signature" = $$'~Module signature appended~\n' ]; then \
425 $(builddir
)/build-
$*/scripts
/sign-file
$(MODHASHALGO
) \
431 echo
"WARNING: Missing debug symbols for module '$$module'."; \
436 # Build the final ABI information.
438 sed
-e
's/^\(.\+\)[[:space:]]\+\(.\+\)[[:space:]]\(.\+\)$$/\3 \2 \1/' \
439 $(builddir
)/build-
$*/Module.symvers |
sort > $(abidir
)/$*
441 # Build the final ABI modules information.
442 find
$(pkgdir_bin
) $(pkgdir
) $(pkgdir_ex
) -name \
*.ko | \
443 sed
-e
's/.*\/\([^\/]*\)\.ko/\1/' |
sort > $(abidir
)/$*.modules
445 # Build the final ABI firmware information.
446 find
$(pkgdir_bin
) $(pkgdir
) $(pkgdir_ex
) -name \
*.ko | \
448 /sbin
/modinfo
$$ko | grep ^firmware || true
; \
449 done |
sort -u
>$(abidir
)/$*.fwinfo
451 # Build the final ABI compiler information.
452 ko
=$$(find
$(pkgdir_bin
) $(pkgdir
) $(pkgdir_ex
) -name \
*.ko | head
-1); \
453 readelf
-p .comment
"$$ko" | gawk
' \
456 for (n=4; n<=NF; n++) { \
457 printf(" %s", $$n); \
460 }' |
sort -u
>$(abidir
)/$*.compiler
462 # Build the final ABI retpoline information.
463 if grep
-q CONFIG_RETPOLINE
=y
$(builddir
)/build-
$*/.config
; then \
464 echo
"# retpoline v1.0" >$(abidir
)/$*.retpoline
; \
465 $(SHELL
) $(DROOT
)/scripts
/retpoline-extract
$(builddir
)/build-
$* $(CURDIR
) | \
466 sort >>$(abidir
)/$*.retpoline
; \
468 echo
"# RETPOLINE NOT ENABLED" >$(abidir
)/$*.retpoline
; \
471 # Build the buildinfo package content.
472 install -d
$(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*
473 install -m644
$(builddir
)/build-
$*/.config \
474 $(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*/config
475 install -m644
$(abidir
)/$* \
476 $(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*/abi
477 install -m644
$(abidir
)/$*.modules \
478 $(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*/modules
479 install -m644
$(abidir
)/$*.fwinfo \
480 $(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*/fwinfo
481 install -m644
$(abidir
)/$*.retpoline \
482 $(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*/retpoline
483 install -m644
$(abidir
)/$*.compiler \
484 $(pkgdir_bldinfo
)/usr
/lib
/linux
/$(abi_release
)-$*/compiler
486 headers_tmp
:= $(CURDIR
)/debian
/tmp-headers
487 headers_dir
:= $(CURDIR
)/debian
/linux-libc-dev
489 hmake
:= $(MAKE
) -C
$(CURDIR
) O
=$(headers_tmp
) \
490 KERNELVERSION
=$(abi_release
) INSTALL_HDR_PATH
=$(headers_tmp
)/install \
491 SHELL
="$(SHELL)" ARCH
=$(header_arch
)
493 install-arch-headers
:
497 ifeq ($(do_libc_dev_package
),true
)
498 dh_prep
-plinux-libc-dev
501 rm -rf
$(headers_tmp
)
502 install -d
$(headers_tmp
) $(headers_dir
)/usr
/include/
504 $(hmake
) $(defconfig
)
505 mv
$(headers_tmp
)/.config
$(headers_tmp
)/.config.old
506 sed
-e
's/^# \(CONFIG_MODVERSIONS\) is not set$$/\1=y/' \
507 -e
's/.*CONFIG_LOCALVERSION_AUTO.*/# CONFIG_LOCALVERSION_AUTO is not set/' \
508 $(headers_tmp
)/.config.old
> $(headers_tmp
)/.config
510 $(hmake
) headers_install
512 ( cd
$(headers_tmp
)/install/include/ && \
513 find .
-name
'.' -o
-name
'.*' -prune
-o
-print | \
514 cpio
-pvd
--preserve-modification-time \
515 $(headers_dir
)/usr
/include/ )
516 mkdir
$(headers_dir
)/usr
/include/$(DEB_HOST_MULTIARCH
)
517 mv
$(headers_dir
)/usr
/include/asm
$(headers_dir
)/usr
/include/$(DEB_HOST_MULTIARCH
)/
519 rm -rf
$(headers_tmp
)
522 dh_installchangelogs
-p
$(1)
523 dh_installdocs
-p
$(1)
525 dh_fixperms
-p
$(1) -X
/boot
/
526 dh_shlibdeps
-p
$(1) $(shlibdeps_opts
)
528 dh_installdebconf
-p
$(1)
529 $(lockme
) dh_gencontrol
-p
$(1) -- -Vlinux
:rprovides
='$(rprovides)'
538 $(subst ${newline},; \
${newline},$(call dh_all
,$(1)))
541 binary-arch-headers
: install-arch-headers
545 ifeq ($(do_libc_dev_package
),true
)
546 ifneq ($(DEBIAN
),debian.master
)
547 echo
"non-master branch building linux-libc-dev, aborting"
550 $(call dh_all
,linux-libc-dev
)
553 binary-
%: pkgimg
= $(bin_pkg_name
)-$*
554 binary-
%: pkgimg_mods
= $(mods_pkg_name
)-$*
555 binary-
%: pkgimg_ex
= $(mods_extra_pkg_name
)-$*
556 binary-
%: pkgdir_ex
= $(CURDIR
)/debian
/$(extra_pkg_name
)-$*
557 binary-
%: pkgbldinfo
= $(bldinfo_pkg_name
)-$*
558 binary-
%: pkghdr
= $(hdrs_pkg_name
)-$*
559 binary-
%: dbgpkg
= $(bin_pkg_name
)-$*-dbgsym
560 binary-
%: dbgpkgdir
= $(CURDIR
)/debian
/$(bin_pkg_name
)-$*-dbgsym
561 binary-
%: pkgtools
= $(tools_flavour_pkg_name
)-$*
562 binary-
%: pkgcloud
= $(cloud_flavour_pkg_name
)-$*
563 binary-
%: rprovides
= $(if
$(filter true
,$(call custom_override
,do_zfs
,$*)),spl-modules
$(comma
) spl-dkms
$(comma
) zfs-modules
$(comma
) zfs-dkms
$(comma
))
564 binary-
%: rprovides
+= $(if
$(filter true
,$(call custom_override
,do_dkms_vbox
,$*)),virtualbox-guest-dkms
$(comma
))
565 binary-
%: target_flavour
= $*
571 $(call dh_all
,$(pkgimg
))
572 $(call dh_all
,$(pkgimg_mods
))
574 ifeq ($(do_extras_package
),true
)
575 ifeq ($(ship_extras_package
),false
)
576 # If $(ship_extras_package) is explicitly set to false, then do not
577 # construct the linux-image-extra package; instead just log all of the
578 # "extra" modules which were pointlessly built yet won't be shipped.
579 find
$(pkgdir_ex
) -name
'*.ko' |
sort \
580 | sed
's|^$(pkgdir_ex)/|NOT-SHIPPED |' \
581 | tee
-a
$(target_flavour
).not-shipped.log
;
583 if
[ -f
$(DEBIAN
)/control.d
/$(target_flavour
).inclusion-list
] ; then \
584 $(call dh_all_inline
,$(pkgimg_ex
)); \
589 $(call dh_all
,$(pkgbldinfo
))
590 $(call dh_all
,$(pkghdr
))
592 ifneq ($(skipsub
),true
)
593 @set
-e
; for sub in
$($(*)_sub
); do \
594 pkg
=$(bin_pkg_name
)-$$sub; \
595 $(call dh_all_inline
,$$pkg); \
599 ifneq ($(skipdbg
),true
)
600 $(call dh_all
,$(dbgpkg
))
602 # Hokay...here's where we do a little twiddling...
603 # Renaming the debug package prevents it from getting into
604 # the primary archive, and therefore prevents this very large
605 # package from being mirrored. It is instead, through some
606 # archive admin hackery, copied to http://ddebs.ubuntu.com.
608 mv ..
/$(dbgpkg
)_
$(release
)-$(revision
)_
$(arch
).deb \
609 ..
/$(dbgpkg
)_
$(release
)-$(revision
)_
$(arch
).ddeb
612 $(lockme_cmd
) 9 || exit
1; \
613 if grep
-qs
'^Build-Debug-Symbols: yes$$' /CurrentlyBuilding
; then \
614 sed
-i
'/^$(dbgpkg)_/s/\.deb /.ddeb /' debian
/files
; \
616 grep
-v
'^$(dbgpkg)_.*$$' debian
/files
> debian
/files.new
; \
617 mv debian
/files.new debian
/files
; \
620 # Now, the package wont get into the archive, but it will get put
621 # into the debug system.
624 ifeq ($(do_linux_tools
),true
)
625 $(call dh_all
,$(pkgtools
))
627 ifeq ($(do_cloud_tools
),true
)
628 $(call dh_all
,$(pkgcloud
))
631 ifneq ($(full_build
),false
)
632 # Clean out this flavours build directory.
633 rm -rf
$(builddir
)/build-
$*
634 # Clean out the debugging package source directory.
639 # per-architecture packages
641 builddirpa
= $(builddir
)/tools-perarch
643 $(stampdir
)/stamp-prepare-perarch
:
645 ifeq ($(do_any_tools
),true
)
647 install -d
$(builddirpa
)
648 rsync
-a
--exclude debian
--exclude debian.master
--exclude
$(DEBIAN
) --exclude .git
-a .
/ $(builddirpa
)/
652 $(stampdir
)/stamp-build-perarch
: $(stampdir
)/stamp-prepare-perarch install-arch-headers
654 ifeq ($(do_linux_tools
),true
)
655 ifeq ($(do_tools_usbip
),true
)
656 chmod
755 $(builddirpa
)/tools
/usb
/usbip
/autogen.sh
657 cd
$(builddirpa
)/tools
/usb
/usbip
&& .
/autogen.sh
658 chmod
755 $(builddirpa
)/tools
/usb
/usbip
/configure
659 cd
$(builddirpa
)/tools
/usb
/usbip
&& .
/configure
--prefix=$(builddirpa
)/tools
/usb
/usbip
/bin
660 cd
$(builddirpa
)/tools
/usb
/usbip
&& make
install CFLAGS
="-g -O2 -static" CROSS_COMPILE
=$(CROSS_COMPILE
)
662 ifeq ($(do_tools_acpidbg
),true
)
663 cd
$(builddirpa
)/tools
/power
/acpi
&& make
clean && make CFLAGS
="-g -O2 -static -I$(builddirpa)/include" CROSS_COMPILE
=$(CROSS_COMPILE
) acpidbg
665 ifeq ($(do_tools_cpupower
),true
)
666 # Allow for multiple installed versions of cpupower and libcpupower.so:
667 # Override LIB_MIN in order to to generate a versioned .so named
668 # libcpupower.so.$(abi_release) and link cpupower with that.
669 make
-C
$(builddirpa
)/tools
/power
/cpupower \
670 CROSS_COMPILE
=$(CROSS_COMPILE
) \
671 CROSS
=$(CROSS_COMPILE
) \
672 LIB_MIN
=$(abi_release
) CPUFREQ_BENCH
=false
674 ifeq ($(do_tools_perf
),true
)
675 cd
$(builddirpa
) && $(kmake
) $(defconfig
)
676 mv
$(builddirpa
)/.config
$(builddirpa
)/.config.old
677 sed
-e
's/^# \(CONFIG_MODVERSIONS\) is not set$$/\1=y/' \
678 -e
's/.*CONFIG_LOCALVERSION_AUTO.*/# CONFIG_LOCALVERSION_AUTO is not set/' \
679 $(builddirpa
)/.config.old
> $(builddirpa
)/.config
680 cd
$(builddirpa
) && $(kmake
) syncconfig
681 cd
$(builddirpa
) && $(kmake
) prepare
682 cd
$(builddirpa
)/tools
/perf
&& \
683 $(kmake
) prefix=/usr HAVE_NO_LIBBFD
=1 HAVE_CPLUS_DEMANGLE_SUPPORT
=1 CROSS_COMPILE
=$(CROSS_COMPILE
) NO_LIBPYTHON
=1 NO_LIBPERL
=1 PYTHON
=python2.7
685 ifeq ($(do_tools_bpftool
),true
)
686 $(kmake
) CROSS_COMPILE
=$(CROSS_COMPILE
) -C
$(builddirpa
)/tools
/bpf
/bpftool
688 ifeq ($(do_tools_x86
),true
)
689 cd
$(builddirpa
)/tools
/power
/x86
/x86_energy_perf_policy
&& make CROSS_COMPILE
=$(CROSS_COMPILE
)
690 cd
$(builddirpa
)/tools
/power
/x86
/turbostat
&& make CROSS_COMPILE
=$(CROSS_COMPILE
)
693 ifeq ($(do_cloud_tools
),true
)
694 ifeq ($(do_tools_hyperv
),true
)
695 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
700 install-perarch
: toolspkgdir
= $(CURDIR
)/debian
/$(tools_pkg_name
)
701 install-perarch
: cloudpkgdir
= $(CURDIR
)/debian
/$(cloud_pkg_name
)
702 install-perarch
: $(stampdir
)/stamp-build-perarch
705 ifeq ($(do_linux_tools
),true
)
706 install -d
$(toolspkgdir
)/usr
/lib
707 install -d
$(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
708 ifeq ($(do_tools_usbip
),true
)
709 install -m755
$(builddirpa
)/tools
/usb
/usbip
/bin
/sbin
/usbip \
710 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
711 install -m755
$(builddirpa
)/tools
/usb
/usbip
/bin
/sbin
/usbipd \
712 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
714 ifeq ($(do_tools_acpidbg
),true
)
715 install -m755
$(builddirpa
)/tools
/power
/acpi
/acpidbg \
716 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
718 ifeq ($(do_tools_cpupower
),true
)
719 install -m755
$(builddirpa
)/tools
/power
/cpupower
/cpupower \
720 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
721 # Install only the full versioned libcpupower.so.$(abi_release), not
722 # the usual symlinks to it.
723 install -m644
$(builddirpa
)/tools
/power
/cpupower
/libcpupower.so.
$(abi_release
) \
724 $(toolspkgdir
)/usr
/lib
/
726 ifeq ($(do_tools_perf
),true
)
727 install -m755
$(builddirpa
)/tools
/perf
/perf
$(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
728 ifeq ($(do_tools_perf_jvmti
),true
)
729 install -m755
$(builddirpa
)/tools
/perf
/libperf-jvmti.so
$(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
732 ifeq ($(do_tools_bpftool
),true
)
733 install -m755
$(builddirpa
)/tools
/bpf
/bpftool
/bpftool
$(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
735 ifeq ($(do_tools_x86
),true
)
736 install -m755
$(builddirpa
)/tools
/power
/x86
/x86_energy_perf_policy
/x86_energy_perf_policy \
737 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
738 install -m755
$(builddirpa
)/tools
/power
/x86
/turbostat
/turbostat \
739 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
742 ifeq ($(do_cloud_tools
),true
)
743 ifeq ($(do_tools_hyperv
),true
)
744 install -d
$(cloudpkgdir
)/usr
/lib
745 install -d
$(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
746 install -m755
$(builddirpa
)/tools
/hv
/hv_kvp_daemon \
747 $(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
748 install -m755
$(builddirpa
)/tools
/hv
/hv_vss_daemon \
749 $(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
750 install -m755
$(builddirpa
)/tools
/hv
/hv_fcopy_daemon \
751 $(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
752 install -m755
$(builddirpa
)/tools
/hv
/lsvmbus \
753 $(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
757 binary-perarch
: toolspkg
= $(tools_pkg_name
)
758 binary-perarch
: cloudpkg
= $(cloud_pkg_name
)
759 binary-perarch
: install-perarch
761 ifeq ($(do_linux_tools
),true
)
762 $(call dh_all
,$(toolspkg
))
764 ifeq ($(do_cloud_tools
),true
)
765 $(call dh_all
,$(cloudpkg
))
768 binary-debs
: signing
= $(CURDIR
)/debian
/$(bin_pkg_name
)-signing
769 binary-debs
: signingv
= $(CURDIR
)/debian
/$(bin_pkg_name
)-signing
/$(release
)-$(revision
)
770 binary-debs
: signing_tar
= $(src_pkg_name
)_
$(release
)-$(revision
)_
$(arch
).
tar.gz
771 binary-debs
: binary-perarch
$(addprefix binary-
,$(flavours
))
773 ifeq ($(any_signed
),true
)
774 install -d
$(signingv
)/control
775 { echo
"tarball"; } >$(signingv
)/control
/options
776 cd
$(signing
) && tar czvf ..
/..
/..
/$(signing_tar
) .
777 dpkg-distaddfile
$(signing_tar
) raw-signing
-
780 build-arch-deps-
$(do_flavour_image_package
) += $(addprefix $(stampdir
)/stamp-build-
,$(flavours
))
781 build-arch
: $(build-arch-deps-true
)
785 binary-arch-deps-
$(do_flavour_image_package
) += binary-udebs
787 binary-arch-deps-
$(do_flavour_image_package
) = binary-debs
789 binary-arch-deps-
$(do_libc_dev_package
) += binary-arch-headers
790 ifneq ($(do_common_headers_indep
),true
)
791 binary-arch-deps-
$(do_flavour_header_package
) += binary-headers
793 binary-arch
: $(binary-arch-deps-true
)