-
Notifications
You must be signed in to change notification settings - Fork 775
69 lines (59 loc) · 2.68 KB
/
build-kernel.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
name: Build Kernel
on:
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
build_kernel:
runs-on: ubuntu-latest
steps:
# Step 0: Maximize build space
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 8192
temp-reserve-mb: 2048
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
# Step 1: Download prebuilt toolchain
- name: Download prebuilt toolchain
run: |
AOSP_MIRROR=https://android.googlesource.com
BRANCH=main-kernel-build-2024
# Clone necessary prebuilt tools
git clone $AOSP_MIRROR/platform/prebuilts/build-tools -b $BRANCH --depth 1 build-tools
git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools
git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 mkbootimg
# Add tools to PATH
echo "$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/build-tools/path/linux-x86" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/mkbootimg" >> $GITHUB_PATH
# Step 2: Set boot sign key (store key in the environment and write to a file in new directory)
- name: Set boot sign key
env:
BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }} # Environment variable for the key
run: |
if [ ! -z "$BOOT_SIGN_KEY" ]; then
# Create a new directory in GITHUB_WORKSPACE to avoid permission issues
mkdir -p $GITHUB_WORKSPACE/avb_keys
echo "$BOOT_SIGN_KEY" > $GITHUB_WORKSPACE/avb_keys/testkey_rsa2048.pem
# Ensure it's readable by everyone
chmod 644 $GITHUB_WORKSPACE/avb_keys/testkey_rsa2048.pem
# Optionally, add the directory to the PATH
echo "$GITHUB_WORKSPACE/avb_keys" >> $GITHUB_PATH
fi
# Step 3: Install 'repo' tool
- name: Install 'repo' tool
run: |
curl https://storage.googleapis.com/git-repo-downloads/repo > $GITHUB_WORKSPACE/repo
chmod a+rx $GITHUB_WORKSPACE/repo
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH
# Step 4: Clone kernel build scripts
- name: Clone kernel build scripts
run: |
git clone https://github.com/TheWildJames/kernel_build_scripts.git
# Step 5: Run kernel build script
- name: Run kernel build script
run: |
chmod +x kernel_build_scripts/GKI/aio_gki_build_kernel_release.sh
kernel_build_scripts/GKI/aio_gki_build_kernel_release.sh