-
Notifications
You must be signed in to change notification settings - Fork 6
/
patch_kernel.sh
executable file
·53 lines (46 loc) · 1.55 KB
/
patch_kernel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#
# Simple script to patch a baseline RPi kernel source tree, with
# facilities to easily download and apply PRs from:
# https://github.com/raspberrypi/linux/pull/<#>.
#
# Copyright (c) 2019 sakaki <sakaki@deciban.com>
# License: GPL v2.0
# NO WARRANTY
#
set -e
set -u
shopt -s nullglob
# Utility functions
apply_pr() {
# pr number as $1, comment as $2
echo "Applying PR#${1}: '${2}':"
if ! wget -c --quiet \
https://patch-diff.githubusercontent.com/raw/raspberrypi/linux/pull/${1}.diff \
-O ${1}.patch; then
>&2 echo " Failed to download patchfile for PR#${1}"
elif [[ ! -s ${1}.patch ]]; then
>&2 echo " No non-empty patchfile for PR#${1}"
elif ! patch -p1 --forward --silent --force --dry-run &>/dev/null \
< ${1}.patch; then
>&2 echo " Failed to apply PR#${1} in dry run - already merged?"
elif ! patch -p1 --forward --force < ${1}.patch; then
>&2 echo " PR#{1} failed to apply - source tree may be corrupt!"
else
echo " PR#${1} applied successfully!"
fi
echo
return 0
}
# Custom kernel patches follow
# Submit PRs with edits targeting the _bottom_ of this file
# Please provide a short rationale comment for the changes made
# The apply_pr() function will not apply a patch if it
# has already been merged, or some part of it will otherwise
# not apply
# apply PR #3063
# credit: phire
apply_pr 3063 "Enable 3D acceleration with 64-bit kernel on RPi4"
# apply PR #3144
# credit: yaroslavros
apply_pr 3144 "Add arm64 pcie bounce buffers; enables 4GiB on RPi4"