diff --git a/projects/RPi2/patches/linux/README.md b/tools/RPi/README.md similarity index 100% rename from projects/RPi2/patches/linux/README.md rename to tools/RPi/README.md diff --git a/tools/RPi/gen-rpi-kodi-patch.sh b/tools/RPi/gen-rpi-kodi-patch.sh new file mode 100755 index 0000000000..444a45bb59 --- /dev/null +++ b/tools/RPi/gen-rpi-kodi-patch.sh @@ -0,0 +1,101 @@ +#!/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 + +usage() +{ + local me="$(basename $0)" + + echo "Usage: ${me} |" + echo + echo "Example: ${me} jarvis_rbp_backports d11fabefb909e75e7186bd9ecd0cbff9e8b24577" + echo "Example: ${me} jarvis_rbp_backports Jarvis" + echo + echo "For sha, see https://github.com/xbmc/xbmc/compare/Jarvis...popcornmix:jarvis_rbp_backports (replace branches as appropriate)" + exit 1 +} + +if [ -z "${1}" ]; then + echo "ERROR: popcornmix branch must be specified!" + echo + usage +fi + +if [ -z "${2}" ]; then + echo "ERROR: First popcornmix revision (sha) or name of xbmc branch must be specified!" + echo + usage +fi + +BRANCH="$1" +BASEREV="$2" + +rm -fr raspberrypi-kodi + +# If we have a persisted version of the repo, quickly copy it +if [ -d raspberrypi-kodi.stash ]; then + echo "Copying raspberrypi-kodi.stash raspberrypi-kodii..." + cp -r raspberrypi-kodi.stash raspberrypi-kodi + cd raspberrypi-kodi + git checkout ${BRANCH} +else + git clone -b ${BRANCH} --depth=${DEPTH} --single-branch https://github.com/popcornmix/xbmc.git raspberrypi-kodi + cd raspberrypi-kodi +fi + +if [[ ${BASEREV} =~ [0-9a-f]{40} ]]; then + BASEREV="${BASEREV}~1" +else + git remote add -t ${BASEREV} xbmc https://github.com/xbmc/xbmc.git + BASEREV="xbmc/${BASEREV}" +fi + +git fetch --all --depth=${DEPTH} +git reset --hard origin/${BRANCH} + +if [ -d addons/skin.confluence ]; then + SKIN1=skin.confluence + SKIN2=kodi-theme-Confluence +else + SKIN1=skin.estuary + SKIN2=kodi-theme-Estuary +fi + +git format-patch --no-signature --stdout ${BASEREV} -- addons/${SKIN1} | sed -E 's#addons/skin\.[^/]*/##g' >/tmp/skin.patch +git format-patch --no-signature --stdout ${BASEREV} -- . ":!addons/${SKIN1}" >/tmp/kodi.patch + +cd .. && rm -fr raspberrypi-kodi + +echo +echo "New skin patch: /tmp/skin.patch" +echo "New kodi patch: /tmp/kodi.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" + +BRANCH="${BRANCH//_/-}" + +echo +echo "cp /tmp/skin.patch projects/RPi/patches/${SKIN2}/${SKIN2}-001-${BRANCH}.patch" +echo "cp /tmp/skin.patch projects/RPi2/patches/${SKIN2}/${SKIN2}-001-${BRANCH}.patch" +echo "git commit -am \"RPi/RPi2: Update kodi-theme-${SKIN} support patches\"" + +echo +echo "cp /tmp/kodi.patch projects/RPi/patches/kodi/kodi-001-${BRANCH}.patch" +echo "cp /tmp/kodi.patch projects/RPi2/patches/kodi/kodi-001-${BRANCH}.patch" +echo "git commit -am \"RPi/RPi2: Update kodi support patches\"" + +echo diff --git a/tools/RPi/gen-rpi-linux-patch.sh b/tools/RPi/gen-rpi-linux-patch.sh new file mode 100755 index 0000000000..94b095455b --- /dev/null +++ b/tools/RPi/gen-rpi-linux-patch.sh @@ -0,0 +1,102 @@ +#!/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" +[ -n "${2}" ] && REBASE="_rebase" + +usage() +{ + local me="$(basename $0)" + + echo "Usage: ${me} | [rebase]" + 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.6-rc6" + 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 + +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}" ]; then + git remote add -t linux-${BRANCH}.y linux-stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git +fi + +git fetch --all --depth=${DEPTH} +git reset --hard origin/rpi-${BRANCH}.y${REBASE} + +if [ -z "${KERNEL}" ]; then + BASEREV="linux-stable/linux-${BRANCH}.y" +else + BASEREV="$(git log --grep "Linux ${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 -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" +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 "cp /tmp/linux-01-RPi_support.patch projects/RPi2/patches/linux/linux-01-RPi_support.patch" + +echo +echo "git commit -am \"RPi/RPi2: update linux support patches for linux ${KERNEL:-${BRANCH}}\"" + +echo diff --git a/tools/RPi/rpi-linux-rebase.sh b/tools/RPi/rpi-linux-rebase.sh new file mode 100755 index 0000000000..51ace90198 --- /dev/null +++ b/tools/RPi/rpi-linux-rebase.sh @@ -0,0 +1,30 @@ +#!/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 +# 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=" +Add non-mainline source for rtl8192cu wireless driver version +rtl8192c_rf6052\: PHY_RFShadowRefresh\(\)\: fix off-by-one +rtl8192cu\: Add PID for D-Link DWA 131 +Added Device IDs for August DVB-T 205 +net\: Add non-mainline source for rtl8192cu wlan +net\: Fix rtl8192cu build errors on other platforms +" + +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