编译 ksu docker lxc nethunter 内核 #137
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: 编译 ksu docker lxc nethunter 内核 | |
on: | |
watch: | |
types: [started] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build Kernel by ${{ github.actor }} | |
runs-on: ubuntu-latest | |
if: github.event.repository.owner.id == github.event.sender.id | |
env: | |
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" | |
CCACHE_NOHASHDIR: "true" | |
CCACHE_HARDLINK: "true" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 工作配置 | |
run: | | |
echo "LXC_DOCKER=$(cat config.env | grep -w "LXC_DOCKER" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ENABLE_NETHUNTER=$(cat config.env | grep -w "ENABLE_NETHUNTER" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "METHOD_OK=$(cat config.env | grep -w "METHOD_OK" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ENABLE_KVM=$(cat config.env | grep -w "ENABLE_KVM" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "CONTAINER_PATCH=$(cat config.env | grep -w "CONTAINER_PATCH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "MAKEFILE_PATCH=$(cat config.env | grep -w "MAKEFILE_PATCH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "CUSTOM_SCRIPT=$(cat config.env | grep -w "CUSTOM_SCRIPT" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ANDROID_PARANOID_NETWORK_OFF=$(cat config.env | grep -w "ANDROID_PARANOID_NETWORK_OFF" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "CUT_PYTHON=$(cat config.env | grep -w "CUT_PYTHON" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "KERNEL_SOURCE=$(cat config.env | grep -w "KERNEL_SOURCE" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "KERNEL_SOURCE_BRANCH=$(cat config.env | grep -w "KERNEL_SOURCE_BRANCH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "KERNEL_CONFIG=$(cat config.env | grep -w "KERNEL_CONFIG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "KERNEL_DEPTH=$(cat config.env | grep -w "KERNEL_DEPTH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "KERNEL_IMAGE_NAME=$(cat config.env | grep -w "KERNEL_IMAGE_NAME" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ARCH=$(cat config.env | grep -w "ARCH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "EXTRA_CMDS=$(cat config.env | grep -w "EXTRA_CMDS" | head -n 1 | cut -d ":" -f 2)" >> $GITHUB_ENV | |
echo "USE_CUSTOM_CLANG=$(cat config.env | grep -w "USE_CUSTOM_CLANG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "CUSTOM_CLANG_SOURCE=$(cat config.env | grep -w "CUSTOM_CLANG_SOURCE" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "CUSTOM_CLANG_BRANCH=$(cat config.env | grep -w "CUSTOM_CLANG_BRANCH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "CUSTOM_CMDS=$(cat config.env | grep -w "CUSTOM_CMDS" | head -n 1 | cut -d ":" -f 2)" >> $GITHUB_ENV | |
echo "EXTRA_CMDT=$(cat config.env | grep -w "EXTRA_CMDT" | head -n 1 | cut -d ":" -f 2)" >> $GITHUB_ENV | |
echo "EXTRA_CMDU=$(cat config.env | grep -w "EXTRA_CMDU" | head -n 1 | cut -d ":" -f 2)" >> $GITHUB_ENV | |
echo "CLANG_BRANCH=$(cat config.env | grep -w "CLANG_BRANCH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "CLANG_VERSION=$(cat config.env | grep -w "CLANG_VERSION" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ENABLE_GCC_ARM64=$(cat config.env | grep -w "ENABLE_GCC_ARM64" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ENABLE_GCC_ARM32=$(cat config.env | grep -w "ENABLE_GCC_ARM32" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ENABLE_KERNELSU=$(cat config.env | grep -w "ENABLE_KERNELSU" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "KERNELSU_TAG=$(cat config.env | grep -w "KERNELSU_TAG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ADD_KPROBES_CONFIG=$(cat config.env | grep -w "ADD_KPROBES_CONFIG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "DISABLE-LTO=$(cat config.env | grep -w "DISABLE-LTO" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ADD_OVERLAYFS_CONFIG=$(cat config.env | grep -w "ADD_OVERLAYFS_CONFIG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "DISABLE_CC_WERROR=$(cat config.env | grep -w "DISABLE_CC_WERROR" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "ENABLE_CCACHE=$(cat config.env | grep -w "ENABLE_CCACHE" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "NEED_DTBO=$(cat config.env | grep -w "NEED_DTBO" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "BUILD_BOOT_IMG=$(cat config.env | grep -w "BUILD_BOOT_IMG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
echo "SOURCE_BOOT_IMAGE=$(cat config.env | grep -w "SOURCE_BOOT_IMAGE" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV | |
- name: 构建编译内核环境 | |
run: | | |
echo "BUILD_TIME=$(TZ=Asia/Shanghai date "+%Y%m%d%H%M")" >> $GITHUB_ENV | |
echo "DEVICE=$(echo ${{ env.KERNEL_CONFIG }} | sed 's!vendor/!!;s/_defconfig//;s/_user//;s/-perf//')" >> $GITHUB_ENV | |
sudo apt-get update | |
sudo apt-get install binutils binutils-aarch64-linux-gnu binutils-arm-linux-gnueabi git ccache automake flex lzop bison gperf build-essential zip curl zlib1g-dev g++-multilib libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven libssl-dev pwgen libswitch-perl policycoreutils minicom libxml-sax-base-perl libxml-simple-perl bc libc6-dev-i386 lib32ncurses5-dev libx11-dev lib32z-dev libgl1-mesa-dev xsltproc unzip device-tree-compiler python2 python3 | |
mkdir -p $GITHUB_WORKSPACE/kernel_workspace | |
git submodule update --init --recursive | |
- name: 切换python2.7 | |
if: env.CUT_PYTHON == 'true' | |
run: | | |
sudo rm /bin/python | |
sudo ln -s /bin/python2.7 /bin/python | |
- name: 下载Clang-aosp编译器 | |
if: env.USE_CUSTOM_CLANG == 'false' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace | |
mkdir clang-aosp | |
wget https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/${{ env.CLANG_BRANCH }}/clang-${{ env.CLANG_VERSION }}.tar.gz | |
tar -C clang-aosp/ -zxvf clang-${{ env.CLANG_VERSION }}.tar.gz | |
- name: 下载Custom-Clang编译器 | |
if: env.USE_CUSTOM_CLANG == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace | |
if [[ ${{ env.CUSTOM_CLANG_SOURCE }} =~ git ]]; then | |
if [[ ${{ env.CUSTOM_CLANG_SOURCE }} == *'.tar.gz' ]]; then | |
wget -O clang.tar.gz ${{ env.CUSTOM_CLANG_SOURCE }} | |
mkdir clang-aosp | |
tar -C clang-aosp/ -zxvf clang.tar.gz | |
else | |
git clone ${{ env.CUSTOM_CLANG_SOURCE }} -b ${{ env.CUSTOM_CLANG_BRANCH }} clang-aosp --depth=1 | |
fi | |
else | |
wget -O clang.zip ${{ env.CUSTOM_CLANG_SOURCE }} | |
mkdir clang-aosp | |
unzip clang.zip -d clang-aosp/ | |
fi | |
- name: 下载Gcc-aosp编译器 | |
if: env.METHOD_OK == 'A' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace | |
if [ ${{ env.METHOD_OK }} = A ]; then | |
mkdir gcc-64 | |
wget -O gcc-aarch64.tar.gz https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/+archive/refs/tags/android-12.1.0_r27.tar.gz | |
tar -C gcc-64/ -zxvf gcc-aarch64.tar.gz | |
echo "GCC_64=CROSS_COMPILE=$GITHUB_WORKSPACE/kernel_workspace/gcc-64/bin/aarch64-linux-android-" >> $GITHUB_ENV | |
fi | |
if [ ${{ env.METHOD_OK }} = A ]; then | |
mkdir gcc-32 | |
wget -O gcc-arm.tar.gz https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/+archive/refs/tags/android-12.1.0_r27.tar.gz | |
tar -C gcc-32/ -zxvf gcc-arm.tar.gz | |
echo "GCC_32=CROSS_COMPILE_ARM32=$GITHUB_WORKSPACE/kernel_workspace/gcc-32/bin/arm-linux-androideabi-" >> $GITHUB_ENV | |
fi | |
- name: 下载mkbootimg解包工具 | |
if: env.BUILD_BOOT_IMG == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace | |
git clone https://android.googlesource.com/platform/system/tools/mkbootimg tools -b master-kernel-build-2022 --depth=1 | |
- name: 下载直链内核镜像 | |
if: env.BUILD_BOOT_IMG == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace | |
wget -O boot-source.img ${{ env.SOURCE_BOOT_IMAGE }} | |
if [ -f boot-source.img ]; then | |
echo "FORMAT_MKBOOTING=$(echo `tools/unpack_bootimg.py --boot_img=boot-source.img --format mkbootimg`)" >> $GITHUB_ENV | |
echo "HAVE_SOURCE_BOOT_IMAGE=true" >> $GITHUB_ENV | |
fi | |
- name: 下载内核源码 | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace | |
if (( ${{ env.KERNEL_DEPTH }} > 0 )) ;then | |
git clone ${{ env.KERNEL_SOURCE }} -b ${{ env.KERNEL_SOURCE_BRANCH }} android-kernel --depth=${{ env.KERNEL_DEPTH }} | |
else | |
git clone ${{ env.KERNEL_SOURCE }} -b ${{ env.KERNEL_SOURCE_BRANCH }} android-kernel | |
fi | |
cd android-kernel | |
git submodule update --init --recursive | |
- name: 开启KVM配置 | |
if: env.ENABLE_KVM == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_VIRTUALIZATION | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_KVM | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_VHOST_NET | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_VHOST_CROSS_ENDIAN_LEGACY | |
- name: 开启lxc和docker配置 | |
if: env.LXC_DOCKER == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
bash $GITHUB_WORKSPACE/scripts/check-kernel-config/LXC-DOCKER-OPEN-CONFIG.sh arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} -w | |
- name: 打入Makefile补丁 | |
if: env.MAKEFILE_PATCH == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
patch -p1 < $GITHUB_WORKSPACE/patches/Makefile.patch | |
- name: 打入Android-Container补丁 | |
if: env.CONTAINER_PATCH == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
CONTAINER_PATCHES=$GITHUB_WORKSPACE/patches/Android-Container | |
if [ -f kernel/cgroup/cgroup.c ]; then | |
patch -p1 < $CONTAINER_PATCHES/cgroup.patch | |
fi | |
# if [ -f kernel/cgroup/cgroup-v1.c ]; then | |
# patch -p1 < $CONTAINER_PATCHES/cgroup-v1.patch | |
# fi | |
# if [ -f kernel/cgroup/cpuset.c ]; then | |
# patch -p1 < $CONTAINER_PATCHES/cpuset.patch | |
# fi | |
if [ -f net/netfilter/xt_qtaguid.c ]; then | |
patch -p1 < $CONTAINER_PATCHES/xt_qtaguid.patch | |
fi | |
- name: 关闭ANDROID_PARANOID_NETWORK配置 | |
if: env.ANDROID_PARANOID_NETWORK_OFF == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
scripts/config --file arch/arm64/configs/${{ env.KERNEL_CONFIG }} --disable ANDROID_PARANOID_NETWORK | |
- name: 运行自定义脚本 | |
if: env.CUSTOM_SCRIPT == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
bash $GITHUB_WORKSPACE/scripts/customize.sh arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} | |
- name: Setup Kali-Nethunter | |
if: env.ENABLE_NETHUNTER == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
nethunter_patches=$GITHUB_WORKSPACE/patches/kali-nethunter-kernel/4.14 | |
# patch -p1 < $nethunter_patches/add-rtl8188eus-to-rtl8xxxu-drivers-4.14.patch | |
patch -p1 < $nethunter_patches/add-rtl8188eus-to-rtl8xxxu-drivers.patch | |
patch -p1 < $nethunter_patches/add-rtl88xxau-5.6.4.2-drivers.patch | |
patch -p1 < $nethunter_patches/add-wifi-injection-4.14.patch | |
patch -p1 < $nethunter_patches/fix-ath9k-naming-conflict.patch | |
patch -p1 < $nethunter_patches/fix-thread_info.h-compile-time-errors.patch | |
bash $GITHUB_WORKSPACE/scripts/check-kernel-config/Kali-defconfig-checker.sh arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} | |
- name: 开启KSU | |
if: env.ENABLE_KERNELSU == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s ${{ env.KERNELSU_TAG }} | |
echo "UPLOADNAME=-KernelSU" >> $GITHUB_ENV | |
- name: 开启KSU补充内核配置 | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
if [ ${{ env.ADD_KPROBES_CONFIG }} = true ]; then | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_MODULES | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_KPROBES | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_HAVE_KPROBES | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_KPROBE_EVENTS | |
fi | |
if [ ${{ env.ADD_OVERLAYFS_CONFIG }} = true ]; then | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_OVERLAY_FS | |
fi | |
if [ ${{ env.DISABLE-LTO }} = true ]; then | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --disable CONFIG_LTO | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --disable CONFIG_LTO_CLANG | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --disable CONFIG_THINLTO | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --enable CONFIG_LTO_NONE | |
fi | |
if [ ${{ env.DISABLE_CC_WERROR }} = true ]; then | |
scripts/config --file arch/${{ env.ARCH }}/configs/${{ env.KERNEL_CONFIG }} --disable CONFIG_CC_WERROR | |
fi | |
- name: 设置ccache缓存 | |
if: env.ENABLE_CCACHE == 'true' | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: build-kernel-${{ env.DEVICE }}${{ env.UPLOADNAME }} | |
max-size: 2G | |
- name: 开始编译内核 | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
export PATH=$GITHUB_WORKSPACE/kernel_workspace/clang-aosp/bin:$PATH | |
export KBUILD_BUILD_HOST=Github-Action | |
export KBUILD_BUILD_USER=$(echo ${{ github.actor }} | tr A-Z a-z) | |
if [ ${{ env.METHOD_OK }} = A ]; then | |
make -j$(nproc --all) CC=clang O=out ARCH=${{ env.ARCH }} ${{ env.CUSTOM_CMDS }} ${{ env.EXTRA_CMDS }} ${{ env.GCC_64 }} ${{ env.GCC_32 }} ${{ env.KERNEL_CONFIG }} | |
if [ ${{ env.ENABLE_CCACHE }} = true ]; then | |
make -j$(nproc --all) CC="ccache clang" O=out ARCH=${{ env.ARCH }} ${{ env.CUSTOM_CMDS }} ${{ env.EXTRA_CMDS }} ${{ env.GCC_64 }} ${{ env.GCC_32 }} | |
else | |
make -j$(nproc --all) CC=clang O=out ARCH=${{ env.ARCH }} ${{ env.CUSTOM_CMDS }} ${{ env.EXTRA_CMDS }} ${{ env.GCC_64 }} ${{ env.GCC_32 }} | |
fi | |
fi | |
if [ ${{ env.METHOD_OK }} = B ]; then | |
make -j$(nproc --all) CC=clang O=out ARCH=${{ env.ARCH }} ${{ env.CUSTOM_CMDS }} ${{ env.EXTRA_CMDS }} CROSS_COMPILE="aarch64-linux-gnu-" CROSS_COMPILE_ARM32="arm-linux-gnueabi-" ${{ env.KERNEL_CONFIG }} | |
if [ ${{ env.ENABLE_CCACHE }} = true ]; then | |
make -j$(nproc --all) CC="ccache clang" O=out ARCH=${{ env.ARCH }} ${{ env.CUSTOM_CMDS }} CROSS_COMPILE="aarch64-linux-gnu-" CROSS_COMPILE_ARM32="arm-linux-gnueabi-" ${{ env.EXTRA_CMDS }} ${{ env.EXTRA_CMDT }} ${{ env.EXTRA_CMDU }} | |
else | |
make -j$(nproc --all) CC=clang O=out ARCH=${{ env.ARCH }} ${{ env.CUSTOM_CMDS }} CROSS_COMPILE="aarch64-linux-gnu-" CROSS_COMPILE_ARM32="arm-linux-gnueabi-" ${{ env.EXTRA_CMDS }} ${{ env.EXTRA_CMDT }} ${{ env.EXTRA_CMDU }} | |
fi | |
fi | |
- name: 检查编译内核生成文件 | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace | |
if [ -f android-kernel/out/arch/${{ env.ARCH }}/boot/${{ env.KERNEL_IMAGE_NAME }} ]; then | |
echo "CHECK_FILE_IS_OK=true" >> $GITHUB_ENV | |
else | |
echo "Kernel output file is empty" | |
exit 1 | |
fi | |
if [ ${{ env.NEED_DTBO }} = true ]; then | |
if [ -f android-kernel/out/arch/${{ env.ARCH }}/boot/dtbo.img ]; then | |
echo "CHECK_DTBO_IS_OK=true" >> $GITHUB_ENV | |
else | |
echo "DTBO image is empty" | |
exit 1 | |
fi | |
fi | |
android-kernel/scripts/extract-ikconfig android-kernel/out/arch/${{ env.ARCH }}/boot/${{ env.KERNEL_IMAGE_NAME }} | tee .config | |
- name: 制作Anykernel3卡刷包 | |
if: env.CHECK_FILE_IS_OK == 'true' | |
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=auto;!g' AnyKernel3/anykernel.sh | |
sed -i 's/is_slot_device=0;/is_slot_device=auto;/g' AnyKernel3/anykernel.sh | |
cp android-kernel/out/arch/${{ env.ARCH }}/boot/${{ env.KERNEL_IMAGE_NAME }} AnyKernel3/ | |
if [ ${{ env.CHECK_DTBO_IS_OK }} = true ]; then | |
cp android-kernel/out/arch/${{ env.ARCH }}/boot/dtbo.img AnyKernel3/ | |
fi | |
rm -rf AnyKernel3/.git* AnyKernel3/README.md | |
cp .config AnyKernel3/ | |
- name: 制作合成新的内核镜像 | |
if: env.HAVE_SOURCE_BOOT_IMAGE == 'true' && env.CHECK_FILE_IS_OK == 'true' | |
run: | | |
cd $GITHUB_WORKSPACE/kernel_workspace | |
tools/unpack_bootimg.py --boot_img boot-source.img | |
cp android-kernel/out/arch/${{ env.ARCH }}/boot/${{ env.KERNEL_IMAGE_NAME }} out/kernel | |
tools/mkbootimg.py ${{ env.FORMAT_MKBOOTING }} -o boot.img | |
if [ -f boot.img ]; then | |
echo "MAKE_BOOT_IMAGE_IS_OK=true" >> $GITHUB_ENV | |
else | |
echo "Boot image is empty" | |
exit 1 | |
fi | |
- name: 上传Upload Image or Image.gz-dtb | |
if: env.CHECK_FILE_IS_OK == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.KERNEL_IMAGE_NAME }}${{ env.UPLOADNAME }}-${{ env.DEVICE }}-${{ env.BUILD_TIME }} | |
path: kernel_workspace/android-kernel/out/arch/${{ env.ARCH }}/boot/${{ env.KERNEL_IMAGE_NAME }} | |
- name: 上传Upload AnyKernel3 | |
if: env.CHECK_FILE_IS_OK == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: AnyKernel3${{ env.UPLOADNAME }}-${{ env.DEVICE }}-${{ env.BUILD_TIME }} | |
path: kernel_workspace/AnyKernel3/* | |
- name: 上传 DTBO image | |
if: env.CHECK_DTBO_IS_OK == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dtbo-${{ env.DEVICE }}-${{ env.BUILD_TIME }} | |
path: kernel_workspace/android-kernel/out/arch/${{ env.ARCH }}/boot/dtbo.img | |
- name: 上传 boot image | |
if: env.MAKE_BOOT_IMAGE_IS_OK == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: boot${{ env.UPLOADNAME }}-${{ env.DEVICE }}-${{ env.BUILD_TIME }} | |
path: kernel_workspace/boot.img |