From 4aebbb6514eec419f03945c8b9415cff0be3bb7c Mon Sep 17 00:00:00 2001 From: jqtmviyu Date: Thu, 17 Oct 2024 15:48:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E5=B0=8F=E7=B1=B36=E7=9A=84a?= =?UTF-8?q?ction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../build-Mandi-Sa-clang-sagit-smb.yml | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 .github/workflows/build-Mandi-Sa-clang-sagit-smb.yml diff --git a/.github/workflows/build-Mandi-Sa-clang-sagit-smb.yml b/.github/workflows/build-Mandi-Sa-clang-sagit-smb.yml new file mode 100644 index 0000000..615fa53 --- /dev/null +++ b/.github/workflows/build-Mandi-Sa-clang-sagit-smb.yml @@ -0,0 +1,145 @@ +name: 低端机 阿菌未霜clang 小米6 +on: + workflow_dispatch: + +jobs: + build: + name: + runs-on: ubuntu-22.04 + if: github.event.repository.owner.id == github.event.sender.id + + steps: + - uses: actions/checkout@v4 + + - 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 + echo 'KERNEL_ZIP_NAME=sagit-lxc-ksu' >> $GITHUB_ENV + cat config.env | grep ENABLE_KVM= >> $GITHUB_ENV + cat config.env | grep ENABLE_LXC_DOCKER= >> $GITHUB_ENV + cat config.env | grep KERNEL_IMAGE_NAME= >> $GITHUB_ENV + cat config.env | grep LLVM_CONFIG= >> $GITHUB_ENV + cat config.env | grep SWITCH_PYTHON= >> $GITHUB_ENV + cat config.env | grep NEED_DTBO= >> $GITHUB_ENV + cat config.env | grep ENABLE_KERNELSU= >> $GITHUB_ENV + cat config.env | grep KERNELSU_TAG= >> $GITHUB_ENV + + - name: 构建编译内核环境 + run: | + sudo apt-get update + sudo -E apt-get -y -qq install git make bc bison ccache openssl zip kmod cpio flex libelf-dev curl libssl-dev libtfm-dev axel device-tree-compiler ca-certificates python3 binutils binutils-aarch64-linux-gnu binutils-arm-linux-gnueabi + mkdir -p $GITHUB_WORKSPACE/kernel_workspace + + - name: 下载 阿菌未霜 clang 编译器 + run: | + cd $GITHUB_WORKSPACE/kernel_workspace + mkdir clang-mandi-sa + git clone https://codeberg.org/Mandi-Sa/clang --depth=1 -b amd64-kernel-arm clang-mandi-sa + + + - name: 下载内核源码 + run: | + cd $GITHUB_WORKSPACE/kernel_workspace + git clone --recurse-submodules ${{ env.KERNEL_SOURCE }} -b ${{ env.KERNEL_SOURCE_BRANCH }} android-kernel --depth=1 + + + - name: 开启lxc和docker配置 + if: env.ENABLE_LXC_DOCKER == 'true' + run: | + cd $GITHUB_WORKSPACE/kernel_workspace + + # $GITHUB_WORKSPACE/patches/LXC-DOCKER-OPEN-CONFIG.sh android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} -w + + cat $GITHUB_WORKSPACE/patches/lxc-docker-config.conf >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + echo "# CONFIG_ANDROID_PARANOID_NETWORK is not set" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + + - name: 添加runc补丁 + run: | + cd $GITHUB_WORKSPACE/kernel_workspace + chmod 777 $GITHUB_WORKSPACE/patches/runcpatch.sh + if [ -f android-kernel/kernel/cgroup.c ]; then + $GITHUB_WORKSPACE/patches/runcpatch.sh android-kernel/kernel/cgroup.c + fi + if [ -f android-kernel/kernel/cgroup/cgroup.c ]; then + $GITHUB_WORKSPACE/patches/runcpatch.sh android-kernel/kernel/cgroup/cgroup.c + fi + + - name: 添加xt_qtaguid补丁 + run: | + cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel + if [ -f net/netfilter/xt_qtaguid.c ]; then + patch -p1 < $GITHUB_WORKSPACE/patches/xt_qtaguid.patch + fi + + - name: 修复clang18部分 + run: | + cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel + sed -i "s/CONFIG_CC_STACKPROTECTOR_STRONG=y/# CONFIG_CC_STACKPROTECTOR_STRONG is not set/g" arch/arm64/configs/${{ env.KERNEL_CONFIG }} + chmod 777 $GITHUB_WORKSPACE/patches/clangfix2.sh + cp $GITHUB_WORKSPACE/patches/clangfix2.sh ./ + ./clangfix2.sh + + - name: 配置 ksu + if: env.ENABLE_KERNELSU == 'true' + run: | + cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel + curl -LSs "https://raw.githubusercontent.com/jqtmviyu/KernelSU/095/kernel/setup.sh" | bash -s ${{ env.KERNELSU_TAG }} + + - name: 开启kvm + if: env.ENABLE_KVM == 'true' + run: | + cd $GITHUB_WORKSPACE/kernel_workspace + echo "CONFIG_VIRTUALIZATION=y" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + echo "CONFIG_KVM=y" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + echo "CONFIG_VHOST_NET=y" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + echo "CONFIG_VHOST_CROSS_ENDIAN_LEGACY=y" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + + - name: 设置ccache缓存 + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: build-kernel-mido-kernel + max-size: 2G + + - name: 小米6额外配置config + run: | + cd $GITHUB_WORKSPACE/kernel_workspace + # echo "# CONFIG_SECURITY_APPARMOR is not set" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + # echo "# CONFIG_SDCARD_FS is not set" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + echo "CONFIG_CIFS=y" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + echo "CONFIG_CIFS_WEAK_PW_HASH=y" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + echo "CONFIG_CIFS_SMB2=y" >> android-kernel/arch/arm64/configs/${{ env.KERNEL_CONFIG }} + + - name: 开始编译内核 + run: | + cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel + export PATH=$GITHUB_WORKSPACE/kernel_workspace/clang-mandi-sa/bin:$PATH + export KBUILD_BUILD_HOST=17 + export KBUILD_BUILD_USER=HyperPower + make -s -j$(nproc --all) O=out ARCH=arm64 ${{ env.KERNEL_CONFIG }} + if [ ${{env.LLVM_CONFIG}}=y ]; then + make -j$(nproc --all) CC="ccache clang" CXX=clang++ O=out ARCH=arm64 CLANG_TRIPLE="aarch64-linux-gnu-" CROSS_COMPILE="aarch64-linux-gnu-" CROSS_COMPILE_ARM32="arm-linux-gnueabi-" LLVM=1 LLVM_IAS=1 + else + make -j$(nproc --all) CC="ccache clang" CXX=clang++ O=out ARCH=arm64 CLANG_TRIPLE="aarch64-linux-gnu-" 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 + cd AnyKernel3 + git checkout 458caeda335554c58930bf6dbfa23e829911e338 + cd ../ + 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/${{ env.KERNEL_IMAGE_NAME }} 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/*