-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lint job + fixes to @jamlam patches
- Loading branch information
Showing
11 changed files
with
195 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
|
||
# Facilitates the addition of a new patch to the source tree. | ||
# -- Moves patch to tree | ||
# -- Adds patch to kernel.spec list of patches | ||
# -- Adds patch to git | ||
# -- change buildid macro to the name of the patch being added | ||
|
||
# Base directory is relative to where the script is. | ||
BASEDIR="$(dirname "$(cd $(dirname $BASH_SOURCE[0]) && pwd)")" | ||
pushd $BASEDIR > /dev/null | ||
# Check for at least patch | ||
if [ "$#" -lt 1 ]; then | ||
echo "usage: $0 [ /path/to/patch/ ] [ description ]" | ||
exit 1 | ||
fi | ||
PATCHDIR=$1 | ||
DESC=$2 | ||
PATCH="$(basename "$PATCHDIR")" | ||
# Kernel.spec file in the current tree | ||
SPECFILE="$BASEDIR/kernel.spec" | ||
# If adding patch from outside the source tree move it to the source tree | ||
if [ -z "$(ls | grep $PATCH)" ]; then | ||
cp $PATCHDIR $BASEDIR/ | ||
fi | ||
|
||
if [ ! -z "$(grep $PATCH $SPECFILE)" ] | ||
then | ||
echo "$PATCH already in kernel.spec" | ||
exit 1 | ||
fi | ||
# ID number of the last patch in kernel.spec | ||
LPATCH_ID=$(grep ^Patch $SPECFILE | tail -n1 | awk '{ print $1 }' | sed s/Patch// | sed s/://) | ||
# ID of the next patch to be added to kernel.spec | ||
NPATCH_ID=$(($LPATCH_ID + 1 )) | ||
# Add patch with new id at the end of the list of patches | ||
sed -i "/^Patch$LPATCH_ID:\ /a#\ $DESC\nPatch$NPATCH_ID:\ $PATCH" $SPECFILE | ||
# Add it to git | ||
git add $PATCH | ||
BUILDID_PATCH="$(echo $PATCH | sed 's/\-/\_/g' )" | ||
sed -i "s/^.*define buildid .*$/%define buildid .$BUILDID_PATCH/" $SPECFILE | ||
popd > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,87 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
set -euf -o pipefail | ||
|
||
### Apple T2 drivers commit hashes | ||
BCE_DRIVER_GIT_URL=https://github.com/MCMrARM/mbp2018-bridge-drv.git | ||
BCE_DRIVER_BRANCH_NAME=master | ||
BCE_DRIVER_COMMIT_HASH=7330e638b9a32b4ae9ea97857f33838b5613cad3 | ||
APPLE_IB_DRIVER_GIT_URL=https://github.com/roadrunner2/macbook12-spi-driver.git | ||
APPLE_IB_DRIVER_BRANCH_NAME=mbp15 | ||
APPLE_IB_DRIVER_COMMIT_HASH=90cea3e8e32db60147df8d39836bd1d2a5161871 | ||
# BCE_DRIVER_GIT_URL=https://github.com/MCMrARM/mbp2018-bridge-drv.git | ||
# BCE_DRIVER_BRANCH_NAME=master | ||
# BCE_DRIVER_COMMIT_HASH=7330e638b9a32b4ae9ea97857f33838b5613cad3 | ||
# APPLE_IB_DRIVER_GIT_URL=https://github.com/roadrunner2/macbook12-spi-driver.git | ||
# APPLE_IB_DRIVER_BRANCH_NAME=mbp15 | ||
# APPLE_IB_DRIVER_COMMIT_HASH=90cea3e8e32db60147df8d39836bd1d2a5161871 | ||
APPLE_SMC_DRIVER_GIT_URL=https://github.com/MCMrARM/mbp2018-etc | ||
APPLE_SMC_DRIVER_BRANCH_NAME=master | ||
APPLE_SMC_DRIVER_COMMIT_HASH=cf42289ad637d3073e2fd348af71ad43dd31b8b4 | ||
|
||
REPO_PWD=$(pwd) | ||
echo -e "From: fedora kernel <fedora@kernel.org>\nSubject: patch custom drivers\n" > ../patches/custom-drivers.patch | ||
|
||
mkdir -p /root/temp | ||
cd /root/temp | ||
cd /root/temp || exit | ||
|
||
### AppleSMC | ||
git clone --single-branch --branch ${APPLE_SMC_DRIVER_BRANCH_NAME} ${APPLE_SMC_DRIVER_GIT_URL} | ||
cp -rfv mbp2018-etc/applesmc/patches/* ${REPO_PWD}/../patches/ | ||
cd mbp2018-etc || exit | ||
git checkout ${APPLE_SMC_DRIVER_COMMIT_HASH} | ||
cd .. | ||
[ ! -d mbp2018-etc/applesmc/patches ] && { echo 'AppleSMC patches directory not found!'; exit 1; } | ||
while IFS= read -r file; do | ||
echo "adding ${file}" | ||
cp -rfv "${file}" "${REPO_PWD}"/../patches/"${file##*/}" | ||
done < <(find mbp2018-etc/applesmc/patches/ -type f) | ||
|
||
git clone --depth 1 --single-branch --branch v${FEDORA_KERNEL_VERSION} git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git | ||
cd ./linux-stable/drivers | ||
### Add custom drivers to kernel | ||
# echo -e "From: fedora kernel <fedora@kernel.org>\nSubject: patch custom drivers\n" > "${REPO_PWD}"/../patches/custom-drivers.patch | ||
|
||
### bce | ||
git clone --depth 1 --single-branch --branch ${BCE_DRIVER_BRANCH_NAME} ${BCE_DRIVER_GIT_URL} ./bce | ||
cd bce | ||
git checkout ${BCE_DRIVER_COMMIT_HASH} | ||
# git clone --depth 1 --single-branch --branch v"${FEDORA_KERNEL_VERSION}" git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git | ||
# cd ./linux-stable/drivers || exit | ||
|
||
rm -rf .git | ||
cd .. | ||
cp -rfv ${REPO_PWD}/../templates/Kconfig bce/Kconfig | ||
sed -i "s/TEST_DRIVER/BCE_DRIVER/g" bce/Kconfig | ||
sed -i 's/obj-m/obj-$(CONFIG_BCE)/g' bce/Makefile | ||
|
||
### apple-ib | ||
git clone --single-branch --branch ${APPLE_IB_DRIVER_BRANCH_NAME} ${APPLE_IB_DRIVER_GIT_URL} touchbar | ||
cd touchbar | ||
git checkout ${APPLE_IB_DRIVER_COMMIT_HASH} | ||
rm -rf .git | ||
cd .. | ||
cp -rfv ${REPO_PWD}/../templates/Kconfig touchbar/Kconfig | ||
sed -i "s/TEST_DRIVER/TOUCHBAR_DRIVER/g" touchbar/Kconfig | ||
sed -i 's/obj-m/obj-$(CONFIG_TOUCHBAR)/g' touchbar/Makefile | ||
|
||
echo 'obj-$(CONFIG_BCE) += bce/' >> ./Makefile | ||
echo 'obj-$(CONFIG_TOUCHBAR) += touchbar/' >> ./Makefile | ||
sed -i "\$i source \"drivers/bce/Kconfig\"\n" Kconfig | ||
sed -i "\$i source \"drivers/touchbar/Kconfig\"\n" Kconfig | ||
|
||
### Prepare patch | ||
git add . | ||
git diff HEAD >> ${REPO_PWD}/../patches/custom-drivers.patch | ||
|
||
### back to fedora kernel repo | ||
cd $REPO_PWD | ||
for config_file in $(ls | grep kernel | grep '.config') | ||
do | ||
echo 'CONFIG_BCE_DRIVER=m' >> $config_file | ||
echo 'CONFIG_TOUCHBAR_DRIVER=m' >> $config_file | ||
done | ||
|
||
echo 'CONFIG_BCE_DRIVER=m' > configs/fedora/generic/CONFIG_BCE_DRIVER | ||
echo 'CONFIG_TOUCHBAR_DRIVER=m' >> configs/fedora/generic/CONFIG_TOUCHBAR_DRIVER | ||
|
||
echo -e "bce.ko\napple-ib-als.ko\napple-ib-tb.ko\napple-ibridge.ko" >> mod-extra.list | ||
echo 'inputdrvs="gameport tablet touchscreen bce touchbar"' >> filter-x86_64.sh | ||
|
||
### Remove thunderbolt driver | ||
# ### bce | ||
# git clone --depth 1 --single-branch --branch ${BCE_DRIVER_BRANCH_NAME} ${BCE_DRIVER_GIT_URL} ./bce | ||
# cd bce || exit | ||
# git checkout ${BCE_DRIVER_COMMIT_HASH} | ||
|
||
# rm -rf .git | ||
# cd .. | ||
# cp -rfv "${REPO_PWD}"/../templates/Kconfig bce/Kconfig | ||
# sed -i "s/TEST_DRIVER/BCE_DRIVER/g" bce/Kconfig | ||
# # shellcheck disable=SC2016 | ||
# sed -i 's/obj-m/obj-$(CONFIG_BCE)/g' bce/Makefile | ||
|
||
# ### apple-ib | ||
# git clone --single-branch --branch ${APPLE_IB_DRIVER_BRANCH_NAME} ${APPLE_IB_DRIVER_GIT_URL} touchbar | ||
# cd touchbar || exit | ||
# git checkout ${APPLE_IB_DRIVER_COMMIT_HASH} | ||
# rm -rf .git | ||
# cd .. | ||
# cp -rfv "${REPO_PWD}"/../templates/Kconfig touchbar/Kconfig | ||
# sed -i "s/TEST_DRIVER/TOUCHBAR_DRIVER/g" touchbar/Kconfig | ||
# # shellcheck disable=SC2016 | ||
# sed -i 's/obj-m/obj-$(CONFIG_TOUCHBAR)/g' touchbar/Makefile | ||
|
||
# # shellcheck disable=SC2016 | ||
# echo 'obj-$(CONFIG_BCE) += bce/' >> ./Makefile | ||
# # shellcheck disable=SC2016 | ||
# echo 'obj-$(CONFIG_TOUCHBAR) += touchbar/' >> ./Makefile | ||
# sed -i "\$i source \"drivers/bce/Kconfig\"\n" Kconfig | ||
# sed -i "\$i source \"drivers/touchbar/Kconfig\"\n" Kconfig | ||
|
||
# ### Prepare patch | ||
# git add . | ||
# git diff HEAD >> "${REPO_PWD}"/../patches/custom-drivers.patch | ||
|
||
# ### back to fedora kernel repo | ||
# cd "$REPO_PWD" || exit | ||
# find . -type f -name "*.config" -exec sh -c ' | ||
# echo "CONFIG_BCE_DRIVER=m" >> $1 | ||
# echo "CONFIG_TOUCHBAR_DRIVER=m" >> $1 | ||
# ' sh {} \; | ||
|
||
# echo 'CONFIG_BCE_DRIVER=m' > configs/fedora/generic/CONFIG_BCE_DRIVER | ||
# echo 'CONFIG_TOUCHBAR_DRIVER=m' >> configs/fedora/generic/CONFIG_TOUCHBAR_DRIVER | ||
|
||
# echo -e "bce.ko\napple-ib-als.ko\napple-ib-tb.ko\napple-ibridge.ko" >> mod-extra.list | ||
# echo 'inputdrvs="gameport tablet touchscreen bce touchbar"' >> filter-x86_64.sh | ||
|
||
# ### Remove thunderbolt driver | ||
# sed -i "s/CONFIG_THUNDERBOLT=m/CONFIG_THUNDERBOLT=n/g" kernel-x86_64* | ||
# sed -i "s/CONFIG_THUNDERBOLT=m/CONFIG_THUNDERBOLT=n/g" configs/fedora/generic/x86/x86_64/CONFIG_THUNDERBOLT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
7cbba59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.