Build droidian kernel #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is a basic workflow to help you get started with Actions | |
| name: Build droidian kernel | |
| # Controls when the workflow will run | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the "master" branch | |
| push: | |
| tags: | |
| - '*' | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "build" | |
| build: | |
| name: Build kernel | |
| runs-on: ubuntu-latest | |
| container: quay.io/droidian/build-essential:current-amd64 | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: melt-rebase | |
| - name: Update & install dependencies | |
| run: | | |
| apt update | |
| apt install curl aria2 git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison build-essential dpkg-dev findutils android-platform-prebuilts-python-linux-x86-2.7.5 bc rsync kmod cpio bison flex libssl-dev avbtool binutils-aarch64-linux-gnu gcc-4.9-aarch64-linux-android g++-4.9-aarch64-linux-android libgcc-4.9-dev-aarch64-linux-android-cross lz4 linux-packaging-snippets -y | |
| #wget https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/main/clang-r547379.tar.gz -O /clang.tar.gz | |
| #aria2c -x 10 -s 10 -j 10 https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/main/clang-r547379.tar.gz -o clang.tar.gz -d / | |
| aria2c -x 10 -s 10 -j 10 https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.2/LLVM-20.1.2-Linux-X64.tar.xz -o clang.tar.xz -d / | |
| mkdir /clang | |
| #tar -xvf /clang.tar.gz -C /clang | |
| tar -xvf /clang.tar.xz -C /clang | |
| mv /clang/*/* /clang/ | |
| rm -rf /clang.tar.xz | |
| - name: Apply patches | |
| run: | | |
| mkdir patches | |
| curl https://github.com/Pzqqt/android_kernel_xiaomi_marble/compare/melt-rebase...melt-rebase-4LazyGoogle.diff -o patches/4LazyGoogle.diff || exit | |
| curl https://github.com/Pzqqt/android_kernel_xiaomi_marble/compare/melt-rebase-4LazyGoogle...melt-rebase-hyperos.diff -o patches/hyperos.diff || exit | |
| git apply --check --ignore-space-change --ignore-whitespace < ./patches/4LazyGoogle.diff || exit | |
| git apply --ignore-space-change --ignore-whitespace < ./patches/4LazyGoogle.diff || exit | |
| git apply --check --ignore-space-change --ignore-whitespace < ./patches/hyperos.diff || exit | |
| git apply --ignore-space-change --ignore-whitespace < ./patches/hyperos.diff || exit | |
| git apply --check --ignore-space-change --ignore-whitespace < ./lxcbuild/lxc_support.diff | |
| git apply --ignore-space-change --ignore-whitespace < ./lxcbuild/lxc_support.diff | |
| git apply --check --ignore-space-change --ignore-whitespace < ./debian/droidian.diff | |
| git apply --ignore-space-change --ignore-whitespace < ./debian/droidian.diff | |
| - name: Install package build dependencies | |
| run: | | |
| package_info=$(head -n 1 debian/changelog) | |
| package_name=$(echo "${package_info}" | awk '{ print $1 }') | |
| mk-build-deps --remove --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" debian/control | |
| rm -f ${package_name}-build-deps_*.* | |
| - name: Build kernel | |
| run: | | |
| export PATH=/clang/bin:/opt/android/prebuilts/python/2.7.5/bin:$PATH | |
| ARGS="--no-lintian -F -d -sa --no-sign --jobs=$(nproc) -aarm64" | |
| eval debuild "${ARGS}" | |
| - name: Move kernel to out directory | |
| run: | | |
| mkdir /out | |
| cp ../*.deb /out/ | |
| cp ../*.dsc /out/ | |
| cp ../*.tar.xz /out/ | |
| cp out/KERNEL_OBJ/boot.img /out/ | |
| ls /out | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-kernel | |
| path: /out/*.* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| prepare: | |
| runs-on: ubuntu-20.04 | |
| name: Create GitHub release | |
| needs: build | |
| steps: | |
| - name: Delete old latest release | |
| uses: dev-drprasad/[email protected] | |
| with: | |
| delete_release: true # default: false | |
| tag_name: latest-droidian # tag name to delete | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Tag latest | |
| uses: tvdias/[email protected] | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: latest-droidian | |
| publish: | |
| runs-on: ubuntu-20.04 | |
| needs: prepare | |
| name: Publish linux-kernel | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: out | |
| - name: Create latest release | |
| uses: softprops/[email protected] | |
| with: | |
| files: out/linux-kernel/*.* | |
| tag_name: latest-droidian | |
| draft: false | |
| prerelease: false |