Support in-tree builds

This change updates the build code to support in-tree builds. This is
easier to manage for CI builds and reduces the amount of IO operations
necessary for the build process.
This commit is contained in:
Fabian Mastenbroek 2021-04-18 19:55:44 +02:00
parent 7d07970695
commit 3650d4343a
No known key found for this signature in database
GPG key ID: 405FC6F81F0A7B85
7 changed files with 121 additions and 198 deletions

View file

@ -6,30 +6,25 @@ jobs:
build: build:
name: Build name: Build
runs-on: [self-hosted] runs-on: [self-hosted]
strategy:
matrix:
include:
- build_cc: gcc-10
if: github.event.pull_request.head.repo.full_name == github.repository && !contains(github.event.head_commit.message, 'skip ci') if: github.event.pull_request.head.repo.full_name == github.repository && !contains(github.event.head_commit.message, 'skip ci')
steps: steps:
- name: Clean Workspace
run: rm -rf *.deb *.ddeb *.build *.buildinfo *.changes
- name: Checkout Sources - name: Checkout Sources
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
path: pve-edge-kernel
- name: Clean Repository
run: git -C pve-edge-kernel submodule foreach git clean -ffdx
- name: Build Kernel - name: Build Kernel
run: make
env:
PVE_BUILD_CC: ${{ matrix.build_cc }}
- name: Read Build Information
id: read_build_info
run: | run: |
echo "::set-output name=release::$(sed '1q;d' release.txt)" rm -rf *.deb *.ddeb *.build *.buildinfo *.changes
echo "::set-output name=dst::$(sed '1q;d' artifacts.txt)" cd pve-edge-kernel
echo "::set-output name=hdr::$(sed '2q;d' artifacts.txt)" debian/rules debian/control
echo "::set-output name=tools::$(sed '3q;d' artifacts.txt)" debuild -e CC=gcc-10 -e CCACHE_DIR=/var/cache/ccache --prepend-path=/usr/lib/ccache --jobs=auto -b -uc -us
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v2-preview uses: actions/upload-artifact@v2-preview
with: with:
name: debs-${{ matrix.build_type }} name: debs
path: "*.deb" path: "*.deb"

View file

@ -13,33 +13,38 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- build_type: 'generic' - build_profile: 'generic'
build_cc: gcc-10 build_cc: gcc-10
build_cflags: '' build_cflags: ''
- build_type: zen2 - build_profile: zen2
build_cc: gcc-10 build_cc: gcc-10
build_cflags: '-march=znver2' build_cflags: '-march=znver2'
- build_type: cascadelake - build_profile: cascadelake
build_cc: gcc-10 build_cc: gcc-10
build_cflags: '-march=cascadelake' build_cflags: '-march=cascadelake'
steps: steps:
- name: Clean Workspace
run: rm -rf *.deb *.ddeb *.build *.buildinfo *.changes
- name: Checkout Sources - name: Checkout Sources
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
path: pve-edge-kernel
- name: Clean Repository
run: git -C pve-edge-kernel submodule foreach git clean -ffdx
- name: Build Kernel - name: Build Kernel
run: make
env:
PVE_BUILD_TYPE: ${{ matrix.build_type }}
PVE_BUILD_CC: ${{ matrix.build_cc }}
PVE_BUILD_CFLAGS: ${{ matrix.build_cflags }}
- name: Read Build Information
id: read_build_info
run: | run: |
echo "::set-output name=release::$(sed '1q;d' release.txt)" cd pve-edge-kernel
echo "::set-output name=dst::$(sed '1q;d' artifacts.txt)" debian/rules debian/control
echo "::set-output name=hdr::$(sed '2q;d' artifacts.txt)" if [ "$PVE_BUILD_PROFILE" != "generic" ]; then
echo "::set-output name=tools::$(sed '3q;d' artifacts.txt)" debchange -l +$PVE_BUILD_PROFILE -D edge --force-distribution -U -M "Specialization for $PVE_BUILD_PROFILE"
fi
debuild -e PVE* -e CCACHE_DIR=/var/cache/ccache --prepend-path=/usr/lib/ccache --jobs=auto -b -uc -us
env:
PVE_BUILD_PROFILE: ${{ matrix.build_type }}
PVE_KERNEL_CC: ${{ matrix.build_cc }}
PVE_KERNEL_CFLAGS: ${{ matrix.build_cflags }}
PVE_ZFS_CC: ${{ matrix.build_cc }}
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v2-preview uses: actions/upload-artifact@v2-preview
with: with:
@ -80,5 +85,4 @@ jobs:
artifacts/debs-generic/pve-headers-*.deb artifacts/debs-generic/pve-headers-*.deb
artifacts/debs-generic/linux-tools-*.deb artifacts/debs-generic/linux-tools-*.deb
artifacts/debs-generic/pve-kernel-libc-*.deb artifacts/debs-generic/pve-kernel-libc-*.deb
artifacts/debs-*/pve-kernel-*.deb artifacts/debs-*/pve-kernel-*.deb

