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 $(stampdir
)/stamp-prepare-
%: config-prepare-check-
%
23 $(stampdir
)/stamp-prepare-tree-
%: target_flavour
= $*
24 $(stampdir
)/stamp-prepare-tree-
%: $(commonconfdir
)/config.common.
$(family
) $(archconfdir
)/config.common.
$(arch
) $(archconfdir
)/config.flavour.
%
26 install -d
$(builddir
)/build-
$*
27 touch
$(builddir
)/build-
$*/ubuntu-build
28 [ "$(do_full_source)" != 'true' ] && true || \
29 rsync
-a
--exclude debian
--exclude debian.master
--exclude
$(DEBIAN
) * $(builddir
)/build-
$*
30 cat
$^ | sed
-e
's/.*CONFIG_VERSION_SIGNATURE.*/CONFIG_VERSION_SIGNATURE="Ubuntu $(release)-$(revision)-$* $(raw_kernelversion)"/' > $(builddir
)/build-
$*/.config
31 find
$(builddir
)/build-
$* -name
"*.ko" | xargs
rm -f
32 $(build_cd
) $(kmake
) $(build_O
) -j1 silentoldconfig prepare scripts
35 # Used by developers as a shortcut to prepare a tree for compilation.
36 prepare-
%: $(stampdir
)/stamp-prepare-
%
38 # Used by developers to allow efficient pre-building without fakeroot.
39 build-
%: $(stampdir
)/stamp-build-
%
44 # SPL/ZFS wants a fully built kernel before you can configure and build.
45 # It seems to be impossible to tease out the application configuration
46 # from the modules, but at least one can build just the modules.
48 install -d
$(builddir
)/build-
$*/spl
49 rsync
-a
--exclude
=dkms.conf
--delete spl
/ $(builddir
)/build-
$*/spl
/
50 cd
$(builddir
)/build-
$*/spl
; sh autogen.sh
; sh configure
$(splopts
)
51 $(kmake
) -C
$(builddir
)/build-
$*/spl
/module
$(conc_level
)
53 install -d
$(builddir
)/build-
$*/zfs
54 rsync
-a
--exclude
=dkms.conf
--delete zfs
/ $(builddir
)/build-
$*/zfs
/
55 cd
$(builddir
)/build-
$*/zfs
; sh autogen.sh
; sh configure
$(zfsopts
)
56 $(kmake
) -C
$(builddir
)/build-
$*/zfs
/module
$(conc_level
)
59 # Do the actual build, including image and modules
60 $(stampdir
)/stamp-build-
%: target_flavour
= $*
61 $(stampdir
)/stamp-build-
%: splopts
= --with-linux
=$(CURDIR
)
62 $(stampdir
)/stamp-build-
%: splopts
+= --with-linux-obj
=$(builddir
)/build-
$*
63 $(stampdir
)/stamp-build-
%: zfsopts
= $(splopts
)
64 $(stampdir
)/stamp-build-
%: zfsopts
+= --with-spl
=$(builddir
)/build-
$*/spl
65 $(stampdir
)/stamp-build-
%: zfsopts
+= --with-spl-obj
=$(builddir
)/build-
$*/spl
66 $(stampdir
)/stamp-build-
%: zfsopts
+= --prefix=/usr
--with-config
=kernel
67 $(stampdir
)/stamp-build-
%: bldimg
= $(call custom_override
,build_image
,$*)
68 $(stampdir
)/stamp-build-
%: enable_zfs
= $(call custom_override
,do_zfs
,$*)
69 $(stampdir
)/stamp-build-
%: $(stampdir
)/stamp-prepare-
%
70 @echo Debug
: $@ build_image
$(build_image
) bldimg
$(bldimg
)
71 $(build_cd
) $(kmake
) $(build_O
) $(conc_level
) $(bldimg
) modules
$(if
$(filter true
,$(do_dtbs
)),dtbs
)
73 $(if
$(filter true
,$(enable_zfs
)),$(call build_zfs
))
78 cd
$(builddir
)/build-
$*/spl
/module
; \
79 $(kmake
) -C
$(builddir
)/build-
$* SUBDIRS
=`pwd` modules_install
$(splopts
)
80 cd
$(builddir
)/build-
$*/zfs
/module
; \
81 $(kmake
) -C
$(builddir
)/build-
$* SUBDIRS
=`pwd` modules_install
$(zfsopts
)
84 define install_control
=
87 template
="$(DROOT)/templates/$(2).$$which.in"; \
88 script
="$(DROOT)/$(1).$$which"; \
89 sed
-e
's/@abiname@/$(abi_release)/g' \
90 -e
's/@localversion@/-$*/g' \
91 -e
's/@image-stem@/$(instfile)/g' \
92 <"$$template" >"$$script"; \
96 # Install the finished build
97 install-
%: pkgdir_bin
= $(CURDIR
)/debian
/$(bin_pkg_name
)-$*
98 install-
%: pkgdir
= $(CURDIR
)/debian
/$(mods_pkg_name
)-$*
99 install-
%: pkgdir_ex
= $(CURDIR
)/debian
/$(mods_extra_pkg_name
)-$*
100 install-
%: bindoc
= $(pkgdir
)/usr
/share
/doc
/$(bin_pkg_name
)-$*
101 install-
%: dbgpkgdir
= $(CURDIR
)/debian
/$(bin_pkg_name
)-$*-dbgsym
102 install-
%: signingv
= $(CURDIR
)/debian
/$(bin_pkg_name
)-signing
/$(release
)-$(revision
)
103 install-
%: toolspkgdir
= $(CURDIR
)/debian
/$(tools_flavour_pkg_name
)-$*
104 install-
%: cloudpkgdir
= $(CURDIR
)/debian
/$(cloud_flavour_pkg_name
)-$*
105 install-
%: basepkg
= $(hdrs_pkg_name
)
106 install-
%: indeppkg
= $(indep_hdrs_pkg_name
)
107 install-
%: kernfile
= $(call custom_override
,kernel_file
,$*)
108 install-
%: instfile
= $(call custom_override
,install_file
,$*)
109 install-
%: hdrdir
= $(CURDIR
)/debian
/$(basepkg
)-$*/usr
/src
/$(basepkg
)-$*
110 install-
%: target_flavour
= $*
111 install-
%: MODHASHALGO
=sha512
112 install-
%: MODSECKEY
=$(builddir
)/build-
$*/certs
/signing_key.pem
113 install-
%: MODPUBKEY
=$(builddir
)/build-
$*/certs
/signing_key.x509
114 install-
%: build_dir
=$(builddir
)/build-
$*
115 install-
%: enable_zfs
= $(call custom_override
,do_zfs
,$*)
116 install-
%: splopts
= INSTALL_MOD_STRIP
=1
117 install-
%: splopts
+= INSTALL_MOD_PATH
=$(pkgdir
)/
118 install-
%: splopts
+= INSTALL_MOD_DIR
=kernel
/zfs
119 install-
%: splopts
+= $(conc_level
)
120 install-
%: zfsopts
= $(splopts
)
122 @echo Debug
: $@ kernel_file
$(kernel_file
) kernfile
$(kernfile
) install_file
$(install_file
) instfile
$(instfile
)
125 dh_prep
-p
$(bin_pkg_name
)-$*
126 dh_prep
-p
$(mods_pkg_name
)-$*
127 dh_prep
-p
$(hdrs_pkg_name
)-$*
128 ifneq ($(skipdbg
),true
)
129 dh_prep
-p
$(bin_pkg_name
)-$*-dbgsym
133 # compress_file logic required because not all architectures
134 # generate a zImage automatically out of the box
135 ifeq ($(compress_file
),)
136 install -m600
-D
$(builddir
)/build-
$*/$(kernfile
) \
137 $(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$*
139 install -d
$(pkgdir_bin
)/boot
140 gzip
-c9v
$(builddir
)/build-
$*/$(kernfile
) > \
141 $(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$*
142 chmod
600 $(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$*
145 ifeq ($(uefi_signed
),true
)
146 install -d
$(signingv
)
147 # Check to see if this supports handoff, if not do not sign it.
148 # Check the identification area magic and version >= 0x020b
149 handoff
=`dd if="$(pkgdir_bin)/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" }'`; \
150 if
[ "$$handoff" = "GOOD" ]; then \
151 cp
-p
$(pkgdir_bin
)/boot
/$(instfile
)-$(abi_release
)-$* \
152 $(signingv
)/$(instfile
)-$(abi_release
)-$*.efi
; \
156 install -d
$(pkgdir
)/boot
157 install -m644
$(builddir
)/build-
$*/.config \
158 $(pkgdir
)/boot
/config-
$(abi_release
)-$*
159 install -m644
$(abidir
)/$* \
160 $(pkgdir
)/boot
/abi-
$(abi_release
)-$*
161 install -m644
$(abidir
)/$*.retpoline \
162 $(pkgdir
)/boot
/retpoline-
$(abi_release
)-$*
163 install -m600
$(builddir
)/build-
$*/System.map \
164 $(pkgdir
)/boot
/System.map-
$(abi_release
)-$*
165 if
[ "$(filter true,$(do_dtbs))" ]; then \
166 $(build_cd
) $(kmake
) $(build_O
) $(conc_level
) dtbs_install \
167 INSTALL_DTBS_PATH
=$(pkgdir
)/lib
/firmware
/$(abi_release
)-$*/device-tree
; \
168 ( cd
$(pkgdir
)/lib
/firmware
/$(abi_release
)-$*/ && find device-tree
-print ) | \
169 while read dtb_file
; do \
170 echo
"$$dtb_file ?" >> $(DEBIAN
)/d-i
/firmware
/$(arch
)/kernel-image
; \
173 ifeq ($(no_dumpfile
),)
174 makedumpfile
-g
$(pkgdir
)/boot
/vmcoreinfo-
$(abi_release
)-$* \
175 -x
$(builddir
)/build-
$*/vmlinux
176 chmod
0600 $(pkgdir
)/boot
/vmcoreinfo-
$(abi_release
)-$*
179 $(build_cd
) $(kmake
) $(build_O
) $(conc_level
) modules_install
$(vdso
) \
180 INSTALL_MOD_STRIP
=1 INSTALL_MOD_PATH
=$(pkgdir
)/ \
181 INSTALL_FW_PATH
=$(pkgdir
)/lib
/firmware
/$(abi_release
)-$*
183 $(if
$(filter true
,$(enable_zfs
)),$(call install_zfs
))
186 # Build module blacklists:
187 # - blacklist all watchdog drivers (LP:1432837)
189 install -d
$(pkgdir
)/lib
/modprobe.d
190 echo
"# Kernel supplied blacklist for $(src_pkg_name) $(abi_release)-$* $(arch)" \
191 >$(pkgdir
)/lib
/modprobe.d
/blacklist_
$(src_pkg_name
)_
$(abi_release
)-$*.conf
192 for conf in
$(arch
)-$* $(arch
) common.conf
; do \
193 if
[ -f
$(DEBIAN
)/modprobe.d
/$$conf ]; then \
194 echo
"# modprobe.d/$$conf"; \
195 cat
$(DEBIAN
)/modprobe.d
/$$conf; \
197 done
>>$(pkgdir
)/lib
/modprobe.d
/blacklist_
$(src_pkg_name
)_
$(abi_release
)-$*.conf
198 echo
"# Autogenerated watchdog blacklist" \
199 >>$(pkgdir
)/lib
/modprobe.d
/blacklist_
$(src_pkg_name
)_
$(abi_release
)-$*.conf
200 ls
-1 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/kernel
/drivers
/watchdog
/ | \
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 $(call install_control
,$(bin_pkg_name
)-$*,image
,postinst postrm preinst prerm
)
248 $(call install_control
,$(mods_pkg_name
)-$*,extra
,postinst postrm
)
249 ifeq ($(do_extras_package
),true
)
250 # Install the postinit/postrm scripts in the extras package.
251 if
[ -f
$(DEBIAN
)/control.d
/$(target_flavour
).inclusion-list
] ; then \
252 $(call install_control
,$(mods_extra_pkg_name
)-$*,extra
,postinst postrm
); \
256 # Install the full changelog.
257 ifeq ($(do_doc_package
),true
)
259 cat
$(DEBIAN
)/changelog
$(DEBIAN
)/changelog.historical | \
260 gzip
-9 >$(bindoc
)/changelog.Debian.old.gz
261 chmod
644 $(bindoc
)/changelog.Debian.old.gz
264 ifneq ($(skipsub
),true
)
265 for sub in
$($(*)_sub
); do \
266 if
! (TO
=$$sub FROM
=$* ABI_RELEASE
=$(abi_release
) $(SHELL
) \
267 $(DROOT
)/scripts
/sub-flavour
); then exit
1; fi
; \
268 /sbin
/depmod
-b debian
/$(bin_pkg_name
)-$$sub \
269 -ea
-F debian
/$(bin_pkg_name
)-$$sub/boot
/System.map-
$(abi_release
)-$* \
271 $(call install_control
,$(bin_pkg_name
)--$$sub,image
,postinst postrm preinst prerm
); \
275 ifneq ($(skipdbg
),true
)
276 # Debug image is simple
277 install -m644
-D
$(builddir
)/build-
$*/vmlinux \
278 $(dbgpkgdir
)/usr
/lib
/debug
/boot
/vmlinux-
$(abi_release
)-$*
279 $(build_cd
) $(kmake
) $(build_O
) modules_install
$(vdso
) \
280 INSTALL_MOD_PATH
=$(dbgpkgdir
)/usr
/lib
/debug
281 # Add .gnu_debuglink sections to each stripped .ko
282 # pointing to unstripped verson
283 find
$(pkgdir
) -name
'*.ko' | sed
's|$(pkgdir)||'| while read module
; do \
284 if
[[ -f
"$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \
285 $(CROSS_COMPILE
)objcopy \
286 --add-gnu-debuglink
=$(dbgpkgdir
)/usr
/lib
/debug
/$$module \
287 $(pkgdir
)/$$module; \
288 if grep
-q CONFIG_MODULE_SIG
=y
$(builddir
)/build-
$*/.config
; then \
289 $(builddir
)/build-
$*/scripts
/sign-file
$(MODHASHALGO
) \
292 $(pkgdir
)/$$module; \
296 rm -f
$(dbgpkgdir
)/usr
/lib
/debug
/lib
/modules
/$(abi_release
)-$*/build
297 rm -f
$(dbgpkgdir
)/usr
/lib
/debug
/lib
/modules
/$(abi_release
)-$*/source
298 rm -f
$(dbgpkgdir
)/usr
/lib
/debug
/lib
/modules
/$(abi_release
)-$*/modules.
*
299 rm -fr
$(dbgpkgdir
)/usr
/lib
/debug
/lib
/firmware
302 # The flavour specific headers image
303 # TODO: Would be nice if we didn't have to dupe the original builddir
304 install -d
-m755
$(hdrdir
)
305 cat
$(builddir
)/build-
$*/.config | \
306 sed
-e
's/.*CONFIG_DEBUG_INFO=.*/# CONFIG_DEBUG_INFO is not set/g' > \
308 chmod
644 $(hdrdir
)/.config
309 $(kmake
) O
=$(hdrdir
) -j1 silentoldconfig prepare scripts
310 # We'll symlink this stuff
311 rm -f
$(hdrdir
)/Makefile
312 rm -rf
$(hdrdir
)/include2
$(hdrdir
)/source
313 # We do not need the retpoline information.
314 find
$(hdrdir
) -name \
*.o.ur-\
* | xargs
rm -f
315 # Copy over the compilation version.
316 cp
"$(builddir)/build-$*/include/generated/compile.h" \
317 "$(hdrdir)/include/generated/compile.h"
318 # Add UTS_UBUNTU_RELEASE_ABI since UTS_RELEASE is difficult to parse.
319 echo
"#define UTS_UBUNTU_RELEASE_ABI $(abinum)" >> $(hdrdir
)/include/generated
/utsrelease.h
320 # powerpc kernel arch seems to need some .o files for external module linking. Add them in.
321 ifeq ($(build_arch
),powerpc
)
322 mkdir
-p
$(hdrdir
)/arch
/powerpc
/lib
323 cp
$(builddir
)/build-
$*/arch
/powerpc
/lib
/*.o
$(hdrdir
)/arch
/powerpc
/lib
325 # Copy over the new retpoline extractor.
326 cp scripts
/ubuntu-retpoline-extract-one
$(hdrdir
)/scripts
327 # Script to symlink everything up
328 $(SHELL
) $(DROOT
)/scripts
/link-headers
"$(hdrdir)" "$(indeppkg)" "$*"
330 install -d debian
/$(basepkg
)-$*/lib
/modules
/$(abi_release
)-$*
331 $(LN
) /usr
/src
/$(basepkg
)-$* \
332 debian
/$(basepkg
)-$*/lib
/modules
/$(abi_release
)-$*/build
333 # And finally the symvers
334 install -m644
$(builddir
)/build-
$*/Module.symvers \
335 $(hdrdir
)/Module.symvers
337 # Now the header scripts
338 $(call install_control
,$(hdrs_pkg_name
)-$*,headers
,postinst
)
340 # At the end of the package prep, call the tests
341 DPKG_ARCH
="$(arch)" KERN_ARCH
="$(build_arch)" FLAVOUR
="$*" \
342 VERSION
="$(abi_release)" REVISION
="$(revision)" \
343 PREV_REVISION
="$(prev_revision)" ABI_NUM
="$(abinum)" \
344 PREV_ABI_NUM
="$(prev_abinum)" BUILD_DIR
="$(builddir)/build-$*" \
345 INSTALL_DIR
="$(pkgdir)" SOURCE_DIR
="$(CURDIR)" \
346 run-parts
-v
$(DROOT
)/tests-build
349 # Remove files which are generated at installation by postinst,
350 # except for modules.order and modules.builtin
352 # NOTE: need to keep this list in sync with postrm
354 mkdir
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
355 mv
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/modules.order \
356 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
357 if
[ -f
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/modules.builtin
] ; then \
358 mv
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/modules.builtin \
359 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
; \
361 rm -f
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/modules.
*
362 mv
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
/* \
363 $(pkgdir
)/lib
/modules
/$(abi_release
)-$*
364 rmdir
$(pkgdir
)/lib
/modules
/$(abi_release
)-$*/_
366 ifeq ($(do_linux_tools
),true
)
367 # Create the linux-tools tool links
368 install -d
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
369 ifeq ($(do_tools_usbip
),true
)
370 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/usbip
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
371 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/usbipd
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
373 ifeq ($(do_tools_acpidbg
),true
)
374 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/acpidbg
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
376 ifeq ($(do_tools_cpupower
),true
)
377 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/cpupower
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
379 ifeq ($(do_tools_perf
),true
)
380 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/perf
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
382 ifeq ($(do_tools_x86
),true
)
383 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/x86_energy_perf_policy
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
384 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/turbostat
$(toolspkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
387 ifeq ($(do_cloud_tools
),true
)
388 ifeq ($(do_tools_hyperv
),true
)
389 # Create the linux-hyperv tool links
390 install -d
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
391 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/hv_kvp_daemon
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
392 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/hv_vss_daemon
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
393 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/hv_fcopy_daemon
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
394 $(LN
) ..
/..
/$(src_pkg_name
)-tools-
$(abi_release
)/lsvmbus
$(cloudpkgdir
)/usr
/lib
/linux-tools
/$(abi_release
)-$*
398 headers_tmp
:= $(CURDIR
)/debian
/tmp-headers
399 headers_dir
:= $(CURDIR
)/debian
/linux-libc-dev
401 hmake
:= $(MAKE
) -C
$(CURDIR
) O
=$(headers_tmp
) \
402 KERNELVERSION
=$(abi_release
) INSTALL_HDR_PATH
=$(headers_tmp
)/install \
403 SHELL
="$(SHELL)" ARCH
=$(header_arch
)
405 install-arch-headers
:
409 ifeq ($(do_libc_dev_package
),true
)
410 dh_prep
-plinux-libc-dev
413 rm -rf
$(headers_tmp
)
414 install -d
$(headers_tmp
) $(headers_dir
)/usr
/include/
416 $(hmake
) $(defconfig
)
417 mv
$(headers_tmp
)/.config
$(headers_tmp
)/.config.old
418 sed
-e
's/^# \(CONFIG_MODVERSIONS\) is not set$$/\1=y/' \
419 -e
's/.*CONFIG_LOCALVERSION_AUTO.*/# CONFIG_LOCALVERSION_AUTO is not set/' \
420 $(headers_tmp
)/.config.old
> $(headers_tmp
)/.config
421 $(hmake
) silentoldconfig
422 $(hmake
) headers_install
424 ( cd
$(headers_tmp
)/install/include/ && \
425 find .
-name
'.' -o
-name
'.*' -prune
-o
-print | \
426 cpio
-pvd
--preserve-modification-time \
427 $(headers_dir
)/usr
/include/ )
428 mkdir
$(headers_dir
)/usr
/include/$(DEB_HOST_MULTIARCH
)
429 mv
$(headers_dir
)/usr
/include/asm
$(headers_dir
)/usr
/include/$(DEB_HOST_MULTIARCH
)/
431 rm -rf
$(headers_tmp
)
433 binary-arch-headers
: install-arch-headers
437 ifeq ($(do_libc_dev_package
),true
)
438 ifneq ($(DEBIAN
),debian.master
)
439 echo
"non-master branch building linux-libc-dev, aborting"
442 dh_installchangelogs
-plinux-libc-dev
443 dh_installdocs
-plinux-libc-dev
444 dh_compress
-plinux-libc-dev
445 dh_fixperms
-plinux-libc-dev
446 dh_installdeb
-plinux-libc-dev
447 $(lockme
) dh_gencontrol
-plinux-libc-dev
-- $(libc_dev_version
)
448 dh_md5sums
-plinux-libc-dev
449 dh_builddeb
-plinux-libc-dev
452 binary-
%: pkgimg
= $(bin_pkg_name
)-$*
453 binary-
%: pkgimg_mods
= $(mods_pkg_name
)-$*
454 binary-
%: pkgimg_ex
= $(mods_extra_pkg_name
)-$*
455 binary-
%: pkgdir_ex
= $(CURDIR
)/debian
/$(extra_pkg_name
)-$*
456 binary-
%: pkghdr
= $(hdrs_pkg_name
)-$*
457 binary-
%: dbgpkg
= $(bin_pkg_name
)-$*-dbgsym
458 binary-
%: dbgpkgdir
= $(CURDIR
)/debian
/$(bin_pkg_name
)-$*-dbgsym
459 binary-
%: pkgtools
= $(tools_flavour_pkg_name
)-$*
460 binary-
%: pkgcloud
= $(cloud_flavour_pkg_name
)-$*
461 binary-
%: rprovides
= $(if
$(filter true
,$(call custom_override
,do_zfs
,$*)),$(comma
) spl-modules
$(comma
) spl-dkms
$(comma
) zfs-modules
$(comma
) zfs-dkms
)
462 binary-
%: target_flavour
= $*
468 dh_installchangelogs
-p
$(pkgimg
)
469 dh_installdocs
-p
$(pkgimg
)
470 dh_compress
-p
$(pkgimg
)
471 dh_fixperms
-p
$(pkgimg
) -X
/boot
/
472 dh_installdeb
-p
$(pkgimg
)
473 dh_shlibdeps
-p
$(pkgimg
) $(shlibdeps_opts
)
474 $(lockme
) dh_gencontrol
-p
$(pkgimg
) -- -Vlinux
:rprovides
='$(rprovides)'
475 dh_md5sums
-p
$(pkgimg
)
476 dh_builddeb
-p
$(pkgimg
)
478 dh_installchangelogs
-p
$(pkgimg_mods
)
479 dh_installdocs
-p
$(pkgimg_mods
)
480 dh_compress
-p
$(pkgimg_mods
)
481 dh_fixperms
-p
$(pkgimg_mods
) -X
/boot
/
482 dh_installdeb
-p
$(pkgimg_mods
)
483 dh_shlibdeps
-p
$(pkgimg_mods
) $(shlibdeps_opts
)
484 $(lockme
) dh_gencontrol
-p
$(pkgimg_mods
)
485 dh_md5sums
-p
$(pkgimg_mods
)
486 dh_builddeb
-p
$(pkgimg_mods
)
488 ifeq ($(do_extras_package
),true
)
489 ifeq ($(ship_extras_package
),false
)
490 # If $(ship_extras_package) is explicitly set to false, then do not
491 # construct the linux-image-extra package; instead just log all of the
492 # "extra" modules which were pointlessly built yet won't be shipped.
493 find
$(pkgdir_ex
) -name
'*.ko' |
sort \
494 | sed
's|^$(pkgdir_ex)/|NOT-SHIPPED |' \
495 | tee
-a
$(target_flavour
).not-shipped.log
;
497 if
[ -f
$(DEBIAN
)/control.d
/$(target_flavour
).inclusion-list
] ; then \
498 dh_installchangelogs
-p
$(pkgimg_ex
); \
499 dh_installdocs
-p
$(pkgimg_ex
); \
500 dh_compress
-p
$(pkgimg_ex
); \
501 dh_fixperms
-p
$(pkgimg_ex
) -X
/boot
/; \
502 dh_installdeb
-p
$(pkgimg_ex
); \
503 dh_shlibdeps
-p
$(pkgimg_ex
) $(shlibdeps_opts
); \
504 $(lockme
) dh_gencontrol
-p
$(pkgimg_ex
); \
505 dh_md5sums
-p
$(pkgimg_ex
); \
506 dh_builddeb
-p
$(pkgimg_ex
); \
511 dh_installchangelogs
-p
$(pkghdr
)
512 dh_installdocs
-p
$(pkghdr
)
513 dh_compress
-p
$(pkghdr
)
514 dh_fixperms
-p
$(pkghdr
)
515 dh_shlibdeps
-p
$(pkghdr
) $(shlibdeps_opts
)
516 dh_installdeb
-p
$(pkghdr
)
517 $(lockme
) dh_gencontrol
-p
$(pkghdr
)
518 dh_md5sums
-p
$(pkghdr
)
519 dh_builddeb
-p
$(pkghdr
)
521 ifneq ($(skipsub
),true
)
522 @set
-e
; for sub in
$($(*)_sub
); do \
523 pkg
=$(bin_pkg_name
)-$$sub; \
524 dh_installchangelogs
-p
$$pkg; \
525 dh_installdocs
-p
$$pkg; \
526 dh_compress
-p
$$pkg; \
527 dh_fixperms
-p
$$pkg -X
/boot
/; \
528 dh_shlibdeps
-p
$$pkg $(shlibdeps_opts
); \
529 dh_installdeb
-p
$$pkg; \
530 $(lockme
) dh_gencontrol
-p
$$pkg; \
531 dh_md5sums
-p
$$pkg; \
532 dh_builddeb
-p
$$pkg; \
536 ifneq ($(skipdbg
),true
)
537 dh_installchangelogs
-p
$(dbgpkg
)
538 dh_installdocs
-p
$(dbgpkg
)
539 dh_compress
-p
$(dbgpkg
)
540 dh_fixperms
-p
$(dbgpkg
)
541 dh_installdeb
-p
$(dbgpkg
)
542 $(lockme
) dh_gencontrol
-p
$(dbgpkg
)
543 dh_md5sums
-p
$(dbgpkg
)
544 dh_builddeb
-p
$(dbgpkg
)
546 # Hokay...here's where we do a little twiddling...
547 # Renaming the debug package prevents it from getting into
548 # the primary archive, and therefore prevents this very large
549 # package from being mirrored. It is instead, through some
550 # archive admin hackery, copied to http://ddebs.ubuntu.com.
552 mv ..
/$(dbgpkg
)_
$(release
)-$(revision
)_
$(arch
).deb \
553 ..
/$(dbgpkg
)_
$(release
)-$(revision
)_
$(arch
).ddeb
556 $(lockme_cmd
) 9 || exit
1; \
557 if grep
-qs
'^Build-Debug-Symbols: yes$$' /CurrentlyBuilding
; then \
558 sed
-i
'/^$(dbgpkg)_/s/\.deb /.ddeb /' debian
/files
; \
560 grep
-v
'^$(dbgpkg)_.*$$' debian
/files
> debian
/files.new
; \
561 mv debian
/files.new debian
/files
; \
564 # Now, the package wont get into the archive, but it will get put
565 # into the debug system.
568 ifeq ($(do_linux_tools
),true
)
569 dh_installchangelogs
-p
$(pkgtools
)
570 dh_installdocs
-p
$(pkgtools
)
571 dh_compress
-p
$(pkgtools
)
572 dh_fixperms
-p
$(pkgtools
)
573 dh_shlibdeps
-p
$(pkgtools
) $(shlibdeps_opts
)
574 dh_installdeb
-p
$(pkgtools
)
575 $(lockme
) dh_gencontrol
-p
$(pkgtools
)
576 dh_md5sums
-p
$(pkgtools
)
577 dh_builddeb
-p
$(pkgtools
)
579 ifeq ($(do_cloud_tools
),true
)
580 dh_installchangelogs
-p
$(pkgcloud
)
581 dh_installdocs
-p
$(pkgcloud
)
582 dh_compress
-p
$(pkgcloud
)
583 dh_fixperms
-p
$(pkgcloud
)
584 dh_shlibdeps
-p
$(pkgcloud
) $(shlibdeps_opts
)
585 dh_installdeb
-p
$(pkgcloud
)
586 $(lockme
) dh_gencontrol
-p
$(pkgcloud
)
587 dh_md5sums
-p
$(pkgcloud
)
588 dh_builddeb
-p
$(pkgcloud
)
591 ifneq ($(full_build
),false
)
592 # Clean out this flavours build directory.
593 rm -rf
$(builddir
)/build-
$*
594 # Clean out the debugging package source directory.
599 # per-architecture packages
601 builddirpa
= $(builddir
)/tools-perarch
603 $(stampdir
)/stamp-prepare-perarch
:
605 ifeq ($(do_any_tools
),true
)
607 install -d
$(builddirpa
)
608 rsync
-a
--exclude debian
--exclude debian.master
--exclude
$(DEBIAN
) --exclude .git
-a .
/ $(builddirpa
)/
612 $(stampdir
)/stamp-build-perarch
: $(stampdir
)/stamp-prepare-perarch install-arch-headers
614 ifeq ($(do_linux_tools
),true
)
615 ifeq ($(do_tools_usbip
),true
)
616 chmod
755 $(builddirpa
)/tools
/usb
/usbip
/autogen.sh
617 cd
$(builddirpa
)/tools
/usb
/usbip
&& .
/autogen.sh
618 chmod
755 $(builddirpa
)/tools
/usb
/usbip
/configure
619 cd
$(builddirpa
)/tools
/usb
/usbip
&& .
/configure
--prefix=$(builddirpa
)/tools
/usb
/usbip
/bin
620 cd
$(builddirpa
)/tools
/usb
/usbip
&& make
install CFLAGS
="-g -O2 -static" CROSS_COMPILE
=$(CROSS_COMPILE
)
622 ifeq ($(do_tools_acpidbg
),true
)
623 cd
$(builddirpa
)/tools
/power
/acpi
&& make
clean && make CFLAGS
="-g -O2 -static -I$(builddirpa)/include" CROSS_COMPILE
=$(CROSS_COMPILE
) acpidbg
625 ifeq ($(do_tools_cpupower
),true
)
626 # Allow for multiple installed versions of cpupower and libcpupower.so:
627 # Override LIB_MIN in order to to generate a versioned .so named
628 # libcpupower.so.$(abi_release) and link cpupower with that.
629 make
-C
$(builddirpa
)/tools
/power
/cpupower \
630 CROSS_COMPILE
=$(CROSS_COMPILE
) \
631 CROSS
=$(CROSS_COMPILE
) \
632 LIB_MIN
=$(abi_release
) CPUFREQ_BENCH
=false
634 ifeq ($(do_tools_perf
),true
)
635 cd
$(builddirpa
) && $(kmake
) $(defconfig
)
636 mv
$(builddirpa
)/.config
$(builddirpa
)/.config.old
637 sed
-e
's/^# \(CONFIG_MODVERSIONS\) is not set$$/\1=y/' \
638 -e
's/.*CONFIG_LOCALVERSION_AUTO.*/# CONFIG_LOCALVERSION_AUTO is not set/' \
639 $(builddirpa
)/.config.old
> $(builddirpa
)/.config
640 cd
$(builddirpa
) && $(kmake
) silentoldconfig
641 cd
$(builddirpa
) && $(kmake
) prepare
642 cd
$(builddirpa
)/tools
/perf
&& \
643 $(kmake
) prefix=/usr HAVE_NO_LIBBFD
=1 HAVE_CPUS_DEMANGLE_SUPPORT
=1 CROSS_COMPILE
=$(CROSS_COMPILE
) NO_LIBPYTHON
=1 NO_LIBPERL
=1 PYTHON
=python2.7
645 ifeq ($(do_tools_x86
),true
)
646 cd
$(builddirpa
)/tools
/power
/x86
/x86_energy_perf_policy
&& make CROSS_COMPILE
=$(CROSS_COMPILE
)
647 cd
$(builddirpa
)/tools
/power
/x86
/turbostat
&& make CROSS_COMPILE
=$(CROSS_COMPILE
)
650 ifeq ($(do_cloud_tools
),true
)
651 ifeq ($(do_tools_hyperv
),true
)
652 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
657 install-perarch
: toolspkgdir
= $(CURDIR
)/debian
/$(tools_pkg_name
)
658 install-perarch
: cloudpkgdir
= $(CURDIR
)/debian
/$(cloud_pkg_name
)
659 install-perarch
: $(stampdir
)/stamp-build-perarch
662 ifeq ($(do_linux_tools
),true
)
663 install -d
$(toolspkgdir
)/usr
/lib
664 install -d
$(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
665 ifeq ($(do_tools_usbip
),true
)
666 install -m755
$(builddirpa
)/tools
/usb
/usbip
/bin
/sbin
/usbip \
667 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
668 install -m755
$(builddirpa
)/tools
/usb
/usbip
/bin
/sbin
/usbipd \
669 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
671 ifeq ($(do_tools_acpidbg
),true
)
672 install -m755
$(builddirpa
)/tools
/power
/acpi
/acpidbg \
673 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
675 ifeq ($(do_tools_cpupower
),true
)
676 install -m755
$(builddirpa
)/tools
/power
/cpupower
/cpupower \
677 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
678 # Install only the full versioned libcpupower.so.$(abi_release), not
679 # the usual symlinks to it.
680 install -m644
$(builddirpa
)/tools
/power
/cpupower
/libcpupower.so.
$(abi_release
) \
681 $(toolspkgdir
)/usr
/lib
/
683 ifeq ($(do_tools_perf
),true
)
684 install -m755
$(builddirpa
)/tools
/perf
/perf
$(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
686 ifeq ($(do_tools_x86
),true
)
687 install -m755
$(builddirpa
)/tools
/power
/x86
/x86_energy_perf_policy
/x86_energy_perf_policy \
688 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
689 install -m755
$(builddirpa
)/tools
/power
/x86
/turbostat
/turbostat \
690 $(toolspkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
693 ifeq ($(do_cloud_tools
),true
)
694 ifeq ($(do_tools_hyperv
),true
)
695 install -d
$(cloudpkgdir
)/usr
/lib
696 install -d
$(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
697 install -m755
$(builddirpa
)/tools
/hv
/hv_kvp_daemon \
698 $(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
699 install -m755
$(builddirpa
)/tools
/hv
/hv_vss_daemon \
700 $(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
701 install -m755
$(builddirpa
)/tools
/hv
/hv_fcopy_daemon \
702 $(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
703 install -m755
$(builddirpa
)/tools
/hv
/lsvmbus \
704 $(cloudpkgdir
)/usr
/lib
/$(src_pkg_name
)-tools-
$(abi_release
)
708 binary-perarch
: toolspkg
= $(tools_pkg_name
)
709 binary-perarch
: cloudpkg
= $(cloud_pkg_name
)
710 binary-perarch
: install-perarch
712 ifeq ($(do_linux_tools
),true
)
713 dh_strip
-p
$(toolspkg
)
714 dh_installchangelogs
-p
$(toolspkg
)
715 dh_installdocs
-p
$(toolspkg
)
716 dh_compress
-p
$(toolspkg
)
717 dh_fixperms
-p
$(toolspkg
)
718 dh_shlibdeps
-p
$(toolspkg
) $(shlibdeps_opts
)
719 dh_installdeb
-p
$(toolspkg
)
720 $(lockme
) dh_gencontrol
-p
$(toolspkg
)
721 dh_md5sums
-p
$(toolspkg
)
722 dh_builddeb
-p
$(toolspkg
)
724 ifeq ($(do_cloud_tools
),true
)
725 dh_strip
-p
$(cloudpkg
)
726 dh_installchangelogs
-p
$(cloudpkg
)
727 dh_installdocs
-p
$(cloudpkg
)
728 dh_compress
-p
$(cloudpkg
)
729 dh_fixperms
-p
$(cloudpkg
)
730 dh_shlibdeps
-p
$(cloudpkg
) $(shlibdeps_opts
)
731 dh_installdeb
-p
$(cloudpkg
)
732 $(lockme
) dh_gencontrol
-p
$(cloudpkg
)
733 dh_md5sums
-p
$(cloudpkg
)
734 dh_builddeb
-p
$(cloudpkg
)
737 binary-debs
: signing
= $(CURDIR
)/debian
/$(bin_pkg_name
)-signing
738 binary-debs
: signingv
= $(CURDIR
)/debian
/$(bin_pkg_name
)-signing
/$(release
)-$(revision
)
739 binary-debs
: signing_tar
= $(src_pkg_name
)_
$(release
)-$(revision
)_
$(arch
).
tar.gz
740 binary-debs
: binary-perarch
$(addprefix binary-
,$(flavours
))
742 ifeq ($(any_signed
),true
)
743 install -d
$(signingv
)/control
744 { echo
"tarball"; } >$(signingv
)/control
/options
745 cd
$(signing
) && tar czvf ..
/..
/..
/$(signing_tar
) .
746 dpkg-distaddfile
$(signing_tar
) raw-signing
-
749 build-arch-deps-
$(do_flavour_image_package
) += $(addprefix $(stampdir
)/stamp-build-
,$(flavours
))
750 build-arch
: $(build-arch-deps-true
)
754 binary-arch-deps-
$(do_flavour_image_package
) += binary-udebs
756 binary-arch-deps-
$(do_flavour_image_package
) = binary-debs
758 binary-arch-deps-
$(do_libc_dev_package
) += binary-arch-headers
759 ifneq ($(do_common_headers_indep
),true
)
760 binary-arch-deps-
$(do_flavour_header_package
) += binary-headers
762 binary-arch
: $(binary-arch-deps-true
)