Android13-5.15-SM-X910-docker-opts #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android13-5.15-SM-X910-docker-opts | |
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, unlock pKVM | |
kernelsu: | |
required: true | |
type: boolean | |
description: > | |
Enable KernelSU | |
release: | |
required: true | |
type: boolean | |
description: > | |
Upload draft release? | |
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 }} | |
# remove prebuilt/tradefed and prebuilt/asuite as they clone lots of unnecessary (?) stuff that kills the gh actions | |
sed -i '/prebuilts\/tradefed/d' .repo/manifests/default.xml | |
sed -i '/prebuilts\/asuite/d' .repo/manifests/default.xml | |
repo sync | |
- name: Replace pure GKI by SM-X910 GKI | |
run: | | |
cd $GITHUB_WORKSPACE/android-kernel | |
git clone https://github.com/rvalyi/android_kernel_samsung_gts9wifi.git --depth=1 --branch=docker | |
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/flanter21/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 | |
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 | |
rm -rf common/.config | |
BUILD_CONFIG=common/build.config.gki.aarch64 build/config.sh kalama_gki_defconfig | |
echo "----------- cat /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/out/android13-5.15/common/.config ------" | |
cat /home/runner/work/GKI-Custom/GKI-Custom/android-kernel/out/android13-5.15/common/.config | |
echo "------------------------------" | |
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/" | |
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 | |
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: Release | |
uses: softprops/action-gh-release@v2 | |
if: ${{ inputs.release == true }} | |
with: | |
name: Image-${{ inputs.version_name }}_${{ inputs.os_patch_level }} | |
draft: true | |
body: | | |
OS Version = ${{ inputs.os_version }} | |
Enable LXC, Docker, unlock pKVM = ${{ inputs.custom }} | |
Enable KernelSU = ${{ inputs.kernelsu }} | |
files: | | |
$GITHUB_WORKSPACE/output/${{ inputs.version_name }}_${{ inputs.os_patch_level }}-boot.img | |
$GITHUB_WORKSPACE/output/${{ inputs.version_name }}_${{ inputs.os_patch_level }}-boot-lz4.img | |
$GITHUB_WORKSPACE/output/${{ inputs.version_name }}_${{ inputs.os_patch_level }}-boot-gz.img | |
# - name: Upload AnyKernel3 | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: AnyKernel3-${{ inputs.version_name }}_${{ inputs.os_patch_level }} | |
# path: ./AnyKernel3/* |