Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit e2fc447

Browse files
committed
Merge branch 'feature/githubActions'
2 parents e3b51af + 9e1d737 commit e2fc447

File tree

6 files changed

+85
-78
lines changed

6 files changed

+85
-78
lines changed

.drone.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: Build Kernel Package
3+
4+
# yamllint disable-line rule:truthy
5+
on:
6+
[push, pull_request]
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- name: 'Checkout repo'
13+
uses: actions/checkout@v2
14+
- name: 'Set up Python 3.9'
15+
uses: actions/setup-python@v2
16+
- name: 'Install dependencies'
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install yamllint
20+
sudo apt-get install shellcheck bash
21+
- name: 'Analysing the code'
22+
run: |
23+
yamllint .
24+
shellcheck ./*.sh
25+
26+
build:
27+
needs: [lint]
28+
runs-on: ubuntu-20.04
29+
steps:
30+
- name: 'Checkout Repo'
31+
uses: actions/checkout@v2
32+
33+
- name: Build script
34+
id: build
35+
run: |
36+
mkdir /tmp/artifacts
37+
VERSION=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2)
38+
REL=$(./next_version.sh mbp)
39+
echo Building $VERSION-$REL
40+
echo "::set-output name=tag::${VERSION}-${REL}"
41+
sudo ./build.sh
42+
cd /tmp/artifacts
43+
ls -l
44+
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
45+
ls -l
46+
47+
- name: Upload package artifact
48+
if: github.ref == 'refs/heads/master'
49+
uses: actions/upload-artifact@v2
50+
with:
51+
name: linux-mbp-${{ steps.build.outputs.tag }}
52+
path: /tmp/artifacts/*
53+
54+
- name: Release
55+
if: github.ref == 'refs/heads/master'
56+
uses: softprops/action-gh-release@v1
57+
with:
58+
files: |
59+
/tmp/artifacts/Packages.gz
60+
/tmp/artifacts/sha256
61+
/tmp/artifacts/*.deb
62+
tag_name: v${{ steps.build.outputs.tag }}
63+
draft: true
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/patches/custom-drivers.patch
22
/releases
33
/linux-*
4+
/.idea

build.sh

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eu -o pipefail
44

55
## Update docker image tag, because kernel build is using `uname -r` when defining package version variable
66
# KERNEL_VERSION=$(curl -s https://www.kernel.org | grep '<strong>' | head -3 | tail -1 | cut -d'>' -f3 | cut -d'<' -f1)
7-
KERNEL_VERSION=5.9.7
7+
KERNEL_VERSION=5.10.47
88
#KERNEL_REPOSITORY=git://kernel.ubuntu.com/virgin/linux-stable.git
99
KERNEL_REPOSITORY=https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
1010
REPO_PATH=$(pwd)
@@ -19,17 +19,7 @@ echo "CPU threads: $(nproc --all)"
1919
grep 'model name' /proc/cpuinfo | uniq
2020

2121
get_next_version () {
22-
curl -s https://mbp-ubuntu-kernel.herokuapp.com/ -L | grep "linux-image-${KERNEL_VERSION}-${1}" > /dev/null
23-
OLD_BUILD_EXIST=$?
24-
if test $OLD_BUILD_EXIST -eq 0
25-
then
26-
LATEST_BUILD=$(curl -s https://mbp-ubuntu-kernel.herokuapp.com/ -L | grep "linux-image-${KERNEL_VERSION}-${1}" |
27-
grep a | cut -d'>' -f2 | cut -d'<' -f1 |
28-
sort -r | head -n 1 | cut -d'-' -f6 | cut -d'_' -f1)
29-
else
30-
LATEST_BUILD=0
31-
fi
32-
echo "$((LATEST_BUILD+1))"
22+
"${REPO_PATH}"/next_version.sh "${1}"
3323
}
3424

3525
### Clean up
@@ -68,7 +58,7 @@ echo >&2 "===]> Info: Applying patches... "
6858
while IFS= read -r file; do
6959
echo "==> Adding $file"
7060
patch -p1 <"$file"
71-
done < <(find "${WORKING_PATH}/patches" -type f -name "*.patch" | grep -vE '[2]00[0-9]' | sort)
61+
done < <(find "${WORKING_PATH}/patches" -type f -name "*.patch" | sort)
7262

7363
chmod a+x "${KERNEL_PATH}"/debian/rules
7464
chmod a+x "${KERNEL_PATH}"/debian/scripts/*
@@ -85,27 +75,10 @@ make olddefconfig
8575
echo "" >"${KERNEL_PATH}"/.scmversion
8676

8777
# Build Deb packages
88-
make -j "$(getconf _NPROCESSORS_ONLN)" deb-pkg LOCALVERSION=-mbp KDEB_PKGVERSION="$(make kernelversion)-$(get_next_version mbp-alt)"
89-
90-
# Create alternative Kernel
91-
echo >&2 "===]> Info: Create alternative kernel ... "
92-
make distclean
93-
make clean
94-
while IFS= read -r file; do
95-
echo "==> Adding $file"
96-
patch -p1 <"$file"
97-
done < <(find "${WORKING_PATH}/patches" -type f -name "*.patch" | grep -E '[2]00[0-9]' | sort)
98-
cp "${WORKING_PATH}/templates/default-config" "${KERNEL_PATH}/.config"
99-
make olddefconfig
100-
echo "" >"${KERNEL_PATH}"/.scmversion
101-
102-
# Build Deb packages
103-
make -j "$(getconf _NPROCESSORS_ONLN)" deb-pkg LOCALVERSION=-mbp-alt KDEB_PKGVERSION="$(make kernelversion)-$(get_next_version mbp)"
78+
make -j "$(getconf _NPROCESSORS_ONLN)" deb-pkg LOCALVERSION=-mbp KDEB_PKGVERSION="${KERNEL_VERSION}-$(get_next_version mbp)"
10479

10580
#### Copy artifacts to shared volume
10681
echo >&2 "===]> Info: Copying debs and calculating SHA256 ... "
107-
#cp -rfv ../*.deb "${REPO_PATH}/"
108-
#cp -rfv "${KERNEL_PATH}/.config" "${REPO_PATH}/kernel_config_${KERNEL_VERSION}"
10982
cp -rfv "${KERNEL_PATH}/.config" "/tmp/artifacts/kernel_config_${KERNEL_VERSION}"
11083
cp -rfv ../*.deb /tmp/artifacts/
11184
sha256sum ../*.deb >/tmp/artifacts/sha256

next_version.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
curl -s https://mbp-ubuntu-kernel.herokuapp.com/ -L | grep "linux-image-${KERNEL_VERSION}" > /dev/null
3+
OLD_BUILD_EXIST=$?
4+
if test $OLD_BUILD_EXIST -eq 0
5+
then
6+
LATEST_BUILD=$(curl -s https://mbp-ubuntu-kernel.herokuapp.com/ -L | grep "linux-image-${KERNEL_VERSION}-${1}" |
7+
grep a | cut -d'>' -f2 | cut -d'<' -f1 |
8+
sort -r | head -n 1 | cut -d'-' -f6 | cut -d'_' -f1)
9+
else
10+
LATEST_BUILD=0
11+
fi
12+
echo "$((LATEST_BUILD+1))"

patch_driver.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ BUILD_PATH=/tmp/build-kernel
66

77
### Apple T2 drivers commit hashes
88
# Patches
9-
APPLE_SMC_DRIVER_GIT_URL=https://github.com/marcosfad/linux-mbp-arch.git
10-
APPLE_SMC_DRIVER_BRANCH_NAME=release/5.9
11-
APPLE_SMC_DRIVER_COMMIT_HASH=01519664be9474c1cf5b92e37bd87a8d98283915
9+
APPLE_SMC_DRIVER_GIT_URL=https://github.com/aunali1/linux-mbp-arch.git
10+
APPLE_SMC_DRIVER_BRANCH_NAME=master
11+
APPLE_SMC_DRIVER_COMMIT_HASH=1faa37d704798bc04104a88f620e4f55b3466de0
1212
## BCE
1313
#APPLE_BCE_DRIVER_GIT_URL=https://github.com/aunali1/mbp2018-bridge-drv.git
1414
#APPLE_BCE_DRIVER_BRANCH_NAME=aur

0 commit comments

Comments
 (0)