Skip to content

Commit 9656dd8

Browse files
authored
Update build.yml
1 parent 7efd3a7 commit 9656dd8

File tree

1 file changed

+14
-182
lines changed

1 file changed

+14
-182
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -1,189 +1,21 @@
1-
name: Build Script
2-
permissions:
3-
contents: write
4-
actions: write
1+
name: Build crDroid 15.0 - Pixel 2 XL
52

63
on:
7-
workflow_call:
8-
inputs:
9-
android_version:
10-
required: true
11-
type: string
12-
kernel_version:
13-
required: true
14-
type: string
15-
sub_level:
16-
required: true
17-
type: string
18-
os_patch_level:
19-
required: true
20-
type: string
21-
revision:
22-
required: false
23-
type: string
4+
workflow_dispatch:
245

256
jobs:
26-
build-gki:
27-
runs-on: ubuntu-latest
28-
timeout-minutes: 120
29-
env:
30-
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
31-
CCACHE_NOHASHDIR: "true"
32-
CCACHE_HARDLINK: "true"
33-
7+
build-kernel:
8+
name: Build Kernel
9+
runs-on: ubuntu-22.04
3410
steps:
35-
- name: Maximize Build Space
36-
uses: AdityaGarg8/remove-unwanted-software@v5
37-
with:
38-
remove-dotnet: 'true' # Frees ~2 GB
39-
remove-android: 'true' # Frees ~9 GB
40-
remove-haskell: 'true' # Frees ~5.2 GB
41-
remove-codeql: 'true' # Frees ~5.4 GB
42-
remove-docker-images: 'true' # Frees ~3.2 GB
43-
remove-large-packages: 'true' # Frees ~3.1 GB
44-
remove-swapfile: 'true' # Frees ~4 GB
45-
remove-cached-tools: 'false' # Avoid unless confirmed safe
46-
verbose: 'true' # Enable detailed logging
47-
48-
- name: Set CONFIG Environment Variable
49-
run: |
50-
# Set CONFIG dynamically based on inputs values
51-
CONFIG="${{ inputs.android_version }}-${{ inputs.kernel_version }}-${{ inputs.sub_level }}"
52-
53-
# Set CONFIG as an environment variable for future steps
54-
echo "CONFIG=$CONFIG" >> $GITHUB_ENV
55-
56-
echo "CONFIG set to: $CONFIG"
57-
58-
- name: Install ccache
59-
run: sudo apt update && sudo apt install -y ccache
60-
61-
- name: Set up ccache
62-
run: |
63-
mkdir -p ~/.cache/bazel
64-
ccache --version
65-
ccache --max-size=2G
66-
ccache --set-config=compression=true
67-
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
68-
69-
- name: Download toolchain
70-
run: |
71-
AOSP_MIRROR=https://android.googlesource.com
72-
BRANCH=main-kernel-build-2024
73-
git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools
74-
git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 mkbootimg
75-
76-
- name: Set environment variables
77-
run: |
78-
echo "AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool" >> $GITHUB_ENV
79-
echo "MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py" >> $GITHUB_ENV
80-
echo "UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py" >> $GITHUB_ENV
81-
82-
- name: Install Repo
83-
run: |
84-
mkdir -p ./git-repo
85-
echo "Downloading repo tool..."
86-
curl https://storage.googleapis.com/git-repo-downloads/repo > ./git-repo/repo
87-
chmod a+rx ./git-repo/repo
88-
echo "REPO=$GITHUB_WORKSPACE/./git-repo/repo" >> $GITHUB_ENV
89-
90-
- name: Check Disk Space Before Sync
91-
run: |
92-
echo "Disk space before kernel source sync:"
93-
df -h
94-
95-
- name: Initialize and Sync Kernel Source
96-
run: |
97-
echo "Creating folder for configuration: $CONFIG..."
98-
mkdir -p "$CONFIG"
99-
cd "$CONFIG"
100-
echo "Initializing and syncing kernel source..."
101-
$REPO init --depth=1 https://github.com/Flouzr/android_kernel_google_wahoo
102-
$REPO --version
103-
$REPO --trace sync -c -j$(nproc --all) --no-tags --fail-fast
104-
105-
- name: Add Configuration Settings
106-
run: |
107-
echo "Changing to configuration directory: $CONFIG..."
108-
cd "$CONFIG"
109-
echo "Adding configuration settings to wahoo_defconfig..."
110-
111-
# Add KSU configuration settings
112-
echo "CONFIG_HAVE_HW_BREAKPOINT=y" >> ./common/arch/arm64/configs/wahoo_defconfig
113-
echo "CONFIG_KALLSYMS=y" >> ./common/arch/arm64/configs/wahoo_defconfig
114-
115-
# Remove check_defconfig
116-
sed -i 's/check_defconfig//' ./common/build.config.gki
117-
118-
- name: Change Kernel Name
119-
run: |
120-
cd "$CONFIG"
121-
122-
# modify UTS_VERSION
123-
perl -pi -e 's{UTS_VERSION="\$\(echo \$UTS_VERSION \$CONFIG_FLAGS \$TIMESTAMP \| cut -b -\$UTS_LEN\)"}{UTS_VERSION="#1 SMP PREEMPT Sun Apr 20 04:20:00 UTC 2025"}' ./common/scripts/mkcompile_h
124-
125-
sed -i '$s|echo "\$res"|echo "\$res-vBeans\"|' ./common/scripts/setlocalversion
126-
if [ -f "build/build.sh" ]; then
127-
sed -i 's/-dirty//' ./common/scripts/setlocalversion
128-
else
129-
sed -i 's/build-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto))/build-timestamp = "Sun Apr 20 04:20:00 UTC 2025"/' ./common/init/Makefile
130-
sed -i '/^[[:space:]]*"protected_exports_list"[[:space:]]*:[[:space:]]*"android\/abi_gki_protected_exports_aarch64",$/d' ./common/BUILD.bazel
131-
rm -rf ./common/android/abi_gki_protected_exports_*
132-
sed -i "/stable_scmversion_cmd/s/-maybe-dirty//g" ./build/kernel/kleaf/impl/stamp.bzl
133-
sed -E -i "/^CONFIG_LOCALVERSION=/ s/(.*)\"/\\1-vBeans\"/" ./common/arch/arm64/configs/gki_defconfig
134-
fi
135-
13611
- name: Build
137-
run : |
138-
set -e
139-
set -x
140-
cd "$CONFIG"
141-
echo "Building the kernel..."
142-
if [ -f "build/build.sh" ]; then
143-
LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh CC="/usr/bin/ccache clang" || exit 1
144-
else
145-
tools/bazel build --disk_cache=/home/runner/.cache/bazel --config=fast --lto=thin //common:kernel_aarch64_dist || exit 1
146-
fi
147-
ccache --show-stats
148-
149-
- name: Create Bootimgs Folder and Copy Images for Android 14/15
150-
if: ${{ inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
151-
run: |
152-
mkdir bootimgs
153-
154-
echo "Creating bootimgs folder and copying images..."
155-
cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./bootimgs
156-
cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./bootimgs
157-
cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./
158-
cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./
159-
160-
# Create gzip of the Image file
161-
gzip -n -k -f -9 ./Image > ./Image.gz
162-
163-
- name: Android 13/14/15 boot image build script
164-
if: ${{ inputs.android_version == 'android13' || inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
165-
run: |
166-
cd bootimgs
167-
168-
# Create gzip of the Image file
169-
gzip -n -k -f -9 ./Image > ./Image.gz
170-
171-
echo "Building boot.img"
172-
$MKBOOTIMG --header_version 4 --kernel Image --output boot.img
173-
$AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
174-
cp ./boot.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot.img
175-
176-
- name: Compress all img files with gzip
177-
run: |
178-
for image in *.img; do
179-
gzip -vnf9 "$image"
180-
done
181-
182-
- name: Upload Build Artifacts
183-
uses: actions/upload-artifact@v4
12+
uses: dabao1955/kernel_build_action@main
18413
with:
185-
name: pixel2xl-kernel-${{ env.CONFIG }}
186-
path: |
187-
*.zip
188-
*.img.gz
189-
*Image*
14+
kernel-url: https://github.com/Flouzr/android_kernel_google_wahoo
15+
kernel-branch: "15.0"
16+
config: wahoo_defconfig
17+
arch: arm64
18+
aosp-gcc: true
19+
aosp-clang: true
20+
android-version: 15
21+
aosp-clang-version: clang-r547379

0 commit comments

Comments
 (0)