51
.github/scripts/build_a12.sh
vendored
Normal file
51
.github/scripts/build_a12.sh
vendored
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
build_from_image(){
|
||||||
|
export TITLE=kernel-aarch64-$(echo $1 | sed 's/Image-//g')
|
||||||
|
echo "[+] title: $TITLE"
|
||||||
|
|
||||||
|
export PATCH_LEVEL=$(echo $1 | awk -F_ '{ print $2}')
|
||||||
|
echo "[+] patch level: $PATCH_LEVEL"
|
||||||
|
|
||||||
|
echo "[+] Download prebuilt ramdisk"
|
||||||
|
curl -Lo gki-kernel.zip https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-${PATCH_LEVEL}_r1.zip
|
||||||
|
unzip gki-kernel.zip && rm gki-kernel.zip
|
||||||
|
|
||||||
|
echo "[+] Unpack prebuilt boot.img"
|
||||||
|
BOOT_IMG=$(find . -maxdepth 1 -name "boot*.img")
|
||||||
|
$UNPACK_BOOTIMG --boot_img=$BOOT_IMG
|
||||||
|
rm $BOOT_IMG
|
||||||
|
|
||||||
|
echo "[+] Building Image.gz"
|
||||||
|
cat Image | $GZIP -n -f -9 > Image.gz
|
||||||
|
|
||||||
|
echo "[+] Building boot.img"
|
||||||
|
$MKBOOTIMG --header_version 4 --kernel Image --output boot.img --ramdisk out/ramdisk --os_version 12.0.0 --os_patch_level ${PATCH_LEVEL}
|
||||||
|
$AVBTOOL add_hash_footer --partition_name boot --partition_size $((64*1024*1024)) --image boot.img --algorithm SHA256_RSA2048 --key ../kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
||||||
|
|
||||||
|
echo "[+] Building boot-gz.img"
|
||||||
|
$MKBOOTIMG --header_version 4 --kernel Image.gz --output boot-gz.img --ramdisk out/ramdisk --os_version 12.0.0 --os_patch_level ${PATCH_LEVEL}
|
||||||
|
$AVBTOOL add_hash_footer --partition_name boot --partition_size $((64*1024*1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key ../kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
||||||
|
|
||||||
|
echo "[+] Building boot-lz4.img"
|
||||||
|
$MKBOOTIMG --header_version 4 --kernel Image.lz4 --output boot-lz4.img --ramdisk out/ramdisk --os_version 12.0.0 --os_patch_level ${PATCH_LEVEL}
|
||||||
|
$AVBTOOL add_hash_footer --partition_name boot --partition_size $((64*1024*1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key ../kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
||||||
|
|
||||||
|
echo "[+] Compress images"
|
||||||
|
for image in boot*.img; do
|
||||||
|
$GZIP -n -f -9 $image
|
||||||
|
mv $image.gz ksu-$VERSION-$image.gz
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "[+] Images to upload"
|
||||||
|
find . -type f -name "*.gz"
|
||||||
|
|
||||||
|
find . -type f -name "*.gz" | xargs python3 $GITHUB_WORKSPACE/KernelSU/scripts/ksubot.py
|
||||||
|
}
|
||||||
|
|
||||||
|
for dir in Image*; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
echo "----- Building $dir -----"
|
||||||
|
cd $dir
|
||||||
|
build_from_image $dir
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
done
|
||||||
38
.github/scripts/build_a13.sh
vendored
Normal file
38
.github/scripts/build_a13.sh
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
build_from_image(){
|
||||||
|
export TITLE=kernel-aarch64-$(echo $1 | sed 's/Image-//g')
|
||||||
|
echo "[+] title: $TITLE"
|
||||||
|
echo "[+] Building Image.gz"
|
||||||
|
cat Image | $GZIP -n -f -9 > Image.gz
|
||||||
|
|
||||||
|
echo "[+] Building boot.img"
|
||||||
|
$MKBOOTIMG --header_version 4 --kernel Image --output boot.img
|
||||||
|
$AVBTOOL add_hash_footer --partition_name boot --partition_size $((64*1024*1024)) --image boot.img --algorithm SHA256_RSA2048 --key ../kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
||||||
|
|
||||||
|
echo "[+] Building boot-gz.img"
|
||||||
|
$MKBOOTIMG --header_version 4 --kernel Image.gz --output boot-gz.img
|
||||||
|
$AVBTOOL add_hash_footer --partition_name boot --partition_size $((64*1024*1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key ../kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
||||||
|
|
||||||
|
echo "[+] Building boot-lz4.img"
|
||||||
|
$MKBOOTIMG --header_version 4 --kernel Image.lz4 --output boot-lz4.img
|
||||||
|
$AVBTOOL add_hash_footer --partition_name boot --partition_size $((64*1024*1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key ../kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
||||||
|
|
||||||
|
echo "[+] Compress images"
|
||||||
|
for image in boot*.img; do
|
||||||
|
$GZIP -n -f -9 $image
|
||||||
|
mv $image.gz ksu-$VERSION-$image.gz
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "[+] Images to upload"
|
||||||
|
find . -type f -name "*.gz"
|
||||||
|
|
||||||
|
find . -type f -name "*.gz" | xargs python3 $GITHUB_WORKSPACE/KernelSU/scripts/ksubot.py
|
||||||
|
}
|
||||||
|
|
||||||
|
for dir in Image*; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
echo "----- Building $dir -----"
|
||||||
|
cd $dir
|
||||||
|
build_from_image $dir
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
done
|
||||||
66
.github/workflows/build-kernel-a12.yml
vendored
66
.github/workflows/build-kernel-a12.yml
vendored
@@ -5,13 +5,17 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- ".github/workflows/build-kernel-a12.yml"
|
- ".github/workflows/build-kernel-a12.yml"
|
||||||
- ".github/workflows/gki-kernel.yml"
|
- ".github/workflows/gki-kernel.yml"
|
||||||
|
- ".github/scripts/build_a12.sh"
|
||||||
- "kernel/**"
|
- "kernel/**"
|
||||||
|
- "userspace/ksud/**"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
paths:
|
paths:
|
||||||
- ".github/workflows/build-kernel-a12.yml"
|
- ".github/workflows/build-kernel-a12.yml"
|
||||||
- ".github/workflows/gki-kernel.yml"
|
- ".github/workflows/gki-kernel.yml"
|
||||||
|
- ".github/scripts/build-a12.sh"
|
||||||
- "kernel/**"
|
- "kernel/**"
|
||||||
|
- "userspace/ksud/**"
|
||||||
jobs:
|
jobs:
|
||||||
build-ksud:
|
build-ksud:
|
||||||
uses: ./.github/workflows/ksud.yml
|
uses: ./.github/workflows/ksud.yml
|
||||||
@@ -39,9 +43,65 @@ jobs:
|
|||||||
version: android12-5.10
|
version: android12-5.10
|
||||||
version_name: android12-5.10.${{ matrix.sub_level }}
|
version_name: android12-5.10.${{ matrix.sub_level }}
|
||||||
tag: android12-5.10-${{ matrix.os_patch_level }}
|
tag: android12-5.10-${{ matrix.os_patch_level }}
|
||||||
os_version: 12.0.0
|
|
||||||
os_patch_level: ${{ matrix.os_patch_level }}
|
|
||||||
patch_path: "5.10"
|
patch_path: "5.10"
|
||||||
|
upload-artifacts:
|
||||||
|
needs: build-kernel
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }}
|
||||||
|
env:
|
||||||
|
CHAT_ID: ${{ secrets.CHAT_ID }}
|
||||||
|
CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }}
|
||||||
|
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
|
||||||
|
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||||
|
COMMIT_URL: ${{ github.event.head_commit.url }}
|
||||||
|
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
path: KernelSU
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: List artifacts
|
||||||
|
run: |
|
||||||
|
tree
|
||||||
|
|
||||||
|
- name: Download prebuilt toolchain
|
||||||
|
run: |
|
||||||
|
AOSP_MIRROR=https://android.googlesource.com
|
||||||
|
BRANCH=master-kernel-build-2022
|
||||||
|
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
|
||||||
|
pip3 install python-telegram-bot
|
||||||
|
|
||||||
|
- name: Set boot sign key
|
||||||
|
env:
|
||||||
|
BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }}
|
||||||
|
run: |
|
||||||
|
if [ ! -z "$BOOT_SIGN_KEY" ]; then
|
||||||
|
echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Setup mutex for uploading
|
||||||
|
uses: ben-z/gh-action-mutex@v1.0-alpha-7
|
||||||
|
|
||||||
|
- name: Build boot images
|
||||||
|
run: |
|
||||||
|
export AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool
|
||||||
|
export GZIP=$GITHUB_WORKSPACE/build-tools/path/linux-x86/gzip
|
||||||
|
export LZ4=$GITHUB_WORKSPACE/build-tools/path/linux-x86/lz4
|
||||||
|
export MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py
|
||||||
|
export UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py
|
||||||
|
cd $GITHUB_WORKSPACE/KernelSU
|
||||||
|
export VERSION=$(git rev-list --count HEAD)
|
||||||
|
echo "VERSION: $VERSION"
|
||||||
|
cd -
|
||||||
|
bash $GITHUB_WORKSPACE/KernelSU/.github/scripts/build_a12.sh
|
||||||
|
|
||||||
check-build-kernel:
|
check-build-kernel:
|
||||||
needs: build-ksud
|
needs: build-ksud
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
@@ -50,6 +110,4 @@ jobs:
|
|||||||
version: android12-5.10
|
version: android12-5.10
|
||||||
version_name: android12-5.10.101
|
version_name: android12-5.10.101
|
||||||
tag: android12-5.10-2022-05
|
tag: android12-5.10-2022-05
|
||||||
os_version: 12.0.0
|
|
||||||
os_patch_level: 2022-05
|
|
||||||
patch_path: "5.10"
|
patch_path: "5.10"
|
||||||
|
|||||||
66
.github/workflows/build-kernel-a13.yml
vendored
66
.github/workflows/build-kernel-a13.yml
vendored
@@ -5,13 +5,17 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- ".github/workflows/build-kernel-a13.yml"
|
- ".github/workflows/build-kernel-a13.yml"
|
||||||
- ".github/workflows/gki-kernel.yml"
|
- ".github/workflows/gki-kernel.yml"
|
||||||
|
- ".github/scripts/build_a13.sh"
|
||||||
- "kernel/**"
|
- "kernel/**"
|
||||||
|
- "userspace/ksud/**"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
paths:
|
paths:
|
||||||
- ".github/workflows/build-kernel-a13.yml"
|
- ".github/workflows/build-kernel-a13.yml"
|
||||||
- ".github/workflows/gki-kernel.yml"
|
- ".github/workflows/gki-kernel.yml"
|
||||||
|
- ".github/scripts/build-a13.sh"
|
||||||
- "kernel/**"
|
- "kernel/**"
|
||||||
|
- "userspace/ksud/**"
|
||||||
jobs:
|
jobs:
|
||||||
build-ksud:
|
build-ksud:
|
||||||
uses: ./.github/workflows/ksud.yml
|
uses: ./.github/workflows/ksud.yml
|
||||||
@@ -38,9 +42,65 @@ jobs:
|
|||||||
version: android13-${{ matrix.version }}
|
version: android13-${{ matrix.version }}
|
||||||
version_name: android13-${{ matrix.version }}.${{ matrix.sub_level }}
|
version_name: android13-${{ matrix.version }}.${{ matrix.sub_level }}
|
||||||
tag: android13-${{ matrix.version }}-${{ matrix.os_patch_level }}
|
tag: android13-${{ matrix.version }}-${{ matrix.os_patch_level }}
|
||||||
os_version: 13.0.0
|
|
||||||
os_patch_level: ${{ matrix.os_patch_level }}
|
|
||||||
patch_path: ${{ matrix.version }}
|
patch_path: ${{ matrix.version }}
|
||||||
|
upload-artifacts:
|
||||||
|
needs: build-kernel
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }}
|
||||||
|
env:
|
||||||
|
CHAT_ID: ${{ secrets.CHAT_ID }}
|
||||||
|
CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }}
|
||||||
|
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
|
||||||
|
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||||
|
COMMIT_URL: ${{ github.event.head_commit.url }}
|
||||||
|
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
path: KernelSU
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: List artifacts
|
||||||
|
run: |
|
||||||
|
tree
|
||||||
|
|
||||||
|
- name: Download prebuilt toolchain
|
||||||
|
run: |
|
||||||
|
AOSP_MIRROR=https://android.googlesource.com
|
||||||
|
BRANCH=master-kernel-build-2022
|
||||||
|
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
|
||||||
|
pip3 install python-telegram-bot
|
||||||
|
|
||||||
|
- name: Set boot sign key
|
||||||
|
env:
|
||||||
|
BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }}
|
||||||
|
run: |
|
||||||
|
if [ ! -z "$BOOT_SIGN_KEY" ]; then
|
||||||
|
echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Setup mutex for uploading
|
||||||
|
uses: ben-z/gh-action-mutex@v1.0-alpha-7
|
||||||
|
|
||||||
|
- name: Build boot images
|
||||||
|
run: |
|
||||||
|
export AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool
|
||||||
|
export GZIP=$GITHUB_WORKSPACE/build-tools/path/linux-x86/gzip
|
||||||
|
export LZ4=$GITHUB_WORKSPACE/build-tools/path/linux-x86/lz4
|
||||||
|
export MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py
|
||||||
|
export UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py
|
||||||
|
cd $GITHUB_WORKSPACE/KernelSU
|
||||||
|
export VERSION=$(git rev-list --count HEAD)
|
||||||
|
echo "VERSION: $VERSION"
|
||||||
|
cd -
|
||||||
|
bash $GITHUB_WORKSPACE/KernelSU/.github/scripts/build_a13.sh
|
||||||
|
|
||||||
check-build-kernel:
|
check-build-kernel:
|
||||||
needs: build-ksud
|
needs: build-ksud
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
@@ -58,6 +118,4 @@ jobs:
|
|||||||
version: android13-${{ matrix.version }}
|
version: android13-${{ matrix.version }}
|
||||||
version_name: android13-${{ matrix.version }}.${{ matrix.sub_level }}
|
version_name: android13-${{ matrix.version }}.${{ matrix.sub_level }}
|
||||||
tag: android13-${{ matrix.version }}-${{ matrix.os_patch_level }}
|
tag: android13-${{ matrix.version }}-${{ matrix.os_patch_level }}
|
||||||
os_version: 13.0.0
|
|
||||||
os_patch_level: ${{ matrix.os_patch_level }}
|
|
||||||
patch_path: ${{ matrix.version }}
|
patch_path: ${{ matrix.version }}
|
||||||
9
.github/workflows/build-manager.yml
vendored
9
.github/workflows/build-manager.yml
vendored
@@ -12,7 +12,14 @@ on:
|
|||||||
- 'manager/**'
|
- 'manager/**'
|
||||||
jobs:
|
jobs:
|
||||||
build-ksud:
|
build-ksud:
|
||||||
uses: ./.github/workflows/build-ksud.yml
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: aarch64-linux-android
|
||||||
|
- target: x86_64-linux-android
|
||||||
|
uses: ./.github/workflows/ksud.yml
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
build-manager:
|
build-manager:
|
||||||
needs: build-ksud
|
needs: build-ksud
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
138
.github/workflows/gki-kernel.yml
vendored
138
.github/workflows/gki-kernel.yml
vendored
@@ -21,18 +21,6 @@ on:
|
|||||||
description: >
|
description: >
|
||||||
Part of branch name of common kernel manifest,
|
Part of branch name of common kernel manifest,
|
||||||
for example: android12-5.10-2021-11
|
for example: android12-5.10-2021-11
|
||||||
os_version:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
description: >
|
|
||||||
Android version,
|
|
||||||
for example: 12.0.0
|
|
||||||
os_patch_level:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
description: >
|
|
||||||
Part of branch name of common kernel manifest,
|
|
||||||
for example: 2021-11
|
|
||||||
patch_path:
|
patch_path:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
@@ -49,7 +37,7 @@ on:
|
|||||||
default: ksud-aarch64-linux-android
|
default: ksud-aarch64-linux-android
|
||||||
description: >
|
description: >
|
||||||
Artifact name of prebuilt ksud to be embedded
|
Artifact name of prebuilt ksud to be embedded
|
||||||
for example: 5.10
|
for example: ksud-aarch64-linux-android
|
||||||
secrets:
|
secrets:
|
||||||
BOOT_SIGN_KEY:
|
BOOT_SIGN_KEY:
|
||||||
required: false
|
required: false
|
||||||
@@ -71,11 +59,6 @@ jobs:
|
|||||||
CCACHE_NOHASHDIR: "true"
|
CCACHE_NOHASHDIR: "true"
|
||||||
CCACHE_MAXSIZE: "2G"
|
CCACHE_MAXSIZE: "2G"
|
||||||
CCACHE_HARDLINK: "true"
|
CCACHE_HARDLINK: "true"
|
||||||
OUTPUT_IMAGE_GZ: ${{ inputs.version_name }}-Image.gz
|
|
||||||
OUTPUT_BOOT: ${{ inputs.version_name }}-boot.img.zip
|
|
||||||
OUTPUT_BOOT_GZ: ${{ inputs.version_name }}-boot-gz.img.zip
|
|
||||||
OUTPUT_BOOT_LZ4_LG: ${{ inputs.version_name }}-boot-lz4_lg.img.zip
|
|
||||||
OUTPUT_BOOT_LZ4_LEGACY: ${{ inputs.version_name }}-boot-lz4_legacy.img.zip
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@@ -105,31 +88,6 @@ jobs:
|
|||||||
mkdir android-kernel && cd android-kernel
|
mkdir android-kernel && cd android-kernel
|
||||||
../git-repo/repo init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${{ inputs.tag }}
|
../git-repo/repo init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${{ inputs.tag }}
|
||||||
../git-repo/repo sync -j$(nproc --all)
|
../git-repo/repo sync -j$(nproc --all)
|
||||||
curl -Lo gki-kernel.zip https://dl.google.com/android/gki/gki-certified-boot-${{ inputs.tag }}_r1.zip
|
|
||||||
unzip gki-kernel.zip
|
|
||||||
tools/mkbootimg/unpack_bootimg.py --boot_img=$(find . -maxdepth 1 -name "*.img")
|
|
||||||
|
|
||||||
- name: Setup version related environment
|
|
||||||
working-directory: android-kernel
|
|
||||||
run: |
|
|
||||||
case ${{ inputs.version }} in
|
|
||||||
android12-5.10)
|
|
||||||
export AVBTOOL=./build/build-tools/path/linux-x86/avbtool
|
|
||||||
;;
|
|
||||||
android13-5.10 | android13-5.15 )
|
|
||||||
export AVBTOOL=./build/kernel/build-tools/path/linux-x86/avbtool
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
export AVBTOOL=$(find ./build -name "avbtool")
|
|
||||||
echo "find result: $AVBTOOL"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo "AVBTOOL: $AVBTOOL"
|
|
||||||
if [ ! -f "$AVBTOOL" ]; then
|
|
||||||
echo "Don't find AVBTOOL, please fixup this script"
|
|
||||||
crash_this_workflow
|
|
||||||
fi
|
|
||||||
echo "AVBTOOL=$AVBTOOL" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Download prebuilt ksud from artifacts
|
- name: Download prebuilt ksud from artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
@@ -168,100 +126,20 @@ jobs:
|
|||||||
echo "[+] Add KernelSU symbols"
|
echo "[+] Add KernelSU symbols"
|
||||||
cat $KSU_ROOT/kernel/export_symbol.txt | awk '{sub("[ \t]+","");print " "$0}' >> $SYMBOL_LIST
|
cat $KSU_ROOT/kernel/export_symbol.txt | awk '{sub("[ \t]+","");print " "$0}' >> $SYMBOL_LIST
|
||||||
|
|
||||||
- name: Setup boot sign key
|
|
||||||
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }}
|
|
||||||
working-directory: android-kernel
|
|
||||||
env:
|
|
||||||
BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }}
|
|
||||||
run: |
|
|
||||||
if [ ! -z "$BOOT_SIGN_KEY" ]; then
|
|
||||||
echo "$BOOT_SIGN_KEY" > prebuilts/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build boot.img
|
- name: Build boot.img
|
||||||
working-directory: android-kernel
|
working-directory: android-kernel
|
||||||
run: CCACHE="/usr/bin/ccache" BUILD_BOOT_IMG=1 SKIP_VENDOR_BOOT=1 KERNEL_BINARY=Image GKI_RAMDISK_PREBUILT_BINARY=out/ramdisk AVB_SIGN_BOOT_IMG=1 AVB_BOOT_PARTITION_SIZE=$((64*1024*1024)) AVB_BOOT_ALGORITHM=SHA256_RSA2048 AVB_BOOT_KEY=prebuilts/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem BOOT_IMAGE_HEADER_VERSION=4 LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
|
run: CCACHE="/usr/bin/ccache" LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
|
||||||
|
|
||||||
- name: Build boot-gz.img
|
|
||||||
working-directory: android-kernel
|
|
||||||
run: |
|
|
||||||
cat out/${{ inputs.version }}/dist/Image | ./prebuilts/build-tools/path/linux-x86/gzip -n -f -9 > out/${{ inputs.version }}/dist/Image.gz
|
|
||||||
tools/mkbootimg/mkbootimg.py --header_version 4 --kernel ./out/${{ inputs.version }}/dist/Image.gz --ramdisk out/ramdisk --output ./out/${{ inputs.version }}/dist/boot-gz.img --os_version ${{ inputs.os_version }} --os_patch_level ${{ inputs.os_patch_level }}
|
|
||||||
${{ env.AVBTOOL }} add_hash_footer --partition_name boot --partition_size $((64*1024*1024)) --image out/${{ inputs.version }}/dist/boot-gz.img --algorithm SHA256_RSA2048 --key ./prebuilts/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
|
||||||
|
|
||||||
- name: Build boot-lz4_lg.img
|
|
||||||
working-directory: android-kernel
|
|
||||||
run: |
|
|
||||||
tools/mkbootimg/mkbootimg.py --header_version 4 --kernel ./out/${{ inputs.version }}/dist/Image.lz4 --ramdisk out/ramdisk --output ./out/${{ inputs.version }}/dist/boot-lz4_lg.img --os_version ${{ inputs.os_version }} --os_patch_level ${{ inputs.os_patch_level }}
|
|
||||||
${{ env.AVBTOOL }} add_hash_footer --partition_name boot --partition_size $((64*1024*1024)) --image out/${{ inputs.version }}/dist/boot-lz4_lg.img --algorithm SHA256_RSA2048 --key ./prebuilts/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
|
||||||
|
|
||||||
- name: Build boot-lz4_legacy.img
|
|
||||||
working-directory: android-kernel
|
|
||||||
run: |
|
|
||||||
cat ./out/${{ inputs.version }}/dist/Image | ./prebuilts/kernel-build-tools/linux-x86/bin/lz4 -l -12 --favor-decSpeed stdin stdout > ./out/${{ inputs.version }}/dist/Image.lz4-legacy
|
|
||||||
tools/mkbootimg/mkbootimg.py --header_version 4 --kernel ./out/${{ inputs.version }}/dist/Image.lz4-legacy --ramdisk out/ramdisk --output ./out/${{ inputs.version }}/dist/boot-lz4_legacy.img --os_version ${{ inputs.os_version }} --os_patch_level ${{ inputs.os_patch_level }}
|
|
||||||
${{ env.AVBTOOL }} add_hash_footer --partition_name boot --partition_size $((64*1024*1024)) --image out/${{ inputs.version }}/dist/boot-lz4_legacy.img --algorithm SHA256_RSA2048 --key ./prebuilts/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
|
|
||||||
|
|
||||||
- name: Prepare artifacts
|
- name: Prepare artifacts
|
||||||
id: prepareArtifacts
|
id: prepareArtifacts
|
||||||
run: |
|
run: |
|
||||||
OUTDIR=android-kernel/out/${{ inputs.version }}/dist
|
OUTDIR=android-kernel/out/${{ inputs.version }}/dist
|
||||||
cp $OUTDIR/Image.gz $OUTPUT_IMAGE_GZ
|
mkdir output
|
||||||
zip $OUTPUT_BOOT -j -r $OUTDIR/boot.img
|
cp $OUTDIR/Image ./output/
|
||||||
zip $OUTPUT_BOOT_GZ -j -r $OUTDIR/boot-gz.img
|
cp $OUTDIR/Image.lz4 ./output/
|
||||||
zip $OUTPUT_BOOT_LZ4_LG -j -r $OUTDIR/boot-lz4_lg.img
|
|
||||||
zip $OUTPUT_BOOT_LZ4_LEGACY -j -r $OUTDIR/boot-lz4_legacy.img
|
|
||||||
|
|
||||||
- name: Upload Image.gz
|
- name: Upload Image and Image.gz
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.version_name }}-Image.gz
|
name: Image-${{ inputs.version_name }}_${{ inputs.os_patch_level }}
|
||||||
path: ${{ env.OUTPUT_IMAGE_GZ }}
|
path: ./output/*
|
||||||
|
|
||||||
- name: Upload boot.img
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: ${{ inputs.version_name }}-boot.img
|
|
||||||
path: ${{ env.OUTPUT_BOOT }}
|
|
||||||
|
|
||||||
- name: Upload boot-gz.img
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: ${{ inputs.version_name }}-boot-gz.img
|
|
||||||
path: ${{ env.OUTPUT_BOOT_GZ }}
|
|
||||||
|
|
||||||
- name: Upload boot-lz4_lg.img
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: ${{ inputs.version_name }}-boot-lz4_lg.img
|
|
||||||
path: ${{ env.OUTPUT_BOOT_LZ4_LG }}
|
|
||||||
|
|
||||||
- name: Upload boot-lz4_legacy.img
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: ${{ inputs.version_name }}-boot-lz4_legacy.img
|
|
||||||
path: ${{ env.OUTPUT_BOOT_LZ4_LEGACY }}
|
|
||||||
|
|
||||||
- name: Setup mutex for uploading
|
|
||||||
uses: ben-z/gh-action-mutex@v1.0-alpha-7
|
|
||||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && steps.need_upload.outputs.UPLOAD == 'true'
|
|
||||||
|
|
||||||
- name: Upload to telegram
|
|
||||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && steps.need_upload.outputs.UPLOAD == 'true'
|
|
||||||
env:
|
|
||||||
CHAT_ID: ${{ secrets.CHAT_ID }}
|
|
||||||
CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }}
|
|
||||||
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
||||||
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
|
|
||||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
||||||
COMMIT_URL: ${{ github.event.head_commit.url }}
|
|
||||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
||||||
TITLE: kernel-${{ inputs.version_name }}
|
|
||||||
run: |
|
|
||||||
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
|
|
||||||
cd $GITHUB_WORKSPACE/KernelSU
|
|
||||||
export VERSION=$(git rev-list --count HEAD)
|
|
||||||
cd -
|
|
||||||
pip3 install python-telegram-bot
|
|
||||||
python3 $GITHUB_WORKSPACE/KernelSU/scripts/ksubot.py $OUTPUT_IMAGE_GZ $OUTPUT_BOOT $OUTPUT_BOOT_GZ $OUTPUT_BOOT_LZ4_LG $OUTPUT_BOOT_LZ4_LEGACY
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user