4 # Uncomment this to turn on verbose mode.
7 # TODO: check for headers not being installed
10 include /usr
/share
/dpkg
/default.mk
11 include debian
/rules.d
/env.mk
12 include debian
/rules.d
/${DEB_BUILD_ARCH}.mk
14 CHANGELOG_DATE
:=$(shell dpkg-parsechangelog
-SDate
)
16 PVE_KERNEL_PKG
=pve-kernel-
${KVNAME}
17 PVE_HEADER_PKG
=pve-headers-
${KVNAME}
18 LINUX_TOOLS_PKG
=linux-tools-
${KERNEL_MAJMIN}
19 KERNEL_SRC_COPY
=${KERNEL_SRC}_tmp
21 # TODO: split for archs, move to files?
24 -d CONFIG_SND_PCM_OSS \
25 -e CONFIG_TRANSPARENT_HUGEPAGE_MADVISE \
26 -d CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS \
28 -m CONFIG_BLK_DEV_NBD \
29 -m CONFIG_BLK_DEV_RBD \
33 -m CONFIG_HFSPLUS_FS \
35 -e CONFIG_BRIDGE_NETFILTER \
36 -e CONFIG_BLK_DEV_SD \
37 -e CONFIG_BLK_DEV_SR \
38 -e CONFIG_BLK_DEV_DM \
39 -e CONFIG_BLK_DEV_NVME \
40 -d CONFIG_INPUT_EVBUG \
41 -d CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND \
42 -e CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE \
43 -d CONFIG_MODULE_SIG \
44 -d CONFIG_MEMCG_DISABLED \
45 -e CONFIG_MEMCG_SWAP_ENABLED \
47 -e CONFIG_MEMCG_KMEM \
48 -d CONFIG_DEFAULT_CFQ \
49 -e CONFIG_DEFAULT_DEADLINE \
50 -e CONFIG_MODVERSIONS \
51 -d CONFIG_DEFAULT_SECURITY_DAC \
52 -e CONFIG_DEFAULT_SECURITY_APPARMOR \
53 --set-str CONFIG_DEFAULT_SECURITY apparmor \
54 -d CONFIG_UNWINDER_ORC \
55 -d CONFIG_UNWINDER_GUESS \
56 -e CONFIG_UNWINDER_FRAME_POINTER \
57 -e CONFIG_PAGE_TABLE_ISOLATION
59 debian
/control
: $(wildcard debian
/*.in
)
60 sed
-e
's/@@KVNAME@@/${KVNAME}/g' < debian
/pve-kernel.prerm.in
> debian
/${PVE_KERNEL_PKG}.prerm
61 sed
-e
's/@@KVNAME@@/${KVNAME}/g' < debian
/pve-kernel.postrm.in
> debian
/${PVE_KERNEL_PKG}.postrm
62 sed
-e
's/@@KVNAME@@/${KVNAME}/g' < debian
/pve-kernel.postinst.in
> debian
/${PVE_KERNEL_PKG}.postinst
63 sed
-e
's/@@KVNAME@@/${KVNAME}/g' < debian
/pve-headers.postinst.in
> debian
/${PVE_HEADER_PKG}.postinst
64 chmod
+x debian
/${PVE_KERNEL_PKG}.prerm
65 chmod
+x debian
/${PVE_KERNEL_PKG}.postrm
66 chmod
+x debian
/${PVE_KERNEL_PKG}.postinst
67 chmod
+x debian
/${PVE_HEADER_PKG}.postinst
68 sed
-e
's/@KVNAME@/${KVNAME}/g' -e
's/@KVMAJMIN@/${KERNEL_MAJMIN}/g' < debian
/control.in
> debian
/control
70 build
: .compile_mark .tools_compile_mark .modules_compile_mark
72 install: .install_mark .tools_install_mark .headers_install_mark
73 dh_installdocs
-A debian
/copyright debian
/SOURCE
76 dh_strip_nondeterminism
81 debian
/rules fwcheck abicheck
82 dh_strip
-N
${PVE_HEADER_PKG}
91 cd
${KERNEL_SRC}; scripts
/config
${PVE_CONFIG_OPTS}
92 ${MAKE} -C
${KERNEL_SRC} oldconfig
95 .compile_mark
: .config_mark
96 ${MAKE} -C
${KERNEL_SRC} KBUILD_BUILD_VERSION_TIMESTAMP
="PVE ${DEB_VERSION} (${CHANGELOG_DATE})"
99 .install_mark
: .compile_mark .modules_compile_mark
100 rm -rf debian
/${PVE_KERNEL_PKG}
101 mkdir
-p debian
/${PVE_KERNEL_PKG}/lib
/modules
/${KVNAME}
102 mkdir debian
/${PVE_KERNEL_PKG}/boot
103 install -m
644 ${KERNEL_SRC}/.config debian
/${PVE_KERNEL_PKG}/boot
/config-
${KVNAME}
104 install -m
644 ${KERNEL_SRC}/System.map debian
/${PVE_KERNEL_PKG}/boot
/System.map-
${KVNAME}
105 install -m
644 ${KERNEL_SRC}/${KERNEL_IMAGE_PATH} debian
/${PVE_KERNEL_PKG}/boot
/${KERNEL_INSTALL_FILE}-${KVNAME}
106 ${MAKE} -C
${KERNEL_SRC} INSTALL_MOD_PATH
=${BUILD_DIR}/debian
/${PVE_KERNEL_PKG}/ modules_install
107 # install zfs drivers
108 install -d
-m
0755 debian
/${PVE_KERNEL_PKG}/lib
/modules
/${KVNAME}/zfs
109 install -m
644 $(addprefix ${MODULES}/,zfs.ko zavl.ko znvpair.ko zunicode.ko zcommon.ko icp.ko zlua.ko spl.ko
) debian
/${PVE_KERNEL_PKG}/lib
/modules
/${KVNAME}/zfs
111 rm -rf debian
/${PVE_KERNEL_PKG}/lib
/firmware
113 find debian
/${PVE_KERNEL_PKG}/lib
/modules
-name \
*.ko
-print | while read f
; do
strip --strip-debug
"$$f"; done
115 /sbin
/depmod
-b debian
/${PVE_KERNEL_PKG}/ ${KVNAME}
116 # Autogenerate blacklist for watchdog devices (see README)
117 install -m
0755 -d debian
/${PVE_KERNEL_PKG}/lib
/modprobe.d
118 ls debian
/${PVE_KERNEL_PKG}/lib
/modules
/${KVNAME}/kernel
/drivers
/watchdog
/ > watchdog-blacklist.tmp
119 echo ipmi_watchdog.ko
>> watchdog-blacklist.tmp
120 cat watchdog-blacklist.tmp|sed
-e
's/^/blacklist /' -e
's/.ko$$//'|
sort -u
> debian
/${PVE_KERNEL_PKG}/lib
/modprobe.d
/blacklist_
${PVE_KERNEL_PKG}.conf
121 rm -f debian
/${PVE_KERNEL_PKG}/lib
/modules
/${KVNAME}/source
122 rm -f debian
/${PVE_KERNEL_PKG}/lib
/modules
/${KVNAME}/build
125 .tools_compile_mark
: .compile_mark
126 ${MAKE} -C
${KERNEL_SRC}/tools
/perf
prefix=/usr HAVE_NO_LIBBFD
=1 HAVE_CPLUS_DEMANGLE_SUPPORT
=1 NO_LIBPYTHON
=1 NO_LIBPERL
=1 NO_LIBCRYPTO
=1 PYTHON
=python2.7
127 echo
"checking GPL-2 only perf binary for library linkage with incompatible licenses.."
128 ! ldd
${KERNEL_SRC}/tools
/perf
/perf | grep
-q
-E
'\blibbfd'
129 ! ldd
${KERNEL_SRC}/tools
/perf
/perf | grep
-q
-E
'\blibcrypto'
130 ${MAKE} -C
${KERNEL_SRC}/tools
/perf man
133 .tools_install_mark
: .tools_compile_mark
134 rm -rf debian
/${LINUX_TOOLS_PKG}
135 mkdir
-p debian
/${LINUX_TOOLS_PKG}/usr
/bin
136 mkdir
-p debian
/${LINUX_TOOLS_PKG}/usr
/share
/man
/man1
137 install -m
755 ${BUILD_DIR}/${KERNEL_SRC}/tools
/perf
/perf debian
/${LINUX_TOOLS_PKG}/usr
/bin
/perf_
$(KERNEL_MAJMIN
)
138 for i in
${BUILD_DIR}/${KERNEL_SRC}/tools
/perf
/Documentation
/*.1; do \
139 fname
="$${i##*/}"; manname
="$${fname%.1}"; \
140 install -m644
"$$i" "debian/${LINUX_TOOLS_PKG}/usr/share/man/man1/$${manname}_$(KERNEL_MAJMIN).1"; \
144 .headers_prepare_mark
: .config_mark
145 rm -rf debian
/${PVE_HEADER_PKG}
146 mkdir
-p debian
/${PVE_HEADER_PKG}/usr
/src
/linux-headers-
${KVNAME}
147 install -m
0644 ${KERNEL_SRC}/.config debian
/${PVE_HEADER_PKG}/usr
/src
/linux-headers-
${KVNAME}
148 # copy to allow building in parallel to kernel/module compilation without interference
149 rm -rf
${KERNEL_SRC_COPY}
150 cp
-ar ${KERNEL_SRC} ${KERNEL_SRC_COPY}
151 make
-C
${KERNEL_SRC_COPY} mrproper
152 cd
${KERNEL_SRC_COPY}; find .
-path
'./debian/*' -prune \
153 -o
-path
'./include/*' -prune \
154 -o
-path
'./Documentation' -prune \
155 -o
-path
'./scripts' -prune \
159 -o
-name
'Kconfig*' \
164 -print | cpio
-pd
--preserve-modification-time
${BUILD_DIR}/debian
/${PVE_HEADER_PKG}/usr
/src
/linux-headers-
${KVNAME}
165 cd
${KERNEL_SRC_COPY}; cp
-a
include scripts
${BUILD_DIR}/debian
/${PVE_HEADER_PKG}/usr
/src
/linux-headers-
${KVNAME}
166 cd
${KERNEL_SRC_COPY}; \
168 find arch
/${KERNEL_HEADER_ARCH} -name
include -type d
-print | \
169 xargs
-n1
-i
: find
: -type f \
171 cpio
-pd
--preserve-modification-time
${BUILD_DIR}/debian
/${PVE_HEADER_PKG}/usr
/src
/linux-headers-
${KVNAME}
174 .headers_compile_mark
: .headers_prepare_mark
175 # set output to subdir of source to reduce number of hardcoded paths in output files
176 rm -rf
${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG}
177 mkdir
-p
${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG}
178 cp
${KERNEL_SRC}/.config
${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG}/.config
179 ${MAKE} -C
${KERNEL_SRC_COPY} O
=${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG} -j1 syncconfig prepare scripts
180 find
${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG} -name \
*.o.ur-\
* | xargs
rm -f
181 rsync
--ignore-existing
-r
-v
-a
$(addprefix ${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG}/,arch
include kernel scripts tools
) ${BUILD_DIR}/debian
/${PVE_HEADER_PKG}/usr
/src
/linux-headers-
${KVNAME}/
182 rm -rf
${BUILD_DIR}/${KERNEL_SRC_COPY}
185 .headers_install_mark
: .compile_mark .modules_compile_mark .headers_compile_mark
186 cp
${KERNEL_SRC}/include/generated
/compile.h debian
/${PVE_HEADER_PKG}/usr
/src
/linux-headers-
${KVNAME}/include/generated
/compile.h
187 install -m
0644 ${KERNEL_SRC}/Module.symvers debian
/${PVE_HEADER_PKG}/usr
/src
/linux-headers-
${KVNAME}
188 mkdir
-p debian
/${PVE_HEADER_PKG}/lib
/modules
/${KVNAME}
189 ln
-sf
/usr
/src
/linux-headers-
${KVNAME} debian
/${PVE_HEADER_PKG}/lib
/modules
/${KVNAME}/build
192 .modules_compile_mark
: ${MODULES}/zfs.ko
195 ${MODULES}/zfs.ko
: .compile_mark
196 cd
${MODULES}/${ZFSDIR}; .
/autogen.sh
197 cd
${MODULES}/${ZFSDIR}; .
/configure
--with-config
=kernel
--with-linux
=${BUILD_DIR}/${KERNEL_SRC} --with-linux-obj
=${BUILD_DIR}/${KERNEL_SRC}
198 ${MAKE} -C
${MODULES}/${ZFSDIR}
199 cp
${MODULES}/${ZFSDIR}/module
/avl
/zavl.ko
${MODULES}/
200 cp
${MODULES}/${ZFSDIR}/module
/nvpair
/znvpair.ko
${MODULES}/
201 cp
${MODULES}/${ZFSDIR}/module
/unicode
/zunicode.ko
${MODULES}/
202 cp
${MODULES}/${ZFSDIR}/module
/zcommon
/zcommon.ko
${MODULES}/
203 cp
${MODULES}/${ZFSDIR}/module
/icp
/icp.ko
${MODULES}/
204 cp
${MODULES}/${ZFSDIR}/module
/zfs
/zfs.ko
${MODULES}/
205 cp
${MODULES}/${ZFSDIR}/module
/lua
/zlua.ko
${MODULES}/
206 cp
${MODULES}/${ZFSDIR}/module
/spl
/spl.ko
${MODULES}/
208 fwlist-
${KVNAME}: .compile_mark .modules_compile_mark
209 debian
/scripts
/find-firmware.pl debian
/${PVE_KERNEL_PKG}/lib
/modules
/${KVNAME} >fwlist.tmp
213 fwcheck
: fwlist-
${KVNAME} fwlist-previous
214 @echo
"checking fwlist for changes since last built firmware package.."
215 @echo
"if this check fails, add fwlist-${KVNAME} to the pve-firmware repository and upload a new firmware package together with the ${KVNAME} kernel"
216 sort fwlist-previous | uniq
> fwlist-previous.sorted
217 sort fwlist-
${KVNAME} | uniq
> fwlist-
${KVNAME}.sorted
218 diff
-up
-N fwlist-previous.sorted fwlist-
${KVNAME}.sorted
> fwlist.diff
219 rm fwlist.diff fwlist-previous.sorted fwlist-
${KVNAME}.sorted
220 @echo
"done, no need to rebuild pve-firmware"
223 abi-
${KVNAME}: .compile_mark
224 debian
/scripts
/abi-generate debian
/${PVE_HEADER_PKG}/usr
/src
/linux-headers-
${KVNAME}/Module.symvers abi-
${KVNAME} ${KVNAME}
227 abicheck
: debian
/scripts
/abi-check abi-
${KVNAME} abi-prev-
* abi-blacklist
228 debian
/scripts
/abi-check abi-
${KVNAME} abi-prev-
* ${SKIPABI}