Skip to content

Commit

Permalink
Manage kernel patches with Quilt
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianishere committed Apr 18, 2021
1 parent 972a1ef commit 5e900bd
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 7 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ ${KERNEL_SRC}.prepared: ${KERNEL_SRC_SUBMODULE}
cp -a ${KERNEL_SRC_SUBMODULE} ${BUILD_DIR}/${KERNEL_SRC}
sed -i ${BUILD_DIR}/${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/'
rm -rf ${BUILD_DIR}/${KERNEL_SRC}/debian
set -e; cd ${BUILD_DIR}/${KERNEL_SRC}; for patch in ${PVE_PATCHES}; do echo "applying PVE patch '$$patch'" && patch -p1 < ../../$${patch}; done
touch $@

${MODULES}.prepared: $(addsuffix .prepared,${MODULE_DIRS})
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ apt install ./dwarves_1.17-1_amd64.deb
```

#### Obtaining the source
Select the branch of your likings (e.g. `v5.8.x`) and update the submodules:
```bash
git clone https://github.com/fabianishere/pve-edge-kernel
cd pve-ede-kernel
git submodule update --init --depth=1 --recursive linux
git submodule update --init --recursive
```
Afterwards, select the branch of your likings (e.g. `v5.8.x`).

#### Building
Invoking the following command will build the kernel and its associated packages:
Expand All @@ -97,7 +97,8 @@ The Makefile provides several environmental variables to control:
the optimization level or micro architecture to build for.

Kernel options may be controlled from the [debian/rules](debian/rules) file. To build with
additional patches, you may add them to the [patches/pve](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.

## Questions
If you have any questions or want to see additional versions, flavors or micro architectures being built, feel
Expand Down
5 changes: 5 additions & 0 deletions debian/patches/series.linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pve/0001-Make-mkcompile_h-accept-an-alternate-timestamp-strin.patch
pve/0002-bridge-keep-MAC-of-first-assigned-port.patch
pve/0003-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch
pve/0004-kvm-disable-default-dynamic-halt-polling-growth.patch
pve/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch
18 changes: 14 additions & 4 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# TODO: check for headers not being installed
BUILD_DIR=$(shell pwd)

Expand All @@ -23,7 +20,7 @@ KERNEL_SRC_COPY=${KERNEL_SRC}_tmp
PVE_BUILD_CC ?= ${CC}

%:
dh $@
dh $@ --with quilt

debian/control: $(wildcard debian/*.in)
sed -e 's/@@KVNAME@@/${KVNAME}/g' < debian/templates/pve-kernel.prerm.in > debian/${PVE_KERNEL_PKG}.prerm
Expand All @@ -39,6 +36,19 @@ debian/control: $(wildcard debian/*.in)
debian/SOURCE:
echo "git clone git@github.com:fabianishere/pve-kernel-edge.git\\ngit checkout $(shell git rev-parse HEAD)" > $@

override_dh_quilt_patch:
cd linux; \
QUILT_PATCHES=../debian/patches \
QUILT_SERIES=series.linux \
quilt --quiltrc /dev/null --color=always push -a || test $$? = 2

override_dh_quilt_unpatch:
cd linux; \
QUILT_PATCHES=../debian/patches \
QUILT_SERIES=series.linux \
quilt --quiltrc /dev/null pop -a || test $$? = 2
rm -rf linux/.pc

override_dh_auto_build: .compile_mark .tools_compile_mark .modules_compile_mark

override_dh_auto_install: debian/SOURCE .install_mark .tools_install_mark .headers_install_mark .usr_headers_install_mark
Expand Down

0 comments on commit 5e900bd

Please sign in to comment.