2018-01-24 10:54:19 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
# -*- makefile -*-
|
2018-02-28 08:31:06 +00:00
|
|
|
include /usr/share/dpkg/default.mk
|
|
|
|
|
2021-04-18 17:30:23 +00:00
|
|
|
# Common variables for all architectures
|
|
|
|
include debian/rules.d/common.mk
|
2018-02-28 08:31:06 +00:00
|
|
|
|
2021-04-18 17:30:23 +00:00
|
|
|
# Pull in some arch specific stuff
|
|
|
|
include debian/rules.d/arch/${DEB_BUILD_ARCH}.mk
|
2018-02-28 08:31:06 +00:00
|
|
|
|
2021-04-18 17:30:23 +00:00
|
|
|
BUILD_DIR ?= ${CURDIR}
|
|
|
|
KERNEL_SRC := linux
|
|
|
|
ZFS_SRC := zfs
|
2020-04-28 13:13:50 +00:00
|
|
|
|
2021-03-28 19:34:25 +00:00
|
|
|
%:
|
2021-03-28 19:51:08 +00:00
|
|
|
dh $@ --with quilt
|
2021-03-28 19:34:25 +00:00
|
|
|
|
2021-04-18 17:55:44 +00:00
|
|
|
## Debian package metadata
|
|
|
|
debian/control: debian/templates/control.in
|
2023-03-14 03:06:37 +00:00
|
|
|
sed -e 's/@KVNAME@/${KVNAME}/g' -e 's/@KVMAJMIN@/${KERNEL_MAJMIN}/g' -e 's/edge/${DEB_DISTRIBUTION}/g' < debian/templates/control.in > debian/control
|
2021-03-28 19:07:30 +00:00
|
|
|
|
|
|
|
debian/SOURCE:
|
2021-04-18 17:30:23 +00:00
|
|
|
echo "git clone git@github.com:fabianishere/pve-edge-kernel.git \
|
|
|
|
git checkout ${PKG_GIT_VERSION} \
|
|
|
|
git submodule update --init --depth=1" > $@
|
2018-02-28 08:31:06 +00:00
|
|
|
|
2021-04-18 17:55:44 +00:00
|
|
|
## Debhelper phases
|
2021-03-28 19:51:08 +00:00
|
|
|
override_dh_quilt_patch:
|
2021-04-18 17:55:44 +00:00
|
|
|
# Apply crack bundle
|
2023-02-09 06:52:49 +00:00
|
|
|
# git -C ${KERNEL_SRC} fetch ../crack.bundle $$(git -C ${KERNEL_SRC} ls-remote ../crack.bundle | cut -f1)
|
|
|
|
# git -C ${KERNEL_SRC} checkout -f FETCH_HEAD
|
2021-04-18 17:55:44 +00:00
|
|
|
# Apply patches
|
|
|
|
cd ${KERNEL_SRC}; \
|
2021-03-28 19:51:08 +00:00
|
|
|
QUILT_PATCHES=../debian/patches \
|
|
|
|
QUILT_SERIES=series.linux \
|
|
|
|
quilt --quiltrc /dev/null --color=always push -a || test $$? = 2
|
2021-04-18 17:55:44 +00:00
|
|
|
cd ${ZFS_SRC}; \
|
2021-04-18 10:17:29 +00:00
|
|
|
QUILT_PATCHES=../debian/patches \
|
|
|
|
QUILT_SERIES=series.zfs \
|
|
|
|
quilt --quiltrc /dev/null --color=always push -a || test $$? = 2
|
2021-03-28 19:51:08 +00:00
|
|
|
|
|
|
|
override_dh_quilt_unpatch:
|
2021-04-18 17:55:44 +00:00
|
|
|
cd ${KERNEL_SRC}; \
|
2021-03-28 19:51:08 +00:00
|
|
|
QUILT_PATCHES=../debian/patches \
|
|
|
|
QUILT_SERIES=series.linux \
|
|
|
|
quilt --quiltrc /dev/null pop -a || test $$? = 2
|
2021-04-18 17:55:44 +00:00
|
|
|
cd ${ZFS_SRC}; \
|
2021-04-18 10:17:29 +00:00
|
|
|
QUILT_PATCHES=../debian/patches \
|
|
|
|
QUILT_SERIES=series.zfs \
|
|
|
|
quilt --quiltrc /dev/null pop -a || test $$? = 2
|
2021-04-18 17:55:44 +00:00
|
|
|
rm -rf ${KERNEL_SRC}/.pc ${ZFS_SRC}/.pc
|
2021-03-28 19:51:08 +00:00
|
|
|
|
2021-04-18 17:55:44 +00:00
|
|
|
override_dh_autoreconf:
|
|
|
|
dh_autoreconf -D ${ZFS_SRC}
|
|
|
|
|
|
|
|
override_dh_auto_configure: ${KERNEL_SRC}/.config
|
|
|
|
|
|
|
|
override_dh_auto_build:
|
|
|
|
# Kernel
|
|
|
|
dh_auto_build -D ${KERNEL_SRC} -- \
|
|
|
|
CC="${PVE_KERNEL_CC}" \
|
|
|
|
KCFLAGS="${PVE_KERNEL_CFLAGS}" \
|
|
|
|
EXTRAVERSION="${EXTRAVERSION}" \
|
|
|
|
LOCALVERSION="${LOCALVERSION}" \
|
2021-11-28 13:10:53 +00:00
|
|
|
KBUILD_BUILD_VERSION_TIMESTAMP="${PKG_DISTRIBUTOR} ${DEB_VERSION} (${PKG_DATE_UTC_ISO})"
|
2021-04-18 17:55:44 +00:00
|
|
|
# ZFS
|
|
|
|
dh_auto_configure -D ${ZFS_SRC} -- CC="${PVE_ZFS_CC}" --with-config=kernel --with-linux=$(realpath ${KERNEL_SRC}) --with-linux-obj=$(realpath ${KERNEL_SRC})
|
|
|
|
dh_auto_build -D ${ZFS_SRC}
|
2018-02-28 08:31:06 +00:00
|
|
|
|
2021-03-28 19:34:25 +00:00
|
|
|
override_dh_auto_install: debian/SOURCE .install_mark .tools_install_mark .headers_install_mark .usr_headers_install_mark
|
2018-02-28 08:31:06 +00:00
|
|
|
dh_installdocs -A debian/copyright debian/SOURCE
|
|
|
|
dh_installchangelogs
|
|
|
|
dh_installman
|
|
|
|
dh_strip_nondeterminism
|
|
|
|
dh_compress
|
|
|
|
dh_fixperms
|
|
|
|
|
2021-04-18 17:55:44 +00:00
|
|
|
override_dh_auto_clean: debian/control
|
|
|
|
dh_clean
|
|
|
|
dh_auto_clean -D ${KERNEL_SRC}
|
|
|
|
dh_auto_clean -D ${ZFS_SRC}
|
|
|
|
rm -f ${PVE_KERNEL_TEMPLATES} ${PVE_HEADER_TEMPLATES}
|
|
|
|
rm -f debian/SOURCE debian/*.tmp .*_mark
|
|
|
|
|
|
|
|
## Kernel
|
|
|
|
PVE_KERNEL_TEMPLATES := $(patsubst debian/templates/pve-kernel.%.in, debian/${PVE_KERNEL_PKG}.%, $(wildcard debian/templates/pve-kernel.*.in))
|
|
|
|
|
2021-03-28 13:01:15 +00:00
|
|
|
${KERNEL_SRC}/.config:
|
2023-02-09 06:52:49 +00:00
|
|
|
cp debian/config/config.pve ${KERNEL_SRC}/.config
|
2022-11-03 21:42:46 +00:00
|
|
|
${MAKE} -C ${KERNEL_SRC} CC=${PVE_KERNEL_CC} olddefconfig
|
2021-03-28 13:01:15 +00:00
|
|
|
|
2021-04-18 17:55:44 +00:00
|
|
|
debian/${PVE_KERNEL_PKG}.%: debian/templates/pve-kernel.%.in
|
|
|
|
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/templates/pve-kernel.$*.in > debian/${PVE_KERNEL_PKG}.$*
|
|
|
|
chmod +x debian/${PVE_KERNEL_PKG}.$*
|
2018-02-28 08:31:06 +00:00
|
|
|
|
2021-04-18 17:55:44 +00:00
|
|
|
.install_mark: ${PVE_KERNEL_TEMPLATES}
|
2018-02-28 08:31:06 +00:00
|
|
|
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
|
2023-03-23 16:18:18 +00:00
|
|
|
${MAKE} -C ${KERNEL_SRC} INSTALL_PATH=${BUILD_DIR}/debian/${PVE_KERNEL_PKG}/boot dtbs_install
|
2023-03-14 03:06:37 +00:00
|
|
|
|
2018-02-28 08:31:06 +00:00
|
|
|
# install zfs drivers
|
|
|
|
install -d -m 0755 debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
|
2023-10-31 15:30:03 +00:00
|
|
|
install -m 644 ${ZFS_SRC}/module/zfs.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
|
|
|
|
install -m 644 ${ZFS_SRC}/module/spl.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
|
2018-02-28 08:31:06 +00:00
|
|
|
# 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
|
2023-03-14 16:18:56 +00:00
|
|
|
# ls debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/kernel/drivers/watchdog/ > debian/watchdog-blacklist.tmp
|
|
|
|
# echo ipmi_watchdog.ko >> debian/watchdog-blacklist.tmp
|
|
|
|
# cat debian/watchdog-blacklist.tmp | sed -e 's/^/blacklist /' -e 's/.ko$$//' | sort -u > debian/${PVE_KERNEL_PKG}/lib/modprobe.d/blacklist_${PVE_KERNEL_PKG}.conf
|
2018-02-28 08:31:06 +00:00
|
|
|
rm -f debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/source
|
|
|
|
rm -f debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/build
|
|
|
|
touch $@
|
|
|
|
|
2021-04-18 17:55:44 +00:00
|
|
|
## Kernel tools
|
|
|
|
.tools_compile_mark:
|
|
|
|
dh_auto_build -D ${KERNEL_SRC}/tools/perf -- prefix=/usr \
|
|
|
|
HAVE_NO_LIBBFD=1 \
|
|
|
|
HAVE_CPLUS_DEMANGLE_SUPPORT=1 \
|
|
|
|
NO_LIBPYTHON=1 \
|
|
|
|
NO_LIBPERL=1 \
|
|
|
|
NO_LIBCRYPTO=1 \
|
2021-07-27 15:00:52 +00:00
|
|
|
PYTHON=python3
|
2023-03-14 16:18:56 +00:00
|
|
|
# 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
|
|
|
|
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-05-28 09:04:48 +00:00
|
|
|
for i in ${BUILD_DIR}/${KERNEL_SRC}/tools/perf/Documentation/*.1; do \
|
|
|
|
fname="$${i##*/}"; manname="$${fname%.1}"; \
|
|
|
|
install -m644 "$$i" "debian/${LINUX_TOOLS_PKG}/usr/share/man/man1/$${manname}_$(KERNEL_MAJMIN).1"; \
|
|
|
|
done
|
2018-02-28 08:31:06 +00:00
|
|
|
touch $@
|
|
|
|
|
2021-04-18 17:55:44 +00:00
|
|
|
## Headers
|
|
|
|
PVE_HEADER_TEMPLATES := $(patsubst debian/templates/pve-headers.%.in, debian/${PVE_HEADER_PKG}.%, $(wildcard debian/templates/pve-headers.*.in))
|
|
|
|
|
|
|
|
debian/${PVE_HEADER_PKG}.%: debian/templates/pve-headers.%.in
|
|
|
|
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/templates/pve-headers.$*.in > debian/${PVE_HEADER_PKG}.$*
|
|
|
|
chmod +x debian/${PVE_HEADER_PKG}.$*
|
|
|
|
|
|
|
|
.headers_install_mark: ${PVE_HEADER_TEMPLATES}
|
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}
|
2021-04-18 12:46:52 +00:00
|
|
|
( \
|
|
|
|
cd ${KERNEL_SRC}; \
|
2021-05-02 13:21:11 +00:00
|
|
|
find . -path './debian/*' -prune \
|
|
|
|
-o -path './include/*' -prune \
|
|
|
|
-o -path './scripts' -prune \
|
|
|
|
-o -type f \
|
|
|
|
\( \
|
|
|
|
-name 'Makefile*' \
|
|
|
|
-o -name 'Kconfig*' \
|
|
|
|
-o -name 'Kbuild*' \
|
|
|
|
-o -name '*.sh' \
|
|
|
|
-o -name '*.pl' \
|
|
|
|
\) \
|
|
|
|
-print; \
|
2021-04-18 12:46:52 +00:00
|
|
|
find include scripts -type f -o -type l; \
|
2021-05-02 13:21:11 +00:00
|
|
|
find arch/${KERNEL_BUILD_ARCH} -maxdepth 1 -name Makefile\*; \
|
2021-04-18 12:46:52 +00:00
|
|
|
find arch/${KERNEL_BUILD_ARCH} -name module.lds -o -name Kbuild.platforms -o -name Platform; \
|
|
|
|
find $$(find arch/${KERNEL_BUILD_ARCH} -name include -o -name scripts -type d) -type f; \
|
2021-11-21 12:27:00 +00:00
|
|
|
find arch/${KERNEL_BUILD_ARCH}/include Module.symvers include scripts -type f; \
|
|
|
|
find tools/ -name 'objtool' -type f \
|
2021-04-18 17:55:44 +00:00
|
|
|
) | rsync -avq --files-from=- ${KERNEL_SRC} 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 $@
|
|
|
|
|
2021-04-18 17:55:44 +00:00
|
|
|
## User-space headers
|
2020-05-27 15:12:08 +00:00
|
|
|
.usr_headers_install_mark: PKG_DIR = debian/${PVE_USR_HEADER_PKG}
|
|
|
|
.usr_headers_install_mark: OUT_DIR = ${PKG_DIR}/usr
|
2021-04-18 17:55:44 +00:00
|
|
|
.usr_headers_install_mark:
|
2020-05-27 15:12:08 +00:00
|
|
|
rm -rf '${PKG_DIR}'
|
|
|
|
mkdir -p '${PKG_DIR}'
|
|
|
|
$(MAKE) -C ${KERNEL_SRC} headers_install ARCH=$(KERNEL_HEADER_ARCH) INSTALL_HDR_PATH='$(CURDIR)'/$(OUT_DIR)
|
|
|
|
rm -rf $(OUT_DIR)/include/drm $(OUT_DIR)/include/scsi
|
|
|
|
find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) -execdir rm {} +
|
2021-04-18 17:55:44 +00:00
|
|
|
# Move include/asm to arch-specific directory
|
2020-05-27 15:12:08 +00:00
|
|
|
mkdir -p $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)
|
|
|
|
mv $(OUT_DIR)/include/asm $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
|
|
|
|
test ! -d $(OUT_DIR)/include/arch || \
|
|
|
|
mv $(OUT_DIR)/include/arch $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
|
2021-07-27 15:00:52 +00:00
|
|
|
touch $@
|