Build Kernel #16
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: Build Kernel (Stable) | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 11 1/14 * *' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
env: | |
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" | |
CCACHE_NOHASHDIR: "true" | |
CCACHE_MAXSIZE: "2G" | |
CCACHE_HARDLINK: "true" | |
KERNEL_CMDLINE: "ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- O=out" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
fetch-depth: 1 | |
- name: Set Up ccache | |
uses: hendrikmuhs/[email protected] | |
- name: Install Dependencies | |
run: | | |
# 安装所需依赖包 | Install required dependency packages | |
sudo apt-get update -y | |
sudo apt install make python2 git bc ccache curl lib32ncurses5-dev libncurses5 libncurses5-dev -y | |
# 克隆编译器仓库 | Clone the compiler repository | |
# git clone https://github.com/ibnudz/aarch64-linux-android-4.9 $(pwd)/toolchain | |
git clone https://github.com/HoleHolo/ToolChains.git $(pwd)/ToolChain --depth=1 -b main | |
- name: Get Current Time | |
id: get_time | |
run: | | |
echo "TIME=$(TZ=UTC-8 date +%Y%m%d)" >> $GITHUB_OUTPUT | |
- name: Build Android Kernel | |
run: | | |
# 配置 KernelSU | Configure KernelSU | |
rm -rf ./KernelSU | |
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash - | |
# 设置环境变量 | Set environment variables | |
export PATH=$(pwd)/ToolChain/bin/:$PATH | |
# 执行编译操作 | Process compilation operations | |
make $KERNEL_CMDLINE merge_kirin970_defconfig | |
make $KERNEL_CMDLINE -j$(nproc --all) | |
# 打包内核文件 | Package kernel files | |
# tools/mkbootimg --kernel out/arch/arm64/boot/Image.gz --base 0x0 --cmdline "loglevel=4 initcall_debug=n page_tracker=on unmovable_isolate1=2:192M,3:224M,4:256M printktimer=0xfff0a000,0x534,0x538 androidboot.selinux=permissive buildvariant=user" --tags_offset 0x07A00000 --kernel_offset 0x00080000 --ramdisk_offset 0x07C00000 --header_version 1 --os_version 9 --os_patch_level 2019-05-05 --output kernel-${{ steps.get_time.outputs.TIME }}-permissive.img | |
tools/mkbootimg --kernel out/arch/arm64/boot/Image.gz --base 0x0 --cmdline "loglevel=4 initcall_debug=n page_tracker=on unmovable_isolate1=2:192M,3:224M,4:256M printktimer=0xfff0a000,0x534,0x538 androidboot.selinux=enforcing buildvariant=user" --tags_offset 0x07A00000 --kernel_offset 0x00080000 --ramdisk_offset 0x07C00000 --header_version 1 --os_version 9 --os_patch_level 2019-05-05 --output kernel-${{ steps.get_time.outputs.TIME }}-enforcing.img | |
- name: Upload Kernel Image Zip File | |
uses: actions/upload-artifact@v3 | |
with: | |
name: kernel-${{ steps.get_time.outputs.TIME }} | |
path: "kernel-*.img" |