Skip to content

低端机 谷歌clang12.0.5 #2

低端机 谷歌clang12.0.5

低端机 谷歌clang12.0.5 #2

name: 低端机 谷歌clang12.0.5
on:
workflow_dispatch:
jobs:
build:
name:
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
steps:
- uses: actions/checkout@v3
- name: 环境变量配置
run: |
cat config.env | grep KERNEL_SOURCE= >> $GITHUB_ENV
cat config.env | grep KERNEL_SOURCE_BRANCH= >> $GITHUB_ENV
cat config.env | grep KERNEL_CONFIG= >> $GITHUB_ENV
cat config.env | grep KERNEL_ZIP_NAME= >> $GITHUB_ENV
cat config.env | grep LLVM_CONFIG= >> $GITHUB_ENV
cat config.env | grep ENABLE_KERNELSU= >> $GITHUB_ENV
cat config.env | grep KERNELSU_TAG= >> $GITHUB_ENV
cat config.env | grep ENABLE_KVM= >> $GITHUB_ENV
cat config.env | grep ENABLE_LXC_DOCKER= >> $GITHUB_ENV
cat config.env | grep ENABLE_KERNELSU= >> $GITHUB_ENV
cat config.env | grep KERNELSU_TAG= >> $GITHUB_ENV
- name: 构建编译内核环境
run: |
sudo apt update
sudo apt -y install git make bc bison ccache openssl zip kmod cpio flex libelf-dev curl libssl-dev libtfm-dev wget device-tree-compiler ca-certificates python3 python2 binutils binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-arm-linux-gnueabi gcc-arm-linux-gnueabi
mkdir -p $GITHUB_WORKSPACE/kernel_workspace
- name: 下载谷歌clang12编译器
run: |
cd $GITHUB_WORKSPACE/kernel_workspace
mkdir clang-aosp
git clone -q --depth=1 --single-branch https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86 -b android12-release clang-aosp
- name: 下载内核源码
run: |
cd $GITHUB_WORKSPACE/kernel_workspace
git clone ${{ env.KERNEL_SOURCE }} -b ${{ env.KERNEL_SOURCE_BRANCH }} android-kernel --depth=1
- name: 设置ccache缓存
uses: hendrikmuhs/[email protected]
with:
key: build-kernel-mido-kernel
max-size: 2G
- name: 开始编译内核
run: |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel
export PATH=$GITHUB_WORKSPACE/kernel_workspace/clang-aosp/clang-r416183b/bin:$PATH
make O=out ARCH=arm64 ${{ env.KERNEL_CONFIG }}
if [ ${{env.LLVM_CONFIG}}=y ]; then
make -j$(nproc --all) CC="ccache clang" O=out ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" CROSS_COMPILE_ARM32="arm-linux-gnueabi-" LLVM=1 LLVM_IAS=1
else
make -j$(nproc --all) CC="ccache clang" O=out ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" CROSS_COMPILE_ARM32="arm-linux-gnueabi-"
fi
- name: 准备打包内核
run: |
cd $GITHUB_WORKSPACE/kernel_workspace
git clone https://github.com/osm0sis/AnyKernel3
sed -i 's/do.devicecheck=1/do.devicecheck=0/g' AnyKernel3/anykernel.sh
sed -i 's!block=/dev/block/platform/omap/omap_hsmmc.0/by-name/boot;!block=/dev/block/bootdevice/by-name/boot;!g' AnyKernel3/anykernel.sh
sed -i 's/is_slot_device=1;/is_slot_device=0;/g' AnyKernel3/anykernel.sh
cp android-kernel/out/arch/arm64/boot/Image.gz-dtb AnyKernel3/
rm -rf AnyKernel3/.git* AnyKernel3/README.md
rm -rf AnyKernel3/ramdisk AnyKernel3/modules AnyKernel3/patch
- name: 打包并上传
uses: actions/upload-artifact@v3
with:
name: ${{ env.KERNEL_ZIP_NAME }}
path: kernel_workspace/AnyKernel3/*