tools/RPi: drop scripts for creating RPi kernel support patches

Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
Matthias Reichl 2018-03-07 09:31:04 +01:00 committed by MilhouseVH
parent 3df345e89b
commit 099d198a74
3 changed files with 0 additions and 230 deletions

View File

@ -1,63 +0,0 @@
## Raspberry Pi Linux Kernel Patch Instructions
This is needed because we drop a few commits from the upstream Raspberry Pi linux repo
The commit id's will change anytime the Raspberry Pi linux kernel is rebase against upstream
#### Clone the repo
```
git clone https://github.com/raspberrypi/linux.git
cd linux
```
#### Checkout the branch
```
git checkout rpi-4.4.y
```
#### Find the rebase commit, for example
```
git log --grep 'Linux 4.4.6'
```
#### This will show a commit
```
commit 0d1912303e54ed1b2a371be0bba51c384dd57326
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Wed Mar 16 08:43:17 2016 -0700
Linux 4.4.6
```
#### We need to rebase against this commit sha1
```
git rebase -i 0d1912303e54ed1b2a371be0bba51c384dd57326
```
#### Then we need to remove some commits. These lines need to be removed
```
pick 9ee3100 Add non-mainline source for rtl8192cu wireless driver version v4.0.2_9000 as this is widely used. Disabled older rtlwifi driver
pick 143ad45 rtl8192c_rf6052: PHY_RFShadowRefresh(): fix off-by-one
pick 95641b7 rtl8192cu: Add PID for D-Link DWA 131
pick fbd8454 Added Device IDs for August DVB-T 205
```
#### Then we can create the patch using the same commit sha1
```
git format-patch 0d1912303e54ed1b2a371be0bba51c384dd57326 --cover-letter --stdout > linux-01-RPi_support.patch
```
----
#### Rebase conflict
```
git reset --hard HEAD
git checkout master
git branch -D rpi-4.4.y
git pull
git checkout rpi-4.4.y
```
----
#### Further Discussion
https://github.com/LibreELEC/LibreELEC.tv/pull/31

View File

@ -1,132 +0,0 @@
#!/bin/bash
set -e
BIN=$(readlink -f $(dirname $0))
if git rev-parse --is-inside-work-tree &>/dev/null; then
echo "Don't run this script inside a git reppository!"
exit 1
fi
DEPTH=1000
BRANCH="$1"
while [ $# -gt 1 ]; do
if [ "${2,,}" == "rebase" ]; then
REBASE="_rebase"
elif [[ ${2,,} =~ [_-]rebase ]]; then
REBASE="$2"
elif [[ ${2} =~ ^[0-9a-f]*$ ]]; then
BASEREV="${2}"
fi
shift
done
usage()
{
local me="$(basename $0)"
echo "Usage: ${me} <major.minor>|<major.minor.patch> [[_-]rebase] [baserev]"
echo
echo "Example: 4.4 (for rpi-4.4.y) or 4.4.6 - specifying an exact kernel version avoids fetching the upstream repo"
echo " 4.4 rebase - use rpi-4.4.y_rebase branch"
echo " 4.4 -rebase - use rpi-4.4.y-rebase branch"
echo " 4.6-rc6"
echo " 4.7 523d939ef98fd712632d93a5a2b588e477a7565e"
echo " 4.7.0"
exit 1
}
if [ -z "${BRANCH}" ]; then
echo "ERROR: Branch must be specified!"
echo
usage
fi
if [[ ${BRANCH} =~ [0-9]*\.[0-9]*\.[0-9]* ]]; then
KERNEL="${BRANCH}"
BRANCH="${BRANCH%.*}"
elif [[ ${BRANCH} =~ [0-9]*\.[0-9]*-rc[0-9] ]]; then
KERNEL="${BRANCH}"
BRANCH="${BRANCH%-*}"
fi
# On initial release, eg. 4.7.0, the kernel will actually be known as 4.7 in git so strip the trailing .0
[[ ${KERNEL} =~ ^[0-9]*\.[0-9]*\.0*$ ]] && KERNEL="${KERNEL%.*}"
rm -fr raspberrypi-linux
# If we have a persisted version of the repo, quickly copy it
if [ -d raspberrypi-linux.stash ]; then
echo "Copying raspberrypi-linux.stash to raspberrypi-linux..."
cp -r raspberrypi-linux.stash raspberrypi-linux
cd raspberrypi-linux
git checkout rpi-${BRANCH}.y${REBASE}
else
git clone -b rpi-${BRANCH}.y${REBASE} --depth=${DEPTH} --single-branch https://github.com/raspberrypi/linux.git raspberrypi-linux
cd raspberrypi-linux
fi
if [ -z "${KERNEL}" -a -z "${BASEREV}" ]; then
git remote add -t linux-${BRANCH}.y linux-stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
fi
# Apply the following config change to reduce chance of duplicate hashes
git config --local core.abbrev 40
git fetch --all --depth=${DEPTH} --no-tags
git reset --hard origin/rpi-${BRANCH}.y${REBASE}
if [ -n "${BASEREV}" ]; then
:
elif [ -z "${KERNEL}" ]; then
BASEREV="linux-stable/linux-${BRANCH}.y"
KERNEL="$(git log --grep "Linux ${BRANCH}" --pretty=oneline | head -1 | awk '{ print $NF }')"
else
BASEREV="$(git log --grep "Linux ${KERNEL}" --pretty=oneline | head -1)"
[ -z "${BASEREV}" ] && BASEREV="$(git log --grep "Linux v${KERNEL}" --pretty=oneline | head -1)"
[ -z "${BASEREV}" ] && { echo "Unable to determine base revision for BRANCH=${BRANCH}, KERNEL=${KERNEL}"; exit 1; }
echo
echo "FOUND BASE REV: ${BASEREV}"
echo
BASEREV="${BASEREV%% *}"
fi
GIT_SEQUENCE_EDITOR=${BIN}/rpi-linux-rebase.sh git rebase -Xours -i ${BASEREV}
git format-patch --no-signature --stdout ${BASEREV} > /tmp/linux-01-RPi_support.patch
cd .. && rm -fr raspberrypi-linux
echo
cat /tmp/dropped
echo
echo "Dropped patches: /tmp/dropped"
LINE_START=$(grep -n '^DROP_COMMITS="$' ${BIN}/rpi-linux-rebase.sh | awk -F: '{print $1}')
LINE_END=$(grep -n '^"$' ${BIN}/rpi-linux-rebase.sh | awk -F: '{print $1}')
while read -r msg; do
grep -qxE "drop [a-f0-9]{40} ${msg}$" /tmp/dropped || LINES+="${msg}\n"
done <<< "$(sed -n "$((LINE_START + 1)),$((LINE_END - 1))p" ${BIN}/rpi-linux-rebase.sh | grep -v "^#### " | tr -d "\\\\")"
[ -n "${LINES}" ] && echo -e "*****\nThe following commits are no longer being dropped:\n\n${LINES}*****"
echo "New patch file : /tmp/linux-01-RPi_support.patch"
echo
echo "## LibreELEC Update Notes ##"
echo
echo "cd LibreELEC.tv"
echo "git checkout master"
echo "git pull upstream master"
echo "git checkout -b somebranch"
echo
echo "cp /tmp/linux-01-RPi_support.patch projects/RPi/patches/linux/linux-01-RPi_support.patch"
echo
echo "git commit -am \"RPi: update linux support patch for linux ${KERNEL:-${BRANCH}}\""
echo

View File

@ -1,35 +0,0 @@
#!/bin/bash
# Setup:
# git clone -b rpi-4.4.y --depth=1000 --single-branch git@github.com:raspberrypi/linux.git raspberrypi-linux
# git remote add -t linux-4.4.y linux-stable git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
# git config --local core.abbrev 40
# Update:
# git fetch --all --depth=1000
# git reset --hard origin/rpi-4.4.y
# GIT_SEQUENCE_EDITOR=../rpi-linux-rebase.sh git rebase -i linux-stable/linux-4.4.y
# git format-patch --no-signature --stdout linux-stable/linux-4.4.y > ../linux-01-RPi_support.patch
TODO=$1
# Drop commits not used
DROP_COMMITS="
Added Device IDs for August DVB-T 205
net: Add non-mainline source for rtl8192cu wlan
net: Fix rtl8192cu build errors on other platforms
net: rtl8192cu: Normalize indentation
net: rtl8192cu: Fix implicit fallthrough warnings
ARM64: Fix build break for RTL8187\/RTL8192CU wifi
Revert \"softirq: Let ksoftirqd do its job\"
#### Following commits are dropped to avoid merge conflicts ####
drm\/vc4: Release fence after signalling
i2c: bcm2835: Set up the rising\/falling edge delays
"
IFS=$'\n'
for COMMIT in $DROP_COMMITS; do
sed -i -E "s/^pick ([0-9a-f]+) (${COMMIT}.*)/drop \1 \2/g" $TODO
done
grep -E "^drop " $TODO > /tmp/dropped
sed -i -E "/^drop /d" $TODO