forked from rvalyi/GKI-Custom
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (145 loc) · 7.45 KB
/
android14-5.15-SM-X910.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
name: Android14-5.15-SM-X910
on:
workflow_dispatch:
inputs:
os_patch_level:
required: true
type: string
description: >
Patch level of common kernel manifest,
for example: 2024-06
os_version:
required: true
type: string
description: >
OS Version of boot image
for example: 14.0.0
version_name:
required: true
type: string
description: >
With SUBLEVEL of kernel,
for example: android13-5.15.123
custom:
required: true
type: boolean
description: >
Enable LXC, Docker
kernelsu:
required: true
type: boolean
description: >
Enable KernelSU
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt install repo wget dwarves -y
- name: Install latest repo tool
run: |
curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo
chmod a+x /usr/local/bin/repo
- name: Verify repo version
run: repo --version
- name: Sync the kernel source code
run: |
cd $GITHUB_WORKSPACE
mkdir android-kernel
cd android-kernel
# it seems the revision with the least diff with is actually this one from Android 13:
# https://github.com/KDEFFALT/kernel_common-5.15/commit/09996673e3139a6d86fc3d95c852b3a020e2fe5f
repo init --depth 1 -u https://android.googlesource.com/kernel/manifest -b common-android13-5.15-${{ inputs.os_patch_level }}
repo sync
- name: Replace pure GKI by SM-X910 GKI
run: |
cd $GITHUB_WORKSPACE/android-kernel
git clone https://github.com/ArchVIsions/android_kernel_samsung_gts9wifi.git --depth=1
mv common common_pure_gki
mv android_kernel_samsung_gts9wifi common
- name: Apply patches and configuration files
if: ${{ inputs.custom == true }}
run: |
cd $GITHUB_WORKSPACE
git clone https://github.com/rvalyi/GKI-Custom.git gki-patch
# FIXME FIXME FIXME: inject the LXC settings properly, see the diff I put in config...
# cp ./gki-patch/config/gki_defconfig-android13-5.15 ./android-kernel/common/arch/arm64/configs/gki_defconfig
cd ./android-kernel/common
git apply $GITHUB_WORKSPACE/gki-patch/patchs/*.patch
- name: KernelSU
if: ${{ inputs.kernelsu == true }}
run: |
cd $GITHUB_WORKSPACE/android-kernel
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
- name: Build Kernel
run: |
cd $GITHUB_WORKSPACE/android-kernel
echo "ls"
ls
echo "ls build"
ls build
echo "head -n 10 common/Makefile"
head -n 10 common/Makefile
# BUILD_CONFIG=common/build.config.gki.aarch64 build/config.sh savedefconfig
# LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
export ARCH=arm64
sed -i 's/CONFIG_CMDLINE="stack_depot_disable=on kasan.stacktrace=off kvm-arm.mode=protected cgroup_disable=pressure"/CONFIG_CMDLINE="stack_depot_disable=on kasan.stacktrace=off kvm-arm.mode=nvhe cgroup_disable=pressure"' common/arch/arm64/configs/kalama_gki_defconfig # unprotect KVM
sed -i 's/CONFIG_DEBUG_INFO_BTF=y/CONFIG_DEBUG_INFO_BTF=n/' common/arch/arm64/configs/kalama_gki_defconfig
sed -i 's/CONFIG_DEBUG_INFO_BTF_MODULES=y/CONFIG_DEBUG_INFO_BTF_MODULES=n/' common/arch/arm64/configs/kalama_gki_defconfig
echo "will do build/config.sh"
#BUILD_CONFIG=common/build.config.gki.aarch64 build/config.sh savedefconfig
BUILD_CONFIG=common/build.config.gki.aarch64 build/config.sh kalama_gki_defconfig
# BUILD_CONFIG=common/build.config.gki.aarch64 KERNEL_DEFCONFIG=kalama_gki_defconfig build/config.sh savedefconfig
#ls -la .
#echo "build.sh --config done"
gcc common/scripts/sign-file.c -o common/scripts/sign-file -lssl -lcrypto
ls -la /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/common/scripts/sign-file
cd common
openssl req -new -x509 -newkey rsa:4096 -keyout certs/signing_key.pem -out certs/signing_key.x509 -nodes -days 36500 -subj "/CN=Custom Kernel Module Signing/"
ls certs
cd ..
#echo "-----------------------------------"
sed -i '/build_system_dlkm/i cp /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/common/certs/signing_key.pem /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/out/android13-5.15/common/certs/signing_key.pem; cp /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/common/certs/signing_key.x509 /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/out/android13-5.15/common/certs/signing_key.x509; cp /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/common/scripts/sign-file /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/out/android13-5.15/common/scripts/sign-file' build/build.sh
#cat build/build.sh
#ls /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/build/
#ls build
#echo "***********************************"
cp build/kernel/gettop.sh build/gettop.sh
KCFLAGS="-g0 -Wno-error" LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh -j2
- name: Prepare artifacts
id: prepareArtifacts
run: |
cd $GITHUB_WORKSPACE
OUTDIR=android-kernel/out/android13-5.15/dist
mkdir output
cp $OUTDIR/Image ./output/
cp $OUTDIR/Image.lz4 ./output/
cp $OUTDIR/Image ./
gzip -n -k -f -9 Image >Image.gz
git clone https://github.com/Kernel-SU/AnyKernel3
rm -rf ./AnyKernel3/.git
cp $OUTDIR/Image ./AnyKernel3/
wget https://dl.google.com/android/gki/gki-certified-boot-android13-5.15-${{ inputs.os_patch_level }}_r1.zip -O ./gki-kernel.zip
unzip -q ./gki-kernel.zip
rm ./gki-kernel.zip
cd $GITHUB_WORKSPACE/android-kernel
echo "Unpack boot"
./tools/mkbootimg/unpack_bootimg.py --boot_img $GITHUB_WORKSPACE/boot*.img
echo "Build boot.img"
./tools/mkbootimg/mkbootimg.py --header_version 4 --kernel out/android13-5.15/dist/Image --ramdisk out/ramdisk --os_version ${{ inputs.os_version }} --os_patch_level ${{ inputs.os_patch_level }} -o $GITHUB_WORKSPACE/output/${{ inputs.version_name }}_${{ inputs.os_patch_level }}-boot.img
echo "Build boot-lz4.img"
./tools/mkbootimg/mkbootimg.py --header_version 4 --kernel out/android13-5.15/dist/Image.lz4 --ramdisk out/ramdisk --os_version ${{ inputs.os_version }} --os_patch_level ${{ inputs.os_patch_level }} -o $GITHUB_WORKSPACE/output/${{ inputs.version_name }}_${{ inputs.os_patch_level }}-boot-lz4.img
echo "Build boot-gz.img"
./tools/mkbootimg/mkbootimg.py --header_version 4 --kernel $GITHUB_WORKSPACE/Image.gz --ramdisk out/ramdisk --os_version ${{ inputs.os_version }} --os_patch_level ${{ inputs.os_patch_level }} -o $GITHUB_WORKSPACE/output/${{ inputs.version_name }}_${{ inputs.os_patch_level }}-boot-gz.img
- name: Upload Image and Image.gz and boot.img
uses: actions/upload-artifact@v4
with:
name: Image-${{ inputs.version_name }}_${{ inputs.os_patch_level }}
path: ./output/*
- name: Upload AnyKernel3
uses: actions/upload-artifact@v4
with:
name: AnyKernel3-${{ inputs.version_name }}_${{ inputs.os_patch_level }}
path: ./AnyKernel3/*