2018-01-24 10:54:19 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
# -*- makefile -*-
|
|
|
|
|
|
|
|
# Uncomment this to turn on verbose mode.
|
|
|
|
#export DH_VERBOSE=1
|
|
|
|
|
2018-02-28 08:31:06 +00:00
|
|
|
# TODO: check for headers not being installed
|
2018-03-09 10:25:58 +00:00
|
|
|
BUILD_DIR=$(shell pwd)
|
2018-01-24 10:54:19 +00:00
|
|
|
|
2018-02-28 08:31:06 +00:00
|
|
|
include /usr/share/dpkg/default.mk
|
2018-03-09 10:25:58 +00:00
|
|
|
include debian/rules.d/env.mk
|
2018-02-28 08:31:06 +00:00
|
|
|
include debian/rules.d/${DEB_BUILD_ARCH}.mk
|
|
|
|
|
|
|
|
CHANGELOG_DATE:=$(shell dpkg-parsechangelog -SDate)
|
|
|
|
|
|
|
|
PVE_KERNEL_PKG=pve-kernel-${KVNAME}
|
|
|
|
PVE_HEADER_PKG=pve-headers-${KVNAME}
|
2018-05-28 09:04:46 +00:00
|
|
|
LINUX_TOOLS_PKG=linux-tools-${KERNEL_MAJMIN}
|
2018-05-09 10:15:20 +00:00
|
|
|
KERNEL_SRC_COPY=${KERNEL_SRC}_tmp
|
2018-02-28 08:31:06 +00:00
|
|
|
|
|
|
|
# TODO: split for archs, move to files?
|
|
|
|
PVE_CONFIG_OPTS= \
|
|
|
|
-m INTEL_MEI_WDT \
|
|
|
|
-d CONFIG_SND_PCM_OSS \
|
|
|
|
-e CONFIG_TRANSPARENT_HUGEPAGE_MADVISE \
|
|
|
|
-d CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS \
|
|
|
|
-m CONFIG_CEPH_FS \
|
|
|
|
-m CONFIG_BLK_DEV_NBD \
|
|
|
|
-m CONFIG_BLK_DEV_RBD \
|
|
|
|
-m CONFIG_BCACHE \
|
|
|
|
-m CONFIG_JFS_FS \
|
|
|
|
-m CONFIG_HFS_FS \
|
|
|
|
-m CONFIG_HFSPLUS_FS \
|
|
|
|
-e CONFIG_BRIDGE \
|
|
|
|
-e CONFIG_BRIDGE_NETFILTER \
|
|
|
|
-e CONFIG_BLK_DEV_SD \
|
|
|
|
-e CONFIG_BLK_DEV_SR \
|
|
|
|
-e CONFIG_BLK_DEV_DM \
|
|
|
|
-e CONFIG_BLK_DEV_NVME \
|
|
|
|
-d CONFIG_INPUT_EVBUG \
|
|
|
|
-d CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND \
|
|
|
|
-e CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE \
|
|
|
|
-d CONFIG_MODULE_SIG \
|
|
|
|
-d CONFIG_MEMCG_DISABLED \
|
|
|
|
-e CONFIG_MEMCG_SWAP_ENABLED \
|
|
|
|
-e CONFIG_MEMCG_KMEM \
|
|
|
|
-d CONFIG_DEFAULT_CFQ \
|
|
|
|
-e CONFIG_DEFAULT_DEADLINE \
|
|
|
|
-e CONFIG_MODVERSIONS \
|
|
|
|
-d CONFIG_DEFAULT_SECURITY_DAC \
|
|
|
|
-e CONFIG_DEFAULT_SECURITY_APPARMOR \
|
|
|
|
--set-str CONFIG_DEFAULT_SECURITY apparmor \
|
|
|
|
-d CONFIG_UNWINDER_ORC \
|
|
|
|
-d CONFIG_UNWINDER_GUESS \
|
|
|
|
-e CONFIG_UNWINDER_FRAME_POINTER \
|
|
|
|
-e CONFIG_PAGE_TABLE_ISOLATION
|
|
|
|
|
|
|
|
debian/control: $(wildcard debian/*.in)
|
|
|
|
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/pve-kernel.prerm.in > debian/${PVE_KERNEL_PKG}.prerm
|
|
|
|
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/pve-kernel.postrm.in > debian/${PVE_KERNEL_PKG}.postrm
|
|
|
|
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/pve-kernel.postinst.in > debian/${PVE_KERNEL_PKG}.postinst
|
|
|
|
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/pve-headers.postinst.in > debian/${PVE_HEADER_PKG}.postinst
|
|
|
|
chmod +x debian/${PVE_KERNEL_PKG}.prerm
|
|
|
|
chmod +x debian/${PVE_KERNEL_PKG}.postrm
|
|
|
|
chmod +x debian/${PVE_KERNEL_PKG}.postinst
|
|
|
|
chmod +x debian/${PVE_HEADER_PKG}.postinst
|
|
|
|
sed -e 's/@KVNAME@/${KVNAME}/g' < debian/control.in > debian/control
|
|
|
|
|
|
|
|
build: .compile_mark .tools_compile_mark .modules_compile_mark
|
|
|
|
|
|
|
|
install: .install_mark .tools_install_mark .headers_install_mark
|
|
|
|
dh_installdocs -A debian/copyright debian/SOURCE
|
|
|
|
dh_installchangelogs
|
|
|
|
dh_installman
|
|
|
|
dh_strip_nondeterminism
|
|
|
|
dh_compress
|
|
|
|
dh_fixperms
|
|
|
|
|
|
|
|
binary: install
|
|
|
|
debian/rules fwcheck abicheck
|
2018-04-24 11:57:28 +00:00
|
|
|
dh_strip -N${PVE_HEADER_PKG}
|
2018-02-28 08:31:06 +00:00
|
|
|
dh_makeshlibs
|
|
|
|
dh_shlibdeps
|
|
|
|
dh_installdeb
|
|
|
|
dh_gencontrol
|
|
|
|
dh_md5sums
|
|
|
|
dh_builddeb
|
|
|
|
|
2018-05-09 10:15:20 +00:00
|
|
|
.config_mark:
|
2018-02-28 08:31:06 +00:00
|
|
|
cd ${KERNEL_SRC}; scripts/config ${PVE_CONFIG_OPTS}
|
|
|
|
${MAKE} -C ${KERNEL_SRC} oldconfig
|
2018-05-09 10:15:20 +00:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
.compile_mark: .config_mark
|
2018-02-28 08:31:06 +00:00
|
|
|
${MAKE} -C ${KERNEL_SRC} KBUILD_BUILD_VERSION_TIMESTAMP="PVE ${DEB_VERSION} (${CHANGELOG_DATE})"
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
.install_mark: .compile_mark .modules_compile_mark
|
|
|
|
rm -rf debian/${PVE_KERNEL_PKG}
|
|
|
|
mkdir -p debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}
|
|
|
|
mkdir debian/${PVE_KERNEL_PKG}/boot
|
|
|
|
install -m 644 ${KERNEL_SRC}/.config debian/${PVE_KERNEL_PKG}/boot/config-${KVNAME}
|
|
|
|
install -m 644 ${KERNEL_SRC}/System.map debian/${PVE_KERNEL_PKG}/boot/System.map-${KVNAME}
|
|
|
|
install -m 644 ${KERNEL_SRC}/${KERNEL_IMAGE_PATH} debian/${PVE_KERNEL_PKG}/boot/${KERNEL_INSTALL_FILE}-${KVNAME}
|
|
|
|
${MAKE} -C ${KERNEL_SRC} INSTALL_MOD_PATH=${BUILD_DIR}/debian/${PVE_KERNEL_PKG}/ modules_install
|
2018-03-09 14:27:36 +00:00
|
|
|
# disabled for now, incompatbile with 4.15
|
|
|
|
# ## install latest ibg driver
|
|
|
|
# install -m 644 ${MODULES}/igb.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/kernel/drivers/net/ethernet/intel/igb/
|
|
|
|
# # install latest ixgbe driver
|
|
|
|
# install -m 644 ${MODULES}/ixgbe.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/kernel/drivers/net/ethernet/intel/ixgbe/
|
|
|
|
# # install latest e1000e driver
|
|
|
|
# install -m 644 ${MODULES}/e1000e.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/kernel/drivers/net/ethernet/intel/e1000e/
|
2018-02-28 08:31:06 +00:00
|
|
|
# install zfs drivers
|
|
|
|
install -d -m 0755 debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
|
|
|
|
install -m 644 $(addprefix ${MODULES}/,spl.ko splat.ko zfs.ko zavl.ko znvpair.ko zunicode.ko zcommon.ko zpios.ko icp.ko) debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
|
|
|
|
# remove firmware
|
|
|
|
rm -rf debian/${PVE_KERNEL_PKG}/lib/firmware
|
|
|
|
# strip debug info
|
|
|
|
find debian/${PVE_KERNEL_PKG}/lib/modules -name \*.ko -print | while read f ; do strip --strip-debug "$$f"; done
|
|
|
|
# finalize
|
|
|
|
/sbin/depmod -b debian/${PVE_KERNEL_PKG}/ ${KVNAME}
|
|
|
|
# Autogenerate blacklist for watchdog devices (see README)
|
|
|
|
install -m 0755 -d debian/${PVE_KERNEL_PKG}/lib/modprobe.d
|
|
|
|
ls debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/kernel/drivers/watchdog/ > watchdog-blacklist.tmp
|
|
|
|
echo ipmi_watchdog.ko >> watchdog-blacklist.tmp
|
|
|
|
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
|
|
|
|
rm -f debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/source
|
|
|
|
rm -f debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/build
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
.tools_compile_mark: .compile_mark
|
2018-04-25 10:17:19 +00:00
|
|
|
${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
|
|
|
|
echo "checking GPL-2 only perf binary for library linkage with incompatible licenses.."
|
|
|
|
! ldd ${KERNEL_SRC}/tools/perf/perf | grep -q -E '\blibbfd'
|
|
|
|
! ldd ${KERNEL_SRC}/tools/perf/perf | grep -q -E '\blibcrypto'
|
2018-02-28 08:31:06 +00:00
|
|
|
${MAKE} -C ${KERNEL_SRC}/tools/perf man
|
2018-04-24 11:57:29 +00:00
|
|
|
# contained in linux-base
|
|
|
|
rm -f ${KERNEL_SRC}/tools/perf/Documentation/perf.1
|
2018-02-28 08:31:06 +00:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
.tools_install_mark: .tools_compile_mark
|
|
|
|
rm -rf debian/${LINUX_TOOLS_PKG}
|
|
|
|
mkdir -p debian/${LINUX_TOOLS_PKG}/usr/bin
|
2018-04-24 11:57:29 +00:00
|
|
|
mkdir -p debian/${LINUX_TOOLS_PKG}/usr/share/man/man1
|
2018-05-28 09:04:46 +00:00
|
|
|
install -m 755 ${BUILD_DIR}/${KERNEL_SRC}/tools/perf/perf debian/${LINUX_TOOLS_PKG}/usr/bin/perf_$(KERNEL_MAJMIN)
|
2018-04-24 11:57:29 +00:00
|
|
|
install -m644 ${BUILD_DIR}/${KERNEL_SRC}/tools/perf/Documentation/*.1 debian/${LINUX_TOOLS_PKG}/usr/share/man/man1
|
2018-02-28 08:31:06 +00:00
|
|
|
touch $@
|
|
|
|
|
2018-05-09 10:15:20 +00:00
|
|
|
.headers_prepare_mark: .config_mark
|
2018-02-28 08:31:06 +00:00
|
|
|
rm -rf debian/${PVE_HEADER_PKG}
|
|
|
|
mkdir -p debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}
|
|
|
|
install -m 0644 ${KERNEL_SRC}/.config debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}
|
2018-05-09 10:15:20 +00:00
|
|
|
# copy to allow building in parallel to kernel/module compilation without interference
|
|
|
|
rm -rf ${KERNEL_SRC_COPY}
|
|
|
|
cp -ar ${KERNEL_SRC} ${KERNEL_SRC_COPY}
|
|
|
|
make -C ${KERNEL_SRC_COPY} mrproper
|
|
|
|
cd ${KERNEL_SRC_COPY}; find . -path './debian/*' -prune \
|
2018-04-24 11:57:27 +00:00
|
|
|
-o -path './include/*' -prune \
|
|
|
|
-o -path './Documentation' -prune \
|
|
|
|
-o -path './scripts' -prune \
|
|
|
|
-o -type f \
|
|
|
|
\( \
|
|
|
|
-name 'Makefile*' \
|
|
|
|
-o -name 'Kconfig*' \
|
|
|
|
-o -name 'Kbuild*' \
|
|
|
|
-o -name '*.sh' \
|
|
|
|
-o -name '*.pl' \
|
|
|
|
\) \
|
|
|
|
-print | cpio -pd --preserve-modification-time ${BUILD_DIR}/debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}
|
2018-05-09 10:15:20 +00:00
|
|
|
cd ${KERNEL_SRC_COPY}; cp -a include scripts ${BUILD_DIR}/debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}
|
|
|
|
cd ${KERNEL_SRC_COPY}; \
|
2018-04-24 11:57:27 +00:00
|
|
|
( \
|
|
|
|
find arch/${KERNEL_HEADER_ARCH} -name include -type d -print | \
|
|
|
|
xargs -n1 -i: find : -type f \
|
|
|
|
) | \
|
|
|
|
cpio -pd --preserve-modification-time ${BUILD_DIR}/debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}
|
2018-05-09 10:15:20 +00:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
.headers_compile_mark: .headers_prepare_mark
|
|
|
|
# set output to subdir of source to reduce number of hardcoded paths in output files
|
|
|
|
rm -rf ${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG}
|
|
|
|
mkdir -p ${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG}
|
|
|
|
cp ${KERNEL_SRC}/.config ${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG}/.config
|
|
|
|
${MAKE} -C ${KERNEL_SRC_COPY} O=${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG} -j1 silentoldconfig prepare scripts
|
|
|
|
find ${BUILD_DIR}/${KERNEL_SRC_COPY}/${PVE_HEADER_PKG} -name \*.o.ur-\* | xargs rm -f
|
|
|
|
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}/
|
|
|
|
rm -rf ${BUILD_DIR}/${KERNEL_SRC_COPY}
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
.headers_install_mark: .compile_mark .modules_compile_mark .headers_compile_mark
|
|
|
|
cp ${KERNEL_SRC}/include/generated/compile.h debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}/include/generated/compile.h
|
|
|
|
install -m 0644 ${KERNEL_SRC}/Module.symvers debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}
|
2018-02-28 08:31:06 +00:00
|
|
|
mkdir -p debian/${PVE_HEADER_PKG}/lib/modules/${KVNAME}
|
|
|
|
ln -sf /usr/src/linux-headers-${KVNAME} debian/${PVE_HEADER_PKG}/lib/modules/${KVNAME}/build
|
|
|
|
touch $@
|
|
|
|
|
2018-03-09 14:27:36 +00:00
|
|
|
# intel out-of-tree drivers disabled for now - incompatible with 4.15
|
|
|
|
#.modules_compile_mark: $(addprefix ${MODULES}/,igb.ko ixgbe.ko e1000e.ko spl.ko zfs.ko)
|
|
|
|
.modules_compile_mark: $(addprefix ${MODULES}/,spl.ko zfs.ko)
|
2018-02-28 08:31:06 +00:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
${MODULES}/spl.ko: .compile_mark
|
|
|
|
cd ${MODULES}/${SPLDIR}; ./autogen.sh
|
|
|
|
cd ${MODULES}/${SPLDIR}; ./configure --with-config=kernel --with-linux=${BUILD_DIR}/${KERNEL_SRC} --with-linux-obj=${BUILD_DIR}/${KERNEL_SRC}
|
|
|
|
${MAKE} -C ${MODULES}/${SPLDIR}
|
|
|
|
cp ${MODULES}/${SPLDIR}/module/splat/splat.ko ${MODULES}/
|
|
|
|
cp ${MODULES}/${SPLDIR}/module/spl/spl.ko ${MODULES}/
|
|
|
|
|
|
|
|
${MODULES}/zfs.ko: .compile_mark ${MODULES}/spl.ko
|
|
|
|
cd ${MODULES}/${ZFSDIR}; ./autogen.sh
|
|
|
|
cd ${MODULES}/${ZFSDIR}; ./configure --with-spl=${BUILD_DIR}/${MODULES}/${SPLDIR} --with-spl-obj=${BUILD_DIR}/${MODULES}/${SPLDIR} --with-config=kernel --with-linux=${BUILD_DIR}/${KERNEL_SRC} --with-linux-obj=${BUILD_DIR}/${KERNEL_SRC}
|
|
|
|
${MAKE} -C ${MODULES}/${ZFSDIR}
|
|
|
|
cp ${MODULES}/${ZFSDIR}/module/avl/zavl.ko ${MODULES}/
|
|
|
|
cp ${MODULES}/${ZFSDIR}/module/nvpair/znvpair.ko ${MODULES}/
|
|
|
|
cp ${MODULES}/${ZFSDIR}/module/unicode/zunicode.ko ${MODULES}/
|
|
|
|
cp ${MODULES}/${ZFSDIR}/module/zcommon/zcommon.ko ${MODULES}/
|
|
|
|
cp ${MODULES}/${ZFSDIR}/module/zpios/zpios.ko ${MODULES}/
|
|
|
|
cp ${MODULES}/${ZFSDIR}/module/icp/icp.ko ${MODULES}/
|
|
|
|
cp ${MODULES}/${ZFSDIR}/module/zfs/zfs.ko ${MODULES}/
|
|
|
|
|
|
|
|
${MODULES}/igb.ko: .compile_mark
|
|
|
|
${MAKE} -C ${MODULES}/${IGBDIR}/src BUILD_KERNEL=${KVNAME} KSRC=${BUILD_DIR}/${KERNEL_SRC}
|
|
|
|
cp ${MODULES}/${IGBDIR}/src/igb.ko ${MODULES}/
|
|
|
|
|
|
|
|
${MODULES}/ixgbe.ko: .compile_mark
|
|
|
|
${MAKE} -C ${MODULES}/${IXGBEDIR}/src CFLAGS_EXTRA="-DIXGBE_NO_LRO" BUILD_KERNEL=${KVNAME} KSRC=${BUILD_DIR}/${KERNEL_SRC}
|
|
|
|
cp ${MODULES}/${IXGBEDIR}/src/ixgbe.ko ${MODULES}/
|
|
|
|
|
|
|
|
${MODULES}/e1000e.ko: .compile_mark
|
|
|
|
${MAKE} -C ${MODULES}/${E1000EDIR}/src BUILD_KERNEL=${KVNAME} KSRC=${BUILD_DIR}/${KERNEL_SRC}
|
|
|
|
cp ${MODULES}/${E1000EDIR}/src/e1000e.ko ${MODULES}/
|
|
|
|
|
|
|
|
fwlist-${KVNAME}: .compile_mark .modules_compile_mark
|
|
|
|
debian/scripts/find-firmware.pl debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME} >fwlist.tmp
|
|
|
|
mv fwlist.tmp $@
|
|
|
|
|
|
|
|
.PHONY: fwcheck
|
|
|
|
fwcheck: fwlist-${KVNAME} fwlist-previous
|
|
|
|
@echo "checking fwlist for changes since last built firmware package.."
|
|
|
|
@echo "if this check fails, add fwlist-${KVNAME} to the pve-firmware repository and upload a new firmware package together with the ${KVNAME} kernel"
|
|
|
|
sort fwlist-previous | uniq > fwlist-previous.sorted
|
|
|
|
sort fwlist-${KVNAME} | uniq > fwlist-${KVNAME}.sorted
|
|
|
|
diff -up -N fwlist-previous.sorted fwlist-${KVNAME}.sorted > fwlist.diff
|
|
|
|
rm fwlist.diff fwlist-previous.sorted fwlist-${KVNAME}.sorted
|
|
|
|
@echo "done, no need to rebuild pve-firmware"
|
|
|
|
|
|
|
|
|
|
|
|
abi-${KVNAME}: .compile_mark
|
2018-03-21 10:27:30 +00:00
|
|
|
debian/scripts/abi-generate debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}/Module.symvers abi-${KVNAME} ${KVNAME}
|
2018-02-28 08:31:06 +00:00
|
|
|
|
|
|
|
.PHONY: abicheck
|
2018-03-21 10:27:31 +00:00
|
|
|
abicheck: debian/scripts/abi-check abi-${KVNAME} abi-prev-* abi-blacklist
|
|
|
|
debian/scripts/abi-check abi-${KVNAME} abi-prev-* ${SKIPABI}
|
2018-02-28 08:31:06 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|