2018-01-24 13:54:19 +03:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
# -*- makefile -*-
|
|
|
|
|
|
|
|
# Uncomment this to turn on verbose mode.
|
|
|
|
#export DH_VERBOSE=1
|
|
|
|
|
2018-02-28 11:31:06 +03:00
|
|
|
# TODO: check for headers not being installed
|
2018-03-09 13:25:58 +03:00
|
|
|
BUILD_DIR=$(shell pwd)
|
2018-01-24 13:54:19 +03:00
|
|
|
|
2018-02-28 11:31:06 +03:00
|
|
|
include /usr/share/dpkg/default.mk
|
2018-03-09 13:25:58 +03:00
|
|
|
include debian/rules.d/env.mk
|
2023-05-20 18:30:13 +03:00
|
|
|
include debian/rules.d/$(DEB_BUILD_ARCH).mk
|
2018-02-28 11:31:06 +03:00
|
|
|
|
2023-05-20 19:15:51 +03:00
|
|
|
MAKEFLAGS += $(subst parallel=,-j,$(filter parallel=%,${DEB_BUILD_OPTIONS}))
|
|
|
|
|
2018-02-28 11:31:06 +03:00
|
|
|
CHANGELOG_DATE:=$(shell dpkg-parsechangelog -SDate)
|
2023-02-10 18:40:14 +03:00
|
|
|
CHANGELOG_DATE_UTC_ISO := $(shell date -u -d '$(CHANGELOG_DATE)' +%Y-%m-%dT%H:%MZ)
|
2018-02-28 11:31:06 +03:00
|
|
|
|
2024-07-06 15:26:04 +03:00
|
|
|
PMX_KERNEL_PKG=qoup-kernel-$(KVNAME)
|
|
|
|
PMX_KERNEL_SERIES_PKG=qoup-kernel-$(KERNEL_MAJMIN)
|
|
|
|
PMX_DEBUG_KERNEL_PKG=qoup-kernel-$(KVNAME)-dbgsym
|
|
|
|
PMX_HEADER_PKG=qoup-headers-$(KVNAME)
|
|
|
|
PMX_USR_HEADER_PKG=qoup-kernel-libc-dev
|
|
|
|
PMX_KERNEL_SIGNING_TEMPLATE_PKG=qoup-kernel-${KVNAME}-signed-template
|
2023-03-16 12:40:02 +03:00
|
|
|
PMX_KERNEL_SIGNED_VERSION := $(shell echo ${DEB_VERSION} | sed -e 's/-/+/')
|
2023-05-20 18:30:13 +03:00
|
|
|
LINUX_TOOLS_PKG=linux-tools-$(KERNEL_MAJMIN)
|
|
|
|
KERNEL_SRC_COPY=$(KERNEL_SRC)_tmp
|
2018-02-28 11:31:06 +03:00
|
|
|
|
|
|
|
# TODO: split for archs, move to files?
|
2023-07-17 16:57:58 +03:00
|
|
|
PMX_CONFIG_OPTS= \
|
2018-02-28 11:31:06 +03:00
|
|
|
-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 \
|
2022-12-19 18:33:46 +03:00
|
|
|
-m CONFIG_BLK_DEV_UBLK \
|
2019-11-12 15:49:19 +03:00
|
|
|
-d CONFIG_SND_PCSP \
|
2018-02-28 11:31:06 +03:00
|
|
|
-m CONFIG_BCACHE \
|
|
|
|
-m CONFIG_JFS_FS \
|
|
|
|
-m CONFIG_HFS_FS \
|
|
|
|
-m CONFIG_HFSPLUS_FS \
|
2020-05-19 16:46:25 +03:00
|
|
|
-e CIFS_SMB_DIRECT \
|
2021-09-22 11:03:30 +03:00
|
|
|
-e CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU \
|
2018-02-28 11:31:06 +03:00
|
|
|
-e CONFIG_BRIDGE \
|
|
|
|
-e CONFIG_BRIDGE_NETFILTER \
|
|
|
|
-e CONFIG_BLK_DEV_SD \
|
|
|
|
-e CONFIG_BLK_DEV_SR \
|
|
|
|
-e CONFIG_BLK_DEV_DM \
|
2021-08-24 14:57:56 +03:00
|
|
|
-m CONFIG_BLK_DEV_NVME \
|
2019-11-05 14:08:27 +03:00
|
|
|
-e CONFIG_NLS_ISO8859_1 \
|
2018-02-28 11:31:06 +03:00
|
|
|
-d CONFIG_INPUT_EVBUG \
|
|
|
|
-d CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND \
|
2021-07-09 22:23:59 +03:00
|
|
|
-d CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL \
|
2018-02-28 11:31:06 +03:00
|
|
|
-e CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE \
|
2022-03-12 17:16:54 +03:00
|
|
|
-e CONFIG_SYSFB_SIMPLEFB \
|
2022-02-09 10:19:15 +03:00
|
|
|
-e CONFIG_DRM_SIMPLEDRM \
|
2023-03-02 11:32:25 +03:00
|
|
|
-e CONFIG_MODULE_SIG \
|
|
|
|
-e CONFIG_MODULE_SIG_ALL \
|
|
|
|
-e CONFIG_MODULE_SIG_FORMAT \
|
|
|
|
--set-str CONFIG_MODULE_SIG_HASH sha512 \
|
|
|
|
--set-str CONFIG_MODULE_SIG_KEY certs/signing_key.pem \
|
|
|
|
-e CONFIG_MODULE_SIG_KEY_TYPE_RSA \
|
|
|
|
-e CONFIG_MODULE_SIG_SHA512 \
|
2018-02-28 11:31:06 +03:00
|
|
|
-d CONFIG_MEMCG_DISABLED \
|
|
|
|
-e CONFIG_MEMCG_SWAP_ENABLED \
|
2019-09-20 12:04:05 +03:00
|
|
|
-e CONFIG_HYPERV \
|
2020-05-13 17:28:03 +03:00
|
|
|
-m CONFIG_VFIO_IOMMU_TYPE1 \
|
2023-11-25 16:12:39 +03:00
|
|
|
-e CONFIG_VFIO_VIRQFD \
|
2020-05-13 17:28:03 +03:00
|
|
|
-m CONFIG_VFIO \
|
|
|
|
-m CONFIG_VFIO_PCI \
|
|
|
|
-m CONFIG_USB_XHCI_HCD \
|
|
|
|
-m CONFIG_USB_XHCI_PCI \
|
|
|
|
-m CONFIG_USB_EHCI_HCD \
|
|
|
|
-m CONFIG_USB_EHCI_PCI \
|
|
|
|
-m CONFIG_USB_EHCI_HCD_PLATFORM \
|
|
|
|
-m CONFIG_USB_OHCI_HCD \
|
|
|
|
-m CONFIG_USB_OHCI_HCD_PCI \
|
|
|
|
-m CONFIG_USB_OHCI_HCD_PLATFORM \
|
|
|
|
-d CONFIG_USB_OHCI_HCD_SSB \
|
|
|
|
-m CONFIG_USB_UHCI_HCD \
|
|
|
|
-d CONFIG_USB_SL811_HCD_ISO \
|
2018-02-28 11:31:06 +03:00
|
|
|
-e CONFIG_MEMCG_KMEM \
|
|
|
|
-d CONFIG_DEFAULT_CFQ \
|
|
|
|
-e CONFIG_DEFAULT_DEADLINE \
|
|
|
|
-e CONFIG_MODVERSIONS \
|
2022-12-13 17:09:42 +03:00
|
|
|
-e CONFIG_ZSTD_COMPRESS \
|
2018-02-28 11:31:06 +03:00
|
|
|
-d CONFIG_DEFAULT_SECURITY_DAC \
|
|
|
|
-e CONFIG_DEFAULT_SECURITY_APPARMOR \
|
|
|
|
--set-str CONFIG_DEFAULT_SECURITY apparmor \
|
2023-01-30 16:27:19 +03:00
|
|
|
-e CONFIG_MODULE_ALLOW_BTF_MISMATCH \
|
2018-02-28 11:31:06 +03:00
|
|
|
-d CONFIG_UNWINDER_ORC \
|
|
|
|
-d CONFIG_UNWINDER_GUESS \
|
|
|
|
-e CONFIG_UNWINDER_FRAME_POINTER \
|
2021-02-26 15:41:09 +03:00
|
|
|
--set-str CONFIG_SYSTEM_TRUSTED_KEYS ""\
|
2021-08-27 11:15:01 +03:00
|
|
|
--set-str CONFIG_SYSTEM_REVOCATION_KEYS ""\
|
2023-03-02 11:32:25 +03:00
|
|
|
-e CONFIG_SECURITY_LOCKDOWN_LSM \
|
|
|
|
-e CONFIG_SECURITY_LOCKDOWN_LSM_EARLY \
|
|
|
|
--set-str CONFIG_LSM lockdown,yama,integrity,apparmor \
|
2023-08-11 19:02:33 +03:00
|
|
|
-e CONFIG_PAGE_TABLE_ISOLATION \
|
|
|
|
-e CONFIG_ARCH_HAS_CPU_FINALIZE_INIT \
|
2023-10-25 09:22:18 +03:00
|
|
|
-d CONFIG_GDS_FORCE_MITIGATION \
|
2023-11-12 18:33:18 +03:00
|
|
|
-d CONFIG_WQ_CPU_INTENSIVE_REPORT \
|
2024-04-17 11:52:11 +03:00
|
|
|
-d CONFIG_N_GSM \
|
2023-11-16 15:25:01 +03:00
|
|
|
-d UBSAN_BOUNDS \
|
2018-02-28 11:31:06 +03:00
|
|
|
|
|
|
|
debian/control: $(wildcard debian/*.in)
|
2024-07-06 16:07:27 +03:00
|
|
|
sed -e 's/@@KVNAME@@/$(KVNAME)/g' < debian/qoup-kernel.prerm.in > debian/$(PMX_KERNEL_PKG).prerm
|
|
|
|
sed -e 's/@@KVNAME@@/$(KVNAME)/g' < debian/qoup-kernel.postrm.in > debian/$(PMX_KERNEL_PKG).postrm
|
|
|
|
sed -e 's/@@KVNAME@@/$(KVNAME)/g' < debian/qoup-kernel.postinst.in > debian/$(PMX_KERNEL_PKG).postinst
|
|
|
|
sed -e 's/@@KVNAME@@/$(KVNAME)/g' < debian/qoup-headers.postinst.in > debian/$(PMX_HEADER_PKG).postinst
|
|
|
|
sed -e 's/@@KVMAJMIN@@/$(KERNEL_MAJMIN)/g' -e 's/@@KVNAME@@/$(KVNAME)/g' < debian/qoup-kernel-meta.postrm.in > debian/$(PMX_KERNEL_SERIES_PKG).postrm
|
|
|
|
sed -e 's/@@KVMAJMIN@@/$(KERNEL_MAJMIN)/g' -e 's/@@KVNAME@@/$(KVNAME)/g' < debian/qoup-kernel-meta.postinst.in > debian/$(PMX_KERNEL_SERIES_PKG).postinst
|
2023-07-17 16:57:58 +03:00
|
|
|
chmod +x debian/$(PMX_KERNEL_PKG).prerm
|
|
|
|
chmod +x debian/$(PMX_KERNEL_PKG).postrm
|
|
|
|
chmod +x debian/$(PMX_KERNEL_PKG).postinst
|
|
|
|
chmod +x debian/$(PMX_KERNEL_SERIES_PKG).postrm
|
|
|
|
chmod +x debian/$(PMX_KERNEL_SERIES_PKG).postinst
|
|
|
|
chmod +x debian/$(PMX_HEADER_PKG).postinst
|
2023-05-20 18:30:13 +03:00
|
|
|
sed -e 's/@KVNAME@/$(KVNAME)/g' -e 's/@KVMAJMIN@/$(KERNEL_MAJMIN)/g' < debian/control.in > debian/control
|
2018-02-28 11:31:06 +03:00
|
|
|
|
2023-03-16 12:40:02 +03:00
|
|
|
# signing-template
|
2024-07-06 15:26:04 +03:00
|
|
|
sed -e '1 s/qoup-kernel/qoup-kernel-signed/' -e '1 s/${DEB_VERSION}/${PMX_KERNEL_SIGNED_VERSION}/' < debian/changelog > debian/signing-template/changelog
|
2023-03-16 12:40:02 +03:00
|
|
|
sed -e 's/@KVNAME@/${KVNAME}/g' -e 's/@KVMAJMIN@/$(KERNEL_MAJMIN)/g' -e 's/@UNSIGNED_VERSION@/${DEB_VERSION}/g' < debian/signing-template/control.in > debian/signing-template/control
|
|
|
|
sed -e 's/@KVNAME@/${KVNAME}/g' < debian/signing-template/files.json.in > debian/signing-template/files.json
|
|
|
|
sed -e 's/@KVNAME@/${KVNAME}/g' -e 's/@PKG_VERSION@/${DEB_VERSION}/' < debian/signing-template/rules.in > debian/signing-template/rules
|
2024-07-06 16:07:27 +03:00
|
|
|
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/qoup-kernel.prerm.in > debian/signing-template/prerm
|
|
|
|
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/qoup-kernel.postrm.in > debian/signing-template/postrm
|
|
|
|
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/qoup-kernel.postinst.in > debian/signing-template/postinst
|
2023-03-16 12:40:02 +03:00
|
|
|
rm debian/signing-template/*.in
|
|
|
|
cp debian/SOURCE debian/signing-template/
|
|
|
|
|
2018-02-28 11:31:06 +03:00
|
|
|
build: .compile_mark .tools_compile_mark .modules_compile_mark
|
|
|
|
|
2020-05-27 18:12:08 +03:00
|
|
|
install: .install_mark .tools_install_mark .headers_install_mark .usr_headers_install_mark
|
2018-02-28 11:31:06 +03:00
|
|
|
dh_installdocs -A debian/copyright debian/SOURCE
|
|
|
|
dh_installchangelogs
|
|
|
|
dh_installman
|
|
|
|
dh_strip_nondeterminism
|
|
|
|
dh_compress
|
|
|
|
dh_fixperms
|
|
|
|
|
|
|
|
binary: install
|
|
|
|
debian/rules fwcheck abicheck
|
2023-07-17 16:57:58 +03:00
|
|
|
dh_strip -N$(PMX_HEADER_PKG) -N$(PMX_USR_HEADER_PKG)
|
2018-02-28 11:31:06 +03:00
|
|
|
dh_makeshlibs
|
|
|
|
dh_shlibdeps
|
|
|
|
dh_installdeb
|
|
|
|
dh_gencontrol
|
|
|
|
dh_md5sums
|
|
|
|
dh_builddeb
|
|
|
|
|
2018-05-09 13:15:20 +03:00
|
|
|
.config_mark:
|
2023-07-17 16:57:58 +03:00
|
|
|
cd $(KERNEL_SRC); scripts/config $(PMX_CONFIG_OPTS)
|
2023-11-12 18:36:18 +03:00
|
|
|
$(MAKE) -C $(KERNEL_SRC) olddefconfig
|
2021-06-15 14:27:29 +03:00
|
|
|
# copy to allow building in parallel to kernel/module compilation without interference
|
2023-05-20 18:30:13 +03:00
|
|
|
rm -rf $(KERNEL_SRC_COPY)
|
|
|
|
cp -ar $(KERNEL_SRC) $(KERNEL_SRC_COPY)
|
2018-05-09 13:15:20 +03:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
.compile_mark: .config_mark
|
2023-07-17 16:57:58 +03:00
|
|
|
$(MAKE) -C $(KERNEL_SRC) KBUILD_BUILD_VERSION_TIMESTAMP="PMX $(DEB_VERSION) ($(CHANGELOG_DATE_UTC_ISO))"
|
2018-02-28 11:31:06 +03:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
.install_mark: .compile_mark .modules_compile_mark
|
2023-07-17 16:57:58 +03:00
|
|
|
rm -rf debian/$(PMX_KERNEL_PKG)
|
|
|
|
mkdir -p debian/$(PMX_KERNEL_PKG)/lib/modules/$(KVNAME)
|
|
|
|
mkdir debian/$(PMX_KERNEL_PKG)/boot
|
|
|
|
install -m 644 $(KERNEL_SRC)/.config debian/$(PMX_KERNEL_PKG)/boot/config-$(KVNAME)
|
|
|
|
install -m 644 $(KERNEL_SRC)/System.map debian/$(PMX_KERNEL_PKG)/boot/System.map-$(KVNAME)
|
|
|
|
install -m 644 $(KERNEL_SRC)/$(KERNEL_IMAGE_PATH) debian/$(PMX_KERNEL_PKG)/boot/$(KERNEL_INSTALL_FILE)-$(KVNAME)
|
|
|
|
$(MAKE) -C $(KERNEL_SRC) INSTALL_MOD_PATH=$(BUILD_DIR)/debian/$(PMX_KERNEL_PKG)/ modules_install
|
2018-02-28 11:31:06 +03:00
|
|
|
# install zfs drivers
|
2023-07-17 16:57:58 +03:00
|
|
|
install -d -m 0755 debian/$(PMX_KERNEL_PKG)/lib/modules/$(KVNAME)/zfs
|
2023-10-15 17:05:10 +03:00
|
|
|
install -m 644 $(MODULES)/zfs.ko $(MODULES)/spl.ko debian/$(PMX_KERNEL_PKG)/lib/modules/$(KVNAME)/zfs
|
2018-02-28 11:31:06 +03:00
|
|
|
# remove firmware
|
2023-07-17 16:57:58 +03:00
|
|
|
rm -rf debian/$(PMX_KERNEL_PKG)/lib/firmware
|
build: keep unstripped kernel and module files
and put them into a new -dbgsym package for usage with
crash/kdump-tools/...
fixes #3465, and now allows to do the following (after installing
and configuring kdump-tools to collect kernel crash dumps) when the
system crashes:
$ apt install pve-kernel-5.11.21-1-dbgsym
$ crash /usr/lib/debug/boot/vmlinux-5.11.21-1-pve /var/crash/202106151236/dump.202106151236
crash 7.2.9
Copyright (C) 2002-2020 Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
Copyright (C) 1999-2006 Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011 NEC Corporation
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for details.
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
WARNING: kernel relocated [812MB]: patching 136336 gdb minimal_symbol values
KERNEL: /usr/lib/debug/boot/vmlinux-5.11.21-1-pve
DUMPFILE: /var/crash/202106151236/dump.202106151236 [PARTIAL DUMP]
CPUS: 4
DATE: Tue Jun 15 12:36:38 CEST 2021
UPTIME: 00:06:21
LOAD AVERAGE: 0.04, 0.11, 0.08
TASKS: 272
NODENAME: test
RELEASE: 5.11.21-1-pve
VERSION: #1 SMP PVE 5.11.21-1 (Tue, 01 Jun 2021 16:38:57 +0200)
MACHINE: x86_64 (3696 Mhz)
MEMORY: 8 GB
PANIC: "Kernel panic - not syncing: sysrq triggered crash"
PID: 3167
COMMAND: "bash"
TASK: ffff9220c8f5be00 [THREAD_INFO: ffff9220c8f5be00]
CPU: 3
STATE: TASK_RUNNING (PANIC)
crash> bt
PID: 3167 TASK: ffff9220c8f5be00 CPU: 3 COMMAND: "bash"
#0 [ffffa24ec0bfbc80] machine_kexec at ffffffffb3c751f3
#1 [ffffa24ec0bfbce0] __crash_kexec at ffffffffb3d61092
#2 [ffffa24ec0bfbdb0] panic at ffffffffb47b769d
#3 [ffffa24ec0bfbe30] sysrq_handle_crash at ffffffffb434da4a
#4 [ffffa24ec0bfbe40] __handle_sysrq.cold at ffffffffb47e2cdc
#5 [ffffa24ec0bfbe78] write_sysrq_trigger at ffffffffb434e3f8
#6 [ffffa24ec0bfbe90] proc_reg_write at ffffffffb3fc09ea
#7 [ffffa24ec0bfbeb0] vfs_write at ffffffffb3f143b6
#8 [ffffa24ec0bfbee8] ksys_write at ffffffffb3f16b97
#9 [ffffa24ec0bfbf28] __x64_sys_write at ffffffffb3f16c2a
#10 [ffffa24ec0bfbf38] do_syscall_64 at ffffffffb480e868
#11 [ffffa24ec0bfbf50] entry_SYSCALL_64_after_hwframe at ffffffffb4a0008c
RIP: 00007f367f7baf33 RSP: 00007ffe6175dc98 RFLAGS: 00000246
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f367f7baf33
RDX: 0000000000000002 RSI: 0000560510e640b0 RDI: 0000000000000001
RBP: 0000560510e640b0 R8: 000000000000000a R9: 0000000000000001
R10: 0000560510e5f800 R11: 0000000000000246 R12: 0000000000000002
R13: 00007f367f88b6a0 R14: 0000000000000002 R15: 00007f367f88b8a0
ORIG_RAX: 0000000000000001 CS: 0033 SS: 002b
as well as lots of other fun things (see 'help' after opening a crash dump).
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-06-15 14:27:24 +03:00
|
|
|
|
2024-07-06 15:26:04 +03:00
|
|
|
ifeq ($(filter pkg.qoup-kernel.debug,$(DEB_BUILD_PROFILES)),)
|
|
|
|
echo "'pkg.qoup-kernel.debug' build profile disabled, skipping -dbgsym creation"
|
2021-07-21 15:10:40 +03:00
|
|
|
else
|
2024-07-06 15:26:04 +03:00
|
|
|
echo "'pkg.qoup-kernel.debug' build profile enabled, creating -dbgsym contents"
|
2023-07-17 16:57:58 +03:00
|
|
|
mkdir -p debian/$(PMX_DEBUG_KERNEL_PKG)/usr/lib/debug/lib/modules/$(KVNAME)
|
|
|
|
mkdir debian/$(PMX_DEBUG_KERNEL_PKG)/usr/lib/debug/boot
|
|
|
|
install -m 644 $(KERNEL_SRC)/vmlinux debian/$(PMX_DEBUG_KERNEL_PKG)/usr/lib/debug/boot/vmlinux-$(KVNAME)
|
|
|
|
cp -r debian/$(PMX_KERNEL_PKG)/lib/modules/$(KVNAME) debian/$(PMX_DEBUG_KERNEL_PKG)/usr/lib/debug/lib/modules/
|
|
|
|
rm -f debian/$(PMX_DEBUG_KERNEL_PKG)/usr/lib/debug/lib/modules/$(KVNAME)/source
|
|
|
|
rm -f debian/$(PMX_DEBUG_KERNEL_PKG)/usr/lib/debug/lib/modules/$(KVNAME)/build
|
|
|
|
rm -f debian/$(PMX_DEBUG_KERNEL_PKG)/usr/lib/debug/lib/modules/$(KVNAME)/modules.*
|
2021-07-21 15:10:40 +03:00
|
|
|
endif
|
build: keep unstripped kernel and module files
and put them into a new -dbgsym package for usage with
crash/kdump-tools/...
fixes #3465, and now allows to do the following (after installing
and configuring kdump-tools to collect kernel crash dumps) when the
system crashes:
$ apt install pve-kernel-5.11.21-1-dbgsym
$ crash /usr/lib/debug/boot/vmlinux-5.11.21-1-pve /var/crash/202106151236/dump.202106151236
crash 7.2.9
Copyright (C) 2002-2020 Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
Copyright (C) 1999-2006 Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011 NEC Corporation
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for details.
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
WARNING: kernel relocated [812MB]: patching 136336 gdb minimal_symbol values
KERNEL: /usr/lib/debug/boot/vmlinux-5.11.21-1-pve
DUMPFILE: /var/crash/202106151236/dump.202106151236 [PARTIAL DUMP]
CPUS: 4
DATE: Tue Jun 15 12:36:38 CEST 2021
UPTIME: 00:06:21
LOAD AVERAGE: 0.04, 0.11, 0.08
TASKS: 272
NODENAME: test
RELEASE: 5.11.21-1-pve
VERSION: #1 SMP PVE 5.11.21-1 (Tue, 01 Jun 2021 16:38:57 +0200)
MACHINE: x86_64 (3696 Mhz)
MEMORY: 8 GB
PANIC: "Kernel panic - not syncing: sysrq triggered crash"
PID: 3167
COMMAND: "bash"
TASK: ffff9220c8f5be00 [THREAD_INFO: ffff9220c8f5be00]
CPU: 3
STATE: TASK_RUNNING (PANIC)
crash> bt
PID: 3167 TASK: ffff9220c8f5be00 CPU: 3 COMMAND: "bash"
#0 [ffffa24ec0bfbc80] machine_kexec at ffffffffb3c751f3
#1 [ffffa24ec0bfbce0] __crash_kexec at ffffffffb3d61092
#2 [ffffa24ec0bfbdb0] panic at ffffffffb47b769d
#3 [ffffa24ec0bfbe30] sysrq_handle_crash at ffffffffb434da4a
#4 [ffffa24ec0bfbe40] __handle_sysrq.cold at ffffffffb47e2cdc
#5 [ffffa24ec0bfbe78] write_sysrq_trigger at ffffffffb434e3f8
#6 [ffffa24ec0bfbe90] proc_reg_write at ffffffffb3fc09ea
#7 [ffffa24ec0bfbeb0] vfs_write at ffffffffb3f143b6
#8 [ffffa24ec0bfbee8] ksys_write at ffffffffb3f16b97
#9 [ffffa24ec0bfbf28] __x64_sys_write at ffffffffb3f16c2a
#10 [ffffa24ec0bfbf38] do_syscall_64 at ffffffffb480e868
#11 [ffffa24ec0bfbf50] entry_SYSCALL_64_after_hwframe at ffffffffb4a0008c
RIP: 00007f367f7baf33 RSP: 00007ffe6175dc98 RFLAGS: 00000246
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f367f7baf33
RDX: 0000000000000002 RSI: 0000560510e640b0 RDI: 0000000000000001
RBP: 0000560510e640b0 R8: 000000000000000a R9: 0000000000000001
R10: 0000560510e5f800 R11: 0000000000000246 R12: 0000000000000002
R13: 00007f367f88b6a0 R14: 0000000000000002 R15: 00007f367f88b8a0
ORIG_RAX: 0000000000000001 CS: 0033 SS: 002b
as well as lots of other fun things (see 'help' after opening a crash dump).
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-06-15 14:27:24 +03:00
|
|
|
|
2018-02-28 11:31:06 +03:00
|
|
|
# strip debug info
|
2023-07-17 16:57:58 +03:00
|
|
|
find debian/$(PMX_KERNEL_PKG)/lib/modules -name \*.ko -print | while read f ; do strip --strip-debug "$$f"; done
|
2023-03-02 11:32:25 +03:00
|
|
|
|
|
|
|
# sign modules using ephemeral, embedded key
|
|
|
|
if grep -q CONFIG_MODULE_SIG=y ubuntu-kernel/.config ; then \
|
|
|
|
find debian/$(PMX_KERNEL_PKG)/lib/modules -name \*.ko -print | while read f ; do \
|
|
|
|
./ubuntu-kernel/scripts/sign-file sha512 ./ubuntu-kernel/certs/signing_key.pem ubuntu-kernel/certs/signing_key.x509 "$$f" ; \
|
|
|
|
done; \
|
|
|
|
rm ./ubuntu-kernel/certs/signing_key.pem ; \
|
|
|
|
fi
|
2018-02-28 11:31:06 +03:00
|
|
|
# finalize
|
2023-07-17 16:57:58 +03:00
|
|
|
/sbin/depmod -b debian/$(PMX_KERNEL_PKG)/ $(KVNAME)
|
2018-02-28 11:31:06 +03:00
|
|
|
# Autogenerate blacklist for watchdog devices (see README)
|
2023-07-17 16:57:58 +03:00
|
|
|
install -m 0755 -d debian/$(PMX_KERNEL_PKG)/lib/modprobe.d
|
|
|
|
ls debian/$(PMX_KERNEL_PKG)/lib/modules/$(KVNAME)/kernel/drivers/watchdog/ > watchdog-blacklist.tmp
|
2018-02-28 11:31:06 +03:00
|
|
|
echo ipmi_watchdog.ko >> watchdog-blacklist.tmp
|
2023-07-17 16:57:58 +03:00
|
|
|
cat watchdog-blacklist.tmp|sed -e 's/^/blacklist /' -e 's/.ko$$//'|sort -u > debian/$(PMX_KERNEL_PKG)/lib/modprobe.d/blacklist_$(PMX_KERNEL_PKG).conf
|
|
|
|
rm -f debian/$(PMX_KERNEL_PKG)/lib/modules/$(KVNAME)/source
|
|
|
|
rm -f debian/$(PMX_KERNEL_PKG)/lib/modules/$(KVNAME)/build
|
2023-03-16 12:40:02 +03:00
|
|
|
|
|
|
|
# copy signing template contents
|
|
|
|
rm -rf debian/${PMX_KERNEL_SIGNING_TEMPLATE_PKG}
|
|
|
|
mkdir -p debian/${PMX_KERNEL_SIGNING_TEMPLATE_PKG}/usr/share/code-signing/${PMX_KERNEL_SIGNING_TEMPLATE_PKG}/source-template/debian
|
|
|
|
cp -R debian/copyright \
|
|
|
|
debian/signing-template/rules \
|
|
|
|
debian/signing-template/control \
|
|
|
|
debian/signing-template/source \
|
|
|
|
debian/signing-template/changelog \
|
|
|
|
debian/signing-template/prerm \
|
|
|
|
debian/signing-template/postrm \
|
|
|
|
debian/signing-template/postinst \
|
|
|
|
debian/signing-template/SOURCE \
|
|
|
|
debian/${PMX_KERNEL_SIGNING_TEMPLATE_PKG}/usr/share/code-signing/${PMX_KERNEL_SIGNING_TEMPLATE_PKG}/source-template/debian
|
|
|
|
cp debian/signing-template/files.json debian/${PMX_KERNEL_SIGNING_TEMPLATE_PKG}/usr/share/code-signing/${PMX_KERNEL_SIGNING_TEMPLATE_PKG}/
|
|
|
|
|
2018-02-28 11:31:06 +03:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
.tools_compile_mark: .compile_mark
|
2023-10-13 17:02:57 +03:00
|
|
|
$(MAKE) -C $(KERNEL_SRC)/tools/perf prefix=/usr NO_LIBTRACEEVENT=1 HAVE_NO_LIBBFD=1 HAVE_CPLUS_DEMANGLE_SUPPORT=1 NO_LIBPYTHON=1 NO_LIBPERL=1 NO_LIBCRYPTO=1 PYTHON=python3
|
2018-04-25 13:17:19 +03:00
|
|
|
echo "checking GPL-2 only perf binary for library linkage with incompatible licenses.."
|
2023-05-20 18:30:13 +03:00
|
|
|
! ldd $(KERNEL_SRC)/tools/perf/perf | grep -q -E '\blibbfd'
|
|
|
|
! ldd $(KERNEL_SRC)/tools/perf/perf | grep -q -E '\blibcrypto'
|
2023-10-13 17:02:57 +03:00
|
|
|
$(MAKE) -C $(KERNEL_SRC)/tools/perf NO_LIBTRACEEVENT=1 man
|
2018-02-28 11:31:06 +03:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
.tools_install_mark: .tools_compile_mark
|
2023-05-20 18:30:13 +03:00
|
|
|
rm -rf debian/$(LINUX_TOOLS_PKG)
|
|
|
|
mkdir -p debian/$(LINUX_TOOLS_PKG)/usr/bin
|
|
|
|
mkdir -p debian/$(LINUX_TOOLS_PKG)/usr/share/man/man1
|
|
|
|
install -m 755 $(BUILD_DIR)/$(KERNEL_SRC)/tools/perf/perf debian/$(LINUX_TOOLS_PKG)/usr/bin/perf_$(KERNEL_MAJMIN)
|
|
|
|
for i in $(BUILD_DIR)/$(KERNEL_SRC)/tools/perf/Documentation/*.1; do \
|
2018-05-28 12:04:48 +03:00
|
|
|
fname="$${i##*/}"; manname="$${fname%.1}"; \
|
2023-05-20 18:30:13 +03:00
|
|
|
install -m644 "$$i" "debian/$(LINUX_TOOLS_PKG)/usr/share/man/man1/$${manname}_$(KERNEL_MAJMIN).1"; \
|
2018-05-28 12:04:48 +03:00
|
|
|
done
|
2018-02-28 11:31:06 +03:00
|
|
|
touch $@
|
|
|
|
|
2018-05-09 13:15:20 +03:00
|
|
|
.headers_prepare_mark: .config_mark
|
2023-07-17 16:57:58 +03:00
|
|
|
rm -rf debian/$(PMX_HEADER_PKG)
|
|
|
|
mkdir -p debian/$(PMX_HEADER_PKG)/usr/src/linux-headers-$(KVNAME)
|
|
|
|
install -m 0644 $(KERNEL_SRC)/.config debian/$(PMX_HEADER_PKG)/usr/src/linux-headers-$(KVNAME)
|
2023-05-20 18:30:13 +03:00
|
|
|
make -C $(KERNEL_SRC_COPY) mrproper
|
|
|
|
cd $(KERNEL_SRC_COPY); find . -path './debian/*' -prune \
|
2018-04-24 14:57:27 +03: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' \
|
|
|
|
\) \
|
2023-07-17 16:57:58 +03:00
|
|
|
-print | cpio -pd --preserve-modification-time $(BUILD_DIR)/debian/$(PMX_HEADER_PKG)/usr/src/linux-headers-$(KVNAME)
|
2023-05-20 18:30:13 +03:00
|
|
|
cd $(KERNEL_SRC_COPY); \
|
2018-04-24 14:57:27 +03:00
|
|
|
( \
|
2023-05-20 18:30:13 +03:00
|
|
|
find arch/$(KERNEL_HEADER_ARCH) -name include -type d -print | \
|
2018-04-24 14:57:27 +03:00
|
|
|
xargs -n1 -i: find : -type f \
|
|
|
|
) | \
|
2023-07-17 16:57:58 +03:00
|
|
|
cpio -pd --preserve-modification-time $(BUILD_DIR)/debian/$(PMX_HEADER_PKG)/usr/src/linux-headers-$(KVNAME)
|
2018-05-09 13:15:20 +03:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
.headers_compile_mark: .headers_prepare_mark
|
|
|
|
# set output to subdir of source to reduce number of hardcoded paths in output files
|
2023-07-17 16:57:58 +03:00
|
|
|
rm -rf $(BUILD_DIR)/$(KERNEL_SRC_COPY)/$(PMX_HEADER_PKG)
|
|
|
|
mkdir -p $(BUILD_DIR)/$(KERNEL_SRC_COPY)/$(PMX_HEADER_PKG)
|
|
|
|
cp $(KERNEL_SRC)/.config $(BUILD_DIR)/$(KERNEL_SRC_COPY)/$(PMX_HEADER_PKG)/.config
|
|
|
|
$(MAKE) -C $(KERNEL_SRC_COPY) O=$(BUILD_DIR)/$(KERNEL_SRC_COPY)/$(PMX_HEADER_PKG) -j1 syncconfig modules_prepare prepare scripts
|
|
|
|
cd $(KERNEL_SRC_COPY); cp -a include scripts $(BUILD_DIR)/debian/$(PMX_HEADER_PKG)/usr/src/linux-headers-$(KVNAME)
|
|
|
|
find $(BUILD_DIR)/$(KERNEL_SRC_COPY)/$(PMX_HEADER_PKG) -name \*.o.ur-\* -o -name '*.cmd' | xargs rm -f
|
|
|
|
rsync --ignore-existing -r -v -a $(addprefix $(BUILD_DIR)/$(KERNEL_SRC_COPY)/$(PMX_HEADER_PKG)/,arch include kernel scripts tools) $(BUILD_DIR)/debian/$(PMX_HEADER_PKG)/usr/src/linux-headers-$(KVNAME)/
|
2023-05-20 18:30:13 +03:00
|
|
|
rm -rf $(BUILD_DIR)/$(KERNEL_SRC_COPY)
|
2018-05-09 13:15:20 +03:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
.headers_install_mark: .compile_mark .modules_compile_mark .headers_compile_mark
|
2023-07-17 16:57:58 +03:00
|
|
|
cp $(KERNEL_SRC)/include/generated/compile.h debian/$(PMX_HEADER_PKG)/usr/src/linux-headers-$(KVNAME)/include/generated/compile.h
|
|
|
|
install -m 0644 $(KERNEL_SRC)/Module.symvers debian/$(PMX_HEADER_PKG)/usr/src/linux-headers-$(KVNAME)
|
|
|
|
mkdir -p debian/$(PMX_HEADER_PKG)/lib/modules/$(KVNAME)
|
|
|
|
ln -sf /usr/src/linux-headers-$(KVNAME) debian/$(PMX_HEADER_PKG)/lib/modules/$(KVNAME)/build
|
2018-02-28 11:31:06 +03:00
|
|
|
touch $@
|
|
|
|
|
2023-07-17 16:57:58 +03:00
|
|
|
.usr_headers_install_mark: PKG_DIR = debian/$(PMX_USR_HEADER_PKG)
|
2023-05-20 18:30:13 +03:00
|
|
|
.usr_headers_install_mark: OUT_DIR = $(PKG_DIR)/usr
|
2020-05-27 18:12:08 +03:00
|
|
|
.usr_headers_install_mark: .config_mark
|
2023-05-20 18:30:13 +03: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)
|
2020-05-27 18:12:08 +03:00
|
|
|
rm -rf $(OUT_DIR)/include/drm $(OUT_DIR)/include/scsi
|
|
|
|
find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) -execdir rm {} +
|
|
|
|
|
|
|
|
# Move include/asm to arch-specific directory
|
|
|
|
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)/
|
|
|
|
touch $@
|
|
|
|
|
2023-05-20 18:30:13 +03:00
|
|
|
.modules_compile_mark: $(MODULES)/zfs.ko
|
2018-02-28 11:31:06 +03:00
|
|
|
touch $@
|
|
|
|
|
2023-05-20 18:30:13 +03:00
|
|
|
$(MODULES)/zfs.ko: .compile_mark
|
|
|
|
cd $(MODULES)/$(ZFSDIR); ./autogen.sh
|
|
|
|
cd $(MODULES)/$(ZFSDIR); ./configure --with-config=kernel --with-linux=$(BUILD_DIR)/$(KERNEL_SRC) --with-linux-obj=$(BUILD_DIR)/$(KERNEL_SRC)
|
|
|
|
$(MAKE) -C $(MODULES)/$(ZFSDIR)
|
2023-10-15 17:05:10 +03:00
|
|
|
cp $(MODULES)/$(ZFSDIR)/module/zfs.ko $(MODULES)/
|
|
|
|
cp $(MODULES)/$(ZFSDIR)/module/spl.ko $(MODULES)/
|
2018-02-28 11:31:06 +03:00
|
|
|
|
2023-05-20 18:30:13 +03:00
|
|
|
fwlist-$(KVNAME): .compile_mark .modules_compile_mark
|
2023-07-17 16:57:58 +03:00
|
|
|
debian/scripts/find-firmware.pl debian/$(PMX_KERNEL_PKG)/lib/modules/$(KVNAME) >fwlist.tmp
|
2018-02-28 11:31:06 +03:00
|
|
|
mv fwlist.tmp $@
|
|
|
|
|
|
|
|
.PHONY: fwcheck
|
2023-05-20 18:30:13 +03:00
|
|
|
fwcheck: fwlist-$(KVNAME) fwlist-previous
|
2018-02-28 11:31:06 +03:00
|
|
|
@echo "checking fwlist for changes since last built firmware package.."
|
2023-05-20 18:30:13 +03:00
|
|
|
@echo "if this check fails, add fwlist-$(KVNAME) to the pve-firmware repository and upload a new firmware package together with the $(KVNAME) kernel"
|
2018-02-28 11:31:06 +03:00
|
|
|
sort fwlist-previous | uniq > fwlist-previous.sorted
|
2023-05-20 18:30:13 +03:00
|
|
|
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
|
2018-02-28 11:31:06 +03:00
|
|
|
@echo "done, no need to rebuild pve-firmware"
|
|
|
|
|
|
|
|
|
2023-05-20 18:30:13 +03:00
|
|
|
abi-$(KVNAME): .compile_mark
|
2023-07-17 16:57:58 +03:00
|
|
|
debian/scripts/abi-generate debian/$(PMX_HEADER_PKG)/usr/src/linux-headers-$(KVNAME)/Module.symvers abi-$(KVNAME) $(KVNAME)
|
2018-02-28 11:31:06 +03:00
|
|
|
|
|
|
|
.PHONY: abicheck
|
2023-05-20 18:30:13 +03:00
|
|
|
abicheck: debian/scripts/abi-check abi-$(KVNAME) abi-prev-* abi-blacklist
|
|
|
|
debian/scripts/abi-check abi-$(KVNAME) abi-prev-* $(SKIPABI)
|
2018-02-28 11:31:06 +03:00
|
|
|
|
|
|
|
.PHONY: clean
|