2018-06-08 15:39:23 +03:00
|
|
|
# also bump pve-kernel-meta if either of MAJ.MIN, PATCHLEVEL or KREL change
|
2022-12-13 17:09:59 +03:00
|
|
|
KERNEL_MAJ=6
|
2023-03-08 14:06:29 +03:00
|
|
|
KERNEL_MIN=2
|
2023-03-14 20:08:26 +03:00
|
|
|
KERNEL_PATCHLEVEL=6
|
2018-08-10 14:24:30 +03:00
|
|
|
# increment KREL if the ABI changes (abicheck target in debian/rules)
|
|
|
|
# rebuild packages with new KREL and run 'make abiupdate'
|
2022-11-14 22:25:18 +03:00
|
|
|
KREL=1
|
2017-03-15 16:43:11 +03:00
|
|
|
|
2022-11-14 22:25:18 +03:00
|
|
|
PKGREL=1
|
2018-03-05 17:42:44 +03:00
|
|
|
|
2018-05-28 12:04:46 +03:00
|
|
|
KERNEL_MAJMIN=$(KERNEL_MAJ).$(KERNEL_MIN)
|
|
|
|
KERNEL_VER=$(KERNEL_MAJMIN).$(KERNEL_PATCHLEVEL)
|
|
|
|
|
2022-08-02 10:21:09 +03:00
|
|
|
EXTRAVERSION=-${KREL}-pve
|
2017-03-15 16:43:11 +03:00
|
|
|
KVNAME=${KERNEL_VER}${EXTRAVERSION}
|
|
|
|
PACKAGE=pve-kernel-${KVNAME}
|
|
|
|
HDRPACKAGE=pve-headers-${KVNAME}
|
|
|
|
|
2017-05-10 17:33:45 +03:00
|
|
|
ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
2017-05-10 17:33:47 +03:00
|
|
|
|
|
|
|
# amd64/x86_64/x86 share the arch subdirectory in the kernel, 'x86' so we need
|
|
|
|
# a mapping
|
|
|
|
KERNEL_ARCH=x86
|
|
|
|
ifneq (${ARCH}, amd64)
|
|
|
|
KERNEL_ARCH=${ARCH}
|
|
|
|
endif
|
|
|
|
|
2017-06-20 10:51:41 +03:00
|
|
|
GITVERSION:=$(shell git rev-parse HEAD)
|
2017-03-15 16:43:11 +03:00
|
|
|
|
2017-03-24 14:48:43 +03:00
|
|
|
SKIPABI=0
|
|
|
|
|
2018-03-09 13:25:58 +03:00
|
|
|
BUILD_DIR=build
|
2017-03-15 16:43:11 +03:00
|
|
|
|
2022-12-13 10:32:18 +03:00
|
|
|
KERNEL_SRC=ubuntu-kernel
|
2018-05-28 12:04:46 +03:00
|
|
|
KERNEL_SRC_SUBMODULE=submodules/$(KERNEL_SRC)
|
2017-03-15 16:43:11 +03:00
|
|
|
KERNEL_CFG_ORG=config-${KERNEL_VER}.org
|
|
|
|
|
2017-10-12 15:56:28 +03:00
|
|
|
ZFSONLINUX_SUBMODULE=submodules/zfsonlinux
|
2018-03-09 13:25:58 +03:00
|
|
|
ZFSDIR=pkg-zfs
|
2018-02-28 11:31:06 +03:00
|
|
|
|
2018-03-09 13:25:58 +03:00
|
|
|
MODULES=modules
|
2019-05-24 15:40:34 +03:00
|
|
|
MODULE_DIRS=${ZFSDIR}
|
2017-03-15 16:43:11 +03:00
|
|
|
|
2018-03-09 13:25:58 +03:00
|
|
|
# exported to debian/rules via debian/rules.d/dirs.mk
|
2019-05-24 15:40:34 +03:00
|
|
|
DIRS=KERNEL_SRC ZFSDIR MODULES
|
2018-03-09 13:25:58 +03:00
|
|
|
|
2017-03-15 16:43:11 +03:00
|
|
|
DST_DEB=${PACKAGE}_${KERNEL_VER}-${PKGREL}_${ARCH}.deb
|
|
|
|
HDR_DEB=${HDRPACKAGE}_${KERNEL_VER}-${PKGREL}_${ARCH}.deb
|
2021-06-23 11:51:13 +03:00
|
|
|
USR_HDR_DEB=pve-kernel-libc-dev_${KERNEL_VER}-${PKGREL}_${ARCH}.deb
|
2018-05-28 12:04:46 +03:00
|
|
|
LINUX_TOOLS_DEB=linux-tools-$(KERNEL_MAJMIN)_${KERNEL_VER}-${PKGREL}_${ARCH}.deb
|
2021-07-21 20:46:04 +03:00
|
|
|
LINUX_TOOLS_DBG_DEB=linux-tools-$(KERNEL_MAJMIN)-dbgsym_${KERNEL_VER}-${PKGREL}_${ARCH}.deb
|
2017-03-15 16:43:11 +03:00
|
|
|
|
2023-03-08 14:07:16 +03:00
|
|
|
DEBS=${DST_DEB} ${HDR_DEB} ${LINUX_TOOLS_DEB} ${LINUX_TOOLS_DBG_DEB} # ${USR_HDR_DEB}
|
2017-03-15 16:43:11 +03:00
|
|
|
|
2019-05-22 15:01:09 +03:00
|
|
|
all: deb
|
2017-08-02 15:45:53 +03:00
|
|
|
deb: ${DEBS}
|
2017-03-15 16:43:11 +03:00
|
|
|
|
2018-02-28 11:31:06 +03:00
|
|
|
${LINUX_TOOLS_DEB} ${HDR_DEB}: ${DST_DEB}
|
|
|
|
${DST_DEB}: ${BUILD_DIR}.prepared
|
|
|
|
cd ${BUILD_DIR}; dpkg-buildpackage --jobs=auto -b -uc -us
|
2017-03-15 16:43:11 +03:00
|
|
|
lintian ${DST_DEB}
|
2018-02-28 11:31:06 +03:00
|
|
|
#lintian ${HDR_DEB}
|
2017-03-15 16:43:11 +03:00
|
|
|
lintian ${LINUX_TOOLS_DEB}
|
|
|
|
|
2018-03-09 13:25:58 +03:00
|
|
|
${BUILD_DIR}.prepared: $(addsuffix .prepared,${KERNEL_SRC} ${MODULES} debian)
|
2018-02-28 11:31:06 +03:00
|
|
|
cp -a fwlist-previous ${BUILD_DIR}/
|
2018-03-21 13:27:29 +03:00
|
|
|
cp -a abi-prev-* ${BUILD_DIR}/
|
2018-02-28 11:31:06 +03:00
|
|
|
cp -a abi-blacklist ${BUILD_DIR}/
|
2018-03-09 13:25:58 +03:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
debian.prepared: debian
|
|
|
|
rm -rf ${BUILD_DIR}/debian
|
|
|
|
mkdir -p ${BUILD_DIR}
|
|
|
|
cp -a debian ${BUILD_DIR}/debian
|
2018-02-28 11:31:06 +03:00
|
|
|
echo "git clone git://git.proxmox.com/git/pve-kernel.git\\ngit checkout ${GITVERSION}" > ${BUILD_DIR}/debian/SOURCE
|
2018-03-09 13:25:58 +03:00
|
|
|
@$(foreach dir, ${DIRS},echo "${dir}=${${dir}}" >> ${BUILD_DIR}/debian/rules.d/env.mk;)
|
|
|
|
echo "KVNAME=${KVNAME}" >> ${BUILD_DIR}/debian/rules.d/env.mk
|
2018-05-28 12:04:46 +03:00
|
|
|
echo "KERNEL_MAJMIN=${KERNEL_MAJMIN}" >> ${BUILD_DIR}/debian/rules.d/env.mk
|
2018-03-09 13:25:58 +03:00
|
|
|
cd ${BUILD_DIR}; debian/rules debian/control
|
2017-03-15 16:43:11 +03:00
|
|
|
touch $@
|
|
|
|
|
2018-02-28 11:31:06 +03:00
|
|
|
${KERNEL_SRC}.prepared: ${KERNEL_SRC_SUBMODULE} | submodule
|
|
|
|
rm -rf ${BUILD_DIR}/${KERNEL_SRC} $@
|
|
|
|
mkdir -p ${BUILD_DIR}
|
2018-03-09 13:27:15 +03:00
|
|
|
cp -a ${KERNEL_SRC_SUBMODULE} ${BUILD_DIR}/${KERNEL_SRC}
|
2018-02-28 11:31:06 +03:00
|
|
|
# TODO: split for archs, track and diff in our repository?
|
2022-12-13 17:08:27 +03:00
|
|
|
cd ${BUILD_DIR}/${KERNEL_SRC}; python3 debian/scripts/misc/annotations --arch amd64 --export >../../${KERNEL_CFG_ORG}
|
2018-02-28 11:31:06 +03:00
|
|
|
cp ${KERNEL_CFG_ORG} ${BUILD_DIR}/${KERNEL_SRC}/.config
|
|
|
|
sed -i ${BUILD_DIR}/${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/'
|
|
|
|
rm -rf ${BUILD_DIR}/${KERNEL_SRC}/debian ${BUILD_DIR}/${KERNEL_SRC}/debian.master
|
2019-05-15 09:56:10 +03:00
|
|
|
set -e; cd ${BUILD_DIR}/${KERNEL_SRC}; for patch in ../../patches/kernel/*.patch; do echo "applying patch '$$patch'" && patch -p1 < $${patch}; done
|
2017-03-15 16:43:11 +03:00
|
|
|
touch $@
|
|
|
|
|
2018-02-28 11:31:06 +03:00
|
|
|
${MODULES}.prepared: $(addsuffix .prepared,${MODULE_DIRS})
|
|
|
|
touch $@
|
|
|
|
|
2019-02-27 17:06:54 +03:00
|
|
|
${ZFSDIR}.prepared: ${ZFSONLINUX_SUBMODULE}
|
2019-05-24 15:40:34 +03:00
|
|
|
rm -rf ${BUILD_DIR}/${MODULES}/${ZFSDIR} ${BUILD_DIR}/${MODULES}/tmp $@
|
2019-02-27 17:06:54 +03:00
|
|
|
mkdir -p ${BUILD_DIR}/${MODULES}/tmp
|
|
|
|
cp -a ${ZFSONLINUX_SUBMODULE}/* ${BUILD_DIR}/${MODULES}/tmp
|
|
|
|
cd ${BUILD_DIR}/${MODULES}/tmp; make kernel
|
|
|
|
rm -rf ${BUILD_DIR}/${MODULES}/tmp
|
2019-05-24 15:40:34 +03:00
|
|
|
touch ${ZFSDIR}.prepared
|
2017-03-15 16:43:11 +03:00
|
|
|
|
|
|
|
.PHONY: upload
|
|
|
|
upload: ${DEBS}
|
2021-06-23 11:51:33 +03:00
|
|
|
tar cf - ${DEBS}|ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist bullseye --arch ${ARCH}
|
2017-03-15 16:43:11 +03:00
|
|
|
|
|
|
|
.PHONY: distclean
|
|
|
|
distclean: clean
|
2018-02-28 11:31:06 +03:00
|
|
|
git submodule deinit --all
|
2017-03-15 16:43:11 +03:00
|
|
|
|
2017-03-15 17:21:54 +03:00
|
|
|
# upgrade to current master
|
|
|
|
.PHONY: update_modules
|
2017-10-13 09:30:09 +03:00
|
|
|
update_modules: submodule
|
2017-03-15 17:21:54 +03:00
|
|
|
git submodule foreach 'git pull --ff-only origin master'
|
2019-02-27 17:06:54 +03:00
|
|
|
cd ${ZFSONLINUX_SUBMODULE}; git pull --ff-only origin master
|
2017-03-15 17:21:54 +03:00
|
|
|
|
|
|
|
# make sure submodules were initialized
|
2017-10-13 09:30:09 +03:00
|
|
|
.PHONY: submodule
|
|
|
|
submodule:
|
2017-10-12 15:56:28 +03:00
|
|
|
test -f "${KERNEL_SRC_SUBMODULE}/README" || git submodule update --init ${KERNEL_SRC_SUBMODULE}
|
2019-05-25 19:16:26 +03:00
|
|
|
test -f "${ZFSONLINUX_SUBMODULE}/Makefile" || git submodule update --init --recursive ${ZFSONLINUX_SUBMODULE}
|
2017-03-15 17:21:54 +03:00
|
|
|
|
2018-03-21 13:27:33 +03:00
|
|
|
# call after ABI bump with header deb in working directory
|
|
|
|
.PHONY: abiupdate
|
|
|
|
abiupdate: abi-prev-${KVNAME}
|
|
|
|
abi-prev-${KVNAME}: abi-tmp-${KVNAME}
|
|
|
|
ifneq ($(strip $(shell git status --untracked-files=no --porcelain -z)),)
|
|
|
|
@echo "working directory unclean, aborting!"
|
|
|
|
@false
|
|
|
|
else
|
|
|
|
git rm "abi-prev-*"
|
|
|
|
mv $< $@
|
|
|
|
git add $@
|
|
|
|
git commit -s -m "update ABI file for ${KVNAME}" -m "(generated with debian/scripts/abi-generate)"
|
|
|
|
@echo "update abi-prev-${KVNAME} committed!"
|
|
|
|
endif
|
|
|
|
|
|
|
|
abi-tmp-${KVNAME}:
|
|
|
|
@ test -e ${HDR_DEB} || (echo "need ${HDR_DEB} to extract ABI data!" && false)
|
|
|
|
debian/scripts/abi-generate ${HDR_DEB} $@ ${KVNAME} 1
|
2017-03-15 17:21:54 +03:00
|
|
|
|
2017-03-15 16:43:11 +03:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2018-02-28 11:31:06 +03:00
|
|
|
rm -rf *~ build *.prepared ${KERNEL_CFG_ORG}
|
2018-05-23 12:42:10 +03:00
|
|
|
rm -f *.deb *.changes *.buildinfo
|