From e96d2ab3a167dd34f0a5bb28a96dab00b496eb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 28 Feb 2018 09:31:06 +0100 Subject: [PATCH] build: move build and packaging to debian/ the top-level Makefile now only prepares the build directory by copying and patching sources and generating the real files from debian/*.in the actual build and packaging happens in debian/rules --- Makefile | 341 +++++++++------------------------------- debian/rules | 203 ++++++++++++++++++++++++ debian/rules.d/amd64.mk | 5 + 3 files changed, 282 insertions(+), 267 deletions(-) create mode 100644 debian/rules.d/amd64.mk diff --git a/Makefile b/Makefile index f8b790e..71a372b 100644 --- a/Makefile +++ b/Makefile @@ -7,16 +7,12 @@ PKGREL=41 # the fw package: fwlist-2.6.32-PREV-pve KREL=6 -KERNEL_SRC=ubuntu-artful -KERNEL_SRC_SUBMODULE=submodules/ubuntu-artful - -EXTRAVERSION=-${KREL}-pve +export EXTRAVERSION=-${KREL}-pve KVNAME=${KERNEL_VER}${EXTRAVERSION} PACKAGE=pve-kernel-${KVNAME} HDRPACKAGE=pve-headers-${KVNAME} ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH) -NPROCS=$(shell nproc) # amd64/x86_64/x86 share the arch subdirectory in the kernel, 'x86' so we need # a mapping @@ -26,8 +22,6 @@ KERNEL_ARCH=${ARCH} endif GITVERSION:=$(shell git rev-parse HEAD) -CHANGELOG_DATE:=$(shell dpkg-parsechangelog -SDate -lchangelog.Debian) -export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp -lchangelog.Debian) SKIPABI=0 @@ -38,74 +32,41 @@ GCC=$(CC) endif TOP=$(shell pwd) +# TODO: maybe move exported paths to a sourced file in ${BUILD_DIR}? +export BUILD_DIR=${TOP}/build +export KERNEL_SRC=ubuntu-artful +KERNEL_SRC_SUBMODULE=submodules/ubuntu-artful KERNEL_CFG_ORG=config-${KERNEL_VER}.org -E1000EDIR=e1000e-3.3.6 + +export E1000EDIR=e1000e-3.3.6 E1000ESRC=${E1000EDIR}.tar.gz -IGBDIR=igb-5.3.5.10 +export IGBDIR=igb-5.3.5.10 IGBSRC=${IGBDIR}.tar.gz -IXGBEDIR=ixgbe-5.3.3 +export IXGBEDIR=ixgbe-5.3.3 IXGBESRC=${IXGBEDIR}.tar.gz ZFSONLINUX_SUBMODULE=submodules/zfsonlinux -SPLDIR=pkg-spl +export SPLDIR=pkg-spl SPLSRC=${ZFSONLINUX_SUBMODULE}/spl-debian -ZFSDIR=pkg-zfs +export ZFSDIR=pkg-zfs ZFSSRC=${ZFSONLINUX_SUBMODULE}/zfs-debian -ZFS_KO=zfs.ko -ZFS_KO_REST=zavl.ko znvpair.ko zunicode.ko zcommon.ko zpios.ko icp.ko -ZFS_MODULES=$(ZFS_KO) $(ZFS_KO_REST) -SPL_KO=spl.ko -SPL_KO_REST=splat.ko -SPL_MODULES=$(SPL_KO) $(SPL_KO_REST) + +export MODULES=modules +MODULE_DIRS=${E1000EDIR} ${IGBDIR} ${IXGBEDIR} ${SPLDIR} ${ZFSDIR} DST_DEB=${PACKAGE}_${KERNEL_VER}-${PKGREL}_${ARCH}.deb HDR_DEB=${HDRPACKAGE}_${KERNEL_VER}-${PKGREL}_${ARCH}.deb -PVEPKG=proxmox-ve -PVE_DEB=${PVEPKG}_${RELEASE}-${PKGREL}_all.deb -VIRTUALHDRPACKAGE=pve-headers -VIRTUAL_HDR_DEB=${VIRTUALHDRPACKAGE}_${RELEASE}-${PKGREL}_all.deb +LINUX_TOOLS_DEB=linux-tools-4.13_${KERNEL_VER}-${PKGREL}_${ARCH}.deb -LINUX_TOOLS_PKG=linux-tools-4.13 -LINUX_TOOLS_DEB=${LINUX_TOOLS_PKG}_${KERNEL_VER}-${PKGREL}_${ARCH}.deb - -DEBS=${DST_DEB} ${HDR_DEB} ${PVE_DEB} ${VIRTUAL_HDR_DEB} ${LINUX_TOOLS_DEB} +DEBS=${DST_DEB} ${HDR_DEB} ${LINUX_TOOLS_DEB} all: check_gcc deb deb: ${DEBS} -pve: $(PVE_DEB) -${PVE_DEB}: proxmox-ve/control proxmox-ve/postinst ${PVE_RELEASE_KEYS} - rm -rf proxmox-ve/data - mkdir -p proxmox-ve/data/DEBIAN - mkdir -p proxmox-ve/data/usr/share/doc/${PVEPKG}/ - mkdir -p proxmox-ve/data/etc/apt/trusted.gpg.d - install -m 0644 proxmox-ve/proxmox-release-5.x.pubkey proxmox-ve/data/etc/apt/trusted.gpg.d/proxmox-ve-release-5.x.gpg - sed -e 's/@KVNAME@/${KVNAME}/' -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@RELEASE@/${RELEASE}/' -e 's/@PKGREL@/${PKGREL}/' proxmox-ve/data/DEBIAN/control - sed -e 's/@KVNAME@/${KVNAME}/' proxmox-ve/data/DEBIAN/postinst - chmod 0755 proxmox-ve/data/DEBIAN/postinst - install -m 0755 proxmox-ve/postrm proxmox-ve/data/DEBIAN/postrm - echo "git clone git://git.proxmox.com/git/pve-kernel.git\\ngit checkout ${GITVERSION}" > proxmox-ve/data/usr/share/doc/${PVEPKG}/SOURCE - install -m 0644 proxmox-ve/copyright proxmox-ve/data/usr/share/doc/${PVEPKG} - install -m 0644 proxmox-ve/changelog.Debian proxmox-ve/data/usr/share/doc/${PVEPKG} - gzip -n --best proxmox-ve/data/usr/share/doc/${PVEPKG}/changelog.Debian - dpkg-deb --build proxmox-ve/data ${PVE_DEB} - -pve-headers: $(VIRTUAL_HDR_DEB) -${VIRTUAL_HDR_DEB}: proxmox-ve/pve-headers.control - rm -rf pve-headers/data - mkdir -p pve-headers/data/DEBIAN - mkdir -p pve-headers/data/usr/share/doc/${VIRTUALHDRPACKAGE}/ - sed -e 's/@KVNAME@/${KVNAME}/' -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@RELEASE@/${RELEASE}/' -e 's/@PKGREL@/${PKGREL}/' pve-headers/data/DEBIAN/control - echo "git clone git://git.proxmox.com/git/pve-kernel.git\\ngit checkout ${GITVERSION}" > pve-headers/data/usr/share/doc/${VIRTUALHDRPACKAGE}/SOURCE - install -m 0644 proxmox-ve/copyright pve-headers/data/usr/share/doc/${VIRTUALHDRPACKAGE} - install -m 0644 proxmox-ve/changelog.Debian pve-headers/data/usr/share/doc/${VIRTUALHDRPACKAGE} - gzip -n --best pve-headers/data/usr/share/doc/${VIRTUALHDRPACKAGE}/changelog.Debian - dpkg-deb --build pve-headers/data ${VIRTUAL_HDR_DEB} - check_gcc: $(GCC) --version|grep "6\.3" || false @$(GCC) -Werror -mindirect-branch=thunk-extern -mindirect-branch-register -c -x c /dev/null -o check_gcc.o \ @@ -114,227 +75,74 @@ check_gcc: false) @rm -f check_gcc.o -${DST_DEB}: data control.in prerm.in postinst.in postrm.in copyright changelog.Debian | fwcheck abicheck - mkdir -p data/DEBIAN - sed -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@KVNAME@/${KVNAME}/' -e 's/@PKGREL@/${PKGREL}/' -e 's/@ARCH@/${ARCH}/' data/DEBIAN/control - sed -e 's/@@KVNAME@@/${KVNAME}/g' data/DEBIAN/prerm - chmod 0755 data/DEBIAN/prerm - sed -e 's/@@KVNAME@@/${KVNAME}/g' data/DEBIAN/postinst - chmod 0755 data/DEBIAN/postinst - sed -e 's/@@KVNAME@@/${KVNAME}/g' data/DEBIAN/postrm - chmod 0755 data/DEBIAN/postrm - install -D -m 644 copyright data/usr/share/doc/${PACKAGE}/copyright - install -D -m 644 changelog.Debian data/usr/share/doc/${PACKAGE}/changelog.Debian - echo "git clone git://git.proxmox.com/git/pve-kernel.git\\ngit checkout ${GITVERSION}" > data/usr/share/doc/${PACKAGE}/SOURCE - gzip -n -f --best data/usr/share/doc/${PACKAGE}/changelog.Debian - rm -f data/lib/modules/${KVNAME}/source - rm -f data/lib/modules/${KVNAME}/build - dpkg-deb --build data ${DST_DEB} +${LINUX_TOOLS_DEB} ${HDR_DEB}: ${DST_DEB} +${DST_DEB}: ${BUILD_DIR}.prepared + cd ${BUILD_DIR}; debian/rules debian/control + cd ${BUILD_DIR}; dpkg-buildpackage --jobs=auto -b -uc -us lintian ${DST_DEB} - -LINUX_TOOLS_DH_LIST=strip installchangelogs installdocs compress shlibdeps gencontrol md5sums builddeb - -${LINUX_TOOLS_DEB}: .compile_mark control.tools changelog.Debian copyright - rm -rf linux-tools ${LINUX_TOOLS_DEB} - mkdir -p linux-tools/debian - cp control.tools linux-tools/debian/control - echo 9 > linux-tools/debian/compat - cp changelog.Debian linux-tools/debian/changelog - cp copyright linux-tools/debian - mkdir -p linux-tools/debian/linux-tools-4.13/usr/bin - install -m 0755 ${KERNEL_SRC}/tools/perf/perf linux-tools/debian/linux-tools-4.13/usr/bin/perf_4.13 - cd linux-tools; for i in ${LINUX_TOOLS_DH_LIST}; do dh_$$i; done + #lintian ${HDR_DEB} lintian ${LINUX_TOOLS_DEB} -fwlist-${KVNAME}: data - ./find-firmware.pl data/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 - sed -e 's/^\(.\+\)[[:space:]]\+\(.\+\)[[:space:]]\(.\+\)$$/\3 \2 \1/' ${KERNEL_SRC}/Module.symvers | sort > abi-${KVNAME} - -.PHONY: abicheck -abicheck: abi-${KVNAME} abi-previous abi-blacklist - ./abi-check abi-${KVNAME} abi-previous ${SKIPABI} - -data: .compile_mark igb.ko ixgbe.ko e1000e.ko ${SPL_MODULES} ${ZFS_MODULES} - rm -rf data tmp; mkdir -p tmp/lib/modules/${KVNAME} - mkdir tmp/boot - install -m 644 ${KERNEL_SRC}/.config tmp/boot/config-${KVNAME} - install -m 644 ${KERNEL_SRC}/System.map tmp/boot/System.map-${KVNAME} - install -m 644 ${KERNEL_SRC}/arch/${KERNEL_ARCH}/boot/bzImage tmp/boot/vmlinuz-${KVNAME} - cd ${KERNEL_SRC}; make INSTALL_MOD_PATH=../tmp/ modules_install - ## install latest ibg driver - install -m 644 igb.ko tmp/lib/modules/${KVNAME}/kernel/drivers/net/ethernet/intel/igb/ - # install latest ixgbe driver - install -m 644 ixgbe.ko tmp/lib/modules/${KVNAME}/kernel/drivers/net/ethernet/intel/ixgbe/ - # install latest e1000e driver - install -m 644 e1000e.ko tmp/lib/modules/${KVNAME}/kernel/drivers/net/ethernet/intel/e1000e/ - # install zfs drivers - install -d -m 0755 tmp/lib/modules/${KVNAME}/zfs - install -m 644 ${SPL_MODULES} ${ZFS_MODULES} tmp/lib/modules/${KVNAME}/zfs - # remove firmware - rm -rf tmp/lib/firmware - # strip debug info - find tmp/lib/modules -name \*.ko -print | while read f ; do strip --strip-debug "$$f"; done - # finalize - /sbin/depmod -b tmp/ ${KVNAME} - # Autogenerate blacklist for watchdog devices (see README) - install -m 0755 -d tmp/lib/modprobe.d - ls tmp/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 > tmp/lib/modprobe.d/blacklist_${PACKAGE}.conf - mv tmp data - -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 - -.compile_mark: ${KERNEL_SRC}/README ${KERNEL_CFG_ORG} - [ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false) - cp ${KERNEL_CFG_ORG} ${KERNEL_SRC}/.config - cd ${KERNEL_SRC}; ./scripts/config ${PVE_CONFIG_OPTS} - cd ${KERNEL_SRC}; make oldconfig - cd ${KERNEL_SRC}; make KBUILD_BUILD_VERSION_TIMESTAMP="PVE ${KERNEL_VER}-${PKGREL} (${CHANGELOG_DATE})" -j ${NPROCS} - make -C ${KERNEL_SRC}/tools/perf prefix=/usr HAVE_CPLUS_DEMANGLE=1 NO_LIBPYTHON=1 NO_LIBPERL=1 NO_LIBCRYPTO=1 PYTHON=python2.7 - make -C ${KERNEL_SRC}/tools/perf man +${BUILD_DIR}.prepared: $(addsuffix .prepared,${KERNEL_SRC} ${MODULES}) debian + rm -rf ${BUILD_DIR}/debian + cp -a debian ${BUILD_DIR}/debian + cp -a fwlist-previous ${BUILD_DIR}/ + cp -a abi-previous ${BUILD_DIR}/ + cp -a abi-blacklist ${BUILD_DIR}/ + echo "git clone git://git.proxmox.com/git/pve-kernel.git\\ngit checkout ${GITVERSION}" > ${BUILD_DIR}/debian/SOURCE touch $@ -${KERNEL_CFG_ORG}: ${KERNEL_SRC}/README -${KERNEL_SRC}/README: ${KERNEL_SRC_SUBMODULE} | submodule - rm -rf ${KERNEL_SRC} - cp -a ${KERNEL_SRC_SUBMODULE} ${KERNEL_SRC} - cat ${KERNEL_SRC}/debian.master/config/config.common.ubuntu ${KERNEL_SRC}/debian.master/config/${ARCH}/config.common.${ARCH} ${KERNEL_SRC}/debian.master/config/${ARCH}/config.flavour.generic > ${KERNEL_CFG_ORG} - cd ${KERNEL_SRC}; for patch in ../patches/kernel/*.patch; do patch --verbose -p1 < $${patch}; done - sed -i ${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/' +${KERNEL_SRC}.prepared: ${KERNEL_SRC_SUBMODULE} | submodule + rm -rf ${BUILD_DIR}/${KERNEL_SRC} $@ + mkdir -p ${BUILD_DIR} + mkdir ${BUILD_DIR}/${KERNEL_SRC} + cp -a ${KERNEL_SRC_SUBMODULE}/* ${BUILD_DIR}/${KERNEL_SRC}/ +# TODO: split for archs, track and diff in our repository? + cat ${BUILD_DIR}/${KERNEL_SRC}/debian.master/config/config.common.ubuntu ${BUILD_DIR}/${KERNEL_SRC}/debian.master/config/${ARCH}/config.common.${ARCH} ${BUILD_DIR}/${KERNEL_SRC}/debian.master/config/${ARCH}/config.flavour.generic > ${KERNEL_CFG_ORG} + 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 + cd ${BUILD_DIR}/${KERNEL_SRC}; for patch in ../../patches/kernel/*.patch; do patch -p1 < $${patch}; done touch $@ -e1000e.ko e1000e: .compile_mark ${E1000ESRC} - rm -rf ${E1000EDIR} - tar xf ${E1000ESRC} - [ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false) - cd ${E1000EDIR}; patch -p1 < ../patches/intel/intel-module-gcc6-compat.patch - cd ${E1000EDIR}; patch -p1 < ../patches/intel/e1000e/e1000e_4.10_max-mtu.patch - cd ${E1000EDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC} - cp ${E1000EDIR}/src/e1000e.ko e1000e.ko +${MODULES}.prepared: $(addsuffix .prepared,${MODULE_DIRS}) + touch $@ -igb.ko igb: .compile_mark ${IGBSRC} - rm -rf ${IGBDIR} - tar xf ${IGBSRC} - [ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false) - cd ${IGBDIR}; patch -p1 < ../patches/intel/igb/igb_4.10_max-mtu.patch - cd ${IGBDIR}; patch -p1 < ../patches/intel/igb/igb_4.12_compat.patch - cd ${IGBDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC} - cp ${IGBDIR}/src/igb.ko igb.ko +${E1000EDIR}.prepared: ${E1000ESRC} + rm -rf ${BUILD_DIR}/${MODULES}/${E1000EDIR} $@ + mkdir -p ${BUILD_DIR}/${MODULES}/${E1000EDIR} + tar --strip-components=1 -C ${BUILD_DIR}/${MODULES}/${E1000EDIR} -xf ${E1000ESRC} + cd ${BUILD_DIR}/${MODULES}/${E1000EDIR}; patch -p1 < ../../../patches/intel/intel-module-gcc6-compat.patch + cd ${BUILD_DIR}/${MODULES}/${E1000EDIR}; patch -p1 < ../../../patches/intel/e1000e/e1000e_4.10_max-mtu.patch + touch $@ -ixgbe.ko ixgbe: .compile_mark ${IXGBESRC} - rm -rf ${IXGBEDIR} - tar xf ${IXGBESRC} - [ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false) - cd ${IXGBEDIR}/src; make CFLAGS_EXTRA="-DIXGBE_NO_LRO" BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC} - cp ${IXGBEDIR}/src/ixgbe.ko ixgbe.ko +${IGBDIR}.prepared: ${IGBSRC} + rm -rf ${BUILD_DIR}/${MODULES}/${IGBDIR} $@ + mkdir -p ${BUILD_DIR}/${MODULES}/${IGBDIR} + tar --strip-components=1 -C ${BUILD_DIR}/${MODULES}/${IGBDIR} -xf ${IGBSRC} + cd ${BUILD_DIR}/${MODULES}/${IGBDIR}; patch -p1 < ../../../patches/intel/igb/igb_4.10_max-mtu.patch + cd ${BUILD_DIR}/${MODULES}/${IGBDIR}; patch -p1 < ../../../patches/intel/igb/igb_4.12_compat.patch + touch $@ -$(SPL_KO_REST): $(SPL_KO) -$(SPL_KO): .compile_mark ${SPLSRC} - rm -rf ${SPLDIR} - rsync -ra ${SPLSRC}/ ${SPLDIR} - [ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false) - cd ${SPLDIR}; for patch in ../${SPLSRC}/../spl-patches/*.patch; do patch --verbose -p1 < $${patch}; done - cd ${SPLDIR}; ./autogen.sh - cd ${SPLDIR}; ./configure --with-config=kernel --with-linux=${TOP}/${KERNEL_SRC} --with-linux-obj=${TOP}/${KERNEL_SRC} - cd ${SPLDIR}; make - cp ${SPLDIR}/module/spl/spl.ko spl.ko - cp ${SPLDIR}/module/splat/splat.ko splat.ko +${IXGBEDIR}.prepared: ${IXGBESRC} + rm -rf ${BUILD_DIR}/${MODULES}/${IXGBEDIR} $@ + mkdir -p ${BUILD_DIR}/${MODULES}/${IXGBEDIR} + tar --strip-components=1 -C ${BUILD_DIR}/${MODULES}/${IXGBEDIR} -xf ${IXGBESRC} + touch $@ -$(ZFS_KO_REST): $(ZFS_KO) -$(ZFS_KO): .compile_mark ${ZFSSRC} - rm -rf ${ZFSDIR} - rsync -ra ${ZFSSRC}/ ${ZFSDIR} - [ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false) - cd ${ZFSDIR}; for patch in ../${ZFSSRC}/../zfs-patches/*.patch; do patch --verbose -p1 < $${patch}; done - cd ${ZFSDIR}; ./autogen.sh - cd ${ZFSDIR}; ./configure --with-spl=${TOP}/${SPLDIR} --with-spl-obj=${TOP}/${SPLDIR} --with-config=kernel --with-linux=${TOP}/${KERNEL_SRC} --with-linux-obj=${TOP}/${KERNEL_SRC} - cd ${ZFSDIR}; make - cp ${ZFSDIR}/module/zfs/zfs.ko zfs.ko - cp ${ZFSDIR}/module/avl/zavl.ko zavl.ko - cp ${ZFSDIR}/module/nvpair/znvpair.ko znvpair.ko - cp ${ZFSDIR}/module/unicode/zunicode.ko zunicode.ko - cp ${ZFSDIR}/module/zcommon/zcommon.ko zcommon.ko - cp ${ZFSDIR}/module/zpios/zpios.ko zpios.ko - cp ${ZFSDIR}/module/icp/icp.ko icp.ko +$(SPLDIR).prepared: ${SPLSRC} + rm -rf ${BUILD_DIR}/${MODULES}/${SPLDIR} $@ + mkdir -p ${BUILD_DIR}/${MODULES}/${SPLDIR} + cp -a ${SPLSRC}/* ${BUILD_DIR}/${MODULES}/${SPLDIR} + cd ${BUILD_DIR}/${MODULES}/${SPLDIR}; for patch in ../../../${SPLSRC}/../spl-patches/*.patch; do patch -p1 < $${patch}; done + touch $@ -headers_tmp := $(CURDIR)/tmp-headers -headers_dir := $(headers_tmp)/usr/src/linux-headers-${KVNAME} - -hdr: $(HDR_DEB) -${HDR_DEB}: .compile_mark headers-control.in headers-postinst.in - rm -rf $(headers_tmp) - install -d $(headers_tmp)/DEBIAN $(headers_dir)/include/ - sed -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@KVNAME@/${KVNAME}/' -e 's/@PKGREL@/${PKGREL}/' -e 's/@ARCH@/${ARCH}/' $(headers_tmp)/DEBIAN/control - sed -e 's/@@KVNAME@@/${KVNAME}/g' $(headers_tmp)/DEBIAN/postinst - chmod 0755 $(headers_tmp)/DEBIAN/postinst - install -D -m 644 copyright $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/copyright - install -D -m 644 changelog.Debian $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/changelog.Debian - echo "git clone git://git.proxmox.com/git/pve-kernel.git\\ngit checkout ${GITVERSION}" > $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/SOURCE - gzip -n -f --best $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/changelog.Debian - install -m 0644 ${KERNEL_SRC}/.config $(headers_dir) - install -m 0644 ${KERNEL_SRC}/Module.symvers $(headers_dir) - cd ${KERNEL_SRC}; find . -path './debian/*' -prune -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 $(headers_dir) - cd ${KERNEL_SRC}; cp -a include scripts $(headers_dir) - cd ${KERNEL_SRC}; (find arch/${KERNEL_ARCH} -name include -type d -print | \ - xargs -n1 -i: find : -type f) | \ - cpio -pd --preserve-modification-time $(headers_dir) - mkdir -p ${headers_tmp}/lib/modules/${KVNAME} - ln -sf /usr/src/linux-headers-${KVNAME} ${headers_tmp}/lib/modules/${KVNAME}/build - dpkg-deb --build $(headers_tmp) ${HDR_DEB} - #lintian ${HDR_DEB} +$(ZFSDIR).prepared: ${ZFSSRC} + rm -rf ${BUILD_DIR}/${MODULES}/${ZFSDIR} $@ + mkdir -p ${BUILD_DIR}/${MODULES}/${ZFSDIR} + cp -a ${ZFSSRC}/* ${BUILD_DIR}/${MODULES}/${ZFSDIR} + cd ${BUILD_DIR}/${MODULES}/${ZFSDIR}; for patch in ../../../${ZFSSRC}/../zfs-patches/*.patch; do patch -p1 < $${patch}; done + touch $@ .PHONY: upload upload: ${DEBS} @@ -342,7 +150,7 @@ upload: ${DEBS} .PHONY: distclean distclean: clean - rm -rf linux-firmware.git dvb-firmware.git ${KERNEL_SRC}.org + git submodule deinit --all # upgrade to current master .PHONY: update_modules @@ -361,8 +169,7 @@ submodule: .PHONY: clean clean: - rm -rf *~ .compile_mark watchdog-blacklist.tmp ${KERNEL_CFG_ORG} ${KERNEL_SRC} ${KERNEL_SRC}.tmp ${KERNEL_CFG_ORG} ${KERNEL_SRC}.org orig tmp data proxmox-ve/data *.deb ${headers_tmp} fwdata fwlist.tmp *.ko abi-${KVNAME} fwlist-${KVNAME} ${ZFSDIR} ${SPLDIR} ${SPL_MODULES} ${ZFS_MODULES} hpsa.ko ${HPSADIR} ${DRBDDIR} drbd-9.0 ${IGBDIR} igb.ko ${IXGBEDIR} ixgbe.ko ${E1000EDIR} e1000e.ko linux-tools ${LINUX_TOOLS_DEB} - + rm -rf *~ build *.prepared ${KERNEL_CFG_ORG} diff --git a/debian/rules b/debian/rules index a8ddb61..e5f5ddf 100755 --- a/debian/rules +++ b/debian/rules @@ -4,4 +4,207 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +# TODO: check for headers not being installed +include /usr/share/dpkg/default.mk +include debian/rules.d/${DEB_BUILD_ARCH}.mk + +KVNAME=${DEB_VERSION_UPSTREAM}${EXTRAVERSION} +CHANGELOG_DATE:=$(shell dpkg-parsechangelog -SDate) + +PVE_KERNEL_PKG=pve-kernel-${KVNAME} +PVE_HEADER_PKG=pve-headers-${KVNAME} +LINUX_TOOLS_PKG=linux-tools-4.13 + +# 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 + dh_strip + dh_makeshlibs + dh_shlibdeps + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +.compile_mark: ${KERNEL_SRC}/.config + cd ${KERNEL_SRC}; scripts/config ${PVE_CONFIG_OPTS} + ${MAKE} -C ${KERNEL_SRC} oldconfig + ${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 + ## 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/ + # 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 + ${MAKE} -C ${KERNEL_SRC}/tools/perf prefix=/usr HAVE_CPLUS_DEMANGLE=1 NO_LIBPYTHON=1 NO_LIBPERL=1 NO_LIBCRYPTO=1 PYTHON=python2.7 + ${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 + install -m 755 ${BUILD_DIR}/${KERNEL_SRC}/tools/perf/perf debian/${LINUX_TOOLS_PKG}/usr/bin/perf_4.13 + touch $@ + +.headers_install_mark: .compile_mark .modules_compile_mark + 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} + install -m 0644 ${KERNEL_SRC}/Module.symvers debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME} + cd ${KERNEL_SRC}; find . -path './debian/*' -prune -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} + cd ${KERNEL_SRC}; cp -a include scripts ${BUILD_DIR}/debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME} + cd ${KERNEL_SRC}; (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} + 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 $@ + +.modules_compile_mark: $(addprefix ${MODULES}/,igb.ko ixgbe.ko e1000e.ko spl.ko zfs.ko) + 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 + sed -e 's/^\(.\+\)[[:space:]]\+\(.\+\)[[:space:]]\(.\+\)$$/\3 \2 \1/' debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}/Module.symvers | sort > abi-${KVNAME} + +.PHONY: abicheck +abicheck: debian/scripts/abi-check abi-${KVNAME} abi-previous abi-blacklist + debian/scripts/abi-check abi-${KVNAME} abi-previous ${SKIPABI} + +.PHONY: clean diff --git a/debian/rules.d/amd64.mk b/debian/rules.d/amd64.mk new file mode 100644 index 0000000..a6f894b --- /dev/null +++ b/debian/rules.d/amd64.mk @@ -0,0 +1,5 @@ +KERNEL_BUILD_ARCH = x86 +KERNEL_HEADER_ARCH = $(KERNEL_BUILD_ARCH) +KERNEL_BUILD_IMAGE = bzImage +KERNEL_IMAGE_PATH = arch/$(KERNEL_BUILD_ARCH)/boot/${KERNEL_BUILD_IMAGE} +KERNEL_INSTALL_FILE = vmlinuz