-
Notifications
You must be signed in to change notification settings - Fork 1
201 lines (176 loc) · 8.54 KB
/
blank.yml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: Build and Release Kernel
on:
push:
branches:
- main # Trigger the workflow on pushes to the main branch
env:
ROOT_DIR_PREFIX: "OP12-A15"
BRANCH: "android14-6.1"
REPO_NAME: "cabagekiller/KSUNext-SUSFS"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1 # Fetch only the latest commit
- name: Free disk space
run: |
sudo apt-get update -qq
sudo apt-get install -qq curl
curl -fsSL https://raw.githubusercontent.com/kou/arrow/e49d8ae15583ceff03237571569099a6ad62be32/ci/scripts/util_free_space.sh | bash
- name: Add 16GB Swap Space
run: |
sudo fallocate -l 16G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
free -h
- name: Verify swap space
run: |
free -h # Verify swap space is allocated
swapon -s # List swap devices
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y zip bc bison flex g++-multilib \
gcc-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev \
libx11-dev lib32z1-dev libgl1-mesa-glx \
libxml2-utils xsltproc unzip \
dwarves curl pahole make bc libncurses5-dev ccache
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 2G
- name: Install Latest Pahole
run: |
sudo apt-get remove --purge -y dwarves
sudo apt-get update
sudo apt-get install -y git build-essential libdw-dev zlib1g-dev
git clone --recurse-submodules https://git.kernel.org/pub/scm/devel/pahole/pahole.git
cd pahole
cmake .
sudo make install
shell: bash
- name: Install and update repo tool
run: |
sudo wget -O /usr/bin/repo https://storage.googleapis.com/git-repo-downloads/repo
sudo chmod a+x /usr/bin/repo
- name: Set up directories
run: |
mkdir -p ./builds
cd ./builds
export ROOT_DIR="${ROOT_DIR_PREFIX}-$(date +'%Y-%m-%d-%I-%M-%p')-release"
mkdir -p "$ROOT_DIR"
- name: Clone repositories
run: |
cd ./builds/${ROOT_DIR}
git clone https://github.com/TheWildJames/AnyKernel3.git -b $BRANCH
git clone https://gitlab.com/simonpunk/susfs4ksu.git -b gki-android14-6.1
git clone https://github.com/TheWildJames/kernel_patches.git
- name: Get the kernel
run: |
cd ./builds/${ROOT_DIR}
mkdir oneplus12_v && cd oneplus12_v
repo init -u https://github.com/OnePlusOSS/kernel_manifest.git -b oneplus/sm8650 -m oneplus12_v.xml --depth=1
repo sync -j$(nproc) -f
rm -rf ./kernel_platform/common/android/abi_gki_protected_exports_*
- name: Add KernelSU
run: |
cd ./builds/${ROOT_DIR}/oneplus12_v/kernel_platform
curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next/kernel/setup.sh" | bash -s next
- name: Set KSU_GIT_VERSION
run: |
cd ./builds/${ROOT_DIR}/oneplus12_v/kernel_platform
export KSU_GIT_VERSION=$(git rev-parse HEAD)
echo "KSU_GIT_VERSION=$KSU_GIT_VERSION" >> $GITHUB_ENV
- name: Add SUSFS
run: |
cd ./builds/${ROOT_DIR}/oneplus12_v/kernel_platform
echo "adding susfs"
cp ../../susfs4ksu/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch ./KernelSU-Next/
cp ../../susfs4ksu/kernel_patches/50_add_susfs_in_gki-android14-6.1.patch ./common/
cp ../../susfs4ksu/kernel_patches/fs/susfs.c ./common/fs/
cp ../../susfs4ksu/kernel_patches/include/linux/susfs.h ./common/include/linux/
cp ../../susfs4ksu/kernel_patches/include/linux/susfs_def.h ./common/include/linux/
cd ./KernelSU-Next/
patch -p1 < 10_enable_susfs_for_ksu.patch || true
cd ../common
patch -p1 < 50_add_susfs_in_gki-android14-6.1.patch || true
cp ../../../kernel_patches/69_hide_stuff.patch ./
patch -p1 -F 3 < 69_hide_stuff.patch
sed -i '/obj-$(CONFIG_KSU_SUSFS_SUS_SU) += sus_su.o/d' ./fs/Makefile
cd ..
cp ../../kernel_patches/selinux.c_fix.patch ./
patch -p1 -F 3 < selinux.c_fix.patch
cp ../../kernel_patches/apk_sign.c_fix.patch ./
patch -p1 -F 3 < apk_sign.c_fix.patch
cp ../../kernel_patches/Makefile_fix.patch ./
patch -p1 --fuzz=3 < ./Makefile_fix.patch
cp ../../kernel_patches/core_hook.c_fix.patch ./
patch -p1 --fuzz=3 < ./core_hook.c_fix.patch
- name: Configure Kernel
run: |
cd ./builds/${ROOT_DIR}/oneplus12_v/kernel_platform
echo "CONFIG_KSU=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS_SUS_PATH=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_KSU_SUSFS_SUS_SU=y" >> ./common/arch/arm64/configs/gki_defconfig
echo "CONFIG_DEBUG_INFO_BTF=y" >> ./common/arch/arm64/configs/gki_defconfig
sed -i '2s/check_defconfig//' ./common/build.config.gki
- name: Disable Kernel Debug Config
run: |
cd ./builds/${ROOT_DIR}/oneplus12_v/kernel_platform
sed -i '/CONFIG_DEBUG_KERNEL/d' ./common/arch/arm64/configs/gki_defconfig
sed -i '/CONFIG_DEBUG_INFO/d' ./common/arch/arm64/configs/gki_defconfig
sed -i '/CONFIG_DEBUG_INFO_REDUCED/d' ./common/arch/arm64/configs/gki_defconfig
sed -i '/CONFIG_DEBUG_FS/d' ./common/arch/arm64/configs/gki_defconfig
sed -i '/CONFIG_DEBUG_SECTION_MISMATCH/d' ./common/arch/arm64/configs/gki_defconfig
echo "# Kernel debugging disabled for production build" >> ./common/arch/arm64/configs/gki_defconfig
- name: Verify repo sync and check kernel platform directory
run: |
cd ./builds/${ROOT_DIR}/oneplus12_v
if [ ! -d "kernel_platform" ]; then
echo "Error: kernel_platform directory does not exist!"
exit 1
fi
echo "Directory kernel_platform exists. Listing contents..."
ls -R ./kernel_platform
- name: Build Kernel
run: |
cd ./builds/${ROOT_DIR}/oneplus12_v
export PATH="/usr/lib/ccache:$PATH"
./kernel_platform/build_with_bazel.py -t pineapple gki -j$(nproc --all) --nosandbox --verbose_failures --config=stamp --user_kmi_symbol_lists=//msm-kernel:android/abi_gki_aarch64_qcom --ignore_missing_projects //msm-kernel:pineapple_gki_dist //msm-kernel:pineapple_gki_dtc_dist
- name: Copy Kernel Image
run: |
cp ./builds/${ROOT_DIR}/oneplus12_v/kernel_platform/out/dist/Image ./builds/${ROOT_DIR}/AnyKernel3/Image
- name: Create ZIP Package
run: |
cd ./builds/${ROOT_DIR}/AnyKernel3
ZIP_NAME="Anykernel3-OP-A15-${BRANCH}-KernelSU-SUSFS-$(date +'%Y-%m-%d-%H-%M-%S').zip"
zip -r "../$ZIP_NAME" ./
ls -lh "../$ZIP_NAME"
echo "zip_name=$ZIP_NAME" >> $GITHUB_OUTPUT
- name: Publish Release
uses: softprops/action-gh-release@v1
with:
files: ./builds/${ROOT_DIR}/$ZIP_NAME
tag_name: "v$(date +'%Y.%m.%d-%H%M%S')"
name: "OP12 A15 $BRANCH With KernelSUnext & SUSFS"
body: "Kernel release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}