View file

@ -1,99 +0,0 @@
PKGREL=1
PKGRELLOCAL=1
PKGRELFULL=${PKGREL}
KERNEL_MAJMIN=$(shell ./scripts/version.sh -n)
KERNEL_VER=$(shell ./scripts/version.sh -L)
KREL=1
EXTRAVERSION=-${KREL}-edge
# Append Linux flavor name to EXTRAVERSION
ifdef PVE_BUILD_FLAVOR
_ := $(info Using build flavor: ${PVE_BUILD_FLAVOR})
EXTRAVERSION:=${EXTRAVERSION}-${PVE_BUILD_FLAVOR}
endif
# Default to generic micro architecture
PVE_BUILD_TYPE ?= generic
ifneq (${PVE_BUILD_TYPE},generic)
_ := $(info Using build type: ${PVE_BUILD_TYPE})
PKGRELFULL:=${PKGRELFULL}+${PVE_BUILD_TYPE}${PKGRELLOCAL}
endif
KVNAME=${KERNEL_VER}${EXTRAVERSION}
PACKAGE=pve-kernel-${KVNAME}
HDRPACKAGE=pve-headers-${KVNAME}
ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
BUILD_DIR=build
KERNEL_SRC=linux
KERNEL_SRC_SUBMODULE=$(KERNEL_SRC)
KERNEL_CFG_ORG=config-${KERNEL_VER}.org
MODULES=modules
MODULE_DIRS=${ZFSDIR}
# exported to debian/rules via debian/rules.d/dirs.mk
DIRS=KERNEL_SRC MODULES
DST_DEB=${PACKAGE}_${KERNEL_VER}-${PKGRELFULL}_${ARCH}.deb
HDR_DEB=${HDRPACKAGE}_${KERNEL_VER}-${PKGRELFULL}_${ARCH}.deb
LINUX_TOOLS_DEB=linux-tools-$(KERNEL_MAJMIN)_${KERNEL_VER}-${PKGRELFULL}_${ARCH}.deb
DEBS=${DST_DEB} ${HDR_DEB} ${LINUX_TOOLS_DEB}
all: deb release.txt artifacts.txt
deb: ${DEBS}
release.txt:
echo "${KVNAME}" > release.txt
echo "${KERNEL_VER}" >> release.txt
echo "${PKGREL}" >> release.txt
echo "${ARCH}" >> release.txt
echo "${PVE_BUILD_FLAVOR}" >> release.txt
echo "${PVE_BUILD_TYPE}" >> release.txt
artifacts.txt:
echo "${DST_DEB}" > artifacts.txt
echo "${HDR_DEB}" >> artifacts.txt
echo "${LINUX_TOOLS_DEB}" >> artifacts.txt
${LINUX_TOOLS_DEB} ${HDR_DEB}: ${DST_DEB}
${DST_DEB}: ${BUILD_DIR}.prepared
cd ${BUILD_DIR}; dpkg-buildpackage --jobs=auto -b -uc -us
${BUILD_DIR}.prepared: $(addsuffix .prepared,${KERNEL_SRC} ${MODULES} debian)
touch $@
debian.prepared: debian
rm -rf ${BUILD_DIR}/debian
mkdir -p ${BUILD_DIR}
cp -a debian ${BUILD_DIR}/debian
cd ${BUILD_DIR}; debian/rules debian/control
ifneq (${PVE_BUILD_TYPE},generic)
cd ${BUILD_DIR}; debchange -l +${PVE_BUILD_TYPE} -D edge --force-distribution -U -M "Specialization for ${PVE_BUILD_TYPE}"
endif
touch $@
${KERNEL_SRC}.prepared: ${KERNEL_SRC_SUBMODULE}
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
rm -rf ${BUILD_DIR}/${KERNEL_SRC} $@
mkdir -p ${BUILD_DIR}
cp -a ${KERNEL_SRC_SUBMODULE} ${BUILD_DIR}/${KERNEL_SRC}
rm -rf ${BUILD_DIR}/${KERNEL_SRC}/debian
cp -r zfs scripts ${BUILD_DIR}/
touch $@
${MODULES}.prepared: $(addsuffix .prepared,${MODULE_DIRS})
touch $@
.PHONY: clean
clean:
rm -rf *~ build *.prepared ${KERNEL_CFG_ORG}
rm -f *.deb *.ddeb *.changes *.buildinfo release.txt artifacts.txt
rm -f debian/control debian/pve-edge-*.postinst debian/pve-edge-*.prerm debian/pve-edge-*.postrm

View file

@ -64,10 +64,14 @@ apt install ./dwarves_1.17-1_amd64.deb
``` ```
#### Obtaining the source #### Obtaining the source
Select the branch of your likings (e.g. `v5.8.x`) and update the submodules: Obtain the source code as follows:
```bash ```bash
git clone https://github.com/fabianishere/pve-edge-kernel git clone https://github.com/fabianishere/pve-edge-kernel
cd pve-ede-kernel cd pve-ede-kernel
```
Then, select the branch of your likings (e.g. `v5.10.x`) and update the submodules:
```bash
git checkout v5.10.x
git submodule update --init --depth=1 --recursive linux git submodule update --init --depth=1 --recursive linux
git submodule update --init --recursive git submodule update --init --recursive
``` ```
@ -75,7 +79,8 @@ git submodule update --init --recursive
#### Building #### Building
Invoking the following command will build the kernel and its associated packages: Invoking the following command will build the kernel and its associated packages:
```bash ```bash
make debian/rules debian/control
debuild --jobs=auto -ePVE* -b -uc -us
``` ```
The Makefile provides several environmental variables to control: The Makefile provides several environmental variables to control:
@ -90,13 +95,13 @@ The Makefile provides several environmental variables to control:
the kernel (e.g. optimization level or micro architecture). the kernel (e.g. optimization level or micro architecture).
This name is appended as suffix to the Debian package version in case it is not This name is appended as suffix to the Debian package version in case it is not
the default value. the default value.
3. `PVE_BUILD_CC` 3. `PVE_KERNEL_CC`
The compiler to use for the kernel build. The compiler to use for the kernel build.
4. `PVE_BUILD_CFLAGS` 4. `PVE_KERNEL_CFLAGS`
The compilation options to use for the kernel build. Use this variable to specify The compilation options to use for the kernel build. Use this variable to specify
the optimization level or micro architecture to build for. the optimization level or micro architecture to build for.
Kernel options may be controlled from the [debian/rules](debian/rules) file. To build with Kernel options may be controlled from [debian/config/config.pve](debian/config/config.pve). To build with
additional patches, you may add them to the [debian/patches/pve](debian/patches/pve) directory additional patches, you may add them to the [debian/patches/pve](debian/patches/pve) directory
and update the [series](debian/patches/series.linux) file accordingly. and update the [series](debian/patches/series.linux) file accordingly.

137
debian/rules vendored
View file

@ -15,15 +15,8 @@ ZFS_SRC := zfs
%: %:
dh $@ --with quilt dh $@ --with quilt
debian/control: $(wildcard debian/*.in) ## Debian package metadata
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/templates/pve-kernel.prerm.in > debian/${PVE_KERNEL_PKG}.prerm debian/control: debian/templates/control.in
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/templates/pve-kernel.postrm.in > debian/${PVE_KERNEL_PKG}.postrm
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/templates/pve-kernel.postinst.in > debian/${PVE_KERNEL_PKG}.postinst
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/templates/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' -e 's/@KVMAJMIN@/${KERNEL_MAJMIN}/g' < debian/templates/control.in > debian/control sed -e 's/@KVNAME@/${KVNAME}/g' -e 's/@KVMAJMIN@/${KERNEL_MAJMIN}/g' < debian/templates/control.in > debian/control
debian/SOURCE: debian/SOURCE:
@ -31,28 +24,48 @@ debian/SOURCE:
git checkout ${PKG_GIT_VERSION} \ git checkout ${PKG_GIT_VERSION} \
git submodule update --init --depth=1" > $@ git submodule update --init --depth=1" > $@
## Debhelper phases
override_dh_quilt_patch: override_dh_quilt_patch:
cd linux; \ # Apply crack bundle
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
# Apply patches
cd ${KERNEL_SRC}; \
QUILT_PATCHES=../debian/patches \ QUILT_PATCHES=../debian/patches \
QUILT_SERIES=series.linux \ QUILT_SERIES=series.linux \
quilt --quiltrc /dev/null --color=always push -a || test $$? = 2 quilt --quiltrc /dev/null --color=always push -a || test $$? = 2
cd zfs; \ cd ${ZFS_SRC}; \
QUILT_PATCHES=../debian/patches \ QUILT_PATCHES=../debian/patches \
QUILT_SERIES=series.zfs \ QUILT_SERIES=series.zfs \
quilt --quiltrc /dev/null --color=always push -a || test $$? = 2 quilt --quiltrc /dev/null --color=always push -a || test $$? = 2
override_dh_quilt_unpatch: override_dh_quilt_unpatch:
cd linux; \ cd ${KERNEL_SRC}; \
QUILT_PATCHES=../debian/patches \ QUILT_PATCHES=../debian/patches \
QUILT_SERIES=series.linux \ QUILT_SERIES=series.linux \
quilt --quiltrc /dev/null pop -a || test $$? = 2 quilt --quiltrc /dev/null pop -a || test $$? = 2
cd zfs; \ cd ${ZFS_SRC}; \
QUILT_PATCHES=../debian/patches \ QUILT_PATCHES=../debian/patches \
QUILT_SERIES=series.zfs \ QUILT_SERIES=series.zfs \
quilt --quiltrc /dev/null pop -a || test $$? = 2 quilt --quiltrc /dev/null pop -a || test $$? = 2
rm -rf linux/.pc zfs/.pc rm -rf ${KERNEL_SRC}/.pc ${ZFS_SRC}/.pc
override_dh_auto_build: .compile_mark .tools_compile_mark .modules_compile_mark 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}" \
KBUILD_BUILD_VERSION_TIMESTAMP="${KVNAME} ${PVE_BUILD_PROFILE} (${PKG_DATE})"
# 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}
override_dh_auto_install: debian/SOURCE .install_mark .tools_install_mark .headers_install_mark .usr_headers_install_mark override_dh_auto_install: debian/SOURCE .install_mark .tools_install_mark .headers_install_mark .usr_headers_install_mark
dh_installdocs -A debian/copyright debian/SOURCE dh_installdocs -A debian/copyright debian/SOURCE
@ -62,6 +75,16 @@ override_dh_auto_install: debian/SOURCE .install_mark .tools_install_mark .heade
dh_compress dh_compress
dh_fixperms dh_fixperms
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))
${KERNEL_SRC}/.config: ${KERNEL_SRC}/.config:
${KERNEL_SRC}/scripts/kconfig/merge_config.sh -m \ ${KERNEL_SRC}/scripts/kconfig/merge_config.sh -m \
-O ${KERNEL_SRC} \ -O ${KERNEL_SRC} \
@ -69,20 +92,13 @@ ${KERNEL_SRC}/.config:
${KERNEL_SRC}/debian.master/config/${DEB_BUILD_ARCH}/config.common.${DEB_BUILD_ARCH} \ ${KERNEL_SRC}/debian.master/config/${DEB_BUILD_ARCH}/config.common.${DEB_BUILD_ARCH} \
${KERNEL_SRC}/debian.master/config/${DEB_BUILD_ARCH}/config.flavour.generic \ ${KERNEL_SRC}/debian.master/config/${DEB_BUILD_ARCH}/config.flavour.generic \
debian/config/config.pve debian/config/config.pve
${MAKE} -C ${KERNEL_SRC} CC=${PVE_BUILD_CC} oldconfig ${MAKE} -C ${KERNEL_SRC} CC=${PVE_KERNEL_CC} oldconfig
.config_mark: ${KERNEL_SRC}/.config debian/${PVE_KERNEL_PKG}.%: debian/templates/pve-kernel.%.in
touch $@ sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/templates/pve-kernel.$*.in > debian/${PVE_KERNEL_PKG}.$*
chmod +x debian/${PVE_KERNEL_PKG}.$*
.compile_mark: .config_mark .install_mark: ${PVE_KERNEL_TEMPLATES}
${MAKE} -C ${KERNEL_SRC} \
CC=${PVE_BUILD_CC} \
KCFLAGS="${PVE_BUILD_CFLAGS}" \
EXTRAVERSION="${EXTRAVERSION}" \
KBUILD_BUILD_VERSION_TIMESTAMP="${KVNAME} ${PVE_BUILD_PROFILE} (${PKG_DATE})"
touch $@
.install_mark: .compile_mark .modules_compile_mark
rm -rf debian/${PVE_KERNEL_PKG} rm -rf debian/${PVE_KERNEL_PKG}
mkdir -p debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME} mkdir -p debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}
mkdir debian/${PVE_KERNEL_PKG}/boot mkdir debian/${PVE_KERNEL_PKG}/boot
@ -92,7 +108,15 @@ ${KERNEL_SRC}/.config:
${MAKE} -C ${KERNEL_SRC} INSTALL_MOD_PATH=${BUILD_DIR}/debian/${PVE_KERNEL_PKG}/ modules_install ${MAKE} -C ${KERNEL_SRC} INSTALL_MOD_PATH=${BUILD_DIR}/debian/${PVE_KERNEL_PKG}/ modules_install
# install zfs drivers # install zfs drivers
install -d -m 0755 debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs install -d -m 0755 debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
install -m 644 $(addprefix modules/,zfs.ko zavl.ko znvpair.ko zunicode.ko zcommon.ko icp.ko zlua.ko spl.ko zzstd.ko) debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs install -m 644 ${ZFS_SRC}/module/avl/zavl.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
install -m 644 ${ZFS_SRC}/module/nvpair/znvpair.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
install -m 644 ${ZFS_SRC}/module/unicode/zunicode.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
install -m 644 ${ZFS_SRC}/module/zcommon/zcommon.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
install -m 644 ${ZFS_SRC}/module/icp/icp.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
install -m 644 ${ZFS_SRC}/module/zfs/zfs.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
install -m 644 ${ZFS_SRC}/module/lua/zlua.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
install -m 644 ${ZFS_SRC}/module/spl/spl.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
install -m 644 ${ZFS_SRC}/module/zstd/zzstd.ko debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/zfs
# remove firmware # remove firmware
rm -rf debian/${PVE_KERNEL_PKG}/lib/firmware rm -rf debian/${PVE_KERNEL_PKG}/lib/firmware
# strip debug info # strip debug info
@ -101,15 +125,22 @@ ${KERNEL_SRC}/.config:
/sbin/depmod -b debian/${PVE_KERNEL_PKG}/ ${KVNAME} /sbin/depmod -b debian/${PVE_KERNEL_PKG}/ ${KVNAME}
# Autogenerate blacklist for watchdog devices (see README) # Autogenerate blacklist for watchdog devices (see README)
install -m 0755 -d debian/${PVE_KERNEL_PKG}/lib/modprobe.d 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 ls debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/kernel/drivers/watchdog/ > debian/watchdog-blacklist.tmp
echo ipmi_watchdog.ko >> watchdog-blacklist.tmp echo ipmi_watchdog.ko >> debian/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 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
rm -f debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/source rm -f debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/source
rm -f debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/build rm -f debian/${PVE_KERNEL_PKG}/lib/modules/${KVNAME}/build
touch $@ touch $@
.tools_compile_mark: .compile_mark ## Kernel tools
${MAKE} -C ${KERNEL_SRC}/tools/perf prefix=/usr HAVE_NO_LIBBFD=1 HAVE_CPLUS_DEMANGLE_SUPPORT=1 NO_LIBPYTHON=1 NO_LIBPERL=1 NO_LIBCRYPTO=1 PYTHON=python2.7 .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 \
PYTHON=python2.7
echo "checking GPL-2 only perf binary for library linkage with incompatible licenses.." 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 '\blibbfd'
! ldd ${KERNEL_SRC}/tools/perf/perf | grep -q -E '\blibcrypto' ! ldd ${KERNEL_SRC}/tools/perf/perf | grep -q -E '\blibcrypto'
@ -127,13 +158,17 @@ ${KERNEL_SRC}/.config:
done done
touch $@ touch $@
.headers_prepare_mark: .config_mark ## 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}
rm -rf debian/${PVE_HEADER_PKG} rm -rf debian/${PVE_HEADER_PKG}
mkdir -p debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME} 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}/.config debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}
touch $@
.headers_install_mark: .compile_mark .modules_compile_mark .headers_prepare_mark
( \ ( \
cd ${KERNEL_SRC}; \ cd ${KERNEL_SRC}; \
find . arch/${KERNEL_BUILD_ARCH} -maxdepth 1 -name Makefile\*; \ find . arch/${KERNEL_BUILD_ARCH} -maxdepth 1 -name Makefile\*; \
@ -141,42 +176,24 @@ ${KERNEL_SRC}/.config:
find arch/${KERNEL_BUILD_ARCH} -name module.lds -o -name Kbuild.platforms -o -name Platform; \ 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; \ find $$(find arch/${KERNEL_BUILD_ARCH} -name include -o -name scripts -type d) -type f; \
find arch/${KERNEL_BUILD_ARCH}/include Module.symvers include scripts -type f \ find arch/${KERNEL_BUILD_ARCH}/include Module.symvers include scripts -type f \
) | rsync -av --files-from=- ${KERNEL_SRC} debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME} ) | rsync -avq --files-from=- ${KERNEL_SRC} debian/${PVE_HEADER_PKG}/usr/src/linux-headers-${KVNAME}
mkdir -p debian/${PVE_HEADER_PKG}/lib/modules/${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 ln -sf /usr/src/linux-headers-${KVNAME} debian/${PVE_HEADER_PKG}/lib/modules/${KVNAME}/build
touch $@ touch $@
## User-space headers
.usr_headers_install_mark: PKG_DIR = debian/${PVE_USR_HEADER_PKG} .usr_headers_install_mark: PKG_DIR = debian/${PVE_USR_HEADER_PKG}
.usr_headers_install_mark: OUT_DIR = ${PKG_DIR}/usr .usr_headers_install_mark: OUT_DIR = ${PKG_DIR}/usr
.usr_headers_install_mark: .config_mark .usr_headers_install_mark:
rm -rf '${PKG_DIR}' rm -rf '${PKG_DIR}'
mkdir -p '${PKG_DIR}' mkdir -p '${PKG_DIR}'
$(MAKE) -C ${KERNEL_SRC} headers_check ARCH=$(KERNEL_HEADER_ARCH) $(MAKE) -C ${KERNEL_SRC} headers_check ARCH=$(KERNEL_HEADER_ARCH)
$(MAKE) -C ${KERNEL_SRC} headers_install ARCH=$(KERNEL_HEADER_ARCH) INSTALL_HDR_PATH='$(CURDIR)'/$(OUT_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 rm -rf $(OUT_DIR)/include/drm $(OUT_DIR)/include/scsi
find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) -execdir rm {} + find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) -execdir rm {} +
# Move include/asm to arch-specific directory
# Move include/asm to arch-specific directory
mkdir -p $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH) mkdir -p $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)
mv $(OUT_DIR)/include/asm $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/ mv $(OUT_DIR)/include/asm $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
test ! -d $(OUT_DIR)/include/arch || \ test ! -d $(OUT_DIR)/include/arch || \
mv $(OUT_DIR)/include/arch $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/ mv $(OUT_DIR)/include/arch $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
touch $@ touch $@
.modules_compile_mark: modules/zfs.ko
touch $@
modules/zfs.ko: .compile_mark
dh_autoreconf -D ${ZFS_SRC}
dh_auto_configure -D ${ZFS_SRC} -- --with-config=kernel --with-linux=$(realpath ${KERNEL_SRC}) --with-linux-obj=$(realpath ${KERNEL_SRC})
dh_auto_build -D ${ZFS_SRC}
mkdir -p modules
cp ${ZFS_SRC}/module/avl/zavl.ko modules/
cp ${ZFS_SRC}/module/nvpair/znvpair.ko modules/
cp ${ZFS_SRC}/module/unicode/zunicode.ko modules/
cp ${ZFS_SRC}/module/zcommon/zcommon.ko modules/
cp ${ZFS_SRC}/module/icp/icp.ko modules/
cp ${ZFS_SRC}/module/zfs/zfs.ko modules/
cp ${ZFS_SRC}/module/lua/zlua.ko modules/
cp ${ZFS_SRC}/module/spl/spl.ko modules/
cp ${ZFS_SRC}/module/zstd/zzstd.ko modules/

View file

@ -25,7 +25,8 @@ ifneq (${PKG_BUILD_PROFILE},generic)
endif endif
# Build settings # Build settings
PVE_BUILD_CC ?= ${CC} PVE_KERNEL_CC ?= ${CC}
PVE_ZFS_CC ?= ${CC}
### Debian package names ### Debian package names
EXTRAVERSION=-${KERNEL_RELEASE}-${PKG_BUILD_FLAVOR} EXTRAVERSION=-${KERNEL_RELEASE}-${PKG_BUILD_FLAVOR}

View file

@ -55,7 +55,7 @@ Priority: optional
Architecture: any Architecture: any
Provides: linux-headers, Provides: linux-headers,
linux-headers-2.6, linux-headers-2.6,
Depends: coreutils | fileutils (>= 4.0), Depends:
Description: The Proxmox PVE Kernel Headers Description: The Proxmox PVE Kernel Headers
This package contains the linux kernel headers This package contains the linux kernel headers