2018-06-08 12:39:23 +00:00
# also bump pve-kernel-meta if either of MAJ.MIN, PATCHLEVEL or KREL change
2019-05-22 12:11:23 +00:00
KERNEL_MAJ = 5
2020-05-24 20:20:17 +00:00
KERNEL_MIN = 7
KERNEL_PATCHLEVEL = 0
2018-08-10 11:24:30 +00:00
# increment KREL if the ABI changes (abicheck target in debian/rules)
# rebuild packages with new KREL and run 'make abiupdate'
2020-05-27 10:33:33 +00:00
KREL = 0rc7
2017-03-15 13:43:11 +00:00
2020-05-27 10:33:33 +00:00
PKGREL = 0rc7
2018-03-05 14:42:44 +00:00
2018-05-28 09:04:46 +00:00
KERNEL_MAJMIN = $( KERNEL_MAJ) .$( KERNEL_MIN)
KERNEL_VER = $( KERNEL_MAJMIN) .$( KERNEL_PATCHLEVEL)
2020-04-28 13:13:50 +00:00
EXTRAVERSION = -${ KREL }
# Append Linux flavor name to EXTRAVERSION
i f d e f P V E _ B U I L D _ F L A V O R
_ := $( info Using build flavor: ${ PVE_BUILD_FLAVOR } )
EXTRAVERSION:= ${ EXTRAVERSION } -${ PVE_BUILD_FLAVOR }
e n d i f
2020-04-29 10:08:37 +00:00
# Default to generic micro architecture
PVE_BUILD_TYPE ?= generic
2020-04-28 13:13:50 +00:00
# Append Linux build type to EXTRAVERSION
2020-04-29 10:08:37 +00:00
i f n e q ( $ { P V E _ B U I L D _ T Y P E } , g e n e r i c )
_ := $( info Using build type: ${ PVE_BUILD_TYPE } )
2020-04-28 13:13:50 +00:00
EXTRAVERSION:= ${ EXTRAVERSION } -${ PVE_BUILD_TYPE }
e n d i f
2017-03-15 13:43:11 +00:00
KVNAME = ${ KERNEL_VER } ${ EXTRAVERSION }
2020-04-28 13:13:50 +00:00
PACKAGE = pve-edge-kernel-${ KVNAME }
HDRPACKAGE = pve-edge-headers-${ KVNAME }
2017-03-15 13:43:11 +00:00
2017-05-10 14:33:45 +00:00
ARCH = $( shell dpkg-architecture -qDEB_BUILD_ARCH)
2017-05-10 14:33:47 +00:00
# amd64/x86_64/x86 share the arch subdirectory in the kernel, 'x86' so we need
# a mapping
KERNEL_ARCH = x86
i f n e q ( $ { A R C H } , a m d 6 4 )
KERNEL_ARCH = ${ ARCH }
e n d i f
2017-06-20 07:51:41 +00:00
GITVERSION := $( shell git rev-parse HEAD)
2017-03-15 13:43:11 +00:00
2017-03-24 11:48:43 +00:00
SKIPABI = 0
2018-03-09 10:25:58 +00:00
BUILD_DIR = build
2017-03-15 13:43:11 +00:00
2020-04-29 19:32:45 +00:00
KERNEL_SRC = linux-stable
2018-05-28 09:04:46 +00:00
KERNEL_SRC_SUBMODULE = submodules/$( KERNEL_SRC)
2017-03-15 13:43:11 +00:00
KERNEL_CFG_ORG = config-${ KERNEL_VER } .org
2020-04-28 13:13:50 +00:00
ZFSONLINUX_SUBMODULE = submodules/zfsonlinux/
2018-03-09 10:25:58 +00:00
ZFSDIR = pkg-zfs
2018-02-28 08:31:06 +00:00
2018-03-09 10:25:58 +00:00
MODULES = modules
2019-05-24 12:40:34 +00:00
MODULE_DIRS = ${ ZFSDIR }
2017-03-15 13:43:11 +00:00
2018-03-09 10:25:58 +00:00
# exported to debian/rules via debian/rules.d/dirs.mk
2019-05-24 12:40:34 +00:00
DIRS = KERNEL_SRC ZFSDIR MODULES
2018-03-09 10:25:58 +00:00
2017-03-15 13:43:11 +00:00
DST_DEB = ${ PACKAGE } _${ KERNEL_VER } -${ PKGREL } _${ ARCH } .deb
HDR_DEB = ${ HDRPACKAGE } _${ KERNEL_VER } -${ PKGREL } _${ ARCH } .deb
2018-05-28 09:04:46 +00:00
LINUX_TOOLS_DEB = linux-tools-$( KERNEL_MAJMIN) _${ KERNEL_VER } -${ PKGREL } _${ ARCH } .deb
2017-03-15 13:43:11 +00:00
2018-02-28 08:31:06 +00:00
DEBS = ${ DST_DEB } ${ HDR_DEB } ${ LINUX_TOOLS_DEB }
2017-03-15 13:43:11 +00:00
2020-04-28 21:01:54 +00:00
all : deb release .txt artifacts .txt
2017-08-02 12:45:53 +00:00
deb : ${DEBS }
2017-03-15 13:43:11 +00:00
2020-04-28 18:22:14 +00:00
release.txt :
echo " ${ KVNAME } " > release.txt
2020-04-28 21:01:54 +00:00
echo " ${ KERNEL_VER } " >> release.txt
echo " ${ PKGREL } " >> release.txt
echo " ${ ARCH } " >> release.txt
2020-04-28 18:22:14 +00:00
echo " ${ PVE_BUILD_FLAVOR } " >> release.txt
echo " ${ PVE_BUILD_TYPE } " >> release.txt
2020-04-28 21:01:54 +00:00
artifacts.txt :
echo " ${ DST_DEB } " > artifacts.txt
echo " ${ HDR_DEB } " >> artifacts.txt
echo " ${ LINUX_TOOLS_DEB } " >> artifacts.txt
2018-02-28 08:31:06 +00: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 13:43:11 +00:00
lintian ${ DST_DEB }
2018-02-28 08:31:06 +00:00
#lintian ${HDR_DEB}
2017-03-15 13:43:11 +00:00
lintian ${ LINUX_TOOLS_DEB }
2018-03-09 10:25:58 +00:00
${BUILD_DIR}.prepared : $( addsuffix .prepared ,$ {KERNEL_SRC } $ {MODULES } debian )
2018-02-28 08:31:06 +00:00
cp -a fwlist-previous ${ BUILD_DIR } /
2018-03-21 10:27:29 +00:00
cp -a abi-prev-* ${ BUILD_DIR } /
2018-02-28 08:31:06 +00:00
cp -a abi-blacklist ${ BUILD_DIR } /
2018-03-09 10:25:58 +00:00
touch $@
debian.prepared : debian
rm -rf ${ BUILD_DIR } /debian
mkdir -p ${ BUILD_DIR }
cp -a debian ${ BUILD_DIR } /debian
2020-04-28 13:13:50 +00:00
echo " git clone git@github.com:fabianishere/pve-kernel-edge.git\\ngit checkout ${ GITVERSION } " > ${ BUILD_DIR } /debian/SOURCE
2018-03-09 10:25:58 +00: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 09:04:46 +00:00
echo " KERNEL_MAJMIN= ${ KERNEL_MAJMIN } " >> ${ BUILD_DIR } /debian/rules.d/env.mk
2018-03-09 10:25:58 +00:00
cd ${ BUILD_DIR } ; debian/rules debian/control
2017-03-15 13:43:11 +00:00
touch $@
2020-04-29 14:55:31 +00:00
${KERNEL_SRC}.prepared : ${KERNEL_SRC_SUBMODULE }
2018-02-28 08:31:06 +00:00
rm -rf ${ BUILD_DIR } /${ KERNEL_SRC } $@
mkdir -p ${ BUILD_DIR }
2018-03-09 10:27:15 +00:00
cp -a ${ KERNEL_SRC_SUBMODULE } ${ BUILD_DIR } /${ KERNEL_SRC }
2020-04-29 19:32:45 +00:00
set -e; cd ${ BUILD_DIR } /${ KERNEL_SRC } ; for patch in ../../patches/ubuntu/*.patch; do echo " applying Ubuntu patch ' $$ patch' " && patch -p1 < $$ { patch} ; done
2018-02-28 08:31:06 +00:00
# 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
2020-04-29 19:32:45 +00:00
set -e; cd ${ BUILD_DIR } /${ KERNEL_SRC } ; for patch in ../../patches/pve/*.patch; do echo " applying PVE patch ' $$ patch' " && patch -p1 < $$ { patch} ; done
2017-03-15 13:43:11 +00:00
touch $@
2018-02-28 08:31:06 +00:00
${MODULES}.prepared : $( addsuffix .prepared ,$ {MODULE_DIRS })
touch $@
2019-02-27 14:06:54 +00:00
${ZFSDIR}.prepared : ${ZFSONLINUX_SUBMODULE }
2019-05-24 12:40:34 +00:00
rm -rf ${ BUILD_DIR } /${ MODULES } /${ ZFSDIR } ${ BUILD_DIR } /${ MODULES } /tmp $@
2019-02-27 14:06:54 +00:00
mkdir -p ${ BUILD_DIR } /${ MODULES } /tmp
cp -a ${ ZFSONLINUX_SUBMODULE } /* ${ BUILD_DIR } /${ MODULES } /tmp
2020-05-27 13:26:09 +00:00
# set -e; cd ${BUILD_DIR}/${MODULES}/tmp/upstream; for patch in ../../../../patches/zfsonlinux/*.patch; do echo "applying patch '$$patch'" && patch -p1 < $${patch}; done
2019-02-27 14:06:54 +00:00
cd ${ BUILD_DIR } /${ MODULES } /tmp; make kernel
rm -rf ${ BUILD_DIR } /${ MODULES } /tmp
2019-05-24 12:40:34 +00:00
touch ${ ZFSDIR } .prepared
2017-03-15 13:43:11 +00:00
2018-03-21 10:27:33 +00:00
# call after ABI bump with header deb in working directory
.PHONY : abiupdate
abiupdate : abi -prev -${KVNAME }
abi-prev-${KVNAME} : abi -tmp -${KVNAME }
i f n e q ( $( strip $ ( shell git status --untracked -files =no --porcelain -z ) ) , )
@echo "working directory unclean, aborting!"
@false
e l s e
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! "
e n d i f
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 14:21:54 +00:00
2017-03-15 13:43:11 +00:00
.PHONY : clean
clean :
2018-02-28 08:31:06 +00:00
rm -rf *~ build *.prepared ${ KERNEL_CFG_ORG }
2018-05-23 09:42:10 +00:00
rm -f *.deb *.changes *.buildinfo