3 # $(DEBIAN)/rules for Ubuntu linux
5 # Use this however you want, just give credit where credit is due.
7 # Copyright (c) 2007 Ben Collins <bcollins@ubuntu.com>
10 DEBIAN
=$(shell awk
-F
= '($$1 == "DEBIAN") { print $$2 }' <debian
/debian.env
)
12 # dpkg-buildpackage passes options that are incomptatible
13 # with the kernel build.
18 export SHELL
=/bin
/bash
-e
20 # Where do we find the common configuration.
23 # Common variables for all architectures
24 include $(DROOT
)/rules.d
/0-common-vars.mk
26 # Pull in some arch specific stuff
27 -include $(DEBIAN
)/rules.d
/$(arch
).mk
29 # Pull in some branch specific stuff. Used by LTS backport
30 # branches to override master branch settings such as do_tools_common.
31 -include $(DEBIAN
)/rules.d
/hooks.mk
34 include $(DROOT
)/rules.d
/1-maintainer.mk
36 do_linux_tools
=$(sort $(filter-out false
,$(do_tools_usbip
) $(do_tools_cpupower
) $(do_tools_perf
) $(do_tools_bpftool
) $(do_tools_x86
)))
37 do_cloud_tools
=$(sort $(filter-out false
,$(do_tools_hyperv
)))
40 do_tools_perf_jvmti?
=false
42 # Don't build tools or udebs in a cross compile environment.
43 ifneq ($(DEB_HOST_ARCH
),$(DEB_BUILD_ARCH
))
49 do_dkms_wireguard
=false
52 # Are any of the kernel signing options enabled.
53 any_signed
=$(sort $(filter-out false
,$(uefi_signed
) $(opal_signed
) $(sipl_signed
)))
54 ifeq ($(any_signed
),true
)
55 bin_pkg_name
=$(bin_pkg_name_unsigned
)
57 bin_pkg_name
=$(bin_pkg_name_signed
)
60 # Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
61 ifeq ($(DEB_STAGE
),stage1
)
62 DEB_BUILD_PROFILES
=stage1
64 ifneq ($(DEB_BUILD_PROFILE
),)
65 DEB_BUILD_PROFILES
=$(DEB_BUILD_PROFILE
)
67 ifneq ($(filter stage1
,$(DEB_BUILD_PROFILES
)),)
70 do_source_package
=false
71 do_flavour_image_package
=false
72 do_flavour_header_package
=false
75 # autopkgtest -- rebuild support
76 # - only build the first flavour on the assumption it is representative
77 # - disable dkms builds as the versions used may have been deleted
78 ifneq ($(filter autopkgtest
,$(DEB_BUILD_PROFILES
)),)
79 flavours
:= $(firstword $(flavours
))
86 # Being used to build a mainline build -- turn off things which do not work.
87 ifeq ($(do_mainline_build
),true
)
88 do_extras_package
=false
99 # Disable tools build and packaging if do_tools != true
100 ifneq ($(do_tools
),true
)
107 ifeq ($(do_zfs
),false
)
108 do_zfs_disable
:=$(shell cat
$(DROOT
)/zfs-modules.ignore
>>$(prev_abidir
)/..
/modules.ignore
)
111 ifeq ($(do_dkms_vbox
),false
)
112 do_vbox_disable
:=$(shell cat
$(DROOT
)/vbox-modules.ignore
>>$(prev_abidir
)/..
/modules.ignore
)
115 ifeq ($(do_dkms_wireguard
),false
)
116 do_wireguard_disable
:=$(shell cat
$(DROOT
)/wireguard-modules.ignore
>>$(prev_abidir
)/..
/modules.ignore
)
119 # Either tools package needs the common source preparation
120 do_any_tools
=$(sort $(filter-out false
,$(do_linux_tools
) $(do_cloud_tools
)))
122 # Versions of dkms packages.
123 dkms_zfs_linux_version
=$(shell gawk
'/^zfs-linux / { print $$2; }' debian
/dkms-versions
)
124 dkms_nvidia_390_version
=$(shell gawk
'/^nvidia-graphics-drivers-390/ { print $$2; }' debian
/dkms-versions
)
125 dkms_nvidia_440_version
=$(shell gawk
'/^nvidia-graphics-drivers-440/ { print $$2; }' debian
/dkms-versions
)
126 dkms_vbox_guest_version
=$(shell gawk
'/^virtualbox/ { print $$2; }' debian
/dkms-versions
)
127 dkms_wireguard_version
=$(shell gawk
'/^wireguard-linux-compat / { print $$2; }' debian
/dkms-versions
)
129 # Debian Build System targets
130 binary
: binary-indep binary-arch
132 build
: build-arch build-indep
134 clean: debian
/control
140 rm -rf
$(DEBIAN
)/d-i-
$(arch
)
141 # Generated on the fly.
142 rm -f
$(DEBIAN
)/d-i
/firmware
/$(arch
)/kernel-image
145 rm -rf
$(DEBIAN
)/abi
/$(release
)-$(revision
)
147 rm -f
$(stampdir
)/stamp-
*
148 rm -rf
$(DEBIAN
)/linux-
*
150 # This gets rid of the d-i packages in control
151 cp
-f
$(DEBIAN
)/control.stub
$(DROOT
)/control
152 cp
$(DEBIAN
)/changelog debian
/changelog
154 # Install the copyright information.
155 cp
$(DEBIAN
)/copyright debian
/copyright
157 # Install the retpoline extractor.
158 cp
$(DROOT
)/scripts
/retpoline-extract-one scripts
/ubuntu-retpoline-extract-one
160 # If we have a reconstruct script use it.
161 [ -f
$(DEBIAN
)/reconstruct
] && bash
$(DEBIAN
)/reconstruct || true
163 # Remove generated intermediate files
164 rm -f
$(DROOT
)/control.stub
$(DEBIAN
)/control.stub
165 rm -f
$(DROOT
)/scripts
/fix-filenames
168 rm -rf
$(DROOT
)/control debian
/changelog \
169 debian
/control debian
/control.stub debian
/copyright \
170 scripts
/ubuntu-retpoline-extract-one
172 # Builds the image, arch headers and debug packages
173 include $(DROOT
)/rules.d
/2-binary-arch.mk
175 # Rules for building the udebs ($(DEBIAN)-installer)
176 include $(DROOT
)/rules.d
/5-udebs.mk
178 # Builds the source, doc and linux-headers indep packages
179 include $(DROOT
)/rules.d
/3-binary-indep.mk
181 # Various checks to be performed on builds
182 include $(DROOT
)/rules.d
/4-checks.mk
184 control_files
:= $(DEBIAN
)/control.stub.in
185 ifeq ($(do_libc_dev_package
),true
)
186 ifneq (,$(wildcard $(DEBIAN
)/control.d
/linux-libc-dev.stub
))
187 control_files
+= $(DEBIAN
)/control.d
/linux-libc-dev.stub
190 ifeq ($(do_doc_package
),true
)
191 ifneq (,$(wildcard $(DEBIAN
)/control.d
/linux-doc.stub
))
192 control_files
+= $(DEBIAN
)/control.d
/linux-doc.stub
197 .PHONY
: $(DEBIAN
)/control.stub
198 $(DEBIAN
)/control.stub
: \
199 $(DROOT
)/scripts
/control-create \
201 $(DEBIAN
)/changelog \
202 $(wildcard $(DEBIAN
)/control.d
/* $(DEBIAN
)/sub-flavours
/*.vars
)
203 for i in
$(control_files
); do \
206 done | sed
-e
's/PKGVER/$(release)/g' \
207 -e
's/ABINUM/$(abinum)/g' \
208 -e
's/SRCPKGNAME/$(src_pkg_name)/g' \
209 -e
's/=HUMAN=/$(human_arch)/g' \
210 -e
's/=SERIES=/$(series)/g' \
211 > $(DEBIAN
)/control.stub
;
212 flavours
="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
213 for i in
$$flavours; do \
214 $(SHELL
) $(DROOT
)/scripts
/control-create
$$i "$(any_signed)" | \
215 sed
-e
's/PKGVER/$(release)/g' \
216 -e
's/ABINUM/$(abinum)/g' \
217 -e
's/SRCPKGNAME/$(src_pkg_name)/g' \
218 -e
's/=HUMAN=/$(human_arch)/g' \
219 -e
's/=SERIES=/$(series)/g' \
220 >> $(DEBIAN
)/control.stub
; \
223 .PHONY
: debian
/control
224 debian
/control
: $(DEBIAN
)/control.stub
225 echo
"# placebo control.stub for kernel-wedge flow change" >debian
/control.stub
226 cp
$(DEBIAN
)/control.stub debian
/control
227 export KW_DEFCONFIG_DIR
=$(DEBIAN
)/d-i
&& \
228 export KW_CONFIG_DIR
=$(DEBIAN
)/d-i
&& \
229 LANG
=C kernel-wedge gen-control
$(release
)-$(abinum
) | \
230 perl
-f
$(DROOT
)/scripts
/misc
/kernel-wedge-arch.pl
$(arch
) \
231 >>$(CURDIR
)/debian
/control