Skip to content

Commit 1175246

Browse files
authored
Update custom.yml
1 parent 940b10d commit 1175246

File tree

1 file changed

+40
-60
lines changed

1 file changed

+40
-60
lines changed

.github/workflows/custom.yml

Lines changed: 40 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ jobs:
4141
- name: Install full build dependencies (including cross-toolchain)
4242
run: |
4343
sudo apt-get update -y
44-
sudo apt-get install -y git device-tree-compiler lz4 xz-utils zlib1g-dev openjdk-17-jdk gcc g++ python3 python-is-python3 p7zip-full android-sdk-libsparse-utils erofs-utils \
45-
default-jdk git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses-dev libx11-dev libreadline-dev libgl1 libgl1-mesa-dev \
46-
python3 make sudo gcc g++ bc grep tofrodos python3-markdown libxml2-utils xsltproc libtinfo6 \
47-
make repo cpio kmod openssl libelf-dev pahole libssl-dev libarchive-tools zstd rsync --fix-missing
44+
sudo apt-get install -y git device-tree-compiler lz4 xz-utils zlib1g-dev openjdk-17-jdk gcc g++ python3 python-is-python3 p7zip-full android-sdk-libsparse-utils erofs-utils default-jdk git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses-dev libx11-dev libreadline-dev libgl1 libgl1-mesa-dev python3 make sudo gcc g++ bc grep tofrodos python3-markdown libxml2-utils xsltproc libtinfo6 make repo cpio kmod openssl libelf-dev pahole libssl-dev libarchive-tools zstd rsync --fix-missing
4845
sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
4946
5047
- name: Verify cross-compiler binaries
@@ -72,7 +69,7 @@ jobs:
7269
fi
7370
7471
- name: Apply SUSFS patches if enabled
75-
if: ${{ github.event.inputs.enable_susfs == 'true' }}
72+
if: github.event.inputs.enable_susfs == 'true'
7673
working-directory: kernel
7774
run: |
7875
git clone https://gitlab.com/simonpunk/susfs4ksu.git -b kernel-4.14 susfs_patches
@@ -87,23 +84,24 @@ jobs:
8784
patch -N -p1 < 50_add_susfs_in_kernel-4.14.patch
8885
fi
8986
if find . -name "*.rej" | grep -q .; then
90-
echo "SUSFS patch rejects found:"; find . -name "*.rej" -print -exec sed -n '1,20p' {} \;
87+
echo "SUSFS patch rejects found:"
88+
find . -name "*.rej" -print -exec sed -n '1,20p' {} \;
9189
exit 1
9290
fi
9391
9492
- name: Patch btrfs struct timespec64 using patch file
9593
working-directory: kernel
9694
run: |
9795
patchfile="btrfs_timespec64.patch"
98-
cat > $patchfile <<EOF
96+
cat > "$patchfile" <<'EOF'
9997
--- a/fs/btrfs/inode.c
10098
+++ b/fs/btrfs/inode.c
10199
@@ -6627,7 +6627,7 @@
102100
- struct timespec now = current_time(&parent_inode->vfs_inode);
103101
+ struct timespec64 now = current_time(&parent_inode->vfs_inode);
104102
EOF
105103
if grep -qF "struct timespec now = current_time(&parent_inode->vfs_inode);" fs/btrfs/inode.c; then
106-
patch -p1 < $patchfile || (echo "Patch failed or already applied"; exit 1)
104+
patch -p1 < "$patchfile" || (echo "Patch failed or already applied"; exit 1)
107105
else
108106
echo "Patch already applied or no match"
109107
fi
@@ -112,50 +110,50 @@ EOF
112110
- name: Patch try_to_unmap argument pattern
113111
working-directory: kernel
114112
run: |
115-
sed -i 's|try_to_unmap(page, ttu_flags);|try_to_unmap(page, ttu_flags, NULL);|g' mm/huge_memory.c
113+
sed -i 's@try_to_unmap(page, ttu_flags);@try_to_unmap(page, ttu_flags, NULL);@g' mm/huge_memory.c
116114
grep -C2 "try_to_unmap" mm/huge_memory.c | cat -n
117115
118116
- name: Patch hugetlbpage ptep allocation (safe/atomic, non-fatal)
119117
working-directory: kernel
120118
run: |
121119
file=arch/arm64/mm/hugetlbpage.c
122-
ln=$(awk '/huge_pte_alloc/{f=1} f && /{/{print NR; exit}' $file)
120+
ln=$(awk '/huge_pte_alloc/{f=1} f && /{/{print NR; exit}' "$file")
123121
if [ -n "$ln" ]; then
124-
if ! sed -n "$((ln+1)),$((ln+15))p" $file | grep -q "pte_t *ptep"; then
125-
sed -i "$((ln+1)) i\ pte_t *ptep = NULL;" $file
122+
if ! sed -n "$((ln+1)),$((ln+15))p" "$file" | grep -q "pte_t \*ptep"; then
123+
sed -i "$((ln+1)) i\ pte_t *ptep = NULL;" "$file"
126124
echo "Inserted 'pte_t *ptep = NULL;' after line $ln"
127125
fi
128-
sed -i 's/ptep = huge_pmd_share(mm, vma, addr, pud);/if (!ptep) ptep = huge_pmd_share(mm, vma, addr, pud);/' $file
126+
sed -i 's@ptep = huge_pmd_share(mm, vma, addr, pud);@if (!ptep) ptep = huge_pmd_share(mm, vma, addr, pud);@' "$file"
129127
else
130128
echo "huge_pte_alloc function not found, skipping ptep patch"
131129
fi
132-
grep -n "pte_t *ptep" $file | cat -n || true
133-
grep -C4 "ptep = huge_pmd_share" $file | cat -n || true
130+
grep -n "pte_t \*ptep" "$file" | cat -n || true
131+
grep -C4 "ptep = huge_pmd_share" "$file" | cat -n || true
134132
135133
- name: Remove mm->nr_ptes usage (safe/atomic)
136134
working-directory: kernel
137135
run: |
138-
sed -i 's/\(.*mm->nr_ptes.*\)/\/\* REMOVED_for_ARM64 \1 \*\//' mm/khugepaged.c
136+
sed -i 's@\(.*mm->nr_ptes.*\)@/* REMOVED_for_ARM64 \1 */@' mm/khugepaged.c
139137
grep -C2 "nr_ptes" mm/khugepaged.c | cat -n || true
140138
141139
- name: Add SUSFS configs if enabled
142-
if: ${{ github.event.inputs.enable_susfs == 'true' }}
140+
if: github.event.inputs.enable_susfs == 'true'
143141
working-directory: kernel
144142
run: |
145143
conf="arch/arm64/configs/${{ github.event.inputs.defconfig_file }}"
146-
{
147-
echo "CONFIG_KSU=y"
148-
echo "CONFIG_KSU_SUSFS=y"
149-
echo "CONFIG_KSU_SUSFS_SUS_PATH=y"
150-
echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y"
151-
echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y"
152-
echo "CONFIG_KSU_SUSFS_SUS_OVERLAYFS=y"
153-
echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y"
154-
echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y"
155-
echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y"
156-
echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y"
157-
echo "CONFIG_KSU_SUSFS_SUS_SU=y"
158-
} >> "$conf"
144+
cat >> "$conf" <<'EOF'
145+
CONFIG_KSU=y
146+
CONFIG_KSU_SUSFS=y
147+
CONFIG_KSU_SUSFS_SUS_PATH=y
148+
CONFIG_KSU_SUSFS_SUS_MOUNT=y
149+
CONFIG_KSU_SUSFS_SUS_KSTAT=y
150+
CONFIG_KSU_SUSFS_SUS_OVERLAYFS=y
151+
CONFIG_KSU_SUSFS_TRY_UMOUNT=y
152+
CONFIG_KSU_SUSFS_SPOOF_UNAME=y
153+
CONFIG_KSU_SUSFS_ENABLE_LOG=y
154+
CONFIG_KSU_SUSFS_OPEN_REDIRECT=y
155+
CONFIG_KSU_SUSFS_SUS_SU=y
156+
EOF
159157

160158
- name: Disable problematic configs
161159
working-directory: kernel
@@ -170,7 +168,8 @@ EOF
170168
- name: Ensure NR_CPUS config
171169
working-directory: kernel
172170
run: |
173-
grep -q '^CONFIG_NR_CPUS=' arch/arm64/configs/${{ github.event.inputs.defconfig_file }} || echo 'CONFIG_NR_CPUS=8' >> arch/arm64/configs/${{ github.event.inputs.defconfig_file }}
171+
conf="arch/arm64/configs/${{ github.event.inputs.defconfig_file }}"
172+
grep -q '^CONFIG_NR_CPUS=' "$conf" || echo 'CONFIG_NR_CPUS=8' >> "$conf"
174173
175174
- name: Prepare kernel config
176175
working-directory: kernel
@@ -190,57 +189,39 @@ EOF
190189
- name: Copy kernel Image.lz4 if exists
191190
if: always()
192191
run: |
193-
if [ -f kernel/out/arch/arm64/boot/Image.lz4 ]; then
194-
mkdir -p kernel/AnyKernel3
195-
cp kernel/out/arch/arm64/boot/Image.lz4 kernel/AnyKernel3/Image.lz4
196-
elif [ -f kernel/out/arch/arm64/boot/Image.gz ]; then
197-
mkdir -p kernel/AnyKernel3
198-
cp kernel/out/arch/arm64/boot/Image.gz kernel/AnyKernel3/Image.gz
199-
else
200-
echo "No kernel image found"
201-
exit 1
192+
if [ -f kernel/out/android12-5.10/dist/Image.lz4 ]; then
193+
cp kernel/out/android12-5.10/dist/Image.lz4 kernel/AnyKernel3/Image.lz4
202194
fi
203195
204196
- name: Package Kernel ZIP
205197
working-directory: kernel/AnyKernel3
206198
run: |
207-
if [ ! -d "AnyKernel3" ]; then
208-
echo "AnyKernel3 directory not found, creating basic structure"
209-
mkdir -p AnyKernel3
210-
echo "do DEVICE_NAME=OnePlus 7" > AnyKernel3/anykernel.sh
211-
echo "do CLEANUP=0" >> AnyKernel3/anykernel.sh
212-
fi
213-
zip -r ../${{ github.event.inputs.release_name }}.zip * -x .git README.md *placeholder
199+
zip -r ../${{ github.event.inputs.release_name }}.zip *
214200
215201
- name: Build Wi-Fi Module (qca_cld3)
216202
working-directory: kernel
217203
run: |
218204
export PATH=/usr/lib/llvm-18/bin:$PATH
219205
LTO=thin ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make modules_prepare
220-
LTO=thin ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j$(nproc) M=drivers/staging/qcacld-3.0 modules
206+
LTO=thin ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j$(nproc) -C drivers/staging/qcacld-3.0 M=$(pwd)/drivers/staging/qcacld-3.0 modules
221207
mkdir -p ../modules/vendor/lib/modules
222-
find drivers/staging/qcacld-3.0 -name "*.ko" -exec cp {} ../modules/vendor/lib/modules/ \;
223-
if [ -z "$(ls -A ../modules/vendor/lib/modules)" ]; then
224-
echo "No Wi-Fi modules built"
225-
exit 1
226-
fi
208+
find out/drivers/staging/qcacld-3.0 -name "*.ko" -exec cp -v {} ../modules/vendor/lib/modules/ \;
227209
sudo chown -R $(id -u):$(id -g) ../modules
228210
229211
- name: Package Wi-Fi Module ZIP
230212
run: |
231-
if [ ! -d "modules/vendor/lib/modules" ] || [ -z "$(ls modules/vendor/lib/modules/*.ko 2>/dev/null)" ]; then
232-
echo "No Wi-Fi modules to package, skipping ZIP creation"
233-
else
234-
cd modules
235-
zip -r ../${{ github.event.inputs.release_name }}-modules.zip vendor
213+
if [ ! -d "modules/vendor/lib/modules" ] || ! ls modules/vendor/lib/modules/*.ko >/dev/null 2>&1; then
214+
echo "No Wi-Fi modules to package, exiting."
215+
exit 1
236216
fi
217+
cd modules
218+
zip -r ../${{ github.event.inputs.release_name }}-modules.zip *
237219
238220
- name: Upload kernel build artifacts
239221
uses: actions/upload-artifact@v4
240222
with:
241223
name: kernel-output
242224
path: kernel/out
243-
if-no-files-found: ignore
244225

245226
- name: Upload zips
246227
uses: actions/upload-artifact@v4
@@ -249,4 +230,3 @@ EOF
249230
path: |
250231
kernel/${{ github.event.inputs.release_name }}.zip
251232
${{ github.event.inputs.release_name }}-modules.zip
252-
if-no-files-found: ignore

0 commit comments

Comments
 (0)