├── .Scripts └── CleanUp.sh ├── .assets ├── FAQ │ └── workflow permissions.png ├── artifacts.png ├── logo.png ├── logo.svg └── logo_background.png ├── .github └── workflows │ ├── del.yml │ ├── kernel.yml │ ├── kernel.yml.bak │ └── twrp.yml ├── .gitignore ├── Guidance └── zh_CN │ ├── How to build kernel.md │ ├── How to build kernel.pdf │ └── How to build kernel.pptx ├── Kernel ├── .gitignore ├── LXC │ ├── LXC_defconfig │ ├── Patches │ │ ├── cgroup.patch │ │ └── xt_qtaguid.patch │ └── README.md ├── README.md ├── README.zh_CN.md └── configs │ ├── README.md │ ├── README.zh_CN.md │ ├── larus.config.json.11 │ ├── markw.config.json.11 │ ├── test │ ├── D8G.config.json │ └── test.repos.json │ ├── thyme.config.json.11 │ ├── wayne.config.json.11 │ ├── xiaomi9.config.json │ └── xiaomi9.config.json.bak ├── LICENSE ├── README.md ├── README.zh_CN.md ├── System ├── .gitignore ├── Patches │ ├── LineageOS │ │ ├── custom_recovery │ │ │ ├── android_build │ │ │ │ └── 0001-Recovery-Inject-custom-TWRP-during-packaging-process.patch │ │ │ └── android_build_soong │ │ │ │ └── 0001-Env-allow-use-custom-TWRP.patch │ │ ├── manifests │ │ │ └── 0001-Devices-add-thyme-s-device-tree-in-easterNday.xml.patch │ │ └── mask │ │ │ └── android_frameworks_base │ │ │ └── 0001-Photos-Unlimited-storage-achieved.patch │ └── apply.py ├── README.md ├── README.zh_CN.md └── build.sh └── TWRP ├── README.md └── configs └── thyme.config.json /.Scripts/CleanUp.sh: -------------------------------------------------------------------------------- 1 | # Delete all tags & releases 2 | gh release list | awk -F '\\t' '{print $3}' | while read -r line; do gh release delete -y "$line" --cleanup-tag; done -------------------------------------------------------------------------------- /.assets/FAQ/workflow permissions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DogDayAndroid/Android-Builder/8c3c69ce1b2974c7351b2b48f249d2b700f91a8d/.assets/FAQ/workflow permissions.png -------------------------------------------------------------------------------- /.assets/artifacts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DogDayAndroid/Android-Builder/8c3c69ce1b2974c7351b2b48f249d2b700f91a8d/.assets/artifacts.png -------------------------------------------------------------------------------- /.assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DogDayAndroid/Android-Builder/8c3c69ce1b2974c7351b2b48f249d2b700f91a8d/.assets/logo.png -------------------------------------------------------------------------------- /.assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 74 | 87 | 123 | 135 | 147 | 172 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 238 | 250 | 272 | 294 | 306 | 344 | 364 | 385 | 398 | 399 | -------------------------------------------------------------------------------- /.assets/logo_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DogDayAndroid/Android-Builder/8c3c69ce1b2974c7351b2b48f249d2b700f91a8d/.assets/logo_background.png -------------------------------------------------------------------------------- /.github/workflows/del.yml: -------------------------------------------------------------------------------- 1 | name: Delete old workflow runs 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | days: 6 | description: "Number of days." 7 | required: true 8 | default: "30" 9 | minimum_runs: 10 | description: "The minimum runs to keep for each workflow." 11 | required: true 12 | default: "6" 13 | delete_workflow_pattern: 14 | description: "The name or filename of the workflow. if not set then it will target all workflows." 15 | required: false 16 | delete_workflow_by_state_pattern: 17 | description: "Remove workflow by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually" 18 | required: true 19 | default: "All" 20 | type: choice 21 | options: 22 | - "All" 23 | - active 24 | - deleted 25 | - disabled_inactivity 26 | - disabled_manually 27 | delete_run_by_conclusion_pattern: 28 | description: "Remove workflow by conclusion: action_required, cancelled, failure, skipped, success" 29 | required: true 30 | default: "All" 31 | type: choice 32 | options: 33 | - "All" 34 | - action_required 35 | - cancelled 36 | - failure 37 | - skipped 38 | - success 39 | dry_run: 40 | description: "Only log actions, do not perform any delete operations." 41 | required: false 42 | schedule: 43 | - cron: '14 13 1 * *' 44 | 45 | jobs: 46 | del_runs: 47 | runs-on: ubuntu-latest 48 | permissions: 49 | actions: write 50 | steps: 51 | - name: Delete workflow runs 52 | uses: Mattraks/delete-workflow-runs@v2 53 | with: 54 | token: ${{ github.token }} 55 | repository: ${{ github.repository }} 56 | retain_days: ${{ github.event.inputs.days }} 57 | keep_minimum_runs: ${{ github.event.inputs.minimum_runs }} 58 | delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }} 59 | delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }} 60 | delete_run_by_conclusion_pattern: ${{ github.event.inputs.delete_run_by_conclusion_pattern }} 61 | dry_run: ${{ github.event.inputs.dry_run }} 62 | -------------------------------------------------------------------------------- /.github/workflows/kernel.yml: -------------------------------------------------------------------------------- 1 | name: Build kernels 2 | 3 | on: 4 | push: 5 | paths: 6 | - ".github/workflows/kernel.yml" 7 | workflow_dispatch: 8 | schedule: 9 | - cron: "14 13 * * 5" 10 | 11 | jobs: 12 | Read-configuration: 13 | name: 🐂 Parse *.config.json 14 | runs-on: ubuntu-latest 15 | outputs: 16 | CONFIGS: ${{ steps.generate-matrix.outputs.CONFIGS }} 17 | BUILD_DATE: ${{ steps.generate-builddate.outputs.BUILDDATE }} 18 | steps: 19 | # This action checks-out your CONFIGSitory under $GITHUB_WORKSPACE, so your workflow can access it. 20 | - name: 😄 Checkout 21 | uses: actions/checkout@v4 22 | 23 | # Match the configuration files in the CONFIGS directory, read the contents and merge them into an array. 24 | - name: 😆 Generate Matrix 25 | id: generate-matrix 26 | run: | 27 | echo "CONFIGS<> $GITHUB_OUTPUT 28 | jq -s '[.[][]]' Kernel/configs/*.config.json >> $GITHUB_OUTPUT 29 | echo "EOF" >> $GITHUB_OUTPUT 30 | 31 | # Set compile time. 32 | - name: ⏰ Set builddate 33 | id: generate-builddate 34 | run: echo "BUILDDATE=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT 35 | 36 | Build-Kernel: 37 | name: "🐎 Build kernel" 38 | runs-on: ubuntu-latest 39 | needs: 40 | - Read-configuration 41 | strategy: 42 | max-parallel: 4 43 | fail-fast: false 44 | matrix: 45 | CONFIG: ${{ fromJSON(needs.Read-configuration.outputs.CONFIGS) }} 46 | env: 47 | # Basic configuration 48 | WORKSPACE: ${{ github.workspace }} 49 | BUILD_DATE: "${{ needs.Read-configuration.outputs.BUILD_DATE }}" 50 | 51 | # Kernel source configuration 52 | KERNEL_NAME: ${{ matrix.CONFIG.kernelSource.name }} 53 | KERNEL_REPO: ${{ matrix.CONFIG.kernelSource.repo }} 54 | KERNEL_BRANCH: ${{ matrix.CONFIG.kernelSource.branch }} 55 | KERNEL_DEVICE: ${{ matrix.CONFIG.kernelSource.device }} 56 | KERNEL_DEFCONFIG_PATH: ${{ matrix.CONFIG.kernelSource.defconfig }} 57 | 58 | # Whether to use ccache to speed up compilation 59 | ENABLE_CCACHE: ${{ matrix.CONFIG.enableCcache }} 60 | 61 | # Whether to use ANYKERNEL3 packaged flash package 62 | USE_ANYKERNEL3: ${{ matrix.CONFIG.AnyKernel3.use }} 63 | 64 | # Whether to publish 65 | CONFIRM_RELEASE: ${{ matrix.CONFIG.AnyKernel3.release }} 66 | 67 | # Whether to enable KernelSU 68 | ENABLE_KERNELSU: ${{ matrix.CONFIG.enableKernelSU }} 69 | 70 | # Whether to enable LXC docker 71 | ENABLE_LXC: ${{ matrix.CONFIG.enableLXC }} 72 | 73 | # Set output & ccache directory 74 | OUT_DIR: "${{ github.workspace }}/out" 75 | CCACHE_DIR: "${{ github.workspace }}/ccache" 76 | steps: 77 | # Set swap space 78 | - name: 📐 Set swap to 10G 79 | uses: pierotofy/set-swap-space@master 80 | with: 81 | swap-size-gb: 10 82 | 83 | # This action checks-out your CONFIGSitory under $GITHUB_WORKSPACE, so your workflow can access it. 84 | - name: 😄 Checkout 85 | uses: actions/checkout@v4 86 | 87 | # Install prerequisites for Ubuntu 88 | - name: ⭐ Install prerequisites 89 | run: | 90 | sudo apt-get update 91 | sudo apt-get install -y curl git ftp lftp wget libarchive-tools ccache python2 python2-dev python3 92 | sudo apt-get install -y pngcrush schedtool dpkg-dev liblz4-tool make optipng maven device-tree-compiler 93 | sudo apt-get install -y libc6-dev-i386 lib32ncurses5-dev libx11-dev lib32z-dev libgl1-mesa-dev xsltproc 94 | sudo apt-get install -y libxml2-utils libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools lzop flex tree 95 | sudo apt-get install -y build-essential bc gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi libssl-dev libfl-dev 96 | sudo apt-get install -y pwgen libswitch-perl policycoreutils minicom libxml-sax-base-perl libxml-simple-perl 97 | sudo apt-get install -y zip unzip tar gzip bzip2 rar unrar llvm g++-multilib bison gperf zlib1g-dev automake 98 | 99 | # Initialize ccache 100 | - name: 🚄 Setup ccache 101 | if: ${{ env.ENABLE_CCACHE == 'true' }} 102 | id: hash 103 | run: | 104 | # Create output directory 105 | mkdir -p ${{ env.OUT_DIR }} 106 | 107 | # Initialize ccache 108 | ccache -o compression=false -o cache_dir=${{ env.CCACHE_DIR }} 109 | 110 | # Generate configuration's hash 111 | echo $(echo -n '${{ toJSON(matrix.config) }}' | openssl dgst -sha1 | awk '{print $2}') 112 | echo "HASH=$(echo -n '${{ toJSON(matrix.config) }}' | openssl dgst -sha1 | awk '{print $2}')" >> $GITHUB_OUTPUT 113 | 114 | - name: 🚅 Cache ccache & output 115 | env: 116 | HASH: ${{ steps.hash.outputs.HASH }} 117 | if: ${{ env.ENABLE_CCACHE == 'true' }} 118 | uses: actions/cache@v3 119 | with: 120 | path: | 121 | ${{ env.OUT_DIR }} 122 | ${{ env.CCACHE_DIR }} 123 | key: cache-${{ env.KERNEL_NAME }}-${{env.HASH}}-${{ env.BUILD_DATE }} 124 | restore-keys: | 125 | cache-${{ env.KERNEL_NAME }}-${{env.HASH}}-${{ env.BUILD_DATE }} 126 | cache-${{ env.KERNEL_NAME }}-${{env.HASH}}- 127 | cache-${{ env.KERNEL_NAME }}- 128 | 129 | - name: 🌟 Clone kernel source => (${{ env.KERNEL_REPO }}) 130 | run: | 131 | git clone --recursive --depth=1 -j $(nproc) --branch ${{ env.KERNEL_BRANCH }} ${{ env.KERNEL_REPO }} ${{ env.KERNEL_NAME }} 132 | # tree ${{ env.KERNEL_NAME }} 133 | 134 | - name: 💫 Get toolchains 135 | env: 136 | toolchains: "${{ toJSON(matrix.CONFIG.toolchains) }}" 137 | run: | 138 | toolchains_num="$(echo $toolchains | jq 'length')" 139 | echo "🤔 There is $toolchains_num defined toolchains." 140 | 141 | for ((i=0;i /dev/null; then 148 | # If from archive 149 | toolchain_url=$(echo $toolchain | jq -r ".url") 150 | mkdir -p '$toolchain_name' 151 | 152 | # Download archive 153 | wget "$toolchain_url" 154 | 155 | # Get filename 156 | filename="${toolchain_url##*/}" 157 | case "$filename" in 158 | *.zip) 159 | unzip -d $toolchain_name "$filename" 160 | ;; 161 | *.tar) 162 | tar xvf "$filename" -C $toolchain_name 163 | ;; 164 | *.tar.gz) 165 | tar zxvf "$filename" -C $toolchain_name 166 | ;; 167 | *.rar) 168 | unrar x "$filename" $toolchain_name 169 | ;; 170 | *) 171 | echo "unknown file type: $filename" 172 | ;; 173 | esac 174 | # Delete file to avoid duplicate name conflicts 175 | rm $filename 176 | 177 | echo "🤔 Download $toolchain_name => ($toolchain_url)" 178 | else 179 | # If from git 180 | toolchain_repo=$(echo $toolchain | jq -r ".repo") 181 | toolchain_branch=$(echo $toolchain | jq -r ".branch") 182 | git clone --recursive --depth=1 -j $(nproc) --branch $toolchain_branch $toolchain_repo $toolchain_name 183 | 184 | echo "🤔 Clone $toolchain_name => ($toolchain_repo)" 185 | fi 186 | 187 | jq -r ".binaryEnv[] | tostring" <<< "$toolchain" | while read -r subPath; do 188 | echo "${{ env.WORKSPACE }}/$toolchain_name/$subPath" >> $GITHUB_PATH 189 | done 190 | done 191 | 192 | - name: 😎 Set build args 193 | id: generate-args 194 | env: 195 | PARAMS: "${{ toJSON(matrix.CONFIG.params) }}" 196 | THREAD: $(nproc --all) 197 | run: | 198 | echo "🤔 PATH Variable: $PATH" 199 | 200 | ARCH=$(echo $PARAMS | jq -r ".ARCH") 201 | CC=$(echo $PARAMS | jq -r ".CC") 202 | 203 | args="-j${{ env.THREAD }} O=${{ env.OUT_DIR }} ARCH=$ARCH" 204 | if [ -n "$CC" ]; then 205 | 206 | if [[ "$CC" == *"/"* ]]; then 207 | CC=${{ env.WORKSPACE }}/$CC 208 | fi 209 | 210 | if [ ${{ env.ENABLE_CCACHE }} = true ]; then 211 | args="$args CC=\"ccache $CC\"" 212 | else 213 | args="$args CC=$CC" 214 | fi 215 | fi 216 | while read -r externalCommand; do 217 | key=$(echo "$externalCommand" | cut -d= -f1) 218 | value=$(echo "$externalCommand" | cut -d= -f2) 219 | if [[ "$value" == *"/"* ]]; then 220 | value="${{ env.WORKSPACE }}/$value" 221 | fi 222 | args="$args $key=$value" 223 | done < <(jq -r '.externalCommands | to_entries[] | "\(.key)=\(.value)"' <<< "$PARAMS") 224 | 225 | echo "ARCH=$ARCH" >> $GITHUB_OUTPUT 226 | echo "ARGS=$args" >> $GITHUB_OUTPUT 227 | 228 | echo "🤔 $args" 229 | 230 | - name: 😋 Setup KernelSU 231 | working-directory: ${{ env.KERNEL_NAME }} 232 | env: 233 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 234 | if: ${{ env.ENABLE_KERNELSU == 'true' }} 235 | run: | 236 | # Delete old KernelSU 237 | if [ -d "./KernelSU" ]; then 238 | rm -rf "./KernelSU" 239 | fi 240 | if [ -d "./drivers/kernelsu" ]; then 241 | rm -rf "./drivers/kernelsu" 242 | fi 243 | 244 | # Apply new KernelSU patches 245 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.9.5 246 | 247 | echo -e "CONFIG_KPROBES=y" >> arch/${{ env.ARCH }}/configs/${{ env.KERNEL_DEFCONFIG_PATH }} 248 | echo -e "CONFIG_HAVE_KPROBES=y" >> arch/${{ env.ARCH }}/configs/${{ env.KERNEL_DEFCONFIG_PATH }} 249 | echo -e "CONFIG_KPROBE_EVENTS=y" >> arch/${{ env.ARCH }}/configs/${{ env.KERNEL_DEFCONFIG_PATH }} 250 | 251 | cat arch/${{ env.ARCH }}/configs/${{ env.KERNEL_DEFCONFIG_PATH }} 252 | 253 | - name: 😋 Setup LXC docker 254 | working-directory: ${{ env.KERNEL_NAME }} 255 | env: 256 | DEFCONFIG: ${{ env.WORKSPACE }}/${{ env.KERNEL_NAME }}/arch/${{ steps.generate-args.outputs.ARCH }}/configs/${{env.KERNEL_DEFCONFIG_PATH}} 257 | ADD_DEFCONFIG: ${{ env.WORKSPACE }}/Kernel/LXC/LXC_defconfig 258 | if: ${{ env.ENABLE_LXC == 'true' }} 259 | run: | 260 | # Add configuration 261 | for config in $(cat ${{ env.ADD_DEFCONFIG }}) 262 | do 263 | echo $config >> ${{ env.DEFCONFIG }} 264 | done 265 | 266 | # Apply patch 267 | if [ -f kernel/cgroup.c ]; then 268 | row=$(sed -n -e '/^static int cgroup_add_file/=' kernel/cgroup.c) 269 | touch /tmp/tmp.txt 270 | sed -n -e '/static int cgroup_add_file/,/return 0/p' kernel/cgroup.c >> /tmp/tmp.txt 271 | row2=$(sed -n -e '/return 0/=' /tmp/tmp.txt) 272 | row3=$(echo `expr $row + $row2 - 1`) 273 | sed -i "$row3 i\ }" kernel/cgroup.c 274 | sed -i "$row3 i\ kernfs_create_link(cgrp->kn, name, kn);" kernel/cgroup.c 275 | sed -i "$row3 i\ snprintf(name, CGROUP_FILE_NAME_MAX, \"%s.%s\", cft->ss->name, cft->name);" kernel/cgroup.c 276 | sed -i "$row3 i\ if (cft->ss && (cgrp->root->flags & CGRP_ROOT_NOPREFIX) && !(cft->flags & CFTYPE_NO_PREFIX)) {" kernel/cgroup.c 277 | echo "🎖️ Modify kernel/cgroup.c" 278 | fi 279 | if [ -f kernel/cgroup/cgroup.c ]; then 280 | row=$(sed -n -e '/^static int cgroup_add_file/=' kernel/cgroup/cgroup.c) 281 | touch /tmp/tmp.txt 282 | sed -n -e '/static int cgroup_add_file/,/return 0/p' kernel/cgroup/cgroup.c >> /tmp/tmp.txt 283 | row2=$(sed -n -e '/return 0/=' /tmp/tmp.txt) 284 | row3=$(echo `expr $row + $row2 - 1`) 285 | sed -i "$row3 i\ }" kernel/cgroup/cgroup.c 286 | sed -i "$row3 i\ kernfs_create_link(cgrp->kn, name, kn);" kernel/cgroup/cgroup.c 287 | sed -i "$row3 i\ snprintf(name, CGROUP_FILE_NAME_MAX, \"%s.%s\", cft->ss->name, cft->name);" kernel/cgroup/cgroup.c 288 | sed -i "$row3 i\ if (cft->ss && (cgrp->root->flags & CGRP_ROOT_NOPREFIX) && !(cft->flags & CFTYPE_NO_PREFIX)) {" kernel/cgroup/cgroup.c 289 | echo "🎖️ Modify kernel/cgroup/cgroup.c" 290 | fi 291 | if [ -f android-kernel/net/netfilter/xt_qtaguid.c ]; then 292 | git am -s < ${{ env.WORKSPACE }}/LXC/Patches/xt_qtaguid.patch 293 | echo "🎖️ Apply xt_qtaguid.patch" 294 | fi 295 | 296 | - name: 👍 Start building the kernel 297 | working-directory: ${{ env.KERNEL_NAME }} 298 | env: 299 | ARGS: ${{ steps.generate-args.outputs.ARGS }} 300 | run: | 301 | echo "🤔 PATH Variable: $PATH" 302 | export KBUILD_BUILD_HOST=Github-Action 303 | export KBUILD_BUILD_USER=$(echo ${{ github.actor }} | tr A-Z a-z) 304 | make ${{ env.ARGS }} ${{ env.KERNEL_DEFCONFIG_PATH }} 305 | make ${{ env.ARGS }} 306 | # tree ${{ env.OUT_DIR }} 307 | 308 | - name: 💛 Upload Image 309 | uses: actions/upload-artifact@v3 310 | env: 311 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 312 | with: 313 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-Image 314 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image 315 | if-no-files-found: ignore 316 | retention-days: 7 317 | 318 | - name: 💙 Upload Image.gz 319 | uses: actions/upload-artifact@v3 320 | env: 321 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 322 | with: 323 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-Image.gz 324 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz 325 | if-no-files-found: ignore 326 | retention-days: 7 327 | 328 | - name: 💙 Upload Image.gz-dtb 329 | uses: actions/upload-artifact@v3 330 | env: 331 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 332 | with: 333 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-Image.gz-dtb 334 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz-dtb 335 | if-no-files-found: ignore 336 | retention-days: 7 337 | 338 | - name: 💜 Upload dtb 339 | uses: actions/upload-artifact@v3 340 | env: 341 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 342 | with: 343 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-dtb 344 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtb 345 | if-no-files-found: ignore 346 | retention-days: 7 347 | 348 | - name: ❤️ Upload dtbo.img 349 | uses: actions/upload-artifact@v3 350 | env: 351 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 352 | with: 353 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-dtbo.img 354 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo.img 355 | if-no-files-found: ignore 356 | retention-days: 7 357 | 358 | - name: ☢️ Upload output directory 359 | uses: actions/upload-artifact@v3 360 | env: 361 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 362 | with: 363 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-Output 364 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/ 365 | retention-days: 7 366 | 367 | - name: ⏰ Pack Anykernel3 368 | if: ${{ env.USE_ANYKERNEL3 == 'true' }} 369 | env: 370 | PARAMS: "${{ toJSON(matrix.CONFIG.AnyKernel3) }}" 371 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 372 | ANYKERNEL3_FILE: "${{ env.WORKSPACE }}/AnyKernel3-${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}" 373 | run: | 374 | if echo -n '${{ env.PARAMS }}' | jq -e 'has("custom")' > /dev/null; then 375 | CUSTOM_ANYKERNEL3=$(echo -n '${{ env.PARAMS }}' | jq -r ".custom") 376 | ANYKERNEL_REPO=$(echo $CUSTOM_ANYKERNEL3 | jq -r ".repo") 377 | ANYKERNEL_BRANCH=$(echo $CUSTOM_ANYKERNEL3 | jq -r ".branch") 378 | git clone --recursive --depth=1 -j $(nproc) --branch $ANYKERNEL_BRANCH $ANYKERNEL_REPO AnyKernel3 379 | echo "🤔 Use custom AnyKernel3 => ($ANYKERNEL_REPO)" 380 | else 381 | git clone --recursive --depth=1 -j $(nproc) https://github.com/osm0sis/AnyKernel3 AnyKernel3 382 | sed -i 's/do.devicecheck=1/do.devicecheck=0/g' AnyKernel3/anykernel.sh 383 | sed -i 's!BLOCK=/dev/block/platform/omap/omap_hsmmc.0/by-name/boot;!BLOCK=auto;!g' AnyKernel3/anykernel.sh 384 | sed -i 's/is_slot_device=0;/is_slot_device=auto;/g' AnyKernel3/anykernel.sh 385 | echo "🤔 Use origin Anykernel3 => (https://github.com/osm0sis/AnyKernel3)" 386 | fi 387 | 388 | 389 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz-dtb" ]; then 390 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz-dtb ./AnyKernel3/ 391 | else 392 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image" ]; then 393 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image ./AnyKernel3/ 394 | fi 395 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz" ]; then 396 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz ./AnyKernel3/ 397 | fi 398 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo" ]; then 399 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo ./AnyKernel3/ 400 | fi 401 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo.img" ]; then 402 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo.img ./AnyKernel3/ 403 | fi 404 | fi 405 | 406 | cd AnyKernel3/ 407 | zip -q -r "${{ env.ANYKERNEL3_FILE }}.zip" * 408 | 409 | - name: "💾 Upload AnyKernel3 image => (${{ env.BUILD_DATE }})" 410 | env: 411 | ANYKERNEL3_FILE: "AnyKernel3-${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}" 412 | uses: actions/upload-artifact@v3 413 | if: ${{ env.USE_ANYKERNEL3 == 'true' }} 414 | with: 415 | name: "${{ env.ANYKERNEL3_FILE }}" 416 | path: AnyKernel3/* 417 | 418 | - name: 🧧 Create GitHub Release => (${{ env.BUILD_DATE }}) 419 | env: 420 | ANYKERNEL3_FILE: "${{ env.WORKSPACE }}/AnyKernel3-${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}" 421 | continue-on-error: true 422 | uses: softprops/action-gh-release@v1 423 | if: ${{ env.USE_ANYKERNEL3 == 'true' && env.CONFIRM_RELEASE == 'true' }} 424 | with: 425 | tag_name: v${{ env.BUILD_DATE }}.${{ github.run_number }} 426 | files: "${{ env.ANYKERNEL3_FILE }}.zip" 427 | generate_release_notes: true 428 | -------------------------------------------------------------------------------- /.github/workflows/kernel.yml.bak: -------------------------------------------------------------------------------- 1 | name: Build kernels 2 | 3 | on: 4 | push: 5 | paths: 6 | - ".github/workflows/kernel.yml" 7 | workflow_dispatch: 8 | schedule: 9 | - cron: "14 13 * * 5" 10 | 11 | jobs: 12 | Read-configuration: 13 | name: 🐂 Parse *.config.json 14 | runs-on: ubuntu-latest 15 | outputs: 16 | CONFIGS: ${{ steps.generate-matrix.outputs.CONFIGS }} 17 | BUILD_DATE: ${{ steps.generate-builddate.outputs.BUILDDATE }} 18 | steps: 19 | # This action checks-out your CONFIGSitory under $GITHUB_WORKSPACE, so your workflow can access it. 20 | - name: 😄 Checkout 21 | uses: actions/checkout@v4 22 | 23 | # Match the configuration files in the CONFIGS directory, read the contents and merge them into an array. 24 | - name: 😆 Generate Matrix 25 | id: generate-matrix 26 | run: | 27 | echo "CONFIGS<> $GITHUB_OUTPUT 28 | jq -s '[.[][]]' Kernel/configs/*.config.json >> $GITHUB_OUTPUT 29 | echo "EOF" >> $GITHUB_OUTPUT 30 | 31 | # Set compile time. 32 | - name: ⏰ Set builddate 33 | id: generate-builddate 34 | run: echo "BUILDDATE=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT 35 | 36 | Build-Kernel: 37 | name: "🐎 Build kernel" 38 | runs-on: ubuntu-latest 39 | needs: 40 | - Read-configuration 41 | strategy: 42 | max-parallel: 4 43 | fail-fast: false 44 | matrix: 45 | CONFIG: ${{ fromJSON(needs.Read-configuration.outputs.CONFIGS) }} 46 | env: 47 | # Basic configuration 48 | WORKSPACE: ${{ github.workspace }} 49 | BUILD_DATE: "${{ needs.Read-configuration.outputs.BUILD_DATE }}" 50 | 51 | # Kernel source configuration 52 | KERNEL_NAME: ${{ matrix.CONFIG.kernelSource.name }} 53 | KERNEL_REPO: ${{ matrix.CONFIG.kernelSource.repo }} 54 | KERNEL_BRANCH: ${{ matrix.CONFIG.kernelSource.branch }} 55 | KERNEL_DEVICE: ${{ matrix.CONFIG.kernelSource.device }} 56 | KERNEL_DEFCONFIG_PATH: ${{ matrix.CONFIG.kernelSource.defconfig }} 57 | 58 | # Whether to use ccache to speed up compilation 59 | ENABLE_CCACHE: ${{ matrix.CONFIG.enableCcache }} 60 | 61 | # Whether to use ANYKERNEL3 packaged flash package 62 | USE_ANYKERNEL3: ${{ matrix.CONFIG.AnyKernel3.use }} 63 | 64 | # Whether to publish 65 | CONFIRM_RELEASE: ${{ matrix.CONFIG.AnyKernel3.release }} 66 | 67 | # Whether to enable KernelSU 68 | ENABLE_KERNELSU: ${{ matrix.CONFIG.enableKernelSU }} 69 | 70 | # Whether to enable LXC docker 71 | ENABLE_LXC: ${{ matrix.CONFIG.enableLXC }} 72 | 73 | # Set output & ccache directory 74 | OUT_DIR: "${{ github.workspace }}/out" 75 | CCACHE_DIR: "${{ github.workspace }}/ccache" 76 | steps: 77 | # Set swap space 78 | - name: 📐 Set swap to 10G 79 | uses: pierotofy/set-swap-space@master 80 | with: 81 | swap-size-gb: 10 82 | 83 | # This action checks-out your CONFIGSitory under $GITHUB_WORKSPACE, so your workflow can access it. 84 | - name: 😄 Checkout 85 | uses: actions/checkout@v4 86 | 87 | # Install prerequisites for Ubuntu 88 | - name: ⭐ Install prerequisites 89 | run: | 90 | sudo apt-get update 91 | sudo apt-get install -y curl git ftp lftp wget libarchive-tools ccache python2 python2-dev python3 92 | sudo apt-get install -y pngcrush schedtool dpkg-dev liblz4-tool make optipng maven device-tree-compiler 93 | sudo apt-get install -y libc6-dev-i386 lib32ncurses5-dev libx11-dev lib32z-dev libgl1-mesa-dev xsltproc 94 | sudo apt-get install -y libxml2-utils libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools lzop flex tree 95 | sudo apt-get install -y build-essential bc gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi libssl-dev libfl-dev 96 | sudo apt-get install -y pwgen libswitch-perl policycoreutils minicom libxml-sax-base-perl libxml-simple-perl 97 | sudo apt-get install -y zip unzip tar gzip bzip2 rar unrar llvm g++-multilib bison gperf zlib1g-dev automake 98 | 99 | # Initialize ccache 100 | - name: 🚄 Setup ccache 101 | if: ${{ env.ENABLE_CCACHE == 'true' }} 102 | id: hash 103 | run: | 104 | # Create output directory 105 | mkdir -p ${{ env.OUT_DIR }} 106 | 107 | # Initialize ccache 108 | ccache -o compression=false -o cache_dir=${{ env.CCACHE_DIR }} 109 | 110 | # Generate configuration's hash 111 | echo $(echo -n '${{ toJSON(matrix.config) }}' | openssl dgst -sha1 | awk '{print $2}') 112 | echo "HASH=$(echo -n '${{ toJSON(matrix.config) }}' | openssl dgst -sha1 | awk '{print $2}')" >> $GITHUB_OUTPUT 113 | 114 | - name: 🚅 Cache ccache & output 115 | env: 116 | HASH: ${{ steps.hash.outputs.HASH }} 117 | if: ${{ env.ENABLE_CCACHE == 'true' }} 118 | uses: actions/cache@v3 119 | with: 120 | path: | 121 | ${{ env.OUT_DIR }} 122 | ${{ env.CCACHE_DIR }} 123 | key: cache-${{ env.KERNEL_NAME }}-${{env.HASH}}-${{ env.BUILD_DATE }} 124 | restore-keys: | 125 | cache-${{ env.KERNEL_NAME }}-${{env.HASH}}-${{ env.BUILD_DATE }} 126 | cache-${{ env.KERNEL_NAME }}-${{env.HASH}}- 127 | cache-${{ env.KERNEL_NAME }}- 128 | 129 | - name: 🌟 Clone kernel source => (${{ env.KERNEL_REPO }}) 130 | run: | 131 | git clone --recursive --depth=1 -j $(nproc) --branch ${{ env.KERNEL_BRANCH }} ${{ env.KERNEL_REPO }} ${{ env.KERNEL_NAME }} 132 | # tree ${{ env.KERNEL_NAME }} 133 | 134 | - name: 💫 Get toolchains 135 | env: 136 | toolchains: "${{ toJSON(matrix.CONFIG.toolchains) }}" 137 | run: | 138 | toolchains_num="$(echo $toolchains | jq 'length')" 139 | echo "🤔 There is $toolchains_num defined toolchains." 140 | 141 | for ((i=0;i /dev/null; then 148 | # If from archive 149 | toolchain_url=$(echo $toolchain | jq -r ".url") 150 | mkdir -p $toolchain_name 151 | 152 | # Download archive 153 | wget "$toolchain_url" 154 | 155 | # Get filename 156 | filename="${toolchain_url##*/}" 157 | case "$filename" in 158 | *.zip) 159 | unzip -d $toolchain_name "$filename" 160 | ;; 161 | *.tar) 162 | tar xvf "$filename" -C $toolchain_name 163 | ;; 164 | *.tar.gz) 165 | tar zxvf "$filename" -C $toolchain_name 166 | ;; 167 | *.rar) 168 | unrar x "$filename" $toolchain_name 169 | ;; 170 | *) 171 | echo "unknown file type: $filename" 172 | ;; 173 | esac 174 | # Delete file to avoid duplicate name conflicts 175 | rm $filename 176 | 177 | echo "🤔 Download $toolchain_name => ($toolchain_url)" 178 | else 179 | # If from git 180 | toolchain_repo=$(echo $toolchain | jq -r ".repo") 181 | toolchain_branch=$(echo $toolchain | jq -r ".branch") 182 | git clone --recursive --depth=1 -j $(nproc) --branch $toolchain_branch $toolchain_repo $toolchain_name 183 | 184 | echo "🤔 Clone $toolchain_name => ($toolchain_repo)" 185 | fi 186 | 187 | jq -r ".binaryEnv[] | tostring" <<< "$toolchain" | while read -r subPath; do 188 | echo "${{ env.WORKSPACE }}/$toolchain_name/$subPath" >> $GITHUB_PATH 189 | done 190 | done 191 | 192 | - name: 😎 Set build args 193 | id: generate-args 194 | env: 195 | PARAMS: "${{ toJSON(matrix.CONFIG.params) }}" 196 | THREAD: $(nproc --all) 197 | run: | 198 | echo "🤔 PATH Variable: $PATH" 199 | 200 | ARCH=$(echo $PARAMS | jq -r ".ARCH") 201 | CC=$(echo $PARAMS | jq -r ".CC") 202 | 203 | args="-j${{ env.THREAD }} O=${{ env.OUT_DIR }} ARCH=$ARCH" 204 | if [ -n "$CC" ]; then 205 | 206 | if [[ "$CC" == *"/"* ]]; then 207 | CC=${{ env.WORKSPACE }}/$CC 208 | fi 209 | 210 | if [ ${{ env.ENABLE_CCACHE }} = true ]; then 211 | args="$args CC=\"ccache $CC\"" 212 | else 213 | args="$args CC=$CC" 214 | fi 215 | fi 216 | while read -r externalCommand; do 217 | key=$(echo "$externalCommand" | cut -d= -f1) 218 | value=$(echo "$externalCommand" | cut -d= -f2) 219 | if [[ "$value" == *"/"* ]]; then 220 | value="${{ env.WORKSPACE }}/$value" 221 | fi 222 | args="$args $key=$value" 223 | done < <(jq -r '.externalCommands | to_entries[] | "\(.key)=\(.value)"' <<< "$PARAMS") 224 | 225 | echo "ARCH=$ARCH" >> $GITHUB_OUTPUT 226 | echo "ARGS=$args" >> $GITHUB_OUTPUT 227 | 228 | echo "🤔 $args" 229 | 230 | - name: 😋 Setup KernelSU 231 | working-directory: ${{ env.KERNEL_NAME }} 232 | env: 233 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 234 | if: ${{ env.ENABLE_KERNELSU == 'true' }} 235 | run: | 236 | # Delete old KernelSU 237 | if [ -d "./KernelSU" ]; then 238 | rm -rf "./KernelSU" 239 | fi 240 | if [ -d "./drivers/kernelsu" ]; then 241 | rm -rf "./drivers/kernelsu" 242 | fi 243 | 244 | # Apply new KernelSU patches 245 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main 246 | 247 | echo -e "CONFIG_KPROBES=y" >> arch/${{ env.ARCH }}/configs/${{ env.KERNEL_DEFCONFIG_PATH }} 248 | echo -e "CONFIG_HAVE_KPROBES=y" >> arch/${{ env.ARCH }}/configs/${{ env.KERNEL_DEFCONFIG_PATH }} 249 | echo -e "CONFIG_KPROBE_EVENTS=y" >> arch/${{ env.ARCH }}/configs/${{ env.KERNEL_DEFCONFIG_PATH }} 250 | 251 | cat arch/${{ env.ARCH }}/configs/${{ env.KERNEL_DEFCONFIG_PATH }} 252 | 253 | - name: 😋 Setup LXC docker 254 | working-directory: ${{ env.KERNEL_NAME }} 255 | env: 256 | DEFCONFIG: ${{ env.WORKSPACE }}/${{ env.KERNEL_NAME }}/arch/${{ steps.generate-args.outputs.ARCH }}/configs/${{env.KERNEL_DEFCONFIG_PATH}} 257 | ADD_DEFCONFIG: ${{ env.WORKSPACE }}/Kernel/LXC/LXC_defconfig 258 | if: ${{ env.ENABLE_LXC == 'true' }} 259 | run: | 260 | # Add configuration 261 | for config in $(cat ${{ env.ADD_DEFCONFIG }}) 262 | do 263 | echo $config >> ${{ env.DEFCONFIG }} 264 | done 265 | 266 | # Apply patch 267 | if [ -f kernel/cgroup.c ]; then 268 | row=$(sed -n -e '/^static int cgroup_add_file/=' kernel/cgroup.c) 269 | touch /tmp/tmp.txt 270 | sed -n -e '/static int cgroup_add_file/,/return 0/p' kernel/cgroup.c >> /tmp/tmp.txt 271 | row2=$(sed -n -e '/return 0/=' /tmp/tmp.txt) 272 | row3=$(echo `expr $row + $row2 - 1`) 273 | sed -i "$row3 i\ }" kernel/cgroup.c 274 | sed -i "$row3 i\ kernfs_create_link(cgrp->kn, name, kn);" kernel/cgroup.c 275 | sed -i "$row3 i\ snprintf(name, CGROUP_FILE_NAME_MAX, \"%s.%s\", cft->ss->name, cft->name);" kernel/cgroup.c 276 | sed -i "$row3 i\ if (cft->ss && (cgrp->root->flags & CGRP_ROOT_NOPREFIX) && !(cft->flags & CFTYPE_NO_PREFIX)) {" kernel/cgroup.c 277 | echo "🎖️ Modify kernel/cgroup.c" 278 | fi 279 | if [ -f kernel/cgroup/cgroup.c ]; then 280 | row=$(sed -n -e '/^static int cgroup_add_file/=' kernel/cgroup/cgroup.c) 281 | touch /tmp/tmp.txt 282 | sed -n -e '/static int cgroup_add_file/,/return 0/p' kernel/cgroup/cgroup.c >> /tmp/tmp.txt 283 | row2=$(sed -n -e '/return 0/=' /tmp/tmp.txt) 284 | row3=$(echo `expr $row + $row2 - 1`) 285 | sed -i "$row3 i\ }" kernel/cgroup/cgroup.c 286 | sed -i "$row3 i\ kernfs_create_link(cgrp->kn, name, kn);" kernel/cgroup/cgroup.c 287 | sed -i "$row3 i\ snprintf(name, CGROUP_FILE_NAME_MAX, \"%s.%s\", cft->ss->name, cft->name);" kernel/cgroup/cgroup.c 288 | sed -i "$row3 i\ if (cft->ss && (cgrp->root->flags & CGRP_ROOT_NOPREFIX) && !(cft->flags & CFTYPE_NO_PREFIX)) {" kernel/cgroup/cgroup.c 289 | echo "🎖️ Modify kernel/cgroup/cgroup.c" 290 | fi 291 | if [ -f android-kernel/net/netfilter/xt_qtaguid.c ]; then 292 | git am -s < ${{ env.WORKSPACE }}/LXC/Patches/xt_qtaguid.patch 293 | echo "🎖️ Apply xt_qtaguid.patch" 294 | fi 295 | 296 | - name: 👍 Start building the kernel 297 | working-directory: ${{ env.KERNEL_NAME }} 298 | env: 299 | ARGS: ${{ steps.generate-args.outputs.ARGS }} 300 | run: | 301 | echo "🤔 PATH Variable: $PATH" 302 | export KBUILD_BUILD_HOST=Github-Action 303 | export KBUILD_BUILD_USER=$(echo ${{ github.actor }} | tr A-Z a-z) 304 | make ${{ env.ARGS }} ${{ env.KERNEL_DEFCONFIG_PATH }} 305 | make ${{ env.ARGS }} 306 | # tree ${{ env.OUT_DIR }} 307 | 308 | - name: 💛 Upload Image 309 | uses: actions/upload-artifact@v3 310 | env: 311 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 312 | with: 313 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-Image 314 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image 315 | if-no-files-found: ignore 316 | retention-days: 7 317 | 318 | - name: 💙 Upload Image.gz 319 | uses: actions/upload-artifact@v3 320 | env: 321 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 322 | with: 323 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-Image.gz 324 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz 325 | if-no-files-found: ignore 326 | retention-days: 7 327 | 328 | - name: 💙 Upload Image.gz-dtb 329 | uses: actions/upload-artifact@v3 330 | env: 331 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 332 | with: 333 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-Image.gz-dtb 334 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz-dtb 335 | if-no-files-found: ignore 336 | retention-days: 7 337 | 338 | - name: 💜 Upload dtb 339 | uses: actions/upload-artifact@v3 340 | env: 341 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 342 | with: 343 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-dtb 344 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtb 345 | if-no-files-found: ignore 346 | retention-days: 7 347 | 348 | - name: ❤️ Upload dtbo.img 349 | uses: actions/upload-artifact@v3 350 | env: 351 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 352 | with: 353 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-dtbo.img 354 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo.img 355 | if-no-files-found: ignore 356 | retention-days: 7 357 | 358 | - name: ☢️ Upload output directory 359 | uses: actions/upload-artifact@v3 360 | env: 361 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 362 | with: 363 | name: ${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}-Output 364 | path: ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/ 365 | retention-days: 7 366 | 367 | - name: ⏰ Pack Anykernel3 368 | if: ${{ env.USE_ANYKERNEL3 == 'true' }} 369 | env: 370 | PARAMS: "${{ toJSON(matrix.CONFIG.AnyKernel3) }}" 371 | ARCH: ${{ steps.generate-args.outputs.ARCH }} 372 | ANYKERNEL3_FILE: "${{ env.WORKSPACE }}/AnyKernel3-${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}" 373 | run: | 374 | if echo -n '${{ env.PARAMS }}' | jq -e 'has("custom")' > /dev/null; then 375 | CUSTOM_ANYKERNEL3=$(echo -n '${{ env.PARAMS }}' | jq -r ".custom") 376 | ANYKERNEL_REPO=$(echo $CUSTOM_ANYKERNEL3 | jq -r ".repo") 377 | ANYKERNEL_BRANCH=$(echo $CUSTOM_ANYKERNEL3 | jq -r ".branch") 378 | git clone --recursive --depth=1 -j $(nproc) --branch $ANYKERNEL_BRANCH $ANYKERNEL_REPO AnyKernel3 379 | echo "🤔 Use custom AnyKernel3 => ($ANYKERNEL_REPO)" 380 | else 381 | git clone --recursive --depth=1 -j $(nproc) https://github.com/osm0sis/AnyKernel3 AnyKernel3 382 | sed -i 's/do.devicecheck=1/do.devicecheck=0/g' AnyKernel3/anykernel.sh 383 | sed -i 's!BLOCK=/dev/block/platform/omap/omap_hsmmc.0/by-name/boot;!BLOCK=auto;!g' AnyKernel3/anykernel.sh 384 | sed -i 's/is_slot_device=0;/is_slot_device=auto;/g' AnyKernel3/anykernel.sh 385 | echo "🤔 Use origin Anykernel3 => (https://github.com/osm0sis/AnyKernel3)" 386 | fi 387 | 388 | 389 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz-dtb" ]; then 390 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz-dtb ./AnyKernel3/ 391 | else 392 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image" ]; then 393 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image ./AnyKernel3/ 394 | fi 395 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz" ]; then 396 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/Image.gz ./AnyKernel3/ 397 | fi 398 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo" ]; then 399 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo ./AnyKernel3/ 400 | fi 401 | if [ -e "${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo.img" ]; then 402 | cp -f ${{ env.OUT_DIR }}/arch/${{ env.ARCH }}/boot/dtbo.img ./AnyKernel3/ 403 | fi 404 | fi 405 | 406 | cd AnyKernel3/ 407 | zip -q -r "${{ env.ANYKERNEL3_FILE }}.zip" * 408 | 409 | - name: "💾 Upload AnyKernel3 image => (${{ env.BUILD_DATE }})" 410 | env: 411 | ANYKERNEL3_FILE: "AnyKernel3-${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}" 412 | uses: actions/upload-artifact@v3 413 | if: ${{ env.USE_ANYKERNEL3 == 'true' }} 414 | with: 415 | name: "${{ env.ANYKERNEL3_FILE }}" 416 | path: AnyKernel3/* 417 | 418 | - name: 🧧 Create GitHub Release => (${{ env.BUILD_DATE }}) 419 | env: 420 | ANYKERNEL3_FILE: "${{ env.WORKSPACE }}/AnyKernel3-${{ env.KERNEL_NAME }}-${{ env.BUILD_DATE }}" 421 | continue-on-error: true 422 | uses: softprops/action-gh-release@v1 423 | if: ${{ env.USE_ANYKERNEL3 == 'true' && env.CONFIRM_RELEASE == 'true' }} 424 | with: 425 | tag_name: v${{ env.BUILD_DATE }}.${{ github.run_number }} 426 | files: "${{ env.ANYKERNEL3_FILE }}.zip" 427 | generate_release_notes: true 428 | -------------------------------------------------------------------------------- /.github/workflows/twrp.yml: -------------------------------------------------------------------------------- 1 | name: Build TWRPs 2 | 3 | on: 4 | push: 5 | paths: 6 | - ".github/workflows/twrp.yml" 7 | workflow_dispatch: 8 | schedule: 9 | - cron: "14 13 * * 5" 10 | 11 | jobs: 12 | Read-configuration: 13 | name: ®️ Parse *.config.json 14 | runs-on: ubuntu-latest 15 | outputs: 16 | CONFIGS: ${{ steps.generate-matrix.outputs.CONFIGS }} 17 | BUILD_DATE: ${{ steps.generate-builddate.outputs.BUILDDATE }} 18 | steps: 19 | # This action checks-out your CONFIGSitory under $GITHUB_WORKSPACE, so your workflow can access it. 20 | - name: 🔴 Checkout 21 | uses: actions/checkout@v4 22 | 23 | # Match the configuration files in the CONFIGS directory, read the contents and merge them into an array. 24 | - name: 🟠 Generate Matrix 25 | id: generate-matrix 26 | run: | 27 | echo "CONFIGS<> $GITHUB_OUTPUT 28 | jq -s '[.[][]]' TWRP/configs/*.config.json >> $GITHUB_OUTPUT 29 | echo "EOF" >> $GITHUB_OUTPUT 30 | 31 | # Set compile time. 32 | - name: 🟡 Set builddate 33 | id: generate-builddate 34 | run: echo "BUILDDATE=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT 35 | 36 | Build-TWRP: 37 | name: ©️ Build TWRP 38 | runs-on: ubuntu-latest 39 | needs: 40 | - Read-configuration 41 | strategy: 42 | max-parallel: 4 43 | fail-fast: false 44 | matrix: 45 | CONFIG: ${{ fromJSON(needs.Read-configuration.outputs.CONFIGS) }} 46 | env: 47 | # Basic configuration 48 | WORKSPACE: ${{ github.workspace }} 49 | BUILD_DATE: ${{ needs.Read-configuration.outputs.BUILD_DATE }} 50 | 51 | # OrangeFox sync scripts configuration 52 | OF_LOCATION: ${{ github.workspace }}/OrangeFox 53 | OF_SYNC_REPO: ${{ matrix.CONFIG.OrangeFox.Repo }} 54 | OF_SYNC_BRANCH: ${{ matrix.CONFIG.OrangeFox.Branch }} 55 | 56 | # DeviceTree configuration 57 | DEVICE_REPO: ${{ matrix.CONFIG.Device.Repo }} 58 | DEVICE_BRANCH: ${{ matrix.CONFIG.Device.Branch }} 59 | DEVICE_LOCATION: ${{ matrix.CONFIG.Device.Location }} 60 | DEVICE_NAME: ${{ matrix.CONFIG.Device.DeviceName }} 61 | DEVICE_MAKEFILE: ${{ matrix.CONFIG.Device.Makefile }} 62 | DEVICE_BOOT_PARTITION: ${{ matrix.CONFIG.Device.BootPartition }} 63 | 64 | # Set output & ccache directory 65 | OUT_DIR: "${{ github.workspace }}/out" 66 | CCACHE_DIR: "${{ github.workspace }}/ccache" 67 | steps: 68 | # Clean up the workspace and make room for compilation 69 | - name: ♈ Cleanup 70 | uses: easimon/maximize-build-space@master 71 | with: 72 | root-reserve-mb: 512 73 | swap-size-mb: 12288 74 | remove-dotnet: "true" 75 | remove-haskell: "true" 76 | remove-codeql: "true" 77 | remove-docker-images: "true" 78 | 79 | - name: ♉ Prepare the build environment 80 | run: | 81 | cd ~ 82 | sudo apt update -y 83 | sudo apt install git aria2 -y 84 | git clone https://gitlab.com/OrangeFox/misc/scripts 85 | cd scripts 86 | sudo bash setup/android_build_env.sh 87 | sed -i 's/cd -/cd ../g' setup/install_android_sdk.sh 88 | sudo bash setup/install_android_sdk.sh 89 | 90 | - name: ♊ Sync OrangeFox sources and minimal manifest 91 | run: | 92 | git clone ${{ env.OF_SYNC_REPO }} sync 93 | cd sync 94 | ./orangefox_sync.sh --branch ${{ env.OF_SYNC_BRANCH }} --path ${{ env.OF_LOCATION }} 95 | 96 | - name: ♋ Place device trees and kernel 97 | working-directory: ${{ env.OF_LOCATION }} 98 | run: | 99 | git clone --recursive --depth=1 -j $(nproc) --branch ${{ env.DEVICE_BRANCH }} ${{ env.DEVICE_REPO }} ${{ env.DEVICE_LOCATION }} 100 | 101 | - name: ♍ Build it 102 | working-directory: ${{ env.OF_LOCATION }} 103 | continue-on-error: true 104 | run: | 105 | set +e 106 | source build/envsetup.sh 107 | export ALLOW_MISSING_DEPENDENCIES=true 108 | set -e 109 | lunch ${{ env.DEVICE_MAKEFILE }}-eng && mka adbd ${{ env.DEVICE_BOOT_PARTITION }}image 110 | 111 | - name: ♎ Take the OrangeFox build 112 | uses: actions/upload-artifact@v3 113 | with: 114 | name: OrangeFox 115 | if-no-files-found: warn 116 | path: | 117 | ${{ env.OUT_DIR }}/target/product/${{ env.DEVICE_NAME }}/*${{ env.DEVICE_NAME }}.img 118 | ${{ env.OUT_DIR }}/target/product/${{ env.DEVICE_NAME }}/*${{ env.DEVICE_NAME }}.zip 119 | 120 | - name: ♏ Create GitHub Release => (${{ env.BUILD_DATE }}) 121 | continue-on-error: true 122 | uses: softprops/action-gh-release@v1 123 | with: 124 | tag_name: v${{ env.BUILD_DATE }}.${{ github.run_number }} 125 | files: | 126 | ${{ env.OUT_DIR }}/target/product/${{ env.DEVICE_NAME }}/*${{ env.DEVICE_NAME }}.img 127 | ${{ env.OUT_DIR }}/target/product/${{ env.DEVICE_NAME }}/*${{ env.DEVICE_NAME }}.zip 128 | generate_release_notes: true 129 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log -------------------------------------------------------------------------------- /Guidance/zh_CN/How to build kernel.md: -------------------------------------------------------------------------------- 1 | --- 2 | marp: true 3 | size: 16:9 4 | theme: am_red 5 | paginate: true 6 | headingDivider: [2, 3] 7 | footer: \ *easterNday* *Build your own kernel* *2023年11月17日* 8 | --- 9 | 10 | 11 | 12 | 13 | 14 | # 构建属于你自己的内核镜像 15 | 16 | ###### 利用 "Github Actions" 进行内核云编译 17 | 18 | @easterNday 19 | 仓库地址:[https://github.com/DogDayAndroid/Android-Builder](https://github.com/DogDayAndroid/Android-Builde) 20 | 21 | ## 22 | 23 | 24 | 25 | 26 | 27 | 28 | - [什么是内核?](#3) 29 | - [如何获取到设备对应的内核源码?](#5) 30 | - [如何选取编译工具链?](#10) 31 | - [如何编译内核?](#16) 32 | - [如何将内核进行打包?](#23) 33 | - [如何利用 Github Action 完成内核编译?](#27) 34 | - [如何开启 KernelSU 支持?](#45) 35 | - [如何开启 Docker 支持?](#45) 36 | - [本项目参考了哪些项目?](#46) 37 | 38 | ## Android 内核简介 39 | 40 | 41 | 42 | 43 | 44 | ## 内核之于 Android 45 | 46 | > 一个完整的操作系统,包括内核,功能库,用户界面三个主要部分。 47 | 48 | **严格来说,Android 并不是 Linux 的一个发行版,但是 Linux 内核对于 Android 来说必不可少。** 49 | 50 | Android 设备的启动分为三个阶段: 51 | 52 | - **Bootloader:** 设备打开电源后,首先会从处理器的片上 `ROM` 的启动引导代码开始执行,寻找 `Bootloader` 代码,并加载到内存并完成硬件的初始化。 53 | - **Linux Kernel:** 硬件初始化后,`Linux` 内核代码加载到内存,初始化各种软硬件环境,加载驱动程序,挂载根文件系统。 54 | - **Android 系统服务:** 并执行 `init.rc` 通知 `Android` 启动。 55 | 56 | 因此,`Android` 系统实际上是运行在 `Linux Kernel` 之上的一系列系统服务进程。 57 | 58 | ## 内核源码寻找 59 | 60 | 61 | 62 | 63 | 64 | ## 设备代号查询 65 | 66 | 67 | 68 |
69 | 70 | > 编译内核时设备代号通常是必不可少的内容 71 | 72 | 在安卓设备终端(`adb shell`)上执行: 73 | 74 | ```bash 75 | getprop | grep device 76 | ``` 77 | 78 | 在返回的结果中寻找带有 `ro.xx.device` 字样的文本,里面的内容即为你的设备代号,例如: 79 | 80 | ```bash 81 | # 手机代号为 thyme 82 | [ro.product.device]: [thyme] 83 | ``` 84 | 85 |
86 | 87 |
88 | 89 | 例如,我对 **小米 10S** 进行查询: 90 | 91 | ```bash 92 | ❯ adb shell 93 | thyme:/ $ getprop | grep device 94 | [bluetooth.device.class_of_device]: [90,2,12] 95 | [bluetooth.profile.hid.device.enabled]: [true] 96 | [cache_key.bluetooth.bluetooth_device_get_bond_state]: [-1781083723495810673] 97 | [cache_key.system_server.device_policy_manager_caches]: [-1749000785485656421] 98 | [debug.tracing.battery_stats.device_idle]: [0] 99 | [debug.tracing.device_state]: [0:DEFAULT] 100 | [ro.boot.boot_devices]: [soc/1d84000.ufshc] 101 | [ro.boot.bootdevice]: [1d84000.ufshc] 102 | [ro.frp.pst]: [/dev/block/bootdevice/by-name/frp] 103 | [ro.lineage.device]: [thyme] 104 | [ro.opa.eligible_device]: [true] 105 | [ro.product.bootimage.device]: [thyme] 106 | [ro.product.device]: [thyme] 107 | [ro.product.mod_device]: [thyme_global] 108 | [ro.product.odm.device]: [thyme] 109 | [ro.product.product.device]: [thyme] 110 | [ro.product.system.device]: [thyme] 111 | [ro.product.system_ext.device]: [thyme] 112 | [ro.product.vendor.device]: [thyme] 113 | [ro.product.vendor_dlkm.device]: [thyme] 114 | [sys.usb.mtp.device_type]: [3] 115 | ``` 116 | 117 |
118 | 119 | ## 获取设备架构 120 | 121 | > 设备架构在编译过程中也是必须的一环 122 | 123 | 查询设备架构的方法也很简单。 124 | 125 | 在安卓设备终端(`adb shell`)上执行: 126 | 127 | ```bash 128 | uname -m 129 | ``` 130 | 131 | 例如,我对 **小米 10S** 进行查询: 132 | 133 | ``` 134 | thyme:/ $ uname -m 135 | aarch64 136 | ``` 137 | 138 | 其设备架构显示为 `aarch64`,也即是我的设备是 `aarch64` 架构。 139 | 140 | ## 获取设备内核版本 141 | 142 | 在安卓设备终端(`adb shell`)上执行: 143 | 144 | ```bash 145 | uname -r 146 | ``` 147 | 148 | 输出内容的格式为: 149 | 150 | - [版本].[补丁版本].[子版本号]-[内核标识]-[提交记录] 151 | 152 | 例如,我对 **小米 10S** 进行查询: 153 | 154 | ```bash 155 | thyme:/ $ uname -r 156 | 4.19.157-Margatroid-g2b220a0a942c 157 | ``` 158 | 159 | 其对应的内核版本为显示为 `4.19.157` 160 | 161 | ## 内核源码获取 162 | 163 | 164 | 165 |
166 | 167 | 内核源码的一般格式为 `[android_]kernel_设备厂商_cpu/代号`。 168 | 例如,**小米 10S**的代号为 `thyme`, CPU 型号为 `sm8250`,生产厂商为 `xiaomi`,则搜索格式应为下面几种: 169 | 170 | - kernel_xiaomi_thyme 171 | - kernel_xiaomi_sm8250 172 | - android_kernel_xiaomi_thyme 173 | - android_kernel_xiaomi_sm8250 174 | 175 | 用以上关键词在 `Github` 上进行搜索一般都可以找到对应的源码。 176 | 177 |
178 | 179 |
180 | 除此之外,我们还可以通过各手机厂商开源的代码来进行获取。 181 | 182 | | 途径 | 具体介绍 | 183 | | ---------------- | :------------------------------------------------------------------ | 184 | | 小米内核开源 | [小米内核开源](https://github.com/MiCode/Xiaomi_Kernel_OpenSource/) | 185 | | 华为开源代码 | [华为开源代码](https://consumer.huawei.com/en/opensource/) | 186 | | 去手机社区找源码 | [XDA 论坛](https://forum.xda-developers.com/) | 187 | 188 | ~~值得注意的是,通常来说,各手机厂商代码都会经过阉割,并不能开箱即用。~~ 189 | 190 |
191 | 192 | ## 交叉编译器的选择 193 | 194 | 195 | 196 | 197 | 198 | ## 交叉编译的定义 199 | 200 | #### 什么是交叉编译(Cross Compile)? 201 | 202 | - 所谓 **"交叉编译"**,是指编译源代码的开发编译平台和执行源代码编译后程序的目标运行平台是两个不同的平台。 203 | 204 | #### 为什么要使用交叉编译呢? 205 | 206 | - 目标平台上无法实现本地编译(Native Compile),但有能力实现源代码编译的平台 CPU 架构或操作系统与目标平台不同。 207 | 208 | ## 各种 CPU 架构 209 | 210 | 通过之前的内容,我们获取到了我们设备的 CPU 架构,这些架构可以归类为如下几种: 211 | 212 | - **arm:** 32 位的 Arm 架构,包括 `arm`,`arm32`,`armv7` 213 | - **arm64:** 64 位的 Arm 架构,包括 `arm64`,`aarch64` 214 | - **x86:** 32 位的 Intel x86 架构,包括 `x86`,`i386`,`i686` 215 | - **x86_64:** 64 位的 Intel x86 架构,包括 `x86_64`,`amd64` 216 | 217 | 一般来说,我们的手持设备的型号一般为 `arm` 和 `arm64` 中的某一种,当然,也不排除有其他的情况(凤凰 OS 等电脑上使用的 Android 系统是 x86 或 x86_64 架构)。 218 | 219 | ## 交叉编译工具链的三元组格式 220 | 221 | 一般来说,交叉编译连工具的二进制文件命名规则为: `{arch}-{vendor}-{sys}-{abi}` 222 | 223 | 他们分别对应如下内容: 224 | 225 | - **arch:** 对应的设备架构; 226 | - **vendor:** 供应商名称,一般来说会被省略或没有; 227 | - **sys:** 对应的系统,`Android` 编译时一般都为 `linux`; 228 | - **abi:** 两个程序单元之间的二进制接口,`Android` 编译时一般都为 `gnu` 或 `gnueabi` 等。 229 | 230 | 有些编译工具链中会省略 `vendor` 或 `abi` 部分,`Android` 编译时一些常见的命名规则是: 231 | 232 | - aarch64-linux-gnu- 233 | - arm-linux-gnueabi- 234 | - aarch64-linux-android- 235 | - arm-linux-androideabi- 236 | 237 | ## 交叉编译工具链的选取 238 | 239 | > 使用不匹配的编译器,轻则无法开机,重则编译失败。 240 | 241 | 构建安卓内核的工具,只能从安卓源码里面拉取,而且有版本限制,太新不行,太老了也不行。 242 | 243 | 一般来说,2023 年的机型的编译工具链应该都是 `clang` + `gcc` 的形式,但对于一些老机型,可能只支持 `gcc` 编译,下面是一些设备的说明: 244 | 245 | CAF 机型(除谷歌外的高通设备): 246 | 247 | - `3.18`、`4.4`、`4.9` 版本的内核,默认均使用谷歌的 `gcc` 248 | - `4.14` 及以上版本的内核,默认使用 `clang` + `gcc` 249 | 250 | 谷歌机型(Pixel 系列): 251 | 252 | - 从 `Pixel2` 开始使用 `clang` 编译,`Pixel3` 开始使用 `clang` 的 `LTO` 优化 253 | 254 | ## 交叉编译工具链的下载 255 | 256 | 一般来说,我们可以通过第三方系统的仓库(例如:`LineageOS`、`PixelExperience`)或者 `Google` 官方拉取、下载我们需要的交叉编译工具链。 257 | 258 | LineageOS: 259 | 260 | - **Clang:** [LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b](https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b) 261 | - **Gcc for ARM64:** [LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9](https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9) 262 | - **Gcc for ARM:** [LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9](https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9) 263 | 264 | Google: 265 | 266 | - **Clang:** [platform/prebuilts/clang/host/linux-x86](https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86) 267 | - **Gcc for ARM64:** [platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9](https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9) 268 | - **Gcc for ARM:** [platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9](https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9) 269 | 270 | 需要注意,以上只是示例,如果内核编译出现问题,那么可能需要您更换具体的 `clang` 和 `gcc` 版本。 271 | 272 | ## 内核编译 273 | 274 | 275 | 276 | 277 | 278 | ## 环境准备 279 | 280 | 我们假定您本地正在使用 `Ubuntu` 进行内核编译的开发,我们需要安装一些必要的编译工具: 281 | 282 | ```bash 283 | sudo apt update 284 | sudo apt-get install -y bc bison build-essential ccache curl flex g++-multilib gcc-multilib git git-lfs gnupg gperf \ 285 | lib32ncurses5-dev lib32readline-dev lib32z1-dev libelf-dev liblz4-tool libncurses5 libncurses5-dev \ 286 | libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync \ 287 | schedtool squashfs-tools xsltproc zip zlib1g-dev imagemagick 288 | ``` 289 | 290 | 或者您使用 `ArchLinux` 进行开发,您只需要安装: 291 | 292 | ```bash 293 | paru -S aosp-devel linageos-devel 294 | ``` 295 | 296 | ## 内核源码克隆 297 | 298 | 要编译内核,我们首先就需要我们对应设备的内核源码克隆下来,此处以**小米 10S**为例。 299 | 300 | 我选择的仓库是 [https://codeberg.org/DogDayAndroid/android_kernel_xiaomi_thyme](https://codeberg.org/DogDayAndroid/android_kernel_xiaomi_thyme) 301 | 302 | 在终端执行如下指令: 303 | 304 | ```bash 305 | git clone https://codeberg.org/DogDayAndroid/android_kernel_xiaomi_thyme 306 | ``` 307 | 308 | 等待仓库拉取完毕,即可完成内核源码的克隆。 309 | 310 | ## 检查内核源码中设备的 defconfig 311 | 312 | 在**内核源码寻找**部分中,我们已经获取到了设备的**代号**、**架构**,一般来说配置文件会按照这些内容来定义。 313 | 314 | 例如,我的**小米 10S**的代号为**thyme**,架构为**aarch64**,也即是**arm64**,具体架构参考下方: 315 | 316 | - **arm:** 32 位的 Arm 架构,包括 `arm`,`arm32`,`armv7` 317 | - **arm64:** 64 位的 Arm 架构,包括 `arm64`,`aarch64` 318 | 319 | 一般来说, `defconfig` 文件位于如下路径中: 320 | 321 | - `<内核源码文件夹>/arch/<设备架构>/configs/` 322 | - `<内核源码文件夹>/arch/<设备架构>/configs/vendor/` 323 | 324 | 我刚克隆的内核源码中,**thyme**对应的 `defconfig` 文件路径为 `arch/arm64/configs/thyme_defconfig`,请确保您能够找到您的 `defconfig` 文件路径。 325 | 326 | ## 交叉编译工具链的配置 327 | 328 | 329 | 330 | 此处我使用**LineageOS**的交叉编译工具链来进行演示: 331 | 332 | - **Clang:** [LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b](https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b) 333 | - **Gcc for ARM64:** [LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9](https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9) 334 | - **Gcc for ARM:** [LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9](https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9) 335 | 336 | 终端中执行: 337 | 338 | ```bash 339 | git clone https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b clang 340 | git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9 gcc64 341 | git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9 gcc32 342 | ``` 343 | 344 | 随后将编译工具链临时加入我们的环境变量中: 345 | 346 | ``` 347 | export PATH="$PWD/clang/bin:$PWD/gcc64/bin:$PWD/gcc32/bin:$PATH" 348 | ``` 349 | 350 | ## 开始构建内核 351 | 352 | 首先我们需要了解一下我们构建的参数: 353 | 354 | | 参数 | 说明 | 一般参数 | 355 | | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | 356 | | `CC` | 指定使用的编译器,因为 `make` 默认使用 `gcc`,因此实际上只有你在使用 `clang` 进行编译的时候才会使用该参数 | `clang` | 357 | | `CROSS_COMPILE` | 您的主要交叉编译链工具,如果你只使用 `gcc` 进行编译,请指定参数为 `aarch64-linux-android-`,32 位同理 | `aarch64-linux-gnu-` | 358 | | `CLANG_TRIPLE` | 只在使用 `clang` 进行编译的时候才需要使用,用于指定当 `clang` 不生效时候使用的工具链,但在使用上一节我们提到的工具中基本不用设置该参数 | `aarch64-linux-gnu-` | 359 | | `CROSS_COMPILE_ARM32` | 只在编译 32 位内核或者带 vdso 补丁的内核时需要指定该参数 | `arm-linux-gnueabi-` | 360 | | `CROSS_COMPILE_COMPAT` | 类似于参数 `CROSS_COMPILE_ARM32` ,但内核版本为 4.19 及更新版本应使用本参数而非 `CROSS_COMPILE_ARM32` | `arm-linux-gnueabi-` | 361 | 362 | ## 开始构建内核 363 | 364 | 365 | 366 | 下面我给出一个一般的构建脚本: 367 | 368 | ```bash 369 | #!/bin/bash 370 | args="-j$(nproc --all) O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-android- \ 371 | CROSS_COMPILE_ARM32=arm-linux-androideabi- LD=ld.lld AR=llvm-ar NM=llvm-nm OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf \ 372 | OBJSIZE=llvm-size STRIP=llvm-strip LDGOLD=aarch64-linux-gnu-ld.gold LLVM_AR=llvm-ar LLVM_DIS=llvm-dis" 373 | make ${args} 374 | make ${args} 375 | ``` 376 | 377 | 其中 `ARCH=arm64` 是指定架构为 `arm64` 架构,其余参数作用均与上述表格中的内容对应。 378 | 379 | 其中 `` 是我们的 `defconfig` 文件,例如: 380 | 381 | - **小米 10S**对应的 `defconfig` 文件路径为 `arch/arm64/configs/thyme_defconfig`,此处便填写 `thyme_defconfig`; 382 | - 部分项目可能会位于 `arch/arm64/configs/vendor/thyme_defconfig`,此时应该填写 `vendor/thyme_defconfig`。 383 | 384 | 这个构建脚本制定了架构为 `arm64` ,使用 `clang` 进行编译,并且指定了对应的交叉编译工具。 385 | 386 | 值得注意的是,这个脚本并不是通用的,具体的内核需要自己具体的分析和修改。 387 | 388 | ## 内核打包 389 | 390 | 391 | 392 | 393 | 394 | ## 获取内核编译产物 395 | 396 | 通过上节内容,我们可以完成内核编译。这时候我们需要考虑如何将内核进行打包。 397 | 398 | 一般来说,内核编译后的产物位于 `arch/<设备架构>/boot/` 文件夹中。 399 | 400 | - 在编译产物中,可能存在`Image`、`Image.gz`、`Image.gz-dtb`等文件,而我们需要的是那个带 `dtb` 的文件,也就是 `Image.gz-dtb`。不过编译产物也可能是 `Image.lz4-dtb` 抑或 `Image-dtb` 这种,但总之,带上 `dtb` 总没错。 401 | 402 | - 对于一些内核源码,其编译产物可能是 `Image` + `独立的 dtb 文件 / dtbo.img` 的形式,如果是这两个文件也是可以的。 403 | 404 | ## Anykernel3 405 | 406 | `Anykernel` 是一个最初由 `koush` 编写,后被 `osm0sis` 接手并多次迭代的内核刷写工具。 407 | 408 | 其项目地址为: [https://github.com/osm0sis/AnyKernel3](https://github.com/osm0sis/AnyKernel3) 409 | 410 | 我们首先将项目克隆下来并对脚本进行一些修改: 411 | 412 | ```bash 413 | git clone https://github.com/osm0sis/AnyKernel3 AnyKernel3 414 | # 修改脚本 415 | sed -i 's/do.devicecheck=1/do.devicecheck=0/g' AnyKernel3/anykernel.sh 416 | sed -i 's!block=/dev/block/platform/omap/omap_hsmmc.0/by-name/boot;!block=auto;!g' AnyKernel3/anykernel.sh 417 | sed -i 's/is_slot_device=0;/is_slot_device=auto;/g' AnyKernel3/anykernel.sh 418 | ``` 419 | 420 | 请注意,这些修改使得打包后的刷机包可以被任何设备刷入,是存在一定风险的,如果您需要安全的使用该刷机包,请自行查阅 `Anykernel3` 的官方文档。 421 | 422 | ## 刷机包打包及刷入 423 | 424 | 按照**获取内核编译产物**中的指导,我们将 `Image-dtb` 或者 `Image` + `dtb` 或者 `Image` + `dtbo.img` 复制到 `Anykernel3` 的文件夹中,随后利用 `zip` 进行压缩即可完成刷机的打包了。压缩命令如下: 425 | 426 | ```bash 427 | cd AnyKernel3/ 428 | zip -q -r "AnyKnerl3.zip" * 429 | ``` 430 | 431 | 打包完成后,我们就可以进入设备的 `TWRP` 将该压缩包刷入。 432 | 433 | ## 利用 Github Action 云编译内核 434 | 435 | 436 | 437 | 438 | 439 | ## 项目地址 440 | 441 | [https://github.com/DogDayAndroid/Android-Builder](https://github.com/DogDayAndroid/Android-Builder) 442 | 443 | 目前,该项目将支持的内容如下: 444 | 445 | - 利用 `Github Actions` 来进行内核构建 446 | - 克隆本项目到本地后,您可以用脚本自动构建 `LineageOS` 447 | - 利用 `Github Actions` 来进行 `TWRP` 构建 448 | 449 | 每个项目的具体内容会在每个文件夹下单独显示。 您可以进入这些文件夹查看其各自的自述文件以了解如何使用它们。 450 | 451 | #### 许可证 452 | 453 | [![by-nc-sa](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-nc-sa/4.0/)本作品根据 [知识共享署名-非商业性-相同方式共享 4.0 国际许可](http://creativecommons.org/licenses/by-nc-sa/4.0/) 获得许可。 454 | 455 | ## 使用方法 456 | 457 | - 在 GitHub 上 `fork` 本项目 458 | 459 | - 通过 Github 网页或者拉取到本地修改 `config/*.config.json` 文件,并提交修改 460 | 461 | - 查看 Github 网页的 `Action` 页面,找到 `Build kernels` 并 `Run workflow` 462 | 463 | - 等待编译完成,即可进入对应页面下载编译产物 464 | 465 | ## 编译流程 466 | 467 | 468 | 469 | 470 | 471 |
472 | timeline 473 | 内核编译流程 474 | section 读取配置 475 | 克隆仓库 476 | 读取配置文件生成矩阵 477 | 设定编译日期 478 | section 内核编译 479 | Prepare : 📐 增加 swap 分区到 10G : 😄 克隆仓库 480 | : ⭐ 为 Ubuntu 安装必要软件包 : 🚄 ccache 初始化配置 : 🚅 恢复缓存 481 | : 🌟 克隆内核源码 : 💫 获取编译工具链 482 | Basic configuration : 😎 设定编译参数 : 😋 配置 KernelSU : 😋 配置 LXC Docker 483 | : 👍 开始内核编译 484 | section 文件上传、发布 485 | 中间件上传 : 💛 上传 Image : 💙 上传 Image.gz : 💙 上传 Image.gz-dtb 486 | : 💜 上传 dtb : ❤️ 上传 dtbo.img : ☢️ 上传输出文件夹 487 | Anykernel3 打包 : ⏰ 下载 Anykernel3 : ⏰ 打包内核 : 💾 上传刷机包 488 | 发布 489 |
490 | 491 | ## 配置参数解析 492 | 493 | 每个配置模板均由以下几个部分组成: 494 | 495 | | 字段名称 | 描述 | 496 | | -------------- | ---------------------------------------------------------------------------------------------- | 497 | | kernelSource | 内核源代码的相关信息,包括名称、仓库地址、分支和设备类型。 | 498 | | toolchains | 一个数组,包含了需要用到的工具链的相关信息,包括仓库地址、分支和名称。 | 499 | | enableCcache | 一个布尔值,表示是否使用了名为 `ccache` 的编译工具来加速编译。 | 500 | | params | 一个对象,包含了构建参数的相关信息,其中包括了架构类型、交叉编译器、编译器等信息。 | 501 | | AnyKernel3 | 一个对象,包含了构建内核刷机包的相关信息,其中包括了使用的 `AnyKernel3` 仓库地址、分支等信息。 | 502 | | enableKernelSU | 一个布尔值,表示是否使用了名为 `KernelSU` 的内核补丁。 | 503 | | enableLXC | 一个布尔值,表示是否开启 `Docker` 支持。 | 504 | 505 | ## 内核源码配置(kernelSource) 506 | 507 | ```json 508 | "kernelSource": { 509 | "name": "", // 你喜欢的名称,无任何影响,一般设定为 设备名字+编译工具 链版本 510 | "repo": "", // 内核源码的仓库地址 511 | "branch": "", // 对应内核源码仓库的 分支 名称 512 | "device": "", // 对应的设备编号 513 | "defconfig": "" // 对应的 defconfig 文件相对路径 514 | } 515 | ``` 516 | 517 | `name` 部分对于整个编译流程来说是没有影响的,因此理论上你可以随意设定。 518 | 519 | `repo`, `branch` 用于克隆内核源码,我们会默认克隆源码下的所有子模块来保证内核的完整性。 520 | 521 | `defconfig` 中填写的内容是您的 `defconfig` 文件相对于 `arch/arm64/configs` 或 `arch/arm/configs` 文件夹的相对路径,这样做的原因是因为部分 `defconfig` 文件可能会存在于子目录中,`make` 的时候我们需要显示指定他的相对路径。 522 | 523 | ## 内核源码配置(kernelSource) 524 | 525 | 下面是一个基本的例子: 526 | 527 | ```json 528 | "kernelSource": { 529 | "name": "Mi6X", 530 | "repo": "https://github.com/Diva-Room/Miku_kernel_xiaomi_wayne", 531 | "branch": "TDA", 532 | "device": "wayne", 533 | "defconfig": "vendor/wayne_defconfig" 534 | } 535 | ``` 536 | 537 | 这个内核是**小米 6X**的内核源码,网页打开其 `Github` 地址后,我们看到它的主要分支是 `TDA`,同时其 `defconfig` 文件位于 `/arch/arm64/configs/vendor/wayne_defconfig` 内,因此设定 `defconfig` 为 `vendor/wayne_defconfig` 。 538 | 539 | ### 工具链配置(toolchains) 540 | 541 | 交叉编译工具链是我们编译内核时的重要工具,但是编译工具链的下载形式五花八门,可以使用 `git` 拉取下载,也可以通过下载得到,因此对于不同的获取方式,我们分别作了适配: 542 | 543 | - 使用 `Git` 拉取编译工具链 544 | - 使用 `Wget` 下载编译工具链 545 | 546 | ### 工具链配置(toolchains) - 使用 `Git` 拉取编译工具链 547 | 548 | ```json 549 | "toolchains": [ 550 | { 551 | "name": "proton-clang", 552 | "repo": "https://github.com/kdrag0n/proton-clang", 553 | "branch": "master", 554 | "binaryEnv": ["./bin"] 555 | } 556 | ] 557 | ``` 558 | 559 | 这部分的配置其实类似于内核源码的配置,我们同样会使用如下命令来从仓库中拉取源码: 560 | 561 | ```bash 562 | git clone --recursive --depth=1 -j $(nproc) --branch 563 | ``` 564 | 565 | 但是这部分中新增了一个 `binaryEnv`, 这是用于给我们的编译工具链添加全局环境变量设定的,例如此处的 `./bin`,添加内容后,环境变量中会增加编译工具链下的 `bin` 文件夹。 566 | 567 | ### 工具链配置(toolchains) - 使用 `Wget` 下载编译工具链 568 | 569 | 通过这种方式我们可以获取到 `.zip` | `.tar` | `.tar.gz` | `.rar` 格式的编译工具链压缩包。 570 | 571 | ```json 572 | "toolchains": [ 573 | { 574 | "name": "clang", 575 | "url": "https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/master-kernel-build-2022/clang-r450784d.tar.gz", 576 | "binaryEnv": ["./bin"] 577 | }, 578 | { 579 | "name": "gcc", 580 | "url": "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", 581 | "binaryEnv": ["bin"] 582 | } 583 | ] 584 | ``` 585 | 586 | `Action` 会下载并解压他们,同时这部分中也会有 `binaryEnv`, 其作用和上述作用类似,因此不再赘述。 587 | 588 | ### 工具链配置(toolchains) 589 | 590 | 这两种方式并非鱼与熊掌不可得兼的,如果我们既需要 `Git` 拉取又需要 `Wget` 下载的编译工具链,我们也可以像如下配置一样将其混用: 591 | 592 | ```json 593 | "toolchains": [ 594 | { 595 | "name": "clang", 596 | "repo": "https://gitlab.com/ThankYouMario/android_prebuilts_clang-standalone/", 597 | "branch": "11", 598 | "binaryEnv": ["bin"] 599 | }, 600 | { 601 | "name": "gcc", 602 | "url": "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", 603 | "binaryEnv": ["bin"] 604 | } 605 | ] 606 | ``` 607 | 608 | ## 编译参数(params) 609 | 610 | 通常我们在本地进行内核编译的时候,会使用形似如下的编译命令: 611 | 612 | ```sh 613 | make -j$(nproc --all) \ 614 | O=out \ 615 | ARCH=arm64 \ 616 | CC=clang \ 617 | CLANG_TRIPLE=aarch64-linux-gnu- \ 618 | CROSS_COMPILE=aarch64-linux-gnu- \ 619 | CROSS_COMPILE_ARM32=arm-linux-gnueabi- 620 | ``` 621 | 622 | ## 编译参数(params) 623 | 624 | 因此,我们的编译参数配置也以类似的方式来进行配置: 625 | 626 | ```json 627 | "params": { 628 | "ARCH": "arm64", 629 | "CC": "clang", 630 | "externalCommands": { 631 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 632 | "CROSS_COMPILE": "proton-clang/bin/aarch64-linux-gnu-", 633 | "CROSS_COMPILE_ARM32": "proton-clang/bin/arm-linux-gnueabi-" 634 | } 635 | } 636 | ``` 637 | 638 | 其中 `-j` 和 `O=out` 这一部分会由编译脚本自动配置好,因此配置中并不用进行设置。`ARCH` 以及 `CC` 部分对应上面的指令部分,其他的更多参数则对应 `externalCommands` 部分。 639 | 640 | ## 编译参数(params) 641 | 642 | 643 | 644 | ```json 645 | # Template for markw(Xiaomi4) 646 | "params": { 647 | "ARCH": "arm64", 648 | "CC": "clang", 649 | "externalCommands": { 650 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 651 | "CROSS_COMPILE": "aarch64-linux-android-", 652 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 653 | "LD": "ld.lld", 654 | "AR": "llvm-ar", 655 | "NM": "llvm-nm", 656 | "OBJCOPY": "llvm-objcopy", 657 | "OBJDUMP": "llvm-objdump", 658 | "READELF": "llvm-readelf", 659 | "OBJSIZE": "llvm-size", 660 | "STRIP": "llvm-strip", 661 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 662 | "LLVM_AR": "llvm-ar", 663 | "LLVM_DIS": "llvm-dis", 664 | "CONFIG_THINLTO": "" 665 | } 666 | } 667 | ``` 668 | 669 | ## 开启 `ccache` 加速编译 670 | 671 | 内核编译过程中,如果反复的编译会非常耗费我们的时间,`ccache` 使得我们可以可以复用以前编译时的一些中间件的缓存从而加快编译的速度,例如上一小节中的编译命令开启 `ccache` 后应为: 672 | 673 | ```sh 674 | make -j$(nproc --all) \ 675 | O=out \ 676 | ARCH=arm64 \ 677 | CC="ccache clang" \ 678 | CLANG_TRIPLE=aarch64-linux-gnu- \ 679 | CROSS_COMPILE=aarch64-linux-gnu- \ 680 | CROSS_COMPILE_ARM32=arm-linux-gnueabi- 681 | ``` 682 | 683 | ## 开启 `ccache` 加速编译 684 | 685 | 这样我们就引出了一个单独的配置参数 `enableCcache`,我们只需要在配置的时候将 `enableCcache` 设置为 `true` 即可实现同样的命令: 686 | 687 | ```json 688 | "enableCcache": true, 689 | "params": { 690 | "ARCH": "arm64", 691 | "CC": "clang", 692 | "externalCommands": { 693 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 694 | "CROSS_COMPILE": "aarch64-linux-android-", 695 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-" 696 | } 697 | } 698 | ``` 699 | 700 | ## 内核刷机包配置(AnyKernel3) 701 | 702 | 目前本项目仅支持 `AnyKernel3`,其配置如下: 703 | 704 | ```json 705 | "AnyKernel3": { 706 | "use": true, 707 | "release": true, 708 | "custom": { 709 | "repo": "https://github.com/easterNday/AnyKernel3/", 710 | "branch": "thyme" 711 | } 712 | } 713 | ``` 714 | 715 | ## 内核刷机包配置(AnyKernel3) 716 | 717 | 这段配置中,我使用了自定义的 `AnyKernel3` 来进行打包,如果您不想额外的 `fork` 一个仓库来实现的话,可以选择删除 `custom` 字段来使用原版的 `AnyKernel3` 来打包您的内核,删除后的配置如下: 718 | 719 | ```json 720 | "AnyKernel3": { 721 | "use": true, 722 | "release": true 723 | } 724 | ``` 725 | 726 | 配置中的 `use` 表示您是否使用 `AnyKernel3` 来进行打包,`release` 表示您是否将打包后的刷机包发布出来,`release` 当且仅当 `AnyKernel3` 设置为 `true` 的时候才生效,否则默认为 `false`。 727 | 728 | ## 额外的编译参数设定 729 | 730 | #### KernelSU 731 | 732 | 使用 `"enableKernelSU": true,` 来控制是否启用 `KernelSU`,设置为 `false` 则不启用。 733 | 734 | #### LXC Docker 735 | 736 | 使用 `"enableLXC": false` 来控制是否启用 `Docker` 支持,设置为 `true` 则启用。 737 | 738 | ## 教程及参考内容 739 | 740 | 741 | 742 | 743 | 744 | ## 教程 745 | 746 | - [自己编译定制一个牛逼的安卓内核](https://parrotsec-cn.org/t/topic/2168) 747 | - [让 Android 手机更省电流畅,你可以试试「刷内核」](https://sspai.com/post/56296) 748 | - [[内核向] 交叉编译器的选择](https://www.akr-developers.com/d/129) 749 | - [[白话文版] ClangBuiltLinux Clang 的使用](https://www.akr-developers.com/d/121) 750 | - [Neutron-clang 的编译说明](https://github.com/Neutron-Toolchains/clang-build-catalogue#building-linux) 751 | - [[内核向] 论如何优雅的刷入内核](https://www.akr-developers.com/d/125) 752 | 753 | ## 参考 754 | 755 | - [DogDayAndroid/KSU_Thyme_BuildBot](https://github.com/DogDayAndroid/KSU_Thyme_BuildBot/blob/main/build.sh):我自己编译的内核使用的本地编译脚本。 756 | - [UtsavBalar1231/Drone-scripts](https://github.com/UtsavBalar1231/Drone-scripts):一个很多人使用的编译脚本,我的部分代码也是参考自这里。 757 | - [EndCredits/kernel_xiaomi_sm7250](https://github.com/EndCredits/kernel_xiaomi_sm7250/blob/android-4.19-main/build.sh):同样的一个编译脚本,但并未提供编译链,但是其中的脚本流程我也有参考。 758 | - [xiaoleGun/KernelSU_Action](https://github.com/xiaoleGun/KernelSU_Action):`KernelSU` 的编译脚本,同样有参考。 759 | 760 | --- 761 | 762 | 763 | 764 | 765 | ###### ~ 欢迎交流 ~ 766 | -------------------------------------------------------------------------------- /Guidance/zh_CN/How to build kernel.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DogDayAndroid/Android-Builder/8c3c69ce1b2974c7351b2b48f249d2b700f91a8d/Guidance/zh_CN/How to build kernel.pdf -------------------------------------------------------------------------------- /Guidance/zh_CN/How to build kernel.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DogDayAndroid/Android-Builder/8c3c69ce1b2974c7351b2b48f249d2b700f91a8d/Guidance/zh_CN/How to build kernel.pptx -------------------------------------------------------------------------------- /Kernel/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ -------------------------------------------------------------------------------- /Kernel/LXC/LXC_defconfig: -------------------------------------------------------------------------------- 1 | CONFIG_NAMESPACES=y 2 | CONFIG_MULTIUSER=y 3 | CONFIG_NET=y 4 | CONFIG_NET_NS=y 5 | CONFIG_PID_NS=y 6 | CONFIG_POSIX_MQUEUE=y 7 | CONFIG_IPC_NS=y 8 | CONFIG_UTS_NS=y 9 | CONFIG_CGROUPS=y 10 | CONFIG_SCHED_AUTOGROUP=y 11 | CONFIG_CGROUP_CPUACCT=y 12 | CONFIG_CGROUP_DEVICE=y 13 | CONFIG_CGROUP_FREEZER=y 14 | CONFIG_CGROUP_SCHED=y 15 | CONFIG_DEBUG_BLK_CGROUP=y 16 | CONFIG_NETFILTER_XT_MATCH_BPF=y 17 | CONFIG_CPUSETS=y 18 | CONFIG_MEMCG=y 19 | CONFIG_KEYS=y 20 | CONFIG_NETDEVICES=y 21 | CONFIG_NET_CORE=y 22 | CONFIG_VETH=y 23 | CONFIG_IPV6=y 24 | CONFIG_IP6_NF_NAT=y 25 | CONFIG_IP6_NF_TARGET_MASQUERADE=y 26 | CONFIG_BRIDGE=y 27 | CONFIG_NETFILTER=y 28 | CONFIG_INET=y 29 | CONFIG_NETFILTER_ADVANCED=y 30 | CONFIG_BRIDGE_NETFILTER=y 31 | CONFIG_IP_NF_FILTER=y 32 | CONFIG_IP_NF_IPTABLES=y 33 | CONFIG_IP_NF_NAT=y 34 | CONFIG_IP_NF_TARGET_MASQUERADE=y 35 | CONFIG_NETFILTER_XTABLES=y 36 | CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y 37 | CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y 38 | CONFIG_NF_CONNTRACK=y 39 | CONFIG_NETFILTER_XT_MATCH_IPVS=y 40 | CONFIG_IP_VS=y 41 | CONFIG_NETFILTER_XT_MARK=y 42 | CONFIG_NF_NAT=y 43 | CONFIG_POSIX_MQUEUE=y 44 | CONFIG_NF_NAT_IPV6=y 45 | CONFIG_NF_NAT_IPV4=y 46 | CONFIG_NF_CONNTRACK_IPV4=y 47 | CONFIG_NF_CONNTRACK_IPV6=y 48 | CONFIG_NF_NAT_NEEDED=y 49 | CONFIG_BPF=y 50 | CONFIG_CGROUP_BPF=y 51 | CONFIG_BPF_SYSCALL=y 52 | CONFIG_USER_NS=y 53 | CONFIG_SECCOMP=y 54 | CONFIG_SECCOMP_FILTER=y 55 | CONFIG_CGROUP_PIDS=y 56 | CONFIG_CGROUP_DEBUG=y 57 | CONFIG_SWAP=y 58 | CONFIG_MEMCG_SWAP=y 59 | CONFIG_MEMCG_SWAP_ENABLED=y 60 | CONFIG_BLOCK=y 61 | CONFIG_IOSCHED_CFQ=y 62 | CONFIG_BLK_CGROUP=y 63 | CONFIG_CFQ_GROUP_IOSCHED=y 64 | CONFIG_BLK_DEV_THROTTLING=y 65 | CONFIG_PERF_EVENTS=y 66 | CONFIG_CGROUP_PERF=y 67 | CONFIG_HUGETLB_PAGE=y 68 | CONFIG_CGROUP_HUGETLB=y 69 | CONFIG_NET_SCHED=y 70 | CONFIG_NET_CLS_CGROUP=y 71 | CONFIG_CGROUP_NET_PRIO=y 72 | CONFIG_FAIR_GROUP_SCHED=y 73 | CONFIG_!SCHED_WALT=y 74 | CONFIG_RT_GROUP_SCHED=y 75 | CONFIG_IP_NF_TARGET_REDIRECT=y 76 | CONFIG_IP_VS_NFCT=y 77 | CONFIG_IP_VS_PROTO_TCP=y 78 | CONFIG_IP_VS_PROTO_UDP=y 79 | CONFIG_IP_VS_RR=y 80 | CONFIG_SECURITY=y 81 | CONFIG_SECURITY_SELINUX=y 82 | CONFIG_SECURITY_APPARMOR=y 83 | CONFIG_EXT3_FS=y 84 | CONFIG_EXT3_FS_POSIX_ACL=y 85 | CONFIG_EXT3_FS_SECURITY=y 86 | CONFIG_EXT4_FS=y 87 | CONFIG_EXT4_FS_POSIX_ACL=y 88 | CONFIG_EXT4_FS_SECURITY=y 89 | CONFIG_VXLAN=y 90 | CONFIG_BRIDGE=y 91 | CONFIG_BRIDGE_VLAN_FILTERING=y 92 | CONFIG_VLAN_8021Q=y 93 | CONFIG_CRYPTO=y 94 | CONFIG_CRYPTO_AEAD=y 95 | CONFIG_CRYPTO_GCM=y 96 | CONFIG_CRYPTO_SEQIV=y 97 | CONFIG_CRYPTO_GHASH=y 98 | CONFIG_CHECKPOINT_RESTORE=y 99 | CONFIG_XFRM=y 100 | CONFIG_XFRM_USER=y 101 | CONFIG_XFRM_ALGO=y 102 | CONFIG_INET_ESP=y 103 | CONFIG_INET_XFRM_MODE_TRANSPORT=y 104 | CONFIG_IPVLAN=y 105 | CONFIG_MACVLAN=y 106 | CONFIG_NET_L3_MASTER_DEV=y 107 | CONFIG_DUMMY=y 108 | CONFIG_NF_NAT_FTP=y 109 | CONFIG_NF_CONNTRACK_FTP=y 110 | CONFIG_NF_NAT_TFTP=y 111 | CONFIG_NF_CONNTRACK_TFTP=y 112 | CONFIG_AUFS_FS=y 113 | CONFIG_MD=y 114 | CONFIG_BLK_DEV_DM=y 115 | CONFIG_DM_THIN_PROVISIONING=y 116 | CONFIG_OVERLAY_FS=y 117 | CONFIG_PACKET=y 118 | CONFIG_PACKET_DIAG=y 119 | CONFIG_NETLINK_DIAG=y 120 | CONFIG_FHANDLE=y 121 | CONFIG_UNIX=y 122 | CONFIG_UNIX_DIAG=y 123 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=y 124 | CONFIG_CFS_BANDWIDTH=y 125 | 126 | # CONFIG_ANDROID_PARANOID_NETWORK is not set -------------------------------------------------------------------------------- /Kernel/LXC/Patches/cgroup.patch: -------------------------------------------------------------------------------- 1 | --- a/kernel/cgroup/cgroup.c 2 | +++ b/kernel/cgroup/cgroup.c 3 | @@ -3786,6 +3786,10 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp, 4 | cfile->kn = kn; 5 | spin_unlock_irq(&cgroup_file_kn_lock); 6 | } 7 | + if (cft->ss && (cgrp->root->flags & CGRP_ROOT_NOPREFIX) && !(cft->flags & CFTYPE_NO_PREFIX)) { 8 | + snprintf(name, CGROUP_FILE_NAME_MAX, "%s.%s", cft->ss->name, cft->name); 9 | + kernfs_create_link(cgrp->kn, name, kn); 10 | + } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Kernel/LXC/Patches/xt_qtaguid.patch: -------------------------------------------------------------------------------- 1 | --- a/net/netfilter/xt_qtaguid.c 2023-07-02 00:07:55.000000000 +0800 2 | +++ a/net/netfilter/xt_qtaguid.c 2023-07-02 05:20:40.000000000 +0800 3 | @@ -738,7 +738,7 @@ static int iface_stat_fmt_proc_show(stru 4 | { 5 | struct proc_iface_stat_fmt_info *p = m->private; 6 | struct iface_stat *iface_entry; 7 | - struct rtnl_link_stats64 dev_stats, *stats; 8 | + struct rtnl_link_stats64 *stats; 9 | struct rtnl_link_stats64 no_dev_stats = {0}; 10 | 11 | 12 | @@ -747,12 +747,7 @@ static int iface_stat_fmt_proc_show(stru 13 | 14 | iface_entry = list_entry(v, struct iface_stat, list); 15 | 16 | - if (iface_entry->active) { 17 | - stats = dev_get_stats(iface_entry->net_dev, 18 | - &dev_stats); 19 | - } else { 20 | - stats = &no_dev_stats; 21 | - } 22 | + stats = &no_dev_stats; 23 | /* 24 | * If the meaning of the data changes, then update the fmtX 25 | * string. 26 | -------------------------------------------------------------------------------- /Kernel/LXC/README.md: -------------------------------------------------------------------------------- 1 | # LXC Docker 配置 2 | 3 | ## 一、安装Termux 4 | 5 | 首先,你需要下载并安装 [Termux](https://github.com/termux/termux-app/releases)。 6 | 7 | 然后,打开 `Termux`,执行以下命令: 8 | 9 | ```bash 10 | apt update 11 | apt upgrade 12 | ``` 13 | 14 | ## 二、安装必要的依赖 15 | 16 | 在Termux中执行以下命令: 17 | 18 | ```bash 19 | pkg install root-repo 20 | pkg install tsu docker 21 | ``` 22 | 23 | ## 三、启动 `Docker` 24 | 25 | ### 1. 挂载 `cgroup` 26 | 27 | ```bash 28 | sudo mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup 29 | ``` 30 | 31 | ### 2. 启动 `Docker` 守护进程,并让它在后台运行 32 | 33 | 下面的运行策略二选一即可。如果你不清楚其中的具体区别,请选择第一种: 34 | 35 | ```bash 36 | sudo dockerd --iptables=false &>/dev/null & 37 | # or 38 | sudo ip route add default via 192.168.1.1 dev wlan0 39 | sudo ip rule add from all lookup main pref 30000 40 | sudo dockerd &>/dev/null & 41 | ``` 42 | 43 | ### 3. 测试 `Docker` 是否工作 44 | 45 | ```bash 46 | sudo docker run hello-world 47 | ``` 48 | 49 | 看到 `hello world from docker` 字样即表示 `Docker` 正常工作 50 | 51 | ## 常见问题 52 | 53 | ### 1. 容器内无网络 54 | 55 | ```bash 56 | echo "nameserver 8.8.8.8" > /etc/resolv.conf 57 | groupadd -g 3003 aid_inet && usermod -G nogroup -g aid_inet _apt 58 | ``` 59 | 60 | ## Reference 61 | 62 | - [wu17481748/lxc-docker](https://github.com/wu17481748/lxc-docker) 63 | - [Flyme66/LXC-DOCKER-KernelSU_Action](https://github.com/Flyme66/LXC-DOCKER-KernelSU_Action) 64 | - [手机运行Docker: 从修改内核到刷入原生Linux](https://yzddmr6.com/posts/android-run-docker/) 65 | -------------------------------------------------------------------------------- /Kernel/README.md: -------------------------------------------------------------------------------- 1 | # Build Your Own Kernel 2 | 3 | English | [中文文档](./README.zh_CN.md) 4 | 5 | In this part, we will use `Github Action` to perform kernel cloud compilation. The directory structure of this project is as follows: 6 | 7 | ```sh 8 | . 9 | ├── configs 10 | │   ├── markw.config.json 11 | │   ├── thyme.config.json 12 | │   └── wayne.config.json 13 | └── LXC 14 |    ├── LXC_defconfig 15 |    └── Patches 16 |       ├── cgroup.patch 17 |       └── xt_qtaguid.patch 18 | ``` 19 | 20 | The contents and functions of each part are as follows: 21 | 22 | - **configs**: used to store the detailed configuration of all kernels to be compiled (kernel source code address, compilation tool chain, compilation parameters and additional compilation options) 23 | - **LXC**: stores some configuration files and patches required for kernel support `Docker` 24 | - **LXC_defconfig**: Options that need to be enabled for kernel support `Docker` 25 | - **Patches**: Some patches that need to be applied 26 | 27 | ## Development progress 28 | 29 | - [x] `AnyKernel3` original and customized versions supported 30 | - [x] `KernelSU` compilation support 31 | - [x] `Docker` compilation support 32 | - [x] Use repository owner information to compile 33 | - [ ] Use `MagiskBoot` to generate `boot.img` 34 | - [ ] Compile kernel script locally 35 | - [ ] Web page configuration Json compilation configuration file (to be released soon) 36 | - [ ] Cloud compiled kernel web page 37 | 38 | ## Github Action 39 | 40 | ### Introduction to the compilation process 41 | 42 | The `Github Action` file for compiling the kernel is [kernel.yml](../.github/workflows/kernel.yml). This Action contains the following two jobs: 43 | 44 | - `Read-configuration`: used to read the configuration files in the `configs` folder 45 | - `Build-Kernel`: Compile the text kernel according to the read configuration file, and perform functions such as uploading 46 | 47 | ### Compilation process timeline 48 | 49 | ```mermaid 50 | %%{init: { 'logLevel': 'debug', 'theme': 'neutral' } }%% 51 | timeline 52 | How to build a Kernel 53 | section Read configuration 54 | Checkout repository 55 | Generate configuration matrix 56 | Set builddate 57 | section Kernel Build 58 | Prepare : 📐 Set swap to 10G : 😄 Checkout repository 59 | : ⭐ Install prerequisites for Ubuntu : 🚄 Setup ccache : 🚅 Restore cache 60 | : 🌟 Clone kernel source : 💫 Get toolchains 61 | Basic configuration : 😎 Set build args : 😋 Setup KernelSU : 😋 Setup LXC Docker 62 | : 👍 Build kernel 63 | section Post build 64 | Upload Artifact : 💛 Upload Image : 💙 Upload Image.gz : 💙 Upload Image.gz-dtb 65 | : 💜 Upload dtb : ❤️ Upload dtbo.img : ☢️ Upload output directory 66 | Pack Anykernel3 : ⏰ Get Anykernel3 : ⏰ Pack your kernel : 💾 Upload AnyKernel3 package 67 | Release 68 | ``` 69 | 70 | ## Configuration file parsing 71 | 72 | Please see [Compile Configuration](./configs/) for specific configuration methods. 73 | 74 | ## Instructions 75 | 76 | The basic usage of this project is as follows: 77 | 78 | 1. `fork` this project on GitHub 79 | 80 | 2. Modify the `config/*.config.json` file through the Github web page or pull it locally, and submit the changes 81 | 82 | 3. View the `Action` page of the Github page and find `Build kernels` and `Run workflow` 83 | 84 | 4. After the compilation is completed, you can enter the corresponding page to download the compiled product. 85 | 86 | 5. Use your favorite packaging software for kernel packaging ([AnyKernel3](https://github.com/osm0sis/AnyKernel3), [Android-Image-Kitchen](https://github.com/osm0sis/Android-Image-Kitchen), [MagiskBoot](https://github.com/topjohnwu/Magisk/releases), etc. **Currently this project only integrates AnyKernel3**) 87 | 88 | ![Artifacts](https://github.com/DogDayAndroid/Android-Builder/blob/main/.assets/artifacts.png?raw=true) 89 | 90 | ## Local build 91 | 92 | ### 1. Run `Action` locally 93 | 94 | If you don't want to repeatedly execute `Action` on `Github`, you can use [nektos/act](https://github.com/nektos/act) to test this build process and output it in the local environment. 95 | 96 | After installing [nektos/act](https://github.com/nektos/act) and execute the following instructions: 97 | 98 | ```sh 99 | # Collect build files into the /tmp/artifacts folder: 100 | act --artifact-server-path /tmp/artifacts 101 | ``` 102 | 103 | If you need to place it in a local location you like, please change `/tmp/artifacts` to your preferred directory. 104 | 105 | If an error is reported during the process, please add the parameter `-v` and re-execute to obtain the error report and submit an `issue`. The specific command is as follows: 106 | 107 | ```sh 108 | # Collect build files into the /tmp/artifacts folder: 109 | act --artifact-server-path /tmp/artifacts -v 110 | ``` 111 | 112 | ## FAQ 113 | 114 | ### 1. GitHub release failed with status: `403` 115 | 116 | When you use `softprops/action-gh-release@v1` to publish `Release`, you may encounter the following error: 117 | 118 | ```plaintext 119 | 👩‍🏭 Creating new GitHub release for tag v20230619.7... 120 | ⚠️ GitHub release failed with status: 403 121 | undefined 122 | retrying... (2 retries remaining) 123 | 👩‍🏭 Creating new GitHub release for tag v20230619.7... 124 | ⚠️ GitHub release failed with status: 403 125 | undefined 126 | retrying... (1 retries remaining) 127 | 👩‍🏭 Creating new GitHub release for tag v20230619.7... 128 | ⚠️ GitHub release failed with status: 403 129 | undefined 130 | retrying... (0 retries remaining) 131 | ❌ Too many retries. Aborting... 132 | Error: Too many retries. 133 | ``` 134 | 135 | This is caused by your `Workflow` not having **read and write permission**: 136 | 137 | ![workflow permissions](https://github.com/DogDayAndroid/Android-Builder/blob/main/.assets/FAQ/workflow%20permissions.png?raw=true) 138 | 139 | Open the corresponding read and write permissions as shown above, and then re-run `Action` to publish your own `Release` 140 | 141 | # Acknowledgments 142 | 143 | - [weishu](https://github.com/tiann) : Developer of KernelSU 144 | - [AKR Android Developer Community](https://www.akr-developers.com/) : Provides build tutorials 145 | - [DogDayAndroid/KSU_Thyme_BuildBot](https://github.com/DogDayAndroid/KSU_Thyme_BuildBot) : Predecessor of this project 146 | - [xiaoleGun/KernelSU_Action](https://github.com/xiaoleGun/KernelSU_Action) : Drawing on some Github Actions 147 | - [UtsavBalar1231/Drone-scripts](https://github.com/UtsavBalar1231/Drone-scripts) : Drawing on some Github Actions 148 | -------------------------------------------------------------------------------- /Kernel/README.zh_CN.md: -------------------------------------------------------------------------------- 1 | # 构建属于你自己的内核镜像 2 | 3 | [English](./README.md) | 中文文档 4 | 5 | 这部分内容中,我们会利用 `Github Action` 进行内核云编译。本项目的目录结构如下: 6 | 7 | ```sh 8 | . 9 | ├── configs 10 | │   ├── markw.config.json 11 | │   ├── thyme.config.json 12 | │   └── wayne.config.json 13 | └── LXC 14 |    ├── LXC_defconfig 15 |    └── Patches 16 |       ├── cgroup.patch 17 |       └── xt_qtaguid.patch 18 | ``` 19 | 20 | 其中各个部分的内容及作用如下: 21 | 22 | - **configs**: 用于存储所有待编译内核的详细配置(内核源码地址、编译工具链、编译参数以及额外的编译选项) 23 | - **LXC**: 存放了关于内核支持 `Docker` 所需要的部分配置文件及补丁 24 | - **LXC_defconfig**:内核支持 `Docker` 所需要开启的选项 25 | - **Patches**:部分需要应用的补丁 26 | 27 | ## 开发进度 28 | 29 | - [x] `AnyKernel3` 原版及自定义版本支持 30 | - [x] `KernelSU` 编译支持 31 | - [x] `Docker` 编译支持 32 | - [x] 使用仓库所有者信息来编译 33 | - [ ] 使用 `MagiskBoot` 生成 `boot.img` 34 | - [ ] 本地编译内核脚本 35 | - [ ] 网页配置 Json 编译配置文件(即将发布) 36 | - [ ] 云端编译内核网页 37 | 38 | ## Github Action 39 | 40 | ### 编译流程介绍 41 | 42 | 编译内核的 `Github Action` 文件是 [kernel.yml](../.github/workflows/kernel.yml),该 Action 包含如下两个作业: 43 | 44 | - `Read-configuration`:用于读取 `configs` 文件夹内的配置文件 45 | - `Build-Kernel`:根据读取到的配置文件来进行文内核编译,并执行上传等功能 46 | 47 | ### 编译流程时间线 48 | 49 | ```mermaid 50 | %%{init: { 'logLevel': 'debug', 'theme': 'neutral' } }%% 51 | timeline 52 | 内核编译流程 53 | section 读取配置 54 | 克隆仓库 55 | 读取配置文件生成矩阵 56 | 设定编译日期 57 | section 内核编译 58 | Prepare : 📐 增加 swap 分区到 10G : 😄 克隆仓库 59 | : ⭐ 为 Ubuntu 安装必要软件包 : 🚄 ccache 初始化配置 : 🚅 恢复缓存 60 | : 🌟 克隆内核源码 : 💫 获取编译工具链 61 | Basic configuration : 😎 设定编译参数 : 😋 配置 KernelSU : 😋 配置 LXC Docker 62 | : 👍 开始内核编译 63 | section 文件上传、发布 64 | 中间件上传 : 💛 上传 Image : 💙 上传 Image.gz : 💙 上传 Image.gz-dtb 65 | : 💜 上传 dtb : ❤️ 上传 dtbo.img : ☢️ 上传输出文件夹 66 | Anykernel3 打包 : ⏰ 下载 Anykernel3 : ⏰ 打包内核 : 💾 上传刷机包 67 | 发布 68 | ``` 69 | 70 | ## 配置文件解析 71 | 72 | 具体配置方法请查看 [编译配置](./configs/) 。 73 | 74 | ## 使用方法 75 | 76 | 本项目的基础使用方法如下: 77 | 78 | 1. 在 GitHub 上 `fork` 本项目 79 | 80 | 2. 通过 Github 网页或者拉取到本地修改 `config/*.config.json` 文件,并提交修改 81 | 82 | 3. 查看 Github 网页的 `Action` 页面,找到 `Build kernels` 并 `Run workflow` 83 | 84 | 4. 等待编译完成,即可进入对应页面下载编译产物 85 | 86 | 5. 使用您喜欢的打包软件进行内核打包([AnyKernel3](https://github.com/osm0sis/AnyKernel3)、[Android-Image-Kitchen](https://github.com/osm0sis/Android-Image-Kitchen)、[MagiskBoot](https://github.com/topjohnwu/Magisk/releases) 等,**目前本项目仅集成 AnyKernel3**) 87 | 88 | ![Artifacts](https://github.com/DogDayAndroid/Android-Builder/blob/main/.assets/artifacts.png?raw=true) 89 | 90 | ## 本地构建 91 | 92 | ### 1. 本地运行 `Action` 93 | 94 | 如果您并不想在 `Github` 上重复执行 `Action`,您可以利用 [nektos/act](https://github.com/nektos/act) 来在本地环境里测试本构建流程并输出。 95 | 96 | 安装 [nektos/act](https://github.com/nektos/act) 后并执行如下指令: 97 | 98 | ```sh 99 | # 将构建文件收集到 /tmp/artifacts 文件夹: 100 | act --artifact-server-path /tmp/artifacts 101 | ``` 102 | 103 | 如果您需要放在本地你喜欢的位置,请更改 `/tmp/artifacts` 为您喜欢的目录即可。 104 | 105 | 如果中途报错,请加入参数 `-v` 重新执行获取错误报告并提交 `issue` ,具体命令如下: 106 | 107 | ```sh 108 | # 将构建文件收集到 /tmp/artifacts 文件夹: 109 | act --artifact-server-path /tmp/artifacts -v 110 | ``` 111 | 112 | ## 常见问题 113 | 114 | ### 1. GitHub release failed with status: `403` 115 | 116 | 当您使用 `softprops/action-gh-release@v1` 发布 `Release` 时, 您可能会遇到如下报错: 117 | 118 | ```plaintext 119 | 👩‍🏭 Creating new GitHub release for tag v20230619.7... 120 | ⚠️ GitHub release failed with status: 403 121 | undefined 122 | retrying... (2 retries remaining) 123 | 👩‍🏭 Creating new GitHub release for tag v20230619.7... 124 | ⚠️ GitHub release failed with status: 403 125 | undefined 126 | retrying... (1 retries remaining) 127 | 👩‍🏭 Creating new GitHub release for tag v20230619.7... 128 | ⚠️ GitHub release failed with status: 403 129 | undefined 130 | retrying... (0 retries remaining) 131 | ❌ Too many retries. Aborting... 132 | Error: Too many retries. 133 | ``` 134 | 135 | 这是由于您的 `Workflow` 没有**读写权限**导致的: 136 | 137 | ![workflow permissions](https://github.com/DogDayAndroid/Android-Builder/blob/main/.assets/FAQ/workflow%20permissions.png?raw=true) 138 | 139 | 按照上图打开对应读写权限,随后重新运行 `Action` 就可以发布属于你自己的 `Release` 了 140 | 141 | # 致谢 142 | 143 | - [weishu](https://github.com/tiann) : KernelSU 的开发者 144 | - [AKR 安卓开发者社区](https://www.akr-developers.com/) : 编译教程提供 145 | - [DogDayAndroid/KSU_Thyme_BuildBot](https://github.com/DogDayAndroid/KSU_Thyme_BuildBot) : 此项目的前身 146 | - [xiaoleGun/KernelSU_Action](https://github.com/xiaoleGun/KernelSU_Action) : 借鉴部分 Github Action 147 | - [UtsavBalar1231/Drone-scripts](https://github.com/UtsavBalar1231/Drone-scripts) : 借鉴部分 Github Action 148 | -------------------------------------------------------------------------------- /Kernel/configs/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Write kernel compilation configuration file 3 | 4 | English | [中文文档](./README.zh_CN.md) 5 | 6 | ## Basic configuration file case 7 | 8 | Each kernel compilation configuration file is a `Json` file ending with `.config.json`. The file is an array, and each `item` in the array is our kernel compilation configuration. 9 | 10 |
11 | Configuration template 12 | 13 | ```json 14 | [ 15 | { 16 | "kernelSource": { 17 | "name": "", 18 | "repo": "", 19 | "branch": "", 20 | "device": "", 21 | "defconfig": "" 22 | }, 23 | "toolchains": [ 24 | { 25 | "name": "", 26 | "repo": "", 27 | "branch": "", 28 | "binaryEnv": [] 29 | }, 30 | { 31 | "name": "", 32 | "url": "", 33 | "binaryEnv": [] 34 | } 35 | ], 36 | "enableCcache": true, 37 | "params": { 38 | "ARCH": "", 39 | "CC": "", 40 | "externalCommands": { 41 | "CROSS_COMPILE": "", 42 | "CROSS_COMPILE_ARM32": "", 43 | "CROSS_COMPILE_COMPAT": "", 44 | "CLANG_TRIPLE": "" 45 | } 46 | }, 47 | "AnyKernel3": { 48 | "use": true, 49 | "release": true, 50 | "custom": { 51 | "repo": "", 52 | "branch": "" 53 | } 54 | }, 55 | "enableKernelSU": true, 56 | "enableLXC": false 57 | } 58 | ] 59 | ``` 60 | 61 |
62 | 63 | It is recommended to store different device kernels in different `Json` files, and each configuration can be different. This makes it easier to modify, view and classify the kernel configuration. 64 | 65 | ## Configuration parameter analysis 66 | 67 | Each configuration template consists of the following parts: 68 | 69 | | Field name | Description | 70 | | -------------------------- | --------------------------------------------------------------------------------------------- | 71 | | kernelSource | Information about the kernel source code, including name, repository address, branch, and device type. | 72 | | toolchains | An array containing information about the toolchains that need to be used, including warehouse addresses, branches, and names. | 73 | | enableCcache | A Boolean value indicating whether a compilation tool named `ccache` is used to speed up compilation. | 74 | | params | An object containing information about build parameters, including architecture type, cross-compiler, compiler and other information. | 75 | | AnyKernel3 | An object that contains information related to building the kernel flash package, including the `AnyKernel3` warehouse address, branch and other information used. | 76 | | enableKernelSU | A Boolean value indicating whether the kernel patch named `KernelSU` is used. | 77 | | enableLXC | A Boolean value indicating whether to enable `Docker` support. | 78 | 79 | ### Kernel source code configuration (kernelSource) 80 | 81 | ```json 82 | "kernelSource": { 83 | "name": "", // The name you like has no effect. It is generally set to the device name + compilation tool chain version. 84 | "repo": "", // The warehouse address of the kernel source code 85 | "branch": "", // The branch name corresponding to the kernel source code repository 86 | "device": "", // Corresponding device number 87 | "defconfig": "" // The relative path of the corresponding defconfig file 88 | } 89 | ``` 90 | 91 | The `name` part has no impact on the entire compilation process, so in theory you can set it as you like. 92 | 93 | `repo`, `branch` are used to clone the kernel source code. We will clone all submodules under the source code by default to ensure the integrity of the kernel. The cloning code is as follows: 94 | 95 | ```bash 96 | git clone --recursive --depth=1 -j $(nproc) --branch 97 | ``` 98 | 99 | The content filled in `defconfig` is the relative path of your `defconfig` file relative to the `arch/arm64/configs` or `arch/arm/configs` folder. The reason for this is because some `defconfig` files may Exists in a subdirectory, we need to explicitly specify its relative path when `make`. 100 | 101 | Here's a basic example: 102 | 103 | ```json 104 | "kernelSource": { 105 | "name": "Mi6X", 106 | "repo": "https://github.com/Diva-Room/Miku_kernel_xiaomi_wayne", 107 | "branch": "TDA", 108 | "device": "wayne", 109 | "defconfig": "vendor/wayne_defconfig" 110 | } 111 | ``` 112 | 113 | This kernel is the kernel source code of **Xiaomi 6X**. After opening its `Github` address on the web page, we see that its main branch is `TDA`, and its `defconfig` file is located in `/arch/arm64/configs/vendor /wayne_defconfig`, so set `defconfig` to `vendor/wayne_defconfig`. 114 | 115 | ### Toolchain configuration (toolchains) 116 | 117 | The cross-compilation tool chain is an important tool when we compile the kernel, but the download forms of the compilation tool chain are various. You can use `git` to pull and download, or you can obtain it through downloading. Therefore, we have made adaptations for different acquisition methods. : 118 | 119 | --- 120 | 121 | #### 1. Use `Git` to pull the compilation tool chain 122 | 123 | ```json 124 | "toolchains": [ 125 | { 126 | "name": "proton-clang", 127 | "repo": "https://github.com/kdrag0n/proton-clang", 128 | "branch": "master", 129 | "binaryEnv": ["./bin"] 130 | } 131 | ] 132 | ``` 133 | 134 | This part of the configuration is actually similar to the configuration of the kernel source code. We will also use the following command to pull the source code from the warehouse: 135 | 136 | ```bash 137 | git clone --recursive --depth=1 -j $(nproc) --branch 138 | ``` 139 | 140 | However, a new `binaryEnv` has been added to this part, which is used to add global environment variable settings to our compilation tool chain, such as `./bin` here. After adding content, compilation will be added to the environment variables `bin` folder under the tool chain, which is of great benefit to our kernel compilation. 141 | 142 | --- 143 | 144 | #### 2. Use `Wget` to download the compilation tool chain 145 | 146 | In this way we can obtain the compilation tool chain compressed package in `.zip` | `.tar` | `.tar.gz` | `.rar` format. 147 | 148 | ```json 149 | "toolchains": [ 150 | { 151 | "name": "clang", 152 | "url": "https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/master-kernel-build-2022/clang-r450784d.tar.gz" , 153 | "binaryEnv": ["./bin"] 154 | }, 155 | { 156 | "name": "gcc", 157 | "url": "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", 158 | "binaryEnv": ["bin"] 159 | } 160 | ] 161 | ``` 162 | 163 | `Action` will download and decompress them, and there will also be `binaryEnv` in this part. Its function is similar to the above function, so it will not be described again. 164 | 165 | --- 166 | 167 | These two methods are not mutually exclusive. If we need both `Git` to pull and `Wget` to download the compilation toolchain, we can also mix them like the following configuration: 168 | 169 | ```json 170 | "toolchains": [ 171 | { 172 | "name": "clang", 173 | "repo": "https://gitlab.com/ThankYouMario/android_prebuilts_clang-standalone/", 174 | "branch": "11", 175 | "binaryEnv": ["bin"] 176 | }, 177 | { 178 | "name": "gcc", 179 | "url": "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", 180 | "binaryEnv": ["bin"] 181 | } 182 | ] 183 | ``` 184 | 185 | ### Compilation parameters (params) 186 | 187 | #### basic configuration 188 | 189 | Usually when we compile the kernel locally, we use a compilation command similar to the following: 190 | 191 | ```sh 192 | make -j$(nproc --all) \ 193 | O=out\ 194 | ARCH=arm64 \ 195 | CC=clang\ 196 | CLANG_TRIPLE=aarch64-linux-gnu-\ 197 | CROSS_COMPILE=aarch64-linux-gnu-\ 198 | CROSS_COMPILE_ARM32=arm-linux-gnueabi- 199 | ``` 200 | 201 | Therefore, our compilation parameter configuration is also configured in a similar way: 202 | 203 | ```json 204 | "params": { 205 | "ARCH": "arm64", 206 | "CC": "clang", 207 | "externalCommands": { 208 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 209 | "CROSS_COMPILE": "proton-clang/bin/aarch64-linux-gnu-", 210 | "CROSS_COMPILE_ARM32": "proton-clang/bin/arm-linux-gnueabi-" 211 | } 212 | } 213 | ``` 214 | 215 | The `-j` and `O=out` parts will be automatically configured by the compilation script, so there is no need to set them in the configuration. The `ARCH` and `CC` parts correspond to the above command part, and more other parameters correspond to the `externalCommand` part, such as the compilation parameter configuration of `markw`: 216 | 217 | ```json 218 | "params": { 219 | "ARCH": "arm64", 220 | "CC": "clang", 221 | "externalCommands": { 222 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 223 | "CROSS_COMPILE": "aarch64-linux-android-", 224 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 225 | "LD": "ld.lld", 226 | "AR": "llvm-ar", 227 | "NM": "llvm-nm", 228 | "OBJCOPY": "llvm-objcopy", 229 | "OBJDUMP": "llvm-objdump", 230 | "READELF": "llvm-readelf", 231 | "OBJSIZE": "llvm-size", 232 | "STRIP": "llvm-strip", 233 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 234 | "LLVM_AR": "llvm-ar", 235 | "LLVM_DIS": "llvm-dis", 236 | "CONFIG_THINLTO": "" 237 | } 238 | } 239 | ``` 240 | 241 | #### Turn on `ccache` to speed up compilation 242 | 243 | During the kernel compilation process, repeated compilation will consume a lot of our time. `ccache` allows us to reuse some middleware caches from previous compilations to speed up compilation. For example, the compilation command in the previous section turns on `ccache` should be followed by: 244 | 245 | ```sh 246 | make -j$(nproc --all) \ 247 | O=out\ 248 | ARCH=arm64 \ 249 | CC="ccache clang" \ 250 | CLANG_TRIPLE=aarch64-linux-gnu-\ 251 | CROSS_COMPILE=aarch64-linux-gnu-\ 252 | CROSS_COMPILE_ARM32=arm-linux-gnueabi- 253 | ``` 254 | 255 | In this way, we introduce a separate configuration parameter `enableCcache`. We only need to set `enableCcache` to `true` during configuration to implement the same command: 256 | 257 | ```json 258 | "enableCcache": true, 259 | "params": { 260 | "ARCH": "arm64", 261 | "CC": "clang", 262 | "externalCommands": { 263 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 264 | "CROSS_COMPILE": "aarch64-linux-android-", 265 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 266 | "LD": "ld.lld", 267 | "AR": "llvm-ar", 268 | "NM": "llvm-nm", 269 | "OBJCOPY": "llvm-objcopy", 270 | "OBJDUMP": "llvm-objdump", 271 | "READELF": "llvm-readelf", 272 | "OBJSIZE": "llvm-size", 273 | "STRIP": "llvm-strip", 274 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 275 | "LLVM_AR": "llvm-ar", 276 | "LLVM_DIS": "llvm-dis", 277 | "CONFIG_THINLTO": "" 278 | } 279 | } 280 | ``` 281 | 282 | **Please note that `enableCcache` is an independent configuration, please make sure it exists. If you do not use it, please set it to `false` instead of deleting it directly.** 283 | 284 | ### Kernel flash package configuration (AnyKernel3) 285 | 286 | Kernel packaging can be done through [AnyKernel3](https://github.com/osm0sis/AnyKernel3), [Android-Image-Kitchen](https://github.com/osm0sis/Android-Image-Kitchen), [MagiskBoot]( https://github.com/topjohnwu/Magisk/releases) and other tools to achieve this. Currently, this project only supports `AnyKernel3`, and its configuration is as follows: 287 | 288 | ```json 289 | "AnyKernel3": { 290 | "use": true, 291 | "release": true, 292 | "custom": { 293 | "repo": "https://github.com/easterNday/AnyKernel3/", 294 | "branch": "thyme" 295 | } 296 | } 297 | ``` 298 | 299 | In this configuration, I used the customized `AnyKernel3` for packaging. If you don’t want to `fork` a warehouse to implement it, you can choose to delete the `custom` field and use the original `AnyKernel3` to package your Kernel, the configuration after deletion is as follows: 300 | 301 | ```json 302 | "AnyKernel3": { 303 | "use": true, 304 | "release": true 305 | } 306 | ``` 307 | 308 | `use` in the configuration indicates whether you use `AnyKernel3` for packaging, `release` indicates whether you will release the packaged flash package, `release` only occurs when `AnyKernel3` is set to `true` takes effect, otherwise it defaults to `false`. 309 | 310 | ### Additional compilation parameter settings 311 | 312 | #### KernelSU 313 | 314 | Use `"enableKernelSU": true,` to control whether to enable `KernelSU`, set it to `false` to disable it. 315 | 316 | #### LXC Docker 317 | 318 | Use `"enableLXC": false` to control whether `Docker` support is enabled, set to `true` to enable it. 319 | 320 | ## Reference 321 | 322 | - [DogDayAndroid/KSU_Thyme_BuildBot](https://github.com/DogDayAndroid/KSU_Thyme_BuildBot): The predecessor of this project 323 | - [UtsavBalar1231/Drone-scripts](https://github.com/UtsavBalar1231/Drone-scripts): Refer to its compilation process 324 | - [xiaoleGun/KernelSU_Action](https://github.com/xiaoleGun/KernelSU_Action): Refer to its original AnyKerne3 packaging part 325 | -------------------------------------------------------------------------------- /Kernel/configs/README.zh_CN.md: -------------------------------------------------------------------------------- 1 | # 内核编译配置文件编写 2 | 3 | [English](./README.md) | 中文文档 4 | 5 | ## 基本配置文件案例 6 | 7 | 每个内核编译配置文件都是一个以 `.config.json` 结尾的 `Json` 文件,文件中是一个数组,数组中的每个 `item` 就是我们的内核编译配置。 8 | 9 |
10 | 配置模板 11 | 12 | ```json 13 | [ 14 | { 15 | "kernelSource": { 16 | "name": "", 17 | "repo": "", 18 | "branch": "", 19 | "device": "", 20 | "defconfig": "" 21 | }, 22 | "toolchains": [ 23 | { 24 | "name": "", 25 | "repo": "", 26 | "branch": "", 27 | "binaryEnv": [] 28 | }, 29 | { 30 | "name": "", 31 | "url": "", 32 | "binaryEnv": [] 33 | } 34 | ], 35 | "enableCcache": true, 36 | "params": { 37 | "ARCH": "", 38 | "CC": "", 39 | "externalCommands": { 40 | "CROSS_COMPILE": "", 41 | "CROSS_COMPILE_ARM32": "", 42 | "CROSS_COMPILE_COMPAT": "", 43 | "CLANG_TRIPLE": "" 44 | } 45 | }, 46 | "AnyKernel3": { 47 | "use": true, 48 | "release": true, 49 | "custom": { 50 | "repo": "", 51 | "branch": "" 52 | } 53 | }, 54 | "enableKernelSU": true, 55 | "enableLXC": false 56 | } 57 | ] 58 | ``` 59 | 60 |
61 | 62 | 建议将不同的设备内核存储在不同的 `Json` 文件中,其中的每一条配置可以不同,这样便于对内核配置进行修改、查看和分类。 63 | 64 | ## 配置参数解析 65 | 66 | 每个配置模板均由以下几个部分组成: 67 | 68 | | 字段名称 | 描述 | 69 | | ------------ | ---------------------------------------------------------------------------------------------- | 70 | | kernelSource | 内核源代码的相关信息,包括名称、仓库地址、分支和设备类型。 | 71 | | toolchains | 一个数组,包含了需要用到的工具链的相关信息,包括仓库地址、分支和名称。 | 72 | | enableCcache | 一个布尔值,表示是否使用了名为 `ccache` 的编译工具来加速编译。 | 73 | | params | 一个对象,包含了构建参数的相关信息,其中包括了架构类型、交叉编译器、编译器等信息。 | 74 | | AnyKernel3 | 一个对象,包含了构建内核刷机包的相关信息,其中包括了使用的 `AnyKernel3` 仓库地址、分支等信息。 | 75 | | enableKernelSU | 一个布尔值,表示是否使用了名为 `KernelSU` 的内核补丁。 | 76 | | enableLXC | 一个布尔值,表示是否开启 `Docker` 支持。 | 77 | 78 | ### 内核源码配置(kernelSource) 79 | 80 | ```json 81 | "kernelSource": { 82 | "name": "", // 你喜欢的名称,无任何影响,一般设定为 设备名字+编译工具 链版本 83 | "repo": "", // 内核源码的仓库地址 84 | "branch": "", // 对应内核源码仓库的 分支 名称 85 | "device": "", // 对应的设备编号 86 | "defconfig": "" // 对应的 defconfig 文件相对路径 87 | } 88 | ``` 89 | 90 | `name` 部分对于整个编译流程来说是没有影响的,因此理论上你可以随意设定。 91 | 92 | `repo`, `branch` 用于克隆内核源码,我们会默认克隆源码下的所有子模块来保证内核的完整性,克隆代码如下: 93 | 94 | ```bash 95 | git clone --recursive --depth=1 -j $(nproc) --branch 96 | ``` 97 | 98 | `defconfig` 中填写的内容是您的 `defconfig` 文件相对于 `arch/arm64/configs` 或 `arch/arm/configs` 文件夹的相对路径,这样做的原因是因为部分 `defconfig` 文件可能会存在于子目录中,`make` 的时候我们需要显示指定他的相对路径。 99 | 100 | 下面是一个基本的例子: 101 | 102 | ```json 103 | "kernelSource": { 104 | "name": "Mi6X", 105 | "repo": "https://github.com/Diva-Room/Miku_kernel_xiaomi_wayne", 106 | "branch": "TDA", 107 | "device": "wayne", 108 | "defconfig": "vendor/wayne_defconfig" 109 | } 110 | ``` 111 | 112 | 这个内核是**小米6X**的内核源码,网页打开其 `Github` 地址后,我们看到它的主要分支是 `TDA`,同时其 `defconfig` 文件位于 `/arch/arm64/configs/vendor/wayne_defconfig` 内,因此设定 `defconfig` 为 `vendor/wayne_defconfig` 。 113 | 114 | ### 工具链配置(toolchains) 115 | 116 | 交叉编译工具链是我们编译内核时的重要工具,但是编译工具链的下载形式五花八门,可以使用 `git` 拉取下载,也可以通过下载得到,因此对于不同的获取方式,我们分别作了适配: 117 | 118 | --- 119 | 120 | #### 1. 使用 `Git` 拉取编译工具链 121 | 122 | ```json 123 | "toolchains": [ 124 | { 125 | "name": "proton-clang", 126 | "repo": "https://github.com/kdrag0n/proton-clang", 127 | "branch": "master", 128 | "binaryEnv": ["./bin"] 129 | } 130 | ] 131 | ``` 132 | 133 | 这部分的配置其实类似于内核源码的配置,我们同样会使用如下命令来从仓库中拉取源码: 134 | 135 | ```bash 136 | git clone --recursive --depth=1 -j $(nproc) --branch 137 | ``` 138 | 139 | 但是这部分中新增了一个 `binaryEnv`, 这是用于给我们的编译工具链添加全局环境变量设定的,例如此处的 `./bin`,添加内容后,环境变量中会增加编译工具链下的 `bin` 文件夹,这对于我们的内核编译大有裨益。 140 | 141 | --- 142 | 143 | #### 2. 使用 `Wget` 下载编译工具链 144 | 145 | 通过这种方式我们可以获取到 `.zip` | `.tar` | `.tar.gz` | `.rar` 格式的编译工具链压缩包。 146 | 147 | ```json 148 | "toolchains": [ 149 | { 150 | "name": "clang", 151 | "url": "https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/master-kernel-build-2022/clang-r450784d.tar.gz", 152 | "binaryEnv": ["./bin"] 153 | }, 154 | { 155 | "name": "gcc", 156 | "url": "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", 157 | "binaryEnv": ["bin"] 158 | } 159 | ] 160 | ``` 161 | 162 | `Action` 会下载并解压他们,同时这部分中也会有 `binaryEnv`, 其作用和上述作用类似,因此不再赘述。 163 | 164 | --- 165 | 166 | 这两种方式并非鱼与熊掌不可得兼的,如果我们既需要 `Git` 拉取又需要 `Wget` 下载的编译工具链,我们也可以像如下配置一样将其混用: 167 | 168 | ```json 169 | "toolchains": [ 170 | { 171 | "name": "clang", 172 | "repo": "https://gitlab.com/ThankYouMario/android_prebuilts_clang-standalone/", 173 | "branch": "11", 174 | "binaryEnv": ["bin"] 175 | }, 176 | { 177 | "name": "gcc", 178 | "url": "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", 179 | "binaryEnv": ["bin"] 180 | } 181 | ] 182 | ``` 183 | 184 | ### 编译参数(params) 185 | 186 | #### 基本配置 187 | 188 | 通常我们在本地进行内核编译的时候,会使用形似如下的编译命令: 189 | 190 | ```sh 191 | make -j$(nproc --all) \ 192 | O=out \ 193 | ARCH=arm64 \ 194 | CC=clang \ 195 | CLANG_TRIPLE=aarch64-linux-gnu- \ 196 | CROSS_COMPILE=aarch64-linux-gnu- \ 197 | CROSS_COMPILE_ARM32=arm-linux-gnueabi- 198 | ``` 199 | 200 | 因此,我们的编译参数配置也以类似的方式来进行配置: 201 | 202 | ```json 203 | "params": { 204 | "ARCH": "arm64", 205 | "CC": "clang", 206 | "externalCommands": { 207 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 208 | "CROSS_COMPILE": "proton-clang/bin/aarch64-linux-gnu-", 209 | "CROSS_COMPILE_ARM32": "proton-clang/bin/arm-linux-gnueabi-" 210 | } 211 | } 212 | ``` 213 | 214 | 其中 `-j` 和 `O=out` 这一部分会由编译脚本自动配置好,因此配置中并不用进行设置。`ARCH` 以及 `CC` 部分对应上面的指令部分,其他的更多参数则对应 `externalCommand` 部分,例如 `markw` 的编译参数配置: 215 | 216 | ```json 217 | "params": { 218 | "ARCH": "arm64", 219 | "CC": "clang", 220 | "externalCommands": { 221 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 222 | "CROSS_COMPILE": "aarch64-linux-android-", 223 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 224 | "LD": "ld.lld", 225 | "AR": "llvm-ar", 226 | "NM": "llvm-nm", 227 | "OBJCOPY": "llvm-objcopy", 228 | "OBJDUMP": "llvm-objdump", 229 | "READELF": "llvm-readelf", 230 | "OBJSIZE": "llvm-size", 231 | "STRIP": "llvm-strip", 232 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 233 | "LLVM_AR": "llvm-ar", 234 | "LLVM_DIS": "llvm-dis", 235 | "CONFIG_THINLTO": "" 236 | } 237 | } 238 | ``` 239 | 240 | #### 开启 `ccache` 加速编译 241 | 242 | 内核编译过程中,如果反复的编译会非常耗费我们的时间,`ccache` 使得我们可以可以复用以前编译时的一些中间件的缓存从而加快编译的速度,例如上一小节中的编译命令开启 `ccache` 后应为: 243 | 244 | ```sh 245 | make -j$(nproc --all) \ 246 | O=out \ 247 | ARCH=arm64 \ 248 | CC="ccache clang" \ 249 | CLANG_TRIPLE=aarch64-linux-gnu- \ 250 | CROSS_COMPILE=aarch64-linux-gnu- \ 251 | CROSS_COMPILE_ARM32=arm-linux-gnueabi- 252 | ``` 253 | 254 | 这样我们就引出了一个单独的配置参数 `enableCcache`,我们只需要在配置的时候将 `enableCcache` 设置为 `true` 即可实现同样的命令: 255 | 256 | ```json 257 | "enableCcache": true, 258 | "params": { 259 | "ARCH": "arm64", 260 | "CC": "clang", 261 | "externalCommands": { 262 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 263 | "CROSS_COMPILE": "aarch64-linux-android-", 264 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 265 | "LD": "ld.lld", 266 | "AR": "llvm-ar", 267 | "NM": "llvm-nm", 268 | "OBJCOPY": "llvm-objcopy", 269 | "OBJDUMP": "llvm-objdump", 270 | "READELF": "llvm-readelf", 271 | "OBJSIZE": "llvm-size", 272 | "STRIP": "llvm-strip", 273 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 274 | "LLVM_AR": "llvm-ar", 275 | "LLVM_DIS": "llvm-dis", 276 | "CONFIG_THINLTO": "" 277 | } 278 | } 279 | ``` 280 | 281 | **请注意,`enableCcache` 是一条独立的配置,请确保其存在,如果您不使用请设定为 `false` 而不是直接删除。** 282 | 283 | ### 内核刷机包配置(AnyKernel3) 284 | 285 | 内核打包可以通过 [AnyKernel3](https://github.com/osm0sis/AnyKernel3)、[Android-Image-Kitchen](https://github.com/osm0sis/Android-Image-Kitchen)、[MagiskBoot](https://github.com/topjohnwu/Magisk/releases) 等工具来实现,目前本项目仅支持 `AnyKernel3`,其配置如下: 286 | 287 | ```json 288 | "AnyKernel3": { 289 | "use": true, 290 | "release": true, 291 | "custom": { 292 | "repo": "https://github.com/easterNday/AnyKernel3/", 293 | "branch": "thyme" 294 | } 295 | } 296 | ``` 297 | 298 | 这段配置中,我使用了自定义的 `AnyKernel3` 来进行打包,如果您不想额外的 `fork` 一个仓库来实现的话,可以选择删除 `custom` 字段来使用原版的 `AnyKernel3` 来打包您的内核,删除后的配置如下: 299 | 300 | ```json 301 | "AnyKernel3": { 302 | "use": true, 303 | "release": true 304 | } 305 | ``` 306 | 307 | 配置中的 `use` 表示您是否使用 `AnyKernel3` 来进行打包,`release` 表示您是否将打包后的刷机包发布出来,`release` 当且仅当 `AnyKernel3` 设置为 `true` 的时候才生效,否则默认为 `false`。 308 | 309 | ### 额外的编译参数设定 310 | 311 | #### KernelSU 312 | 313 | 使用 `"enableKernelSU": true,` 来控制是否启用 `KernelSU`,设置为 `false` 则不启用。 314 | 315 | #### LXC Docker 316 | 317 | 使用 `"enableLXC": false` 来控制是否启用 `Docker` 支持,设置为 `true` 则启用。 318 | 319 | ## 参考 320 | 321 | - [DogDayAndroid/KSU_Thyme_BuildBot](https://github.com/DogDayAndroid/KSU_Thyme_BuildBot) : 此项目的前身 322 | - [UtsavBalar1231/Drone-scripts](https://github.com/UtsavBalar1231/Drone-scripts) : 参考其编译过程 323 | - [xiaoleGun/KernelSU_Action](https://github.com/xiaoleGun/KernelSU_Action) : 参考其原版 AnyKerne3 打包部分 324 | -------------------------------------------------------------------------------- /Kernel/configs/larus.config.json.11: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "kernelSource": { 4 | "name": "Mi CC 9e", 5 | "repo": "https://github.com/MiCode/Xiaomi_Kernel_OpenSource", 6 | "branch": "laurus-q-oss", 7 | "device": "laurus-q-oss", 8 | "defconfig": "vendor/wayne_defconfig" 9 | }, 10 | "toolchains": [ 11 | { 12 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 13 | "branch": "lineage-20.0", 14 | "name": "clang", 15 | "binaryEnv": [ 16 | "bin" 17 | ] 18 | }, 19 | { 20 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 21 | "branch": "lineage-19.1", 22 | "name": "aarch64", 23 | "binaryEnv": [ 24 | "bin" 25 | ] 26 | }, 27 | { 28 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 29 | "branch": "lineage-19.1", 30 | "name": "arm", 31 | "binaryEnv": [ 32 | "bin" 33 | ] 34 | } 35 | ], 36 | "enableCcache": true, 37 | "params": { 38 | "ARCH": "arm64", 39 | "CC": "clang", 40 | "externalCommands": { 41 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 42 | "CROSS_COMPILE": "aarch64-linux-android-", 43 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 44 | "LD": "ld.lld", 45 | "AR": "llvm-ar", 46 | "NM": "llvm-nm", 47 | "OBJCOPY": "llvm-objcopy", 48 | "OBJDUMP": "llvm-objdump", 49 | "READELF": "llvm-readelf", 50 | "OBJSIZE": "llvm-size", 51 | "STRIP": "llvm-strip", 52 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 53 | "LLVM_AR": "llvm-ar", 54 | "LLVM_DIS": "llvm-dis", 55 | "CONFIG_THINLTO": "" 56 | } 57 | }, 58 | "AnyKernel3": { 59 | "use": true, 60 | "release": true 61 | }, 62 | "enableKernelSU": true, 63 | "enableLXC": true 64 | } 65 | ] -------------------------------------------------------------------------------- /Kernel/configs/markw.config.json.11: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "kernelSource": { 4 | "name": "Xiaomi4", 5 | "repo": "https://github.com/SonicBSV/android_kernel_xiaomi_markw-4.9", 6 | "branch": "master", 7 | "device": "markw", 8 | "defconfig": "markw_defconfig" 9 | }, 10 | "toolchains": [ 11 | { 12 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 13 | "branch": "lineage-20.0", 14 | "name": "clang", 15 | "binaryEnv": [ 16 | "bin" 17 | ] 18 | }, 19 | { 20 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 21 | "branch": "lineage-19.1", 22 | "name": "aarch64", 23 | "binaryEnv": [ 24 | "bin" 25 | ] 26 | }, 27 | { 28 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 29 | "branch": "lineage-19.1", 30 | "name": "arm", 31 | "binaryEnv": [ 32 | "bin" 33 | ] 34 | } 35 | ], 36 | "enableCcache": true, 37 | "params": { 38 | "ARCH": "arm64", 39 | "CC": "clang", 40 | "externalCommands": { 41 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 42 | "CROSS_COMPILE": "aarch64-linux-android-", 43 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 44 | "LD": "ld.lld", 45 | "AR": "llvm-ar", 46 | "NM": "llvm-nm", 47 | "OBJCOPY": "llvm-objcopy", 48 | "OBJDUMP": "llvm-objdump", 49 | "READELF": "llvm-readelf", 50 | "OBJSIZE": "llvm-size", 51 | "STRIP": "llvm-strip", 52 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 53 | "LLVM_AR": "llvm-ar", 54 | "LLVM_DIS": "llvm-dis", 55 | "CONFIG_THINLTO": "" 56 | } 57 | }, 58 | "AnyKernel3": { 59 | "use": true, 60 | "release": true 61 | }, 62 | "enableKernelSU": true, 63 | "enableLXC": true 64 | } 65 | ] -------------------------------------------------------------------------------- /Kernel/configs/test/D8G.config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "kernelSource": { 4 | "name": "D8G(Poco_F3)", 5 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 6 | "branch": "13", 7 | "device": "alioth", 8 | "defconfig": "vendor/xiaomi/alioth.config" 9 | }, 10 | "toolchains": [ 11 | { 12 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 13 | "branch": "lineage-20.0", 14 | "name": "clang", 15 | "binaryEnv": [ 16 | "bin" 17 | ] 18 | }, 19 | { 20 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 21 | "branch": "lineage-19.1", 22 | "name": "aarch64", 23 | "binaryEnv": [ 24 | "bin" 25 | ] 26 | }, 27 | { 28 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 29 | "branch": "lineage-19.1", 30 | "name": "arm", 31 | "binaryEnv": [ 32 | "bin" 33 | ] 34 | } 35 | ], 36 | "enableCcache": true, 37 | "params": { 38 | "ARCH": "arm64", 39 | "CC": "clang", 40 | "externalCommands": { 41 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 42 | "CROSS_COMPILE": "aarch64-linux-android-", 43 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 44 | "LD": "ld.lld", 45 | "AR": "llvm-ar", 46 | "NM": "llvm-nm", 47 | "OBJCOPY": "llvm-objcopy", 48 | "OBJDUMP": "llvm-objdump", 49 | "READELF": "llvm-readelf", 50 | "OBJSIZE": "llvm-size", 51 | "STRIP": "llvm-strip", 52 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 53 | "LLVM_AR": "llvm-ar", 54 | "LLVM_DIS": "llvm-dis", 55 | "CONFIG_THINLTO": "" 56 | } 57 | }, 58 | "AnyKernel3": { 59 | "use": true, 60 | "release": true 61 | }, 62 | "enableKernelSU": true 63 | }, 64 | { 65 | "kernelSource": { 66 | "name": "D8G(MI10T)", 67 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 68 | "branch": "13", 69 | "device": "apollo", 70 | "defconfig": "vendor/xiaomi/apollo.config" 71 | }, 72 | "toolchains": [ 73 | { 74 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 75 | "branch": "lineage-20.0", 76 | "name": "clang", 77 | "binaryEnv": [ 78 | "bin" 79 | ] 80 | }, 81 | { 82 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 83 | "branch": "lineage-19.1", 84 | "name": "aarch64", 85 | "binaryEnv": [ 86 | "bin" 87 | ] 88 | }, 89 | { 90 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 91 | "branch": "lineage-19.1", 92 | "name": "arm", 93 | "binaryEnv": [ 94 | "bin" 95 | ] 96 | } 97 | ], 98 | "enableCcache": true, 99 | "params": { 100 | "ARCH": "arm64", 101 | "CC": "clang", 102 | "externalCommands": { 103 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 104 | "CROSS_COMPILE": "aarch64-linux-android-", 105 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 106 | "LD": "ld.lld", 107 | "AR": "llvm-ar", 108 | "NM": "llvm-nm", 109 | "OBJCOPY": "llvm-objcopy", 110 | "OBJDUMP": "llvm-objdump", 111 | "READELF": "llvm-readelf", 112 | "OBJSIZE": "llvm-size", 113 | "STRIP": "llvm-strip", 114 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 115 | "LLVM_AR": "llvm-ar", 116 | "LLVM_DIS": "llvm-dis", 117 | "CONFIG_THINLTO": "" 118 | } 119 | }, 120 | "AnyKernel3": { 121 | "use": true, 122 | "release": true 123 | }, 124 | "enableKernelSU": true 125 | }, 126 | { 127 | "kernelSource": { 128 | "name": "D8G(MI10T_PRO)", 129 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 130 | "branch": "13", 131 | "device": "apollo", 132 | "defconfig": "vendor/xiaomi/apollo.config" 133 | }, 134 | "toolchains": [ 135 | { 136 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 137 | "branch": "lineage-20.0", 138 | "name": "clang", 139 | "binaryEnv": [ 140 | "bin" 141 | ] 142 | }, 143 | { 144 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 145 | "branch": "lineage-19.1", 146 | "name": "aarch64", 147 | "binaryEnv": [ 148 | "bin" 149 | ] 150 | }, 151 | { 152 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 153 | "branch": "lineage-19.1", 154 | "name": "arm", 155 | "binaryEnv": [ 156 | "bin" 157 | ] 158 | } 159 | ], 160 | "enableCcache": true, 161 | "params": { 162 | "ARCH": "arm64", 163 | "CC": "clang", 164 | "externalCommands": { 165 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 166 | "CROSS_COMPILE": "aarch64-linux-android-", 167 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 168 | "LD": "ld.lld", 169 | "AR": "llvm-ar", 170 | "NM": "llvm-nm", 171 | "OBJCOPY": "llvm-objcopy", 172 | "OBJDUMP": "llvm-objdump", 173 | "READELF": "llvm-readelf", 174 | "OBJSIZE": "llvm-size", 175 | "STRIP": "llvm-strip", 176 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 177 | "LLVM_AR": "llvm-ar", 178 | "LLVM_DIS": "llvm-dis", 179 | "CONFIG_THINLTO": "" 180 | } 181 | }, 182 | "AnyKernel3": { 183 | "use": true, 184 | "release": true 185 | }, 186 | "enableKernelSU": true 187 | }, 188 | { 189 | "kernelSource": { 190 | "name": "D8G(RedmiK30S_Ultra)", 191 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 192 | "branch": "13", 193 | "device": "apollo", 194 | "defconfig": "vendor/xiaomi/apollo.config" 195 | }, 196 | "toolchains": [ 197 | { 198 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 199 | "branch": "lineage-20.0", 200 | "name": "clang", 201 | "binaryEnv": [ 202 | "bin" 203 | ] 204 | }, 205 | { 206 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 207 | "branch": "lineage-19.1", 208 | "name": "aarch64", 209 | "binaryEnv": [ 210 | "bin" 211 | ] 212 | }, 213 | { 214 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 215 | "branch": "lineage-19.1", 216 | "name": "arm", 217 | "binaryEnv": [ 218 | "bin" 219 | ] 220 | } 221 | ], 222 | "enableCcache": true, 223 | "params": { 224 | "ARCH": "arm64", 225 | "CC": "clang", 226 | "externalCommands": { 227 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 228 | "CROSS_COMPILE": "aarch64-linux-android-", 229 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 230 | "LD": "ld.lld", 231 | "AR": "llvm-ar", 232 | "NM": "llvm-nm", 233 | "OBJCOPY": "llvm-objcopy", 234 | "OBJDUMP": "llvm-objdump", 235 | "READELF": "llvm-readelf", 236 | "OBJSIZE": "llvm-size", 237 | "STRIP": "llvm-strip", 238 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 239 | "LLVM_AR": "llvm-ar", 240 | "LLVM_DIS": "llvm-dis", 241 | "CONFIG_THINLTO": "" 242 | } 243 | }, 244 | "AnyKernel3": { 245 | "use": true, 246 | "release": true 247 | }, 248 | "enableKernelSU": true 249 | }, 250 | { 251 | "kernelSource": { 252 | "name": "D8G(Poco_F4)", 253 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 254 | "branch": "13", 255 | "device": "munch", 256 | "defconfig": "vendor/xiaomi/munch.config" 257 | }, 258 | "toolchains": [ 259 | { 260 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 261 | "branch": "lineage-20.0", 262 | "name": "clang", 263 | "binaryEnv": [ 264 | "bin" 265 | ] 266 | }, 267 | { 268 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 269 | "branch": "lineage-19.1", 270 | "name": "aarch64", 271 | "binaryEnv": [ 272 | "bin" 273 | ] 274 | }, 275 | { 276 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 277 | "branch": "lineage-19.1", 278 | "name": "arm", 279 | "binaryEnv": [ 280 | "bin" 281 | ] 282 | } 283 | ], 284 | "enableCcache": true, 285 | "params": { 286 | "ARCH": "arm64", 287 | "CC": "clang", 288 | "externalCommands": { 289 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 290 | "CROSS_COMPILE": "aarch64-linux-android-", 291 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 292 | "LD": "ld.lld", 293 | "AR": "llvm-ar", 294 | "NM": "llvm-nm", 295 | "OBJCOPY": "llvm-objcopy", 296 | "OBJDUMP": "llvm-objdump", 297 | "READELF": "llvm-readelf", 298 | "OBJSIZE": "llvm-size", 299 | "STRIP": "llvm-strip", 300 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 301 | "LLVM_AR": "llvm-ar", 302 | "LLVM_DIS": "llvm-dis", 303 | "CONFIG_THINLTO": "" 304 | } 305 | }, 306 | "AnyKernel3": { 307 | "use": true, 308 | "release": true 309 | }, 310 | "enableKernelSU": true 311 | }, 312 | { 313 | "kernelSource": { 314 | "name": "D8G(Mi10_Ultra)", 315 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 316 | "branch": "13", 317 | "device": "cas", 318 | "defconfig": "vendor/xiaomi/cas.config" 319 | }, 320 | "toolchains": [ 321 | { 322 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 323 | "branch": "lineage-20.0", 324 | "name": "clang", 325 | "binaryEnv": [ 326 | "bin" 327 | ] 328 | }, 329 | { 330 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 331 | "branch": "lineage-19.1", 332 | "name": "aarch64", 333 | "binaryEnv": [ 334 | "bin" 335 | ] 336 | }, 337 | { 338 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 339 | "branch": "lineage-19.1", 340 | "name": "arm", 341 | "binaryEnv": [ 342 | "bin" 343 | ] 344 | } 345 | ], 346 | "enableCcache": true, 347 | "params": { 348 | "ARCH": "arm64", 349 | "CC": "clang", 350 | "externalCommands": { 351 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 352 | "CROSS_COMPILE": "aarch64-linux-android-", 353 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 354 | "LD": "ld.lld", 355 | "AR": "llvm-ar", 356 | "NM": "llvm-nm", 357 | "OBJCOPY": "llvm-objcopy", 358 | "OBJDUMP": "llvm-objdump", 359 | "READELF": "llvm-readelf", 360 | "OBJSIZE": "llvm-size", 361 | "STRIP": "llvm-strip", 362 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 363 | "LLVM_AR": "llvm-ar", 364 | "LLVM_DIS": "llvm-dis", 365 | "CONFIG_THINLTO": "" 366 | } 367 | }, 368 | "AnyKernel3": { 369 | "use": true, 370 | "release": true 371 | }, 372 | "enableKernelSU": true 373 | }, 374 | { 375 | "kernelSource": { 376 | "name": "D8G(Mi10_Pro)", 377 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 378 | "branch": "13", 379 | "device": "cmi", 380 | "defconfig": "vendor/xiaomi/cmi.config" 381 | }, 382 | "toolchains": [ 383 | { 384 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 385 | "branch": "lineage-20.0", 386 | "name": "clang", 387 | "binaryEnv": [ 388 | "bin" 389 | ] 390 | }, 391 | { 392 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 393 | "branch": "lineage-19.1", 394 | "name": "aarch64", 395 | "binaryEnv": [ 396 | "bin" 397 | ] 398 | }, 399 | { 400 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 401 | "branch": "lineage-19.1", 402 | "name": "arm", 403 | "binaryEnv": [ 404 | "bin" 405 | ] 406 | } 407 | ], 408 | "enableCcache": true, 409 | "params": { 410 | "ARCH": "arm64", 411 | "CC": "clang", 412 | "externalCommands": { 413 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 414 | "CROSS_COMPILE": "aarch64-linux-android-", 415 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 416 | "LD": "ld.lld", 417 | "AR": "llvm-ar", 418 | "NM": "llvm-nm", 419 | "OBJCOPY": "llvm-objcopy", 420 | "OBJDUMP": "llvm-objdump", 421 | "READELF": "llvm-readelf", 422 | "OBJSIZE": "llvm-size", 423 | "STRIP": "llvm-strip", 424 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 425 | "LLVM_AR": "llvm-ar", 426 | "LLVM_DIS": "llvm-dis", 427 | "CONFIG_THINLTO": "" 428 | } 429 | }, 430 | "AnyKernel3": { 431 | "use": true, 432 | "release": true 433 | }, 434 | "enableKernelSU": true 435 | }, 436 | { 437 | "kernelSource": { 438 | "name": "D8G(RedmiK30_Pro)", 439 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 440 | "branch": "13", 441 | "device": "lmi", 442 | "defconfig": "vendor/xiaomi/lmi.config" 443 | }, 444 | "toolchains": [ 445 | { 446 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 447 | "branch": "lineage-20.0", 448 | "name": "clang", 449 | "binaryEnv": [ 450 | "bin" 451 | ] 452 | }, 453 | { 454 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 455 | "branch": "lineage-19.1", 456 | "name": "aarch64", 457 | "binaryEnv": [ 458 | "bin" 459 | ] 460 | }, 461 | { 462 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 463 | "branch": "lineage-19.1", 464 | "name": "arm", 465 | "binaryEnv": [ 466 | "bin" 467 | ] 468 | } 469 | ], 470 | "enableCcache": true, 471 | "params": { 472 | "ARCH": "arm64", 473 | "CC": "clang", 474 | "externalCommands": { 475 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 476 | "CROSS_COMPILE": "aarch64-linux-android-", 477 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 478 | "LD": "ld.lld", 479 | "AR": "llvm-ar", 480 | "NM": "llvm-nm", 481 | "OBJCOPY": "llvm-objcopy", 482 | "OBJDUMP": "llvm-objdump", 483 | "READELF": "llvm-readelf", 484 | "OBJSIZE": "llvm-size", 485 | "STRIP": "llvm-strip", 486 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 487 | "LLVM_AR": "llvm-ar", 488 | "LLVM_DIS": "llvm-dis", 489 | "CONFIG_THINLTO": "" 490 | } 491 | }, 492 | "AnyKernel3": { 493 | "use": true, 494 | "release": true 495 | }, 496 | "enableKernelSU": true 497 | }, 498 | { 499 | "kernelSource": { 500 | "name": "D8G(POCO_F2_Pro)", 501 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 502 | "branch": "13", 503 | "device": "lmi", 504 | "defconfig": "vendor/xiaomi/lmi.config" 505 | }, 506 | "toolchains": [ 507 | { 508 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 509 | "branch": "lineage-20.0", 510 | "name": "clang", 511 | "binaryEnv": [ 512 | "bin" 513 | ] 514 | }, 515 | { 516 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 517 | "branch": "lineage-19.1", 518 | "name": "aarch64", 519 | "binaryEnv": [ 520 | "bin" 521 | ] 522 | }, 523 | { 524 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 525 | "branch": "lineage-19.1", 526 | "name": "arm", 527 | "binaryEnv": [ 528 | "bin" 529 | ] 530 | } 531 | ], 532 | "enableCcache": true, 533 | "params": { 534 | "ARCH": "arm64", 535 | "CC": "clang", 536 | "externalCommands": { 537 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 538 | "CROSS_COMPILE": "aarch64-linux-android-", 539 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 540 | "LD": "ld.lld", 541 | "AR": "llvm-ar", 542 | "NM": "llvm-nm", 543 | "OBJCOPY": "llvm-objcopy", 544 | "OBJDUMP": "llvm-objdump", 545 | "READELF": "llvm-readelf", 546 | "OBJSIZE": "llvm-size", 547 | "STRIP": "llvm-strip", 548 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 549 | "LLVM_AR": "llvm-ar", 550 | "LLVM_DIS": "llvm-dis", 551 | "CONFIG_THINLTO": "" 552 | } 553 | }, 554 | "AnyKernel3": { 555 | "use": true, 556 | "release": true 557 | }, 558 | "enableKernelSU": true 559 | }, 560 | { 561 | "kernelSource": { 562 | "name": "D8G(Mi10)", 563 | "repo": "https://github.com/diphons/D8G_Kernel_oxygen/", 564 | "branch": "13", 565 | "device": "umi", 566 | "defconfig": "vendor/xiaomi/umi.config" 567 | }, 568 | "toolchains": [ 569 | { 570 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 571 | "branch": "lineage-20.0", 572 | "name": "clang", 573 | "binaryEnv": [ 574 | "bin" 575 | ] 576 | }, 577 | { 578 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 579 | "branch": "lineage-19.1", 580 | "name": "aarch64", 581 | "binaryEnv": [ 582 | "bin" 583 | ] 584 | }, 585 | { 586 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 587 | "branch": "lineage-19.1", 588 | "name": "arm", 589 | "binaryEnv": [ 590 | "bin" 591 | ] 592 | } 593 | ], 594 | "enableCcache": true, 595 | "params": { 596 | "ARCH": "arm64", 597 | "CC": "clang", 598 | "externalCommands": { 599 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 600 | "CROSS_COMPILE": "aarch64-linux-android-", 601 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 602 | "LD": "ld.lld", 603 | "AR": "llvm-ar", 604 | "NM": "llvm-nm", 605 | "OBJCOPY": "llvm-objcopy", 606 | "OBJDUMP": "llvm-objdump", 607 | "READELF": "llvm-readelf", 608 | "OBJSIZE": "llvm-size", 609 | "STRIP": "llvm-strip", 610 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 611 | "LLVM_AR": "llvm-ar", 612 | "LLVM_DIS": "llvm-dis", 613 | "CONFIG_THINLTO": "" 614 | } 615 | }, 616 | "AnyKernel3": { 617 | "use": true, 618 | "release": true 619 | }, 620 | "enableKernelSU": true 621 | } 622 | ] -------------------------------------------------------------------------------- /Kernel/configs/test/test.repos.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "kernelSource": { 4 | "name": "OnePlus_KernelSU", 5 | "repo": "https://github.com/tangalbert919/android_kernel_oneplus_sm8450", 6 | "branch": "lineage-19.1", 7 | "device": "gki", 8 | "defconfig": "gki_defconfig" 9 | }, 10 | "withKernelSU": true, 11 | "toolchains": [ 12 | { 13 | "repo": "https://github.com/CruelKernel/samsung-exynos9820-toolchain/", 14 | "branch": "google", 15 | "name": "google", 16 | "binPath": ["./aarch64-linux-android-4.9/bin", "llvm/bin"] 17 | } 18 | ], 19 | "params": { 20 | "ARCH": "arm64", 21 | "CC": "google/llvm/bin/clang", 22 | "externalCommand": { 23 | "CROSS_COMPILE": "google/aarch64-linux-android-4.9/bin/aarch64-linux-android-", 24 | "CLANG_TRIPLE": "google/llvm/bin/aarch64-linux-android-", 25 | "LD": "google/llvm/bin/ld.lld", 26 | "AR": "google/llvm/bin/llvm-ar", 27 | "NM": "google/llvm/bin/llvm-nm", 28 | "OBJCOPY": "google/llvm/bin/llvm-objcopy", 29 | "OBJDUMP": "google/llvm/bin/llvm-objdump", 30 | "READELF": "google/llvm/bin/llvm-readelf", 31 | "OBJSIZE": "google/llvm/bin/llvm-size", 32 | "STRIP": "google/llvm/bin/llvm-strip", 33 | "LDGOLD": "google/aarch64-linux-android-4.9/bin/aarch64-linux-android-ld.gold", 34 | "LLVM_AR": "google/llvm/bin/llvm-ar", 35 | "LLVM_DIS": "google/llvm/bin/llvm-dis" 36 | } 37 | }, 38 | "AnyKernel3": { 39 | "use": false, 40 | "release": true, 41 | "repo": "https://github.com/easterNday/AnyKernel3/", 42 | "branch": "thyme" 43 | } 44 | }, 45 | { 46 | "kernelSource": { 47 | "name": "Panda35064-chopin", 48 | "repo": "https://github.com/YuyukoAOSPMod/kernel_xiaomi_chopin", 49 | "branch": "12.1", 50 | "device": "chopin", 51 | "defconfig": "chopin_defconfig" 52 | }, 53 | "withKernelSU": true, 54 | "toolchains": [ 55 | { 56 | "repo": "https://github.com/CruelKernel/samsung-exynos9820-toolchain/", 57 | "branch": "google", 58 | "name": "google", 59 | "binPath": ["./aarch64-linux-android-4.9/bin", "llvm/bin"] 60 | } 61 | ], 62 | "params": { 63 | "ARCH": "arm64", 64 | "CC": "google/llvm/bin/clang", 65 | "externalCommand": { 66 | "CROSS_COMPILE": "google/aarch64-linux-android-4.9/bin/aarch64-linux-android-", 67 | "CLANG_TRIPLE": "google/llvm/bin/aarch64-linux-android-", 68 | 69 | "LD": "google/llvm/bin/ld.lld", 70 | "AR": "google/llvm/bin/llvm-ar", 71 | "NM": "google/llvm/bin/llvm-nm", 72 | "OBJCOPY": "google/llvm/bin/llvm-objcopy", 73 | "OBJDUMP": "google/llvm/bin/llvm-objdump", 74 | "READELF": "google/llvm/bin/llvm-readelf", 75 | "OBJSIZE": "google/llvm/bin/llvm-size", 76 | "STRIP": "google/llvm/bin/llvm-strip", 77 | "LDGOLD": "google/aarch64-linux-android-4.9/bin/aarch64-linux-android-ld.gold", 78 | "LLVM_AR": "google/llvm/bin/llvm-ar", 79 | "LLVM_DIS": "google/llvm/bin/llvm-dis" 80 | } 81 | }, 82 | "AnyKernel3": { 83 | "use": false, 84 | "release": true, 85 | "repo": "https://github.com/easterNday/AnyKernel3/", 86 | "branch": "thyme" 87 | } 88 | }, 89 | { 90 | "kernelSource": { 91 | "name": "SM-N976N", 92 | "repo": "https://github.com/easterNday/samsung-exynos9820/", 93 | "branch": "devel", 94 | "device": "exynos9820-d2xks", 95 | "defconfig": "exynos9820-d2xks_defconfig" 96 | }, 97 | "withKernelSU": false, 98 | "toolchains": [ 99 | { 100 | "repo": "https://github.com/CruelKernel/samsung-exynos9820-toolchain/", 101 | "branch": "samsung", 102 | "name": "samsung", 103 | "binPath": [ 104 | "clang/host/linux-x86/clang-r349610-jopp/bin", 105 | "gcc-cfp/gcc-cfp-jopp-only/aarch64-linux-android-4.9/bin" 106 | ] 107 | } 108 | ], 109 | "params": { 110 | "ARCH": "arm64", 111 | "CC": "google/llvm/bin/clang", 112 | "externalCommand": { 113 | "CROSS_COMPILE": "google/aarch64-linux-android-4.9/bin/aarch64-linux-android-", 114 | "CLANG_TRIPLE": "google/llvm/bin/aarch64-linux-android-", 115 | "LD": "google/llvm/bin/ld.lld", 116 | "AR": "google/llvm/bin/llvm-ar", 117 | "NM": "google/llvm/bin/llvm-nm", 118 | "OBJCOPY": "google/llvm/bin/llvm-objcopy", 119 | "OBJDUMP": "google/llvm/bin/llvm-objdump", 120 | "READELF": "google/llvm/bin/llvm-readelf", 121 | "OBJSIZE": "google/llvm/bin/llvm-size", 122 | "STRIP": "google/llvm/bin/llvm-strip", 123 | "LDGOLD": "google/aarch64-linux-android-4.9/bin/aarch64-linux-android-ld.gold", 124 | "LLVM_AR": "google/llvm/bin/llvm-ar", 125 | "LLVM_DIS": "google/llvm/bin/llvm-dis" 126 | } 127 | }, 128 | "AnyKernel3": { 129 | "use": false, 130 | "release": true, 131 | "repo": "https://github.com/easterNday/AnyKernel3/", 132 | "branch": "thyme" 133 | } 134 | } 135 | ] 136 | -------------------------------------------------------------------------------- /Kernel/configs/thyme.config.json.11: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "kernelSource": { 4 | "name": "Xiaomi10S(Proton)", 5 | "repo": "https://codeberg.org/DogDayAndroid/android_kernel_xiaomi_thyme", 6 | "branch": "lineage-20.0", 7 | "device": "thyme", 8 | "defconfig": "thyme_defconfig" 9 | }, 10 | "enableCcache": true, 11 | "toolchains": [ 12 | { 13 | "repo": "https://github.com/kdrag0n/proton-clang", 14 | "branch": "master", 15 | "name": "proton-clang", 16 | "binaryEnv": [ 17 | "bin" 18 | ] 19 | } 20 | ], 21 | "params": { 22 | "ARCH": "arm64", 23 | "CC": "proton-clang/bin/clang", 24 | "externalCommands": { 25 | "CROSS_COMPILE": "proton-clang/bin/aarch64-linux-gnu-", 26 | "CROSS_COMPILE_ARM32": "proton-clang/bin/arm-linux-gnueabi-", 27 | "LD": "proton-clang/bin/ld.lld", 28 | "AR": "proton-clang/bin/llvm-ar", 29 | "NM": "proton-clang/bin/llvm-nm", 30 | "OBJCOPY": "proton-clang/bin/llvm-objcopy", 31 | "OBJDUMP": "proton-clang/bin/llvm-objdump", 32 | "READELF": "proton-clang/bin/llvm-readelf", 33 | "OBJSIZE": "proton-clang/bin/llvm-size", 34 | "STRIP": "proton-clang/bin/llvm-strip", 35 | "LDGOLD": "proton-clang/bin/aarch64-linux-gnu-ld.gold", 36 | "LLVM_AR": "proton-clang/bin/llvm-ar", 37 | "LLVM_DIS": "proton-clang/bin/llvm-dis" 38 | } 39 | }, 40 | "AnyKernel3": { 41 | "use": true, 42 | "release": true 43 | }, 44 | "enableKernelSU": true, 45 | "enableLXC": false 46 | }, 47 | { 48 | "kernelSource": { 49 | "name": "Xiaomi10S(Google)", 50 | "repo": "https://codeberg.org/DogDayAndroid/android_kernel_xiaomi_thyme", 51 | "branch": "lineage-20.0", 52 | "device": "thyme", 53 | "defconfig": "thyme_defconfig" 54 | }, 55 | "toolchains": [ 56 | { 57 | "repo": "https://android.googlesource.com/platform/prebuilts/gas/linux-x86", 58 | "branch": "master", 59 | "name": "gas", 60 | "binaryEnv": [] 61 | }, 62 | { 63 | "repo": "https://gitlab.com/ThankYouMario/android_prebuilts_clang-standalone/", 64 | "branch": "11", 65 | "name": "clang", 66 | "binaryEnv": [ 67 | "bin" 68 | ] 69 | } 70 | ], 71 | "enableCcache": true, 72 | "params": { 73 | "ARCH": "arm64", 74 | "CC": "clang/bin/clang", 75 | "externalCommands": { 76 | "CROSS_COMPILE": "aarch64-linux-gnu-", 77 | "CROSS_COMPILE_ARM32": "arm-linux-gnueabi-", 78 | "CROSS_COMPILE_COMPAT": "arm-linux-gnueabi-", 79 | "CLANG_TRIPLE": "aarch64-linux-gnu-" 80 | } 81 | }, 82 | "AnyKernel3": { 83 | "use": true, 84 | "release": true, 85 | "custom": { 86 | "repo": "https://github.com/easterNday/AnyKernel3/", 87 | "branch": "thyme" 88 | } 89 | }, 90 | "enableKernelSU": true, 91 | "enableLXC": false 92 | }, 93 | { 94 | "kernelSource": { 95 | "name": "Xiaomi10S(Utsav)", 96 | "repo": "https://github.com/UtsavBalar1231/kernel_xiaomi_sm8250", 97 | "branch": "android13-stable", 98 | "device": "thyme", 99 | "defconfig": "thyme_defconfig" 100 | }, 101 | "enableCcache": true, 102 | "toolchains": [ 103 | { 104 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 105 | "branch": "lineage-20.0", 106 | "name": "clang", 107 | "binaryEnv": [ 108 | "bin" 109 | ] 110 | }, 111 | { 112 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 113 | "branch": "lineage-19.1", 114 | "name": "aarch64", 115 | "binaryEnv": [ 116 | "bin" 117 | ] 118 | }, 119 | { 120 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 121 | "branch": "lineage-19.1", 122 | "name": "arm", 123 | "binaryEnv": [ 124 | "bin" 125 | ] 126 | } 127 | ], 128 | "params": { 129 | "ARCH": "arm64", 130 | "CC": "clang/bin/clang", 131 | "externalCommands": { 132 | "CROSS_COMPILE": "aarch64-linux-gnu-", 133 | "CROSS_COMPILE_ARM32": "arm-linux-gnueabi-", 134 | "CROSS_COMPILE_COMPAT": "arm-linux-gnueabi-", 135 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 136 | "LD": "ld.lld", 137 | "AR": "llvm-ar", 138 | "NM": "llvm-nm", 139 | "OBJCOPY": "llvm-objcopy", 140 | "OBJDUMP": "llvm-objdump", 141 | "READELF": "llvm-readelf", 142 | "OBJSIZE": "llvm-size", 143 | "STRIP": "llvm-strip", 144 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 145 | "LLVM_AR": "llvm-ar", 146 | "LLVM_DIS": "llvm-dis" 147 | } 148 | }, 149 | "AnyKernel3": { 150 | "use": true, 151 | "release": true 152 | }, 153 | "enableKernelSU": true, 154 | "enableLXC": false 155 | }, 156 | { 157 | "kernelSource": { 158 | "name": "Xiaomi10S(Google-Docker)", 159 | "repo": "https://codeberg.org/DogDayAndroid/android_kernel_xiaomi_thyme", 160 | "branch": "lineage-20.0", 161 | "device": "thyme", 162 | "defconfig": "thyme_defconfig" 163 | }, 164 | "toolchains": [ 165 | { 166 | "repo": "https://android.googlesource.com/platform/prebuilts/gas/linux-x86", 167 | "branch": "master", 168 | "name": "gas", 169 | "binaryEnv": [] 170 | }, 171 | { 172 | "repo": "https://gitlab.com/ThankYouMario/android_prebuilts_clang-standalone/", 173 | "branch": "11", 174 | "name": "clang", 175 | "binaryEnv": [ 176 | "bin" 177 | ] 178 | } 179 | ], 180 | "enableCcache": true, 181 | "params": { 182 | "ARCH": "arm64", 183 | "CC": "clang/bin/clang", 184 | "externalCommands": { 185 | "CROSS_COMPILE": "aarch64-linux-gnu-", 186 | "CROSS_COMPILE_ARM32": "arm-linux-gnueabi-", 187 | "CROSS_COMPILE_COMPAT": "arm-linux-gnueabi-", 188 | "CLANG_TRIPLE": "aarch64-linux-gnu-" 189 | } 190 | }, 191 | "AnyKernel3": { 192 | "use": true, 193 | "release": true, 194 | "custom": { 195 | "repo": "https://github.com/easterNday/AnyKernel3/", 196 | "branch": "thyme" 197 | } 198 | }, 199 | "enableKernelSU": true, 200 | "enableLXC": true 201 | } 202 | ] -------------------------------------------------------------------------------- /Kernel/configs/wayne.config.json.11: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "kernelSource": { 4 | "name": "Mi6X", 5 | "repo": "https://github.com/Diva-Room/Miku_kernel_xiaomi_wayne", 6 | "branch": "TDA", 7 | "device": "wayne", 8 | "defconfig": "vendor/wayne_defconfig" 9 | }, 10 | "toolchains": [ 11 | { 12 | "repo": "https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b", 13 | "branch": "lineage-20.0", 14 | "name": "clang", 15 | "binaryEnv": [ 16 | "bin" 17 | ] 18 | }, 19 | { 20 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9", 21 | "branch": "lineage-19.1", 22 | "name": "aarch64", 23 | "binaryEnv": [ 24 | "bin" 25 | ] 26 | }, 27 | { 28 | "repo": "https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9", 29 | "branch": "lineage-19.1", 30 | "name": "arm", 31 | "binaryEnv": [ 32 | "bin" 33 | ] 34 | } 35 | ], 36 | "enableCcache": true, 37 | "params": { 38 | "ARCH": "arm64", 39 | "CC": "clang", 40 | "externalCommands": { 41 | "CLANG_TRIPLE": "aarch64-linux-gnu-", 42 | "CROSS_COMPILE": "aarch64-linux-android-", 43 | "CROSS_COMPILE_ARM32": "arm-linux-androideabi-", 44 | "LD": "ld.lld", 45 | "AR": "llvm-ar", 46 | "NM": "llvm-nm", 47 | "OBJCOPY": "llvm-objcopy", 48 | "OBJDUMP": "llvm-objdump", 49 | "READELF": "llvm-readelf", 50 | "OBJSIZE": "llvm-size", 51 | "STRIP": "llvm-strip", 52 | "LDGOLD": "aarch64-linux-gnu-ld.gold", 53 | "LLVM_AR": "llvm-ar", 54 | "LLVM_DIS": "llvm-dis", 55 | "CONFIG_THINLTO": "" 56 | } 57 | }, 58 | "AnyKernel3": { 59 | "use": true, 60 | "release": true 61 | }, 62 | "enableKernelSU": true, 63 | "enableLXC": false 64 | } 65 | ] -------------------------------------------------------------------------------- /Kernel/configs/xiaomi9.config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "kernelSource": { 4 | "name": "Xiaomi9KernelPoweredBySeparate", 5 | "repo": "https://github.com/Separatee/AllinOneKernel", 6 | "branch": "main", 7 | "device": "cepheus", 8 | "defconfig": "cepheus_defconfig" 9 | }, 10 | "toolchains": [ 11 | { 12 | "name": "proton-clang", 13 | "repo": "https://github.com/kdrag0n/proton-clang", 14 | "branch": "master", 15 | "binaryEnv": ["./bin"] 16 | } 17 | ], 18 | "enableCcache": true, 19 | "params": { 20 | "ARCH": "arm64", 21 | "CC": "clang", 22 | "externalCommands": { 23 | "CROSS_COMPILE": "proton-clang/bin/aarch64-linux-gnu-", 24 | "CROSS_COMPILE_ARM32": "proton-clang/bin/arm-linux-gnueabi-", 25 | "CLANG_TRIPLE": "aarch64-linux-gnu-" 26 | } 27 | }, 28 | "AnyKernel3": { 29 | "use": false, 30 | "release": true 31 | }, 32 | "enableKernelSU": false, 33 | "enableLXC": false 34 | } 35 | ] 36 | -------------------------------------------------------------------------------- /Kernel/configs/xiaomi9.config.json.bak: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "kernelSource": { 4 | "name": "Xiaomi9KernelPoweredBySeparate", 5 | "repo": "https://github.com/Separatee/AllinOneKernel", 6 | "branch": "main", 7 | "device": "cepheus", 8 | "defconfig": "cepheus_defconfig" 9 | }, 10 | "toolchains": [ 11 | { 12 | "name": "proton-clang", 13 | "repo": "https://github.com/kdrag0n/proton-clang", 14 | "branch": "master", 15 | "binaryEnv": ["./bin"] 16 | }, 17 | { 18 | "name": "", 19 | "url": "", 20 | "binaryEnv": [] 21 | } 22 | ], 23 | "enableCcache": true, 24 | "params": { 25 | "ARCH": "arm64", 26 | "CC": "clang", 27 | "externalCommands": { 28 | "CROSS_COMPILE": "proton-clang/bin/aarch64-linux-gnu-", 29 | "CROSS_COMPILE_ARM32": "proton-clang/bin/arm-linux-gnueabi-", 30 | "CLANG_TRIPLE": "aarch64-linux-gnu-" 31 | } 32 | }, 33 | "AnyKernel3": { 34 | "use": false, 35 | "release": true 36 | }, 37 | "enableKernelSU": false, 38 | "enableLXC": false 39 | } 40 | ] 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-NonCommercial-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International 58 | Public License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-NonCommercial-ShareAlike 4.0 International Public License 63 | ("Public License"). To the extent this Public License may be 64 | interpreted as a contract, You are granted the Licensed Rights in 65 | consideration of Your acceptance of these terms and conditions, and the 66 | Licensor grants You such rights in consideration of benefits the 67 | Licensor receives from making the Licensed Material available under 68 | these terms and conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-NC-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution, NonCommercial, and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. NonCommercial means not primarily intended for or directed towards 126 | commercial advantage or monetary compensation. For purposes of 127 | this Public License, the exchange of the Licensed Material for 128 | other material subject to Copyright and Similar Rights by digital 129 | file-sharing or similar means is NonCommercial provided there is 130 | no payment of monetary compensation in connection with the 131 | exchange. 132 | 133 | l. Share means to provide material to the public by any means or 134 | process that requires permission under the Licensed Rights, such 135 | as reproduction, public display, public performance, distribution, 136 | dissemination, communication, or importation, and to make material 137 | available to the public including in ways that members of the 138 | public may access the material from a place and at a time 139 | individually chosen by them. 140 | 141 | m. Sui Generis Database Rights means rights other than copyright 142 | resulting from Directive 96/9/EC of the European Parliament and of 143 | the Council of 11 March 1996 on the legal protection of databases, 144 | as amended and/or succeeded, as well as other essentially 145 | equivalent rights anywhere in the world. 146 | 147 | n. You means the individual or entity exercising the Licensed Rights 148 | under this Public License. Your has a corresponding meaning. 149 | 150 | 151 | Section 2 -- Scope. 152 | 153 | a. License grant. 154 | 155 | 1. Subject to the terms and conditions of this Public License, 156 | the Licensor hereby grants You a worldwide, royalty-free, 157 | non-sublicensable, non-exclusive, irrevocable license to 158 | exercise the Licensed Rights in the Licensed Material to: 159 | 160 | a. reproduce and Share the Licensed Material, in whole or 161 | in part, for NonCommercial purposes only; and 162 | 163 | b. produce, reproduce, and Share Adapted Material for 164 | NonCommercial purposes only. 165 | 166 | 2. Exceptions and Limitations. For the avoidance of doubt, where 167 | Exceptions and Limitations apply to Your use, this Public 168 | License does not apply, and You do not need to comply with 169 | its terms and conditions. 170 | 171 | 3. Term. The term of this Public License is specified in Section 172 | 6(a). 173 | 174 | 4. Media and formats; technical modifications allowed. The 175 | Licensor authorizes You to exercise the Licensed Rights in 176 | all media and formats whether now known or hereafter created, 177 | and to make technical modifications necessary to do so. The 178 | Licensor waives and/or agrees not to assert any right or 179 | authority to forbid You from making technical modifications 180 | necessary to exercise the Licensed Rights, including 181 | technical modifications necessary to circumvent Effective 182 | Technological Measures. For purposes of this Public License, 183 | simply making modifications authorized by this Section 2(a) 184 | (4) never produces Adapted Material. 185 | 186 | 5. Downstream recipients. 187 | 188 | a. Offer from the Licensor -- Licensed Material. Every 189 | recipient of the Licensed Material automatically 190 | receives an offer from the Licensor to exercise the 191 | Licensed Rights under the terms and conditions of this 192 | Public License. 193 | 194 | b. Additional offer from the Licensor -- Adapted Material. 195 | Every recipient of Adapted Material from You 196 | automatically receives an offer from the Licensor to 197 | exercise the Licensed Rights in the Adapted Material 198 | under the conditions of the Adapter's License You apply. 199 | 200 | c. No downstream restrictions. You may not offer or impose 201 | any additional or different terms or conditions on, or 202 | apply any Effective Technological Measures to, the 203 | Licensed Material if doing so restricts exercise of the 204 | Licensed Rights by any recipient of the Licensed 205 | Material. 206 | 207 | 6. No endorsement. Nothing in this Public License constitutes or 208 | may be construed as permission to assert or imply that You 209 | are, or that Your use of the Licensed Material is, connected 210 | with, or sponsored, endorsed, or granted official status by, 211 | the Licensor or others designated to receive attribution as 212 | provided in Section 3(a)(1)(A)(i). 213 | 214 | b. Other rights. 215 | 216 | 1. Moral rights, such as the right of integrity, are not 217 | licensed under this Public License, nor are publicity, 218 | privacy, and/or other similar personality rights; however, to 219 | the extent possible, the Licensor waives and/or agrees not to 220 | assert any such rights held by the Licensor to the limited 221 | extent necessary to allow You to exercise the Licensed 222 | Rights, but not otherwise. 223 | 224 | 2. Patent and trademark rights are not licensed under this 225 | Public License. 226 | 227 | 3. To the extent possible, the Licensor waives any right to 228 | collect royalties from You for the exercise of the Licensed 229 | Rights, whether directly or through a collecting society 230 | under any voluntary or waivable statutory or compulsory 231 | licensing scheme. In all other cases the Licensor expressly 232 | reserves any right to collect such royalties, including when 233 | the Licensed Material is used other than for NonCommercial 234 | purposes. 235 | 236 | 237 | Section 3 -- License Conditions. 238 | 239 | Your exercise of the Licensed Rights is expressly made subject to the 240 | following conditions. 241 | 242 | a. Attribution. 243 | 244 | 1. If You Share the Licensed Material (including in modified 245 | form), You must: 246 | 247 | a. retain the following if it is supplied by the Licensor 248 | with the Licensed Material: 249 | 250 | i. identification of the creator(s) of the Licensed 251 | Material and any others designated to receive 252 | attribution, in any reasonable manner requested by 253 | the Licensor (including by pseudonym if 254 | designated); 255 | 256 | ii. a copyright notice; 257 | 258 | iii. a notice that refers to this Public License; 259 | 260 | iv. a notice that refers to the disclaimer of 261 | warranties; 262 | 263 | v. a URI or hyperlink to the Licensed Material to the 264 | extent reasonably practicable; 265 | 266 | b. indicate if You modified the Licensed Material and 267 | retain an indication of any previous modifications; and 268 | 269 | c. indicate the Licensed Material is licensed under this 270 | Public License, and include the text of, or the URI or 271 | hyperlink to, this Public License. 272 | 273 | 2. You may satisfy the conditions in Section 3(a)(1) in any 274 | reasonable manner based on the medium, means, and context in 275 | which You Share the Licensed Material. For example, it may be 276 | reasonable to satisfy the conditions by providing a URI or 277 | hyperlink to a resource that includes the required 278 | information. 279 | 3. If requested by the Licensor, You must remove any of the 280 | information required by Section 3(a)(1)(A) to the extent 281 | reasonably practicable. 282 | 283 | b. ShareAlike. 284 | 285 | In addition to the conditions in Section 3(a), if You Share 286 | Adapted Material You produce, the following conditions also apply. 287 | 288 | 1. The Adapter's License You apply must be a Creative Commons 289 | license with the same License Elements, this version or 290 | later, or a BY-NC-SA Compatible License. 291 | 292 | 2. You must include the text of, or the URI or hyperlink to, the 293 | Adapter's License You apply. You may satisfy this condition 294 | in any reasonable manner based on the medium, means, and 295 | context in which You Share Adapted Material. 296 | 297 | 3. You may not offer or impose any additional or different terms 298 | or conditions on, or apply any Effective Technological 299 | Measures to, Adapted Material that restrict exercise of the 300 | rights granted under the Adapter's License You apply. 301 | 302 | 303 | Section 4 -- Sui Generis Database Rights. 304 | 305 | Where the Licensed Rights include Sui Generis Database Rights that 306 | apply to Your use of the Licensed Material: 307 | 308 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 309 | to extract, reuse, reproduce, and Share all or a substantial 310 | portion of the contents of the database for NonCommercial purposes 311 | only; 312 | 313 | b. if You include all or a substantial portion of the database 314 | contents in a database in which You have Sui Generis Database 315 | Rights, then the database in which You have Sui Generis Database 316 | Rights (but not its individual contents) is Adapted Material, 317 | including for purposes of Section 3(b); and 318 | 319 | c. You must comply with the conditions in Section 3(a) if You Share 320 | all or a substantial portion of the contents of the database. 321 | 322 | For the avoidance of doubt, this Section 4 supplements and does not 323 | replace Your obligations under this Public License where the Licensed 324 | Rights include other Copyright and Similar Rights. 325 | 326 | 327 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 328 | 329 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 330 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 331 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 332 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 333 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 334 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 335 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 336 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 337 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 338 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 339 | 340 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 341 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 342 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 343 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 344 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 345 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 346 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 347 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 348 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 349 | 350 | c. The disclaimer of warranties and limitation of liability provided 351 | above shall be interpreted in a manner that, to the extent 352 | possible, most closely approximates an absolute disclaimer and 353 | waiver of all liability. 354 | 355 | 356 | Section 6 -- Term and Termination. 357 | 358 | a. This Public License applies for the term of the Copyright and 359 | Similar Rights licensed here. However, if You fail to comply with 360 | this Public License, then Your rights under this Public License 361 | terminate automatically. 362 | 363 | b. Where Your right to use the Licensed Material has terminated under 364 | Section 6(a), it reinstates: 365 | 366 | 1. automatically as of the date the violation is cured, provided 367 | it is cured within 30 days of Your discovery of the 368 | violation; or 369 | 370 | 2. upon express reinstatement by the Licensor. 371 | 372 | For the avoidance of doubt, this Section 6(b) does not affect any 373 | right the Licensor may have to seek remedies for Your violations 374 | of this Public License. 375 | 376 | c. For the avoidance of doubt, the Licensor may also offer the 377 | Licensed Material under separate terms or conditions or stop 378 | distributing the Licensed Material at any time; however, doing so 379 | will not terminate this Public License. 380 | 381 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 382 | License. 383 | 384 | 385 | Section 7 -- Other Terms and Conditions. 386 | 387 | a. The Licensor shall not be bound by any additional or different 388 | terms or conditions communicated by You unless expressly agreed. 389 | 390 | b. Any arrangements, understandings, or agreements regarding the 391 | Licensed Material not stated herein are separate from and 392 | independent of the terms and conditions of this Public License. 393 | 394 | 395 | Section 8 -- Interpretation. 396 | 397 | a. For the avoidance of doubt, this Public License does not, and 398 | shall not be interpreted to, reduce, limit, restrict, or impose 399 | conditions on any use of the Licensed Material that could lawfully 400 | be made without permission under this Public License. 401 | 402 | b. To the extent possible, if any provision of this Public License is 403 | deemed unenforceable, it shall be automatically reformed to the 404 | minimum extent necessary to make it enforceable. If the provision 405 | cannot be reformed, it shall be severed from this Public License 406 | without affecting the enforceability of the remaining terms and 407 | conditions. 408 | 409 | c. No term or condition of this Public License will be waived and no 410 | failure to comply consented to unless expressly agreed to by the 411 | Licensor. 412 | 413 | d. Nothing in this Public License constitutes or may be interpreted 414 | as a limitation upon, or waiver of, any privileges and immunities 415 | that apply to the Licensor or You, including from the legal 416 | processes of any jurisdiction or authority. 417 | 418 | ======================================================================= 419 | 420 | Creative Commons is not a party to its public 421 | licenses. Notwithstanding, Creative Commons may elect to apply one of 422 | its public licenses to material it publishes and in those instances 423 | will be considered the “Licensor.” The text of the Creative Commons 424 | public licenses is dedicated to the public domain under the CC0 Public 425 | Domain Dedication. Except for the limited purpose of indicating that 426 | material is shared under a Creative Commons public license or as 427 | otherwise permitted by the Creative Commons policies published at 428 | creativecommons.org/policies, Creative Commons does not authorize the 429 | use of the trademark "Creative Commons" or any other trademark or logo 430 | of Creative Commons without its prior written consent including, 431 | without limitation, in connection with any unauthorized modifications 432 | to any of its public licenses or any other arrangements, 433 | understandings, or agreements concerning use of licensed material. For 434 | the avoidance of doubt, this paragraph does not form part of the 435 | public licenses. 436 | 437 | Creative Commons may be contacted at creativecommons.org. 438 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | banner 3 |

DogDay Buildbot

4 | 5 | --- 6 | 7 | English | [中文文档](./README.zh_CN.md) 8 | 9 | ![License](https://img.shields.io/static/v1?label=License&message=BY-NC-SA&logo=creativecommons&color=green) 10 | ![Language](https://img.shields.io/github/languages/top/DogDayAndroid/Android-Builder) 11 | ![Issues](https://img.shields.io/github/issues/DogDayAndroid/Android-Builder) 12 | ![Pull Requests](https://img.shields.io/github/issues-pr/DogDayAndroid/Android-Builder) 13 |
14 | 15 | --- 16 | 17 |
18 | 19 | ## Preface 20 | 21 | Unfortunately, I accidentally deleted the original repository on the night of **2023/11/13**, so you may not be able to find it now if you `fork` or `star` it before. 22 | 23 | After learning from the experience, I decided to make the project more perfect and support more content. Currently, the content that this project will support is as follows: 24 | 25 | - You can enter the **[
  Kernel  
](./Kernel/)** directory in this repository to configure and build the kernel. 26 | - Clone this repository and enter **[
  System  
](./System/)** to develop and compile the system. 27 | - Entering the **[
  TWRP  
](./TWRP/)** folder of this project can help you quickly build TWRP. 28 | 29 | The specific content of each project will be displayed separately under each folder. You can enter these folders to view their individual readme files to learn how to use them. 30 | 31 | ## Contributor 32 | 33 | [![Contributor](https://contrib.rocks/image?repo=DogDayAndroid/Android-Builder)](https://github.com/DogDayAndroid/Android-Builder/graphs/contributors) 34 | 35 | ## Star history 36 | 37 | [![Star History](https://starchart.cc/DogDayAndroid/Android-Builder.svg)](https://starchart.cc/DogDayAndroid/Android-Builder) 38 | 39 | ## License 40 | 41 | [![by-nc-sa](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-nc-sa/4.0/) 42 | 43 | This work is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-nc-sa/4.0/). 44 | -------------------------------------------------------------------------------- /README.zh_CN.md: -------------------------------------------------------------------------------- 1 |
2 | banner 3 |

DogDay Buildbot

4 | 5 | --- 6 | 7 | [English](./README.md) | 中文文档 8 | 9 | ![License](https://img.shields.io/static/v1?label=许可证&message=BY-NC-SA&logo=creativecommons&color=green) 10 | ![Language](https://img.shields.io/github/languages/top/DogDayAndroid/Android-Builder) 11 | ![Issues](https://img.shields.io/github/issues/DogDayAndroid/Android-Builder) 12 | ![Pull Requests](https://img.shields.io/github/issues-pr/DogDayAndroid/Android-Builder) 13 |
14 | 15 | --- 16 | 17 |
18 | 19 | ## 前言 20 | 21 | 不幸的是,我在 **2023/11/13** 晚上不小心删除了原始存储库,因此如果您之前 `fork` 或 `star` 它,现在可能无法找到它。 22 | 23 | 痛定思痛,我决定让项目更加完善,支持更多的内容。 目前,该项目将支持的内容如下: 24 | 25 | - 利用 `Github Actions` 来进行内核构建,这部分内容贮藏在 **[
  Kernel  
](./Kernel/)** 文件夹下。 26 | - 克隆本项目到本地后,您可以用脚本自动构建 `LineageOS`,这部分内容贮藏在 **[
  System  
](./System/)** 文件夹中。 27 | - 利用 `Github Actions` 来进行 `TWRP` 构建,这部分内容贮藏在 **[
  TWRP  
](./TWRP/)** 文件夹下。 28 | 29 | 每个项目的具体内容会在每个文件夹下单独显示。 您可以进入这些文件夹查看其各自的自述文件以了解如何使用它们。 30 | 31 | ## 贡献者 32 | 33 | [![Contributor](https://contrib.rocks/image?repo=DogDayAndroid/Android-Builder)](https://github.com/DogDayAndroid/Android-Builder/graphs/contributors) 34 | 35 | ## 星标历史 36 | 37 | [![Star History](https://starchart.cc/DogDayAndroid/Android-Builder.svg)](https://starchart.cc/DogDayAndroid/Android-Builder) 38 | 39 | ## 许可证 40 | 41 | [![by-nc-sa](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-nc-sa/4.0/) 42 | 43 | 本作品根据 [知识共享署名-非商业性-相同方式共享 4.0 国际许可](http://creativecommons.org/licenses/by-nc-sa/4.0/) 获得许可。 44 | -------------------------------------------------------------------------------- /System/.gitignore: -------------------------------------------------------------------------------- 1 | LineageOS/* 2 | builds/* -------------------------------------------------------------------------------- /System/Patches/LineageOS/custom_recovery/android_build/0001-Recovery-Inject-custom-TWRP-during-packaging-process.patch: -------------------------------------------------------------------------------- 1 | From 75a690c8b292a54ca7c821f087639ae30597b095 Mon Sep 17 00:00:00 2001 2 | From: easterNday <849919718@qq.com> 3 | Date: Sat, 18 Nov 2023 12:46:00 +0800 4 | Subject: [PATCH] Recovery: Inject custom TWRP during packaging process 5 | 6 | * Use custom recovery by export CUSTOM_TWRP to env var. 7 | * Specify the MagiskBoot by export CUSTOM_MAGISKBOOT to env var. 8 | * Both of the above options must be specified to take effect, and an absolute path must be used. 9 | 10 | - Linkage file: build/soong/ui/build/ninja.go 11 | 12 | Change-Id: I43c48a9b490cad2ea3c5fa0b9ea6e4cf6dee9065 13 | --- 14 | tools/releasetools/add_img_to_target_files.py | 46 +++++++++++++++++++ 15 | 1 file changed, 46 insertions(+) 16 | 17 | diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py 18 | index 09f69d040..1ff1a17ee 100644 19 | --- a/tools/releasetools/add_img_to_target_files.py 20 | +++ b/tools/releasetools/add_img_to_target_files.py 21 | @@ -844,6 +844,52 @@ def AddImagesToTargetFiles(filename): 22 | if output_zip: 23 | boot_image.AddToZip(output_zip) 24 | 25 | + def useCustomRecovery(boot_image_path): 26 | + magiskboot = os.getenv('CUSTOM_MAGISKBOOT') 27 | + recovery = os.getenv('CUSTOM_TWRP') 28 | + # Skip patching if relevant environment variables are defined 29 | + if not magiskboot or not recovery: 30 | + logger.info("[Custom Recovery] Skip...") 31 | + return 32 | + # Store the original working directory and switch to the new directory 33 | + origin_pwd = os.getcwd() 34 | + new_pwd = os.path.join(os.getcwd(), "tmp") 35 | + common.RunAndCheckOutput(["mkdir", "-p", new_pwd]) 36 | + os.chdir(new_pwd) 37 | + 38 | + # magiskboot unpack -n recovery.img 39 | + common.RunAndCheckOutput([magiskboot, "unpack", "-n", recovery]) 40 | + 41 | + # Exit if there are no required files 42 | + if not os.path.exists("ramdisk.cpio"): 43 | + logger.info("[Custom Recovery] It seems there is a problem with the Recovery you provided!!!") 44 | + common.RunAndCheckOutput(["rm", "-rf", new_pwd]) 45 | + os.chdir(origin_pwd) 46 | + return 47 | + 48 | + logger.info("[Custom Recovery]\tMagiskBoot:{}\tRecvoery:{}\tUse custom recovery!!!".format(magiskboot, recovery)) 49 | + # Replace recovery 50 | + common.RunAndCheckOutput(["cp", "-f", "ramdisk.cpio", "ramdisk-ofrp.cpio"]) 51 | + logger.info("[Custom Recovery] Copy {} to {}".format("ramdisk.cpio", "ramdisk-ofrp.cpio")) 52 | + common.RunAndCheckOutput(["rm", "-f", "ramdisk.cpio"]) 53 | + logger.info("[Custom Recovery] Delete {}".format("ramdisk.cpio")) 54 | + common.RunAndCheckOutput(["rm", "-f", "kernel", "dtb", "kernel_dtb"]) 55 | + logger.info("[Custom Recovery] Delete {} {} {}".format("kernel", "dtb", "kernel_dtb")) 56 | + common.RunAndCheckOutput([magiskboot, "unpack", "-h", "-n", boot_image_path]) 57 | + logger.info("[Custom Recovery] Unpack {}".format(boot_image_path)) 58 | + common.RunAndCheckOutput(["cp", "-f", "ramdisk-ofrp.cpio", "ramdisk.cpio"]) 59 | + logger.info("[Custom Recovery] Copy {} to {}".format("ramdisk-ofrp.cpio", "ramdisk.cpio")) 60 | + common.RunAndCheckOutput([magiskboot, "repack", "-n", boot_image_path]) 61 | + logger.info("[Custom Recovery] Repack {}".format(boot_image_path)) 62 | + common.RunAndCheckOutput(["mv", "-f", "new-boot.img", boot_image_path]) 63 | + logger.info("[Custom Recovery] Move {} to {}".format("new-boot.img", boot_image_path)) 64 | + common.RunAndCheckOutput(["rm", "-rf", new_pwd]) 65 | + common.RunAndCheckOutput([magiskboot, "cleanup"]) 66 | + logger.info("[Custom Recovery] Cleanup".format("new-boot.img", boot_image_path)) 67 | + os.chdir(origin_pwd) 68 | + # Use prebuilt twrp image if it exists. 69 | + useCustomRecovery(boot_image_path) 70 | + 71 | if has_init_boot: 72 | banner("init_boot") 73 | init_boot_image = common.GetBootableImage( 74 | -- 75 | 2.42.1 76 | 77 | -------------------------------------------------------------------------------- /System/Patches/LineageOS/custom_recovery/android_build_soong/0001-Env-allow-use-custom-TWRP.patch: -------------------------------------------------------------------------------- 1 | From 28a1220360ec8f403079f9668baf67e9c1eafb51 Mon Sep 17 00:00:00 2001 2 | From: easterNday <849919718@qq.com> 3 | Date: Sat, 18 Nov 2023 09:58:46 +0800 4 | Subject: [PATCH] Env: allow use custom TWRP 5 | 6 | * Allow CUSTOM_MAGISKBOOT and CUSTOM_TWRP to be set and read. 7 | * Used to specify a custom recovery. 8 | * Both of them must exist at the same time to take effect. 9 | * They should all be exported using absolute paths. 10 | 11 | - Linkage file: build/tools/releasetools/add_img_to_target_files.py 12 | 13 | Change-Id: Ic5e57f8550db3dc9ad95fbdf66b46b3d2c7823bd 14 | --- 15 | ui/build/ninja.go | 4 ++++ 16 | 1 file changed, 4 insertions(+) 17 | 18 | diff --git a/ui/build/ninja.go b/ui/build/ninja.go 19 | index dab1a9b58..d2bc240ba 100644 20 | --- a/ui/build/ninja.go 21 | +++ b/ui/build/ninja.go 22 | @@ -127,6 +127,10 @@ func runNinjaForBuild(ctx Context, config Config) { 23 | "TMPDIR", 24 | "USER", 25 | 26 | + // Custom TWRP 27 | + "CUSTOM_MAGISKBOOT", 28 | + "CUSTOM_TWRP", 29 | + 30 | // TODO: remove these carefully 31 | // Options for the address sanitizer. 32 | "ASAN_OPTIONS", 33 | -- 34 | 2.42.1 35 | 36 | -------------------------------------------------------------------------------- /System/Patches/LineageOS/manifests/0001-Devices-add-thyme-s-device-tree-in-easterNday.xml.patch: -------------------------------------------------------------------------------- 1 | From 550521767ee7c6c6b6e3a42fda9091ca466e94b4 Mon Sep 17 00:00:00 2001 2 | From: easterNday <849919718@qq.com> 3 | Date: Wed, 6 Sep 2023 12:59:50 +0800 4 | Subject: [PATCH] Devices: add thyme's device tree in easterNday.xml. 5 | 6 | * Add Codeberg & Gitlab remote; 7 | * GApps: add gms in easterNday.xml; 8 | * Use common device tree for thyme. 9 | 10 | Change-Id: I6d29dae4eed4f0c870865eb415306ab85a9892c8 11 | --- 12 | default.xml | 1 + 13 | snippets/easterNday.xml | 21 +++++++++++++++++++++ 14 | 2 files changed, 22 insertions(+) 15 | create mode 100644 snippets/easterNday.xml 16 | 17 | diff --git a/default.xml b/default.xml 18 | index 9afcbf2..8c7da2a 100644 19 | --- a/default.xml 20 | +++ b/default.xml 21 | @@ -1130,4 +1130,5 @@ 22 | 23 | 24 | 25 | + 26 | 27 | diff --git a/snippets/easterNday.xml b/snippets/easterNday.xml 28 | new file mode 100644 29 | index 0000000..8c5b8de 30 | --- /dev/null 31 | +++ b/snippets/easterNday.xml 32 | @@ -0,0 +1,21 @@ 33 | + 34 | + 35 | + 36 | + 37 | + 38 | + 39 | + 40 | + 41 | + 42 | + 43 | + 44 | + 45 | + 46 | + 47 | + 48 | + 49 | + 50 | + 51 | + 52 | + 53 | + 54 | -- 55 | 2.43.0 56 | 57 | -------------------------------------------------------------------------------- /System/Patches/LineageOS/mask/android_frameworks_base/0001-Photos-Unlimited-storage-achieved.patch: -------------------------------------------------------------------------------- 1 | From eeb47bd995c0b8950f08a091f7294bb44f3e398e Mon Sep 17 00:00:00 2001 2 | From: easterNday <849919718@qq.com> 3 | Date: Mon, 27 Nov 2023 12:46:48 +0800 4 | Subject: [PATCH] Photos: Unlimited storage achieved. 5 | 6 | * Achieve unlimited cloud storage of pictures by pretending to be a PixelXL model 7 | - Reference: https://github.com/crdroidandroid/android_frameworks_base/blob/cc484e53adfe6be0bb5582502f49800951ed48b5/core/java/com/android/internal/util/crdroid/PixelPropsUtils.java#L249 8 | - Reference: https://github.com/crdroidandroid/android_frameworks_base/blob/e0408b1c58f026f753950d1906d234cd400c8ccd/core/java/android/app/ApplicationPackageManager.java#L882-L890 9 | - Reference: https://github.com/BaltiApps/Pixelify-Google-Photos 10 | 11 | Change-Id: I50857dd69fde36d0124f1d4dd241ae97088acd26 12 | --- 13 | .../app/ApplicationPackageManager.java | 66 ++++++++++++++ 14 | core/java/android/app/Instrumentation.java | 6 ++ 15 | .../internal/util/easterNday/PropsUtils.java | 85 +++++++++++++++++++ 16 | 3 files changed, 157 insertions(+) 17 | create mode 100644 core/java/com/android/internal/util/easterNday/PropsUtils.java 18 | 19 | diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java 20 | index 475e0f4cb05b..d5f7949d380b 100644 21 | --- a/core/java/android/app/ApplicationPackageManager.java 22 | +++ b/core/java/android/app/ApplicationPackageManager.java 23 | @@ -764,8 +764,74 @@ public class ApplicationPackageManager extends PackageManager { 24 | } 25 | } 26 | 27 | + private static final String[] featuresPixel = { 28 | + "com.google.android.apps.photos.PIXEL_2019_PRELOAD", 29 | + "com.google.android.apps.photos.PIXEL_2019_MIDYEAR_PRELOAD", 30 | + "com.google.android.apps.photos.PIXEL_2018_PRELOAD", 31 | + "com.google.android.apps.photos.PIXEL_2017_PRELOAD", 32 | + "com.google.android.feature.PIXEL_2020_EXPERIENCE", 33 | + "com.google.android.feature.PIXEL_2020_MIDYEAR_EXPERIENCE", 34 | + "com.google.android.feature.PIXEL_2019_EXPERIENCE", 35 | + "com.google.android.feature.PIXEL_2019_MIDYEAR_EXPERIENCE", 36 | + "com.google.android.feature.PIXEL_2018_EXPERIENCE", 37 | + "com.google.android.feature.PIXEL_2017_EXPERIENCE", 38 | + "com.google.android.feature.PIXEL_EXPERIENCE", 39 | + "com.google.android.feature.GOOGLE_BUILD", 40 | + "com.google.android.feature.GOOGLE_EXPERIENCE" 41 | + }; 42 | + 43 | + private static final String[] featuresPixelOthers = { 44 | + "com.google.android.feature.ASI", 45 | + "com.google.android.feature.ANDROID_ONE_EXPERIENCE", 46 | + "com.google.android.feature.GOOGLE_FI_BUNDLED", 47 | + "com.google.android.feature.LILY_EXPERIENCE", 48 | + "com.google.android.feature.TURBO_PRELOAD", 49 | + "com.google.android.feature.WELLBEING", 50 | + "com.google.lens.feature.IMAGE_INTEGRATION", 51 | + "com.google.lens.feature.CAMERA_INTEGRATION", 52 | + "com.google.photos.trust_debug_certs", 53 | + "com.google.android.feature.AER_OPTIMIZED", 54 | + "com.google.android.feature.NEXT_GENERATION_ASSISTANT", 55 | + "android.software.game_service", 56 | + "com.google.android.feature.EXCHANGE_6_2", 57 | + "com.google.android.apps.dialer.call_recording_audio", 58 | + "com.google.android.apps.dialer.SUPPORTED" 59 | + }; 60 | + 61 | + private static final String[] featuresP23 = { 62 | + "com.google.android.feature.PIXEL_2024_EXPERIENCE", 63 | + "com.google.android.feature.PIXEL_2024_MIDYEAR_EXPERIENCE", 64 | + "com.google.android.feature.PIXEL_2023_EXPERIENCE", 65 | + "com.google.android.feature.PIXEL_2023_MIDYEAR_EXPERIENCE" 66 | + }; 67 | + 68 | + private static final String[] featuresTensor = { 69 | + "com.google.android.feature.PIXEL_2022_EXPERIENCE", 70 | + "com.google.android.feature.PIXEL_2022_MIDYEAR_EXPERIENCE", 71 | + "com.google.android.feature.PIXEL_2021_EXPERIENCE", 72 | + "com.google.android.feature.PIXEL_2021_MIDYEAR_EXPERIENCE" 73 | + }; 74 | + 75 | + private static final String[] featuresNexus = { 76 | + "com.google.android.apps.photos.NEXUS_PRELOAD", 77 | + "com.google.android.apps.photos.nexus_preload", 78 | + "com.google.android.feature.PIXEL_EXPERIENCE", 79 | + "com.google.android.feature.GOOGLE_BUILD", 80 | + "com.google.android.feature.GOOGLE_EXPERIENCE" 81 | + }; 82 | + 83 | @Override 84 | public boolean hasSystemFeature(String name) { 85 | + String packageName = ActivityThread.currentPackageName(); 86 | + if (packageName != null && 87 | + packageName.equals("com.google.android.apps.photos") && 88 | + SystemProperties.getBoolean("persist.sys.pixelprops.gphotos", true)) { 89 | + if (Arrays.asList(featuresPixel).contains(name)) return false; 90 | + if (Arrays.asList(featuresPixelOthers).contains(name)) return true; 91 | + if (Arrays.asList(featuresP23).contains(name)) return false; 92 | + if (Arrays.asList(featuresTensor).contains(name)) return false; 93 | + if (Arrays.asList(featuresNexus).contains(name)) return true; 94 | + } 95 | return hasSystemFeature(name, 0); 96 | } 97 | 98 | diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java 99 | index 556058b567f9..02f85b03a049 100644 100 | --- a/core/java/android/app/Instrumentation.java 101 | +++ b/core/java/android/app/Instrumentation.java 102 | @@ -64,6 +64,8 @@ import java.util.ArrayList; 103 | import java.util.List; 104 | import java.util.concurrent.TimeoutException; 105 | 106 | +import com.android.internal.util.easterNday.PropsUtils; 107 | + 108 | /** 109 | * Base class for implementing application instrumentation code. When running 110 | * with instrumentation turned on, this class will be instantiated for you 111 | @@ -1242,6 +1244,8 @@ public class Instrumentation { 112 | Application app = getFactory(context.getPackageName()) 113 | .instantiateApplication(cl, className); 114 | app.attach(context); 115 | + String packageName = context.getPackageName(); 116 | + PropsUtils.setProps(packageName); 117 | return app; 118 | } 119 | 120 | @@ -1259,6 +1263,8 @@ public class Instrumentation { 121 | ClassNotFoundException { 122 | Application app = (Application)clazz.newInstance(); 123 | app.attach(context); 124 | + String packageName = context.getPackageName(); 125 | + PropsUtils.setProps(packageName); 126 | return app; 127 | } 128 | 129 | diff --git a/core/java/com/android/internal/util/easterNday/PropsUtils.java b/core/java/com/android/internal/util/easterNday/PropsUtils.java 130 | new file mode 100644 131 | index 000000000000..7b3af205e120 132 | --- /dev/null 133 | +++ b/core/java/com/android/internal/util/easterNday/PropsUtils.java 134 | @@ -0,0 +1,85 @@ 135 | +package com.android.internal.util.easterNday; 136 | + 137 | +import android.app.Application; 138 | +import android.os.Build; 139 | +import android.os.SystemProperties; 140 | +import android.util.Log; 141 | + 142 | +import java.lang.reflect.Field; 143 | +import java.util.ArrayList; 144 | +import java.util.Arrays; 145 | +import java.util.Collections; 146 | +import java.util.HashMap; 147 | +import java.util.Map; 148 | + 149 | +public class PropsUtils { 150 | + 151 | + private static final String TAG = PropsUtils.class.getSimpleName(); 152 | + private static final String DEVICE = "ro.product.device"; 153 | + private static final boolean DEBUG = false; 154 | + 155 | + private static final Map propsToChangeGeneric; 156 | + private static final Map propsToChangePixelXL; 157 | + private static final Map> propsToKeep; 158 | + 159 | + 160 | + private static volatile boolean sIsGms = false; 161 | + private static volatile boolean sIsFinsky = false; 162 | + 163 | + static { 164 | + propsToKeep = new HashMap<>(); 165 | + propsToKeep.put("com.google.android.settings.intelligence", new ArrayList<>(Collections.singletonList("FINGERPRINT"))); 166 | + 167 | + propsToChangeGeneric = new HashMap<>(); 168 | + propsToChangeGeneric.put("TYPE", "user"); 169 | + propsToChangeGeneric.put("TAGS", "release-keys"); 170 | + 171 | + propsToChangePixelXL = new HashMap<>(); 172 | + propsToChangePixelXL.put("BRAND", "google"); 173 | + propsToChangePixelXL.put("MANUFACTURER", "Google"); 174 | + propsToChangePixelXL.put("DEVICE", "marlin"); 175 | + propsToChangePixelXL.put("PRODUCT", "marlin"); 176 | + propsToChangePixelXL.put("HARDWARE", "marlin"); 177 | + propsToChangePixelXL.put("MODEL", "Pixel XL"); 178 | + propsToChangePixelXL.put("ID", "QP1A.191005.007.A3"); 179 | + propsToChangePixelXL.put("FINGERPRINT", "google/marlin/marlin:10/QP1A.191005.007.A3/5972272:user/release-keys"); 180 | + } 181 | + 182 | + public static void setProps(String packageName) { 183 | + propsToChangeGeneric.forEach((k, v) -> setPropValue(k, v)); 184 | + 185 | + if (packageName == null || packageName.isEmpty()) { 186 | + return; 187 | + } 188 | + 189 | + Map propsToChange = new HashMap<>(); 190 | + 191 | + if (packageName.equals("com.google.android.apps.photos")) { 192 | + propsToChange.putAll(propsToChangePixelXL); 193 | + } 194 | + 195 | + if (DEBUG) Log.d(TAG, "Defining props for: " + packageName); 196 | + for (Map.Entry prop : propsToChange.entrySet()) { 197 | + String key = prop.getKey(); 198 | + Object value = prop.getValue(); 199 | + if (propsToKeep.containsKey(packageName) && propsToKeep.get(packageName).contains(key)) { 200 | + if (DEBUG) Log.d(TAG, "Not defining " + key + " prop for: " + packageName); 201 | + continue; 202 | + } 203 | + if (DEBUG) Log.d(TAG, "Defining " + key + " prop for: " + packageName); 204 | + setPropValue(key, value); 205 | + } 206 | + } 207 | + 208 | + private static void setPropValue(String key, Object value) { 209 | + try { 210 | + if (DEBUG) Log.d(TAG, "Defining prop " + key + " to " + value.toString()); 211 | + Field field = Build.class.getDeclaredField(key); 212 | + field.setAccessible(true); 213 | + field.set(null, value); 214 | + field.setAccessible(false); 215 | + } catch (NoSuchFieldException | IllegalAccessException e) { 216 | + Log.e(TAG, "Failed to set prop " + key, e); 217 | + } 218 | + } 219 | +} 220 | \ No newline at end of file 221 | -- 222 | 2.43.0 223 | 224 | -------------------------------------------------------------------------------- /System/Patches/apply.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import xml.etree.ElementTree as ET 4 | import sys 5 | 6 | 7 | # 解析 manifests 中的 project 字段信息 8 | def parse_manifests(manifests_dir): 9 | project = {} 10 | for subdir, dirs, files in os.walk(manifests_dir): 11 | for file in files: 12 | if file.endswith('.xml'): 13 | file_path = os.path.join(subdir, file) 14 | tree = ET.parse(file_path) 15 | root = tree.getroot() 16 | for child in root: 17 | if child.tag == 'project': 18 | project[child.attrib['name'].split( 19 | '/')[-1]] = child.attrib['path'] 20 | return project 21 | 22 | 23 | if __name__ == '__main__': 24 | root_dir = sys.argv[1] 25 | patch_search_dir = sys.argv[2] 26 | manifests_dir = os.path.join(root_dir, ".repo", "manifests") 27 | 28 | project = parse_manifests(manifests_dir) 29 | for item in os.scandir(patch_search_dir): 30 | if item.is_dir(): 31 | print(item.path, item.name, project[item.name]) 32 | apply_dir = os.path.join(root_dir, project[item.name]) 33 | patch_dir = os.path.join(patch_search_dir, item.name) 34 | # 改变当前工作目录 35 | os.chdir(apply_dir) 36 | # 执行命令并获取输出 37 | try: 38 | output = subprocess.check_output( 39 | "git am %s/*.patch" % (patch_dir), shell=True, stderr=subprocess.STDOUT) 40 | except subprocess.CalledProcessError as e: 41 | output = e.output 42 | finally: 43 | # 输出命令的输出 44 | print(output.decode()) 45 | -------------------------------------------------------------------------------- /System/README.md: -------------------------------------------------------------------------------- 1 | # DogDayAndroid Buildbot 2 | 3 | English | [中文](./README.zh_CN.md) 4 | 5 | --- 6 | 7 | This is a personal modification based on `LineageOS`. 8 | 9 | --- 10 | 11 | ## Instructions 12 | 13 | ```bash 14 | chmod +x build.sh 15 | bash build.sh 16 | ``` 17 | 18 | ## Supported patches 19 | 20 | ### Custom Recovery 21 | 22 | This patch is implemented by me personally. The specific principle is to integrate the customized `Recovery` into the flash package by modifying the compilation process. 23 | 24 | The tools involved are: 25 | 26 | - [xiaoxindada/magiskboot_ndk_on_linux](https://github.com/xiaoxindada/magiskboot_ndk_on_linux) 27 | 28 | The entire replacement process refers to the packaging script of `OrangeFox`. After applying this patch, you need to export the following environment variables: 29 | 30 | ```bash 31 | export CUSTOM_MAGISKBOOT= 32 | export CUSTOM_TWRP= 33 | ``` 34 | 35 | Then execute this script to replace the original `boot.img` when the final kernel is packaged. 36 | 37 | _It is worth noting that this patch may currently only support the replacement and modification of `boot.img`. You may need to test other forms by yourself. If you find that it does not work, please refer to my patch and submit a `Pull Request` to me. _ 38 | 39 | ### Google Photos 40 | 41 | Spoof `Google Photos` to achieve unlimited image cloud storage by disguising the device model as `PixelXL`. 42 | 43 | This part is modified from: 44 | 45 | - [crDroid](https://github.com/crdroidandroid/android_frameworks_base/blob/cc484e53adfe6be0bb5582502f49800951ed48b5/core/java/com/android/internal/util/crdroid/PixelPropsUtils.java#L249) 46 | 47 | ## Reference 48 | 49 | - [ponces/treble_build_pe](https://github.com/ponces/treble_build_pe) 50 | -------------------------------------------------------------------------------- /System/README.zh_CN.md: -------------------------------------------------------------------------------- 1 | # DogDayAndroid Buildbot 2 | 3 | [English](./README.md) | 中文文档 4 | 5 | --- 6 | 7 | 这是一个基于 `LineageOS` 的个人修改版。 8 | 9 | --- 10 | 11 | ## 使用方法 12 | 13 | ```bash 14 | chmod +x build.sh 15 | bash build.sh 16 | ``` 17 | 18 | ## 支持的补丁 19 | 20 | ### 自定义 Recovery 21 | 22 | 这个补丁由我个人实现,具体原理是通过修改编译流程来实现集成自定义的 `Recovery` 到刷机包中,如果您想了解具体的实现原理,请查看 [自定义 Recovery](https://easternday.top/Topic/Android/ROM/System/custom_recovery) 这个教程。 23 | 24 | 其中涉及到的工具有: 25 | 26 | - [xiaoxindada/magiskboot_ndk_on_linux](https://github.com/xiaoxindada/magiskboot_ndk_on_linux) 27 | 28 | 整个替换流程参考了 `OrangeFox` 的打包脚本,应用此补丁后您需要导出如下环境变量: 29 | 30 | ```bash 31 | export CUSTOM_MAGISKBOOT=<指向您使用的 MagiskBoot 工具的绝对路径> 32 | export CUSTOM_TWRP=<指向您需要替换的 Recovery 镜像的绝对路径> 33 | ``` 34 | 35 | 随后执行本脚本即可在最后内核打包的时候替换原有的 `boot.img`。 36 | 37 | _值得注意的是,本补丁目前可能仅支持 `boot.img` 的替换修改,其他形式的可能需要您自行测验,如果您发现不行,请参照我的补丁给我提交 `Pull Request`。_ 38 | 39 | ### 谷歌照片 40 | 41 | 通过将设备型号伪装为 `PixelXL` 来欺骗 `Google Photos` 从而实现无限图片云端存储。 42 | 43 | 这部分修改参考自: 44 | 45 | - [crDroid](https://github.com/crdroidandroid/android_frameworks_base/blob/cc484e53adfe6be0bb5582502f49800951ed48b5/core/java/com/android/internal/util/crdroid/PixelPropsUtils.java#L249) 46 | 47 | ## 参考 48 | 49 | - [ponces/treble_build_pe](https://github.com/ponces/treble_build_pe) 50 | -------------------------------------------------------------------------------- /System/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 4 | echo "--------------------------------------" 5 | echo " DogDayAndroid Buildbot " 6 | echo " by " 7 | echo " easterNday " 8 | echo "--------------------------------------" 9 | echo 10 | 11 | # set -xe 12 | set -e 13 | 14 | # 获取脚本所在路径 15 | ROOT=$(cd $(dirname $0);pwd) 16 | 17 | # BL=$PWD/treble_build_pe 18 | OUTPUTS=$ROOT/builds 19 | 20 | # 初始化仓库 21 | initRepos() { 22 | if [ ! -d $ROOT/LineageOS ]; then 23 | mkdir -p $ROOT/LineageOS 24 | cd $ROOT/LineageOS 25 | echo "--> Initializing LineageOS Repo" 26 | repo init -u https://github.com/LineageOS/android -b lineage-20.0 --git-lfs 27 | echo 28 | fi 29 | } 30 | 31 | # 仓库应用DogDay补丁 32 | applyManifestsPatches() { 33 | if [ -d $ROOT/LineageOS ]; then 34 | cd $ROOT/LineageOS/.repo/manifests 35 | echo "--> Discard Manifests Changes" 36 | git fetch origin 37 | git reset --hard origin/lineage-20.0 38 | echo 39 | 40 | echo "--> Patching Repo Manifests" 41 | git am $ROOT/Patches/LineageOS/manifests/*.patch 42 | echo 43 | fi 44 | } 45 | 46 | # 同步仓库内容 47 | syncRepos() { 48 | if [ -d $ROOT/LineageOS ]; then 49 | cd $ROOT/LineageOS 50 | echo "--> Syncing repos" 51 | repo sync -c --force-sync --no-clone-bundle --no-tags -j16 52 | echo 53 | fi 54 | } 55 | 56 | # applyPatches() { 57 | # echo "--> Applying prerequisite patches" 58 | # bash $BL/apply-patches.sh $BL prerequisite 59 | # echo 60 | 61 | # echo "--> Applying TrebleDroid patches" 62 | # bash $BL/apply-patches.sh $BL trebledroid 63 | # echo 64 | 65 | # echo "--> Applying personal patches" 66 | # bash $BL/apply-patches.sh $BL personal 67 | # echo 68 | 69 | # echo "--> Generating makefiles" 70 | # cd device/phh/treble 71 | # cp $BL/pe.mk . 72 | # bash generate.sh pe 73 | # cd ../../.. 74 | # echo 75 | # } 76 | 77 | # 应用补丁 78 | applyPatches() { 79 | cd $ROOT/Patches/LineageOS 80 | 81 | echo "--> Applying personal patches" 82 | # Device camouflage patch 83 | python $ROOT/Patches/apply.py $ROOT/LineageOS $ROOT/Patches/LineageOS/mask 84 | # Custom recovery patch 85 | python $ROOT/Patches/apply.py $ROOT/LineageOS $ROOT/Patches/LineageOS/custom_recovery 86 | echo 87 | } 88 | 89 | # 设置环境 90 | setupEnv() { 91 | echo "--> Setting up build environment" 92 | cd $ROOT/LineageOS 93 | source build/envsetup.sh 94 | # mkdir -p $OUTPUTS 95 | echo 96 | } 97 | 98 | # 开始编译 99 | build() { 100 | echo "--> Building DogDayAndroid" 101 | export RELEASE_TYPE=RELEASE 102 | lunch lineage_thyme-userdebug 103 | croot 104 | mka clobber 105 | mka bacon -j$(( $(nproc --all) / 2 )) 2>&1 | tee build.log 106 | # mv $OUT/system.img $BD/system-treble_arm64_bvN-slim.img 107 | echo 108 | } 109 | 110 | # buildVariant() { 111 | # echo "--> Building treble_arm64_bvN" 112 | # lunch treble_arm64_bvN-userdebug 113 | # make -j$(nproc --all) installclean 114 | # make -j$(nproc --all) systemimage 115 | # mv $OUT/system.img $BD/system-treble_arm64_bvN.img 116 | # echo 117 | # } 118 | 119 | # generateOta() { 120 | # echo "--> Generating OTA file" 121 | # version="$(date +v%Y.%m.%d)" 122 | # timestamp="$START" 123 | # json="{\"version\": \"$version\",\"date\": \"$timestamp\",\"variants\": [" 124 | # find $BD/ -name "PixelExperience_*" | sort | { 125 | # while read file; do 126 | # filename="$(basename $file)" 127 | # if [[ $filename == *"vndklite"* ]]; then 128 | # name="treble_arm64_bvN-vndklite" 129 | # elif [[ $filename == *"slim"* ]]; then 130 | # name="treble_arm64_bvN-slim" 131 | # else 132 | # name="treble_arm64_bvN" 133 | # fi 134 | # size=$(wc -c $file | awk '{print $1}') 135 | # url="https://github.com/ponces/treble_build_pe/releases/download/$version/$filename" 136 | # json="${json} {\"name\": \"$name\",\"size\": \"$size\",\"url\": \"$url\"}," 137 | # done 138 | # json="${json%?}]}" 139 | # echo "$json" | jq . > $BL/ota.json 140 | # } 141 | # echo 142 | # } 143 | 144 | START=$(date +%s) 145 | 146 | initRepos 147 | applyManifestsPatches 148 | syncRepos 149 | applyPatches 150 | setupEnv 151 | build 152 | 153 | # generatePackages 154 | # generateOta 155 | 156 | END=$(date +%s) 157 | ELAPSEDM=$(($(($END-$START))/60)) 158 | ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60)) 159 | 160 | echo "--> Buildbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds" 161 | echo -------------------------------------------------------------------------------- /TWRP/README.md: -------------------------------------------------------------------------------- 1 | # Builde your Own TWRP 2 | 3 | Only support OrangeFox now! 4 | 5 | ## Reference 6 | 7 | - [azwhikaru/Action-OFRP-Builder](https://github.com/azwhikaru/Action-OFRP-Builder) 8 | -------------------------------------------------------------------------------- /TWRP/configs/thyme.config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "OrangeFox": { 4 | "Repo": "https://gitlab.com/OrangeFox/sync.git", 5 | "Branch": "12.1" 6 | }, 7 | "Device": { 8 | "Repo": "https://codeberg.org/DogDayAndroid/twrp_device_xiaomi_thyme", 9 | "Branch": "android-13", 10 | "Location": "device/xiaomi/thyme", 11 | "DeviceName": "thyme", 12 | "Makefile": "twrp_thyme", 13 | "BootPartition": "boot" 14 | } 15 | } 16 | ] --------------------------------------------------------------------------------