├── .drone.yml ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── .ymllint │ ├── apfs.yml │ ├── debian.yml │ ├── instructions.txt │ ├── kconfig.yml │ ├── kernel-update.yml │ ├── kernel.yml │ ├── lts.yml │ └── mainline.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── apt-repo ├── Dockerfile ├── README.md ├── apfs_ver.txt └── nginx.conf ├── build.sh ├── build_in_docker.sh ├── patch_driver.sh ├── patches └── Readme.md └── templates ├── Kconfig ├── default-config-debian └── default-config-ubuntu /.drone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: pipeline 3 | name: mbp-ubuntu-kernel 4 | 5 | trigger: 6 | event: 7 | exclude: 8 | - pull_request 9 | 10 | steps: 11 | - name: lint 12 | image: alpine 13 | pull: always 14 | commands: 15 | - apk add --no-cache shellcheck python3 py-pip bash 16 | - pip install yamllint 17 | - yamllint . 18 | - shellcheck ./*.sh 19 | 20 | - name: build 21 | image: ubuntu:20.04 22 | pull: always 23 | volumes: 24 | - name: build-artifacts 25 | path: /tmp/artifacts 26 | commands: 27 | - ./build.sh 28 | 29 | - name: publish-github 30 | image: plugins/github-release 31 | volumes: 32 | - name: build-artifacts 33 | path: /tmp/artifacts 34 | settings: 35 | api_key: 36 | from_secret: github_token 37 | files: /tmp/artifacts/* 38 | prerelease: true 39 | when: 40 | event: tag 41 | 42 | volumes: 43 | - name: build-artifacts 44 | temp: {} 45 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [AdityaGarg8] 4 | custom: ['https://www.buymeacoffee.com/gargadityav'] 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "daily" 12 | target-branch: "LTS" 13 | - package-ecosystem: "github-actions" 14 | directory: "/" 15 | schedule: 16 | interval: "daily" 17 | target-branch: "Mainline-Xanmod" 18 | - package-ecosystem: "github-actions" 19 | directory: "/" 20 | schedule: 21 | interval: "daily" 22 | target-branch: "LTS-Xanmod" 23 | -------------------------------------------------------------------------------- /.github/workflows/.ymllint: -------------------------------------------------------------------------------- 1 | rules: 2 | 3 | line-length: disable 4 | -------------------------------------------------------------------------------- /.github/workflows/apfs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: APFS driver update script 3 | 4 | on: 5 | schedule: 6 | - cron: '30 18 * * *' 7 | workflow_dispatch: 8 | 9 | jobs: 10 | Publish: 11 | runs-on: ubuntu-latest 12 | steps: 13 | 14 | - name: 'Checkout Repo' 15 | uses: actions/checkout@v4 16 | with: 17 | persist-credentials: false 18 | fetch-depth: 0 19 | - name: Configure GPG Key 20 | run: | 21 | echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import 22 | env: 23 | GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} 24 | 25 | - name: Get the latest driver 26 | id: publish 27 | run: | 28 | source ${{ github.workspace }}/apt-repo/apfs_ver.txt 29 | 30 | echo "currenthash=${CURRENT_HASH}" >> $GITHUB_ENV 31 | echo "releasever=${RELEASE_VER}" >> $GITHUB_ENV 32 | 33 | git clone --depth 1 https://github.com/linux-apfs/linux-apfs-rw.git 34 | cd linux-apfs-rw 35 | LATEST_HASH=$(git rev-parse HEAD) 36 | echo "latesthash=${LATEST_HASH}" >> $GITHUB_ENV 37 | DKMS_VER=$(cat ./dkms.conf | grep PACKAGE_VERSION | cut -d "\"" -f 2) 38 | DKMS_NAME=$(cat ./dkms.conf | grep PACKAGE_NAME | cut -d "\"" -f 2) 39 | rm -r .git 40 | rm .gitignore 41 | rm README.rst 42 | 43 | if [[ ${CURRENT_HASH} = ${LATEST_HASH} ]] 44 | then 45 | echo "publish=no" >> $GITHUB_ENV 46 | exit 0 47 | else 48 | echo "publish=yes" >> $GITHUB_ENV 49 | RELEASE_VER_MAIN=$(echo ${RELEASE_VER} | cut -d "-" -f 1) 50 | if [[ ${RELEASE_VER_MAIN} != ${DKMS_VER} ]] 51 | then 52 | NEW_RELEASE_VER=${DKMS_VER}-1 53 | else 54 | RELEASE_VER_SUB=$(echo ${RELEASE_VER} | cut -d "-" -f 2) 55 | NEW_RELEASE_VER_SUB=$((${RELEASE_VER_SUB} + 1)) 56 | NEW_RELEASE_VER=${DKMS_VER}-${NEW_RELEASE_VER_SUB} 57 | fi 58 | echo "ver=${NEW_RELEASE_VER}" >> $GITHUB_ENV 59 | cd ${{ github.workspace }} 60 | mkdir linux-apfs 61 | cd linux-apfs 62 | mkdir usr 63 | cd usr 64 | mkdir src 65 | cd src 66 | mkdir ${DKMS_NAME}-${DKMS_VER} 67 | cp -r ${{ github.workspace }}/linux-apfs-rw/* ${{ github.workspace }}/linux-apfs/usr/src/${DKMS_NAME}-${DKMS_VER} 68 | cd ${{ github.workspace }}/linux-apfs 69 | mkdir DEBIAN 70 | cd DEBIAN 71 | 72 | echo "Package: apfs-dkms" > control 73 | echo "Version: ${NEW_RELEASE_VER}" >> control 74 | echo "Maintainer: Aditya Garg" >> control 75 | echo "Architecture: all" >> control 76 | echo "Description: Apple File System driver for Linux" >> control 77 | echo "Depends: dkms" >> control 78 | 79 | echo "dkms add -m linux-apfs-rw -v ${DKMS_VER}" > postinst 80 | echo "dkms build -m linux-apfs-rw -v ${DKMS_VER} && dkms install -m linux-apfs-rw -v ${DKMS_VER} || true" >> postinst 81 | 82 | echo "dkms remove -m linux-apfs-rw -v ${DKMS_VER} --all || true" > prerm 83 | 84 | chmod 755 ./postinst 85 | chmod 755 ./prerm 86 | 87 | cd ${{ github.workspace }} 88 | dpkg-deb --build --root-owner-group linux-apfs 89 | 90 | git clone https://github.com/AdityaGarg8/t2-ubuntu-repo.git 91 | mv ${{ github.workspace }}/linux-apfs.deb ${{ github.workspace }}/t2-ubuntu-repo 92 | cd ${{ github.workspace }}/t2-ubuntu-repo 93 | # Packages & Packages.gz 94 | dpkg-name ./linux-apfs.deb 95 | dpkg-scanpackages --multiversion . > Packages 96 | gzip -k -f Packages 97 | # Release, Release.gpg & InRelease 98 | apt-ftparchive release . > Release 99 | gpg --default-key "${GPG_SIGNING_EMAIL}" -abs -o - Release > Release.gpg 100 | gpg --default-key "${GPG_SIGNING_EMAIL}" --clearsign -o - Release > InRelease 101 | cd ${{ github.workspace }} 102 | fi 103 | env: 104 | GPG_SIGNING_EMAIL: ${{ secrets.GPG_SIGNING_EMAIL }} 105 | - name: Publish 106 | if: env.publish == 'yes' 107 | uses: cpina/github-action-push-to-another-repository@main 108 | env: 109 | SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} 110 | with: 111 | source-directory: 't2-ubuntu-repo' 112 | destination-github-username: 'AdityaGarg8' 113 | destination-repository-name: 't2-ubuntu-repo' 114 | user-email: github-actions[bot]@users.noreply.github.com 115 | user-name: github-actions[bot] 116 | target-branch: main 117 | commit-message: Update APFS driver to v${{ env.ver }} 118 | - name: Cleanup and update the repo 119 | if: env.publish == 'yes' 120 | id: clean 121 | run: | 122 | cd ${{ github.workspace }} 123 | rm -r linux-apfs-rw 124 | rm -r linux-apfs 125 | rm -r t2-ubuntu-repo 126 | sed -i "s/${{ env.releasever }}/${{ env.ver }}/g" ${{ github.workspace }}/apt-repo/apfs_ver.txt 127 | sed -i "s/${{ env.currenthash }}/${{ env.latesthash }}/g" ${{ github.workspace }}/apt-repo/apfs_ver.txt 128 | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" 129 | git config --local user.name "github-actions[bot]" 130 | git commit -m "Update APFS driver to v${{ env.ver }}" -a 131 | - name: Push changes to the repo 132 | if: env.publish == 'yes' 133 | uses: ad-m/github-push-action@master 134 | with: 135 | github_token: ${{ secrets.PAT }} 136 | branch: ${{ github.ref }} 137 | -------------------------------------------------------------------------------- /.github/workflows/debian.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Debian Kernel update script package 3 | 4 | # yamllint disable-line rule:truthy 5 | on: 6 | workflow_dispatch: 7 | jobs: 8 | Publish: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: 'Checkout Repo' 12 | uses: actions/checkout@v4 13 | 14 | - name: Configure GPG Key 15 | run: | 16 | echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import 17 | env: 18 | GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} 19 | 20 | - name: Get the kernel upgrade script 21 | id: publish 22 | run: | 23 | git clone -b script https://github.com/t2linux/T2-Ubuntu-Kernel.git 24 | chmod 755 ${{ github.workspace }}/T2-Ubuntu-Kernel/t2-kernel-script-debian/DEBIAN/postinst 25 | version=$(cat ${{ github.workspace }}/T2-Ubuntu-Kernel/t2-kernel-script-debian/DEBIAN/control | grep Version | cut -d ':' -f 2 | xargs) 26 | echo "ver=${version}" >> $GITHUB_ENV 27 | cd ${{ github.workspace }}/T2-Ubuntu-Kernel 28 | dpkg-deb --build --root-owner-group -Zgzip t2-kernel-script-debian 29 | cd ${{ github.workspace }} 30 | git clone https://github.com/AdityaGarg8/t2-ubuntu-repo.git 31 | cp -r ${{ github.workspace }}/T2-Ubuntu-Kernel/t2-kernel-script-debian.deb ${{ github.workspace }}/t2-ubuntu-repo 32 | cd ${{ github.workspace }}/t2-ubuntu-repo 33 | # Packages & Packages.gz 34 | dpkg-scanpackages --multiversion . > Packages 35 | gzip -k -f Packages 36 | # Release, Release.gpg & InRelease 37 | apt-ftparchive release . > Release 38 | gpg --default-key "${GPG_SIGNING_EMAIL}" -abs -o - Release > Release.gpg 39 | gpg --default-key "${GPG_SIGNING_EMAIL}" --clearsign -o - Release > InRelease 40 | cd ${{ github.workspace }} 41 | env: 42 | GPG_SIGNING_EMAIL: ${{ secrets.GPG_SIGNING_EMAIL }} 43 | - name: Publish 44 | if: github.ref == 'refs/heads/Mainline' 45 | uses: cpina/github-action-push-to-another-repository@main 46 | env: 47 | SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} 48 | with: 49 | source-directory: 't2-ubuntu-repo' 50 | destination-github-username: 'AdityaGarg8' 51 | destination-repository-name: 't2-ubuntu-repo' 52 | user-email: github-actions[bot]@users.noreply.github.com 53 | user-name: github-actions[bot] 54 | target-branch: main 55 | commit-message: Update Debian kernel update script to v${{ env.ver }} 56 | -------------------------------------------------------------------------------- /.github/workflows/instructions.txt: -------------------------------------------------------------------------------- 1 | Installation instructions are given [here](https://github.com/t2linux/T2-Ubuntu-Kernel#pre-installation-steps). 2 | -------------------------------------------------------------------------------- /.github/workflows/kconfig.yml: -------------------------------------------------------------------------------- 1 | name: Get Kernel config 2 | on: 3 | workflow_dispatch: 4 | jobs: 5 | Get-config: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: 'Checkout Repo' 9 | uses: actions/checkout@v4 10 | 11 | - name: Get kconfig 12 | run: | 13 | mkdir /tmp/artifacts 14 | sudo apt update 15 | wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh 16 | chmod +x ubuntu-mainline-kernel.sh 17 | sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/ 18 | latestupstream=$(curl -sL https://kernel.org/ | grep "latest_button" -A 1 | awk "NR==2" | cut -d "/" -f 8 | cut -d "\"" -f 1 | cut -d "-" -f 2 | rev | cut -c 8- | rev) 19 | sudo ubuntu-mainline-kernel.sh -i --yes || 20 | (sub=$(echo ${latestupstream} | cut -d "." -f 3) && 21 | main=$(echo ${latestupstream} | cut -d "." -f 1,2) && 22 | newsub=$((${sub} - 1)) && 23 | newlatest=${main}.${newsub} && 24 | sudo sed -i "s/version=.*/version=v${newlatest}/g" /usr/local/bin/ubuntu-mainline-kernel.sh && 25 | sudo ubuntu-mainline-kernel.sh -i --yes) || echo "Failed" 26 | 27 | LTS_VER=6.12 28 | latestupstream=$(curl -sL https://kernel.org/ | grep ${LTS_VER} | grep tar.xz | cut -d "/" -f 8 | cut -d "\"" -f 1 | cut -d "-" -f 2 | rev | cut -c 8- | rev) 29 | sudo sed -i "s/version=.*/version=v${latestupstream}/g" /usr/local/bin/ubuntu-mainline-kernel.sh 30 | sudo ubuntu-mainline-kernel.sh -i --yes || 31 | (sub=$(echo ${latestupstream} | cut -d "." -f 3) && 32 | main=$(echo ${latestupstream} | cut -d "." -f 1,2) && 33 | newsub=$((${sub} - 1)) && 34 | newlatest=${main}.${newsub} && 35 | sudo sed -i "s/version=.*/version=v${newlatest}/g" /usr/local/bin/ubuntu-mainline-kernel.sh && 36 | sudo ubuntu-mainline-kernel.sh -i --yes) || echo "Failed" 37 | 38 | DOCKER_IMAGE=debian:unstable 39 | docker pull ${DOCKER_IMAGE} 40 | docker run \ 41 | -t \ 42 | -v "$(pwd)":/repo \ 43 | ${DOCKER_IMAGE} \ 44 | /bin/bash -c 'echo "deb http://ftp.debian.org/debian/ experimental main non-free non-free-firmware contrib" >> /etc/apt/sources.list.d/experimental.list && \ 45 | apt-get update && \ 46 | apt-get install -t experimental -y linux-image-amd64 && \ 47 | mkdir /repo/configs 48 | cp -r /boot/config* /repo/configs' 49 | cp -r "$(pwd)"/configs/* /tmp/artifacts 50 | cp -r /boot/config* /tmp/artifacts 51 | - name: Upload package artifact 52 | uses: actions/upload-artifact@v4 53 | with: 54 | name: kconfig 55 | path: /tmp/artifacts/* 56 | -------------------------------------------------------------------------------- /.github/workflows/kernel-update.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Cron job to update kernel 3 | 4 | on: 5 | schedule: 6 | - cron: '0 */8 * * *' 7 | workflow_dispatch: 8 | 9 | jobs: 10 | Mainline: 11 | runs-on: ubuntu-latest 12 | steps: 13 | 14 | - name: 'Checkout Repo' 15 | uses: actions/checkout@v4 16 | with: 17 | persist-credentials: false 18 | fetch-depth: 0 19 | 20 | - name: Check for update 21 | id: publish 22 | run: | 23 | latestrelease=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2) 24 | latestupstream=$(curl -sL https://kernel.org/ | grep "latest_button" -A 1 | awk "NR==2" | cut -d "/" -f 8 | cut -d "\"" -f 1 | cut -d "-" -f 2 | rev | cut -c 8- | rev) 25 | 26 | echo "latestupstream is ${latestupstream}" 27 | echo "current release is ${latestrelease}" 28 | 29 | if [[ ${latestrelease} = ${latestupstream} ]] 30 | then 31 | echo "publish=no" >> $GITHUB_ENV 32 | exit 0 33 | else 34 | echo "publish=yes" >> $GITHUB_ENV 35 | sed -i "s/${latestrelease}/${latestupstream}/g" ${{ github.workspace }}/build.sh 36 | sed -i "s/PKGREL=.*/PKGREL=1/g" ${{ github.workspace }}/build.sh 37 | echo "ver=${latestupstream}" >> $GITHUB_ENV 38 | fi 39 | - name: Update the repo 40 | if: env.publish == 'yes' 41 | id: clean 42 | run: | 43 | cd ${{ github.workspace }} 44 | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" 45 | git config --local user.name "github-actions[bot]" 46 | git commit -m "Update kernel to v${{ env.ver }}" -a 47 | - name: Push changes to the repo 48 | if: env.publish == 'yes' 49 | uses: ad-m/github-push-action@master 50 | with: 51 | github_token: ${{ secrets.PAT }} 52 | branch: ${{ github.ref }} 53 | LTS: 54 | runs-on: ubuntu-latest 55 | steps: 56 | 57 | - name: 'Checkout Repo' 58 | uses: actions/checkout@v4 59 | with: 60 | ref: LTS 61 | persist-credentials: false 62 | fetch-depth: 0 63 | 64 | - name: Check for update 65 | id: publish 66 | run: | 67 | LTS_VER=6.12 68 | latestrelease=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2) 69 | latestupstream=$(curl -sL https://kernel.org/ | grep ${LTS_VER} | grep tar.xz | cut -d "/" -f 8 | cut -d "\"" -f 1 | cut -d "-" -f 2 | rev | cut -c 8- | rev) 70 | 71 | echo "latestupstream is ${latestupstream}" 72 | echo "current release is ${latestrelease}" 73 | 74 | if [[ ${latestrelease} = ${latestupstream} ]] 75 | then 76 | echo "publish=no" >> $GITHUB_ENV 77 | exit 0 78 | else 79 | echo "publish=yes" >> $GITHUB_ENV 80 | sed -i "s/${latestrelease}/${latestupstream}/g" ${{ github.workspace }}/build.sh 81 | sed -i "s/PKGREL=.*/PKGREL=1/g" ${{ github.workspace }}/build.sh 82 | echo "ver=${latestupstream}" >> $GITHUB_ENV 83 | fi 84 | - name: Update the repo 85 | if: env.publish == 'yes' 86 | id: clean 87 | run: | 88 | cd ${{ github.workspace }} 89 | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" 90 | git config --local user.name "github-actions[bot]" 91 | git commit -m "Update kernel to v${{ env.ver }}" -a 92 | - name: Push changes to the repo 93 | if: env.publish == 'yes' 94 | uses: ad-m/github-push-action@master 95 | with: 96 | github_token: ${{ secrets.PAT }} 97 | branch: LTS 98 | Mainline_Xanmod: 99 | runs-on: macos-latest 100 | steps: 101 | 102 | - name: 'Checkout Repo' 103 | uses: actions/checkout@v4 104 | with: 105 | ref: Mainline-Xanmod 106 | persist-credentials: false 107 | fetch-depth: 0 108 | 109 | - name: Check for update 110 | id: publish 111 | run: | 112 | brew install gnu-sed 113 | latestrelease=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2) 114 | if [[ $(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Rolling Release" | grep xanmod | cut -d '=' -f 9 | cut -d '-' -f 1) ]] 115 | then 116 | echo "Rolling Release" 117 | latestupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Rolling Release" | grep xanmod | cut -d '=' -f 9 | cut -d '-' -f 1) 118 | else 119 | echo "Stable Mainline" 120 | latestupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Stable Mainline" | grep xanmod | cut -d '=' -f 9 | cut -d '-' -f 1) 121 | fi 122 | 123 | latestpkgrel=$(grep "PKGREL=\d*" build.sh | cut -d = -f2) 124 | if [[ $(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Rolling Release" | grep xanmod | cut -d '=' -f 9 | cut -d '-' -f 2) ]] 125 | then 126 | echo "Rolling Release" 127 | latestpkgupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Rolling Release" | grep xanmod | cut -d '=' -f 9 | cut -d '-' -f 2) 128 | else 129 | echo "Stable Mainline" 130 | latestpkgupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Stable Mainline" | grep xanmod | cut -d '=' -f 9 | cut -d '-' -f 2) 131 | fi 132 | 133 | echo "latestrelease: ${latestrelease}" 134 | echo "latestupstream: ${latestupstream}" 135 | echo "latestpkgrel: ${latestpkgrel}" 136 | echo "latestpkgupstream: ${latestpkgupstream}" 137 | 138 | if [[ ( ${latestrelease} = ${latestupstream} ) && ( ${latestpkgrel} = ${latestpkgupstream} ) ]] 139 | then 140 | echo "publish=no" >> $GITHUB_ENV 141 | exit 0 142 | else 143 | echo "publish=yes" >> $GITHUB_ENV 144 | gsed -i "s/${latestrelease}/${latestupstream}/g" ${{ github.workspace }}/build.sh 145 | gsed -i "s/PKGREL=.*/PKGREL=${latestpkgupstream}/g" ${{ github.workspace }}/build.sh 146 | echo "ver=${latestupstream}-${latestpkgupstream}" >> $GITHUB_ENV 147 | fi 148 | - name: Update the repo 149 | if: env.publish == 'yes' 150 | id: clean 151 | run: | 152 | cd ${{ github.workspace }} 153 | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" 154 | git config --local user.name "github-actions[bot]" 155 | git commit -m "Update kernel to v${{ env.ver }}" -a 156 | - name: Push changes to the repo 157 | if: env.publish == 'yes' 158 | uses: ad-m/github-push-action@master 159 | with: 160 | github_token: ${{ secrets.PAT }} 161 | branch: Mainline-Xanmod 162 | LTS_Xanmod: 163 | runs-on: macos-latest 164 | steps: 165 | 166 | - name: 'Checkout Repo' 167 | uses: actions/checkout@v4 168 | with: 169 | ref: LTS-Xanmod 170 | persist-credentials: false 171 | fetch-depth: 0 172 | 173 | - name: Check for update 174 | id: publish 175 | run: | 176 | brew install gnu-sed 177 | latestrelease=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2) 178 | latestupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Long Term Support" | grep xanmod | cut -d '=' -f 9 | cut -d '-' -f 1) 179 | 180 | latestpkgrel=$(grep "PKGREL=\d*" build.sh | cut -d = -f2) 181 | latestpkgupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Long Term Support" | grep xanmod | cut -d '=' -f 9 | cut -d '-' -f 2) 182 | 183 | echo "latestrelease: ${latestrelease}" 184 | echo "latestupstream: ${latestupstream}" 185 | echo "latestpkgrel: ${latestpkgrel}" 186 | echo "latestpkgupstream: ${latestpkgupstream}" 187 | 188 | if [[ ( ${latestrelease} = ${latestupstream} ) && ( ${latestpkgrel} = ${latestpkgupstream} ) ]] 189 | then 190 | echo "publish=no" >> $GITHUB_ENV 191 | exit 0 192 | else 193 | echo "publish=yes" >> $GITHUB_ENV 194 | gsed -i "s/${latestrelease}/${latestupstream}/g" ${{ github.workspace }}/build.sh 195 | gsed -i "s/PKGREL=.*/PKGREL=${latestpkgupstream}/g" ${{ github.workspace }}/build.sh 196 | echo "ver=${latestupstream}-${latestpkgupstream}" >> $GITHUB_ENV 197 | fi 198 | - name: Update the repo 199 | if: env.publish == 'yes' 200 | id: clean 201 | run: | 202 | cd ${{ github.workspace }} 203 | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" 204 | git config --local user.name "github-actions[bot]" 205 | git commit -m "Update kernel to v${{ env.ver }}" -a 206 | - name: Push changes to the repo 207 | if: env.publish == 'yes' 208 | uses: ad-m/github-push-action@master 209 | with: 210 | github_token: ${{ secrets.PAT }} 211 | branch: LTS-Xanmod 212 | -------------------------------------------------------------------------------- /.github/workflows/kernel.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Build Kernel Package 3 | 4 | # yamllint disable-line rule:truthy 5 | on: 6 | push: 7 | paths-ignore: 8 | - 'apt-repo/*.txt' 9 | - '.github/workflows/apfs.yml' 10 | - '.github/workflows/gmux.yml' 11 | pull_request: 12 | workflow_dispatch: 13 | 14 | jobs: 15 | Lint: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: 'Checkout repo' 19 | uses: actions/checkout@v4 20 | - name: 'Set up Python 3.9' 21 | uses: actions/setup-python@v5.6.0 22 | - name: 'Install dependencies' 23 | run: | 24 | python -m pip install --upgrade pip 25 | pip install yamllint 26 | sudo apt-get install shellcheck bash 27 | - name: 'Analysing the code' 28 | run: | 29 | yamllint -c ${{ github.workspace }}/.github/workflows/.ymllint . 30 | shellcheck ./*.sh 31 | Create-tag: 32 | needs: [Lint] 33 | runs-on: ubuntu-latest 34 | steps: 35 | - name: 'Checkout Repo' 36 | uses: actions/checkout@v4 37 | 38 | - name: Build script 39 | id: build 40 | run: | 41 | mkdir /tmp/artifacts 42 | VERSION=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2) 43 | REL=$(grep "PKGREL=\d*" build.sh | cut -d = -f2) 44 | #REL=$( git tag |grep -F $VERSION|sort -r|head -n1|tr -d v) 45 | echo Building $VERSION-$REL 46 | echo "tag=${VERSION}-${REL}" >> $GITHUB_OUTPUT 47 | 48 | - name: Create tag 49 | if: github.ref == 'refs/heads/Mainline' 50 | uses: rickstaa/action-create-tag@v1 51 | with: 52 | tag: "v${{ steps.build.outputs.tag }}" 53 | Build: 54 | strategy: 55 | matrix: 56 | target: 57 | - image: ubuntu 58 | tag: "22.04" 59 | name: jammy 60 | - image: ubuntu 61 | tag: "24.04" 62 | name: noble 63 | - image: ubuntu 64 | tag: "24.10" 65 | name: oracular 66 | - image: ubuntu 67 | tag: "25.04" 68 | name: plucky 69 | - image: debian 70 | tag: "12" 71 | name: bookworm 72 | - image: debian 73 | tag: testing 74 | name: testing 75 | needs: [Create-tag] 76 | runs-on: ubuntu-latest 77 | steps: 78 | - name: Free up disk space for the CI 79 | uses: AdityaGarg8/remove-unwanted-software@v5 80 | with: 81 | remove-android: 'true' 82 | remove-dotnet: 'true' 83 | remove-haskell: 'true' 84 | 85 | - name: 'Checkout Repo' 86 | uses: actions/checkout@v4 87 | 88 | - name: Build script 89 | id: build 90 | run: | 91 | mkdir /tmp/artifacts 92 | VERSION=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2) 93 | REL=$(grep "PKGREL=\d*" build.sh | cut -d = -f2) 94 | #REL=$( git tag |grep -F $VERSION|sort -r|head -n1|tr -d v) 95 | echo Building $VERSION-$REL 96 | echo "tag=${VERSION}-${REL}" >> $GITHUB_OUTPUT 97 | 98 | DOCKER_IMAGE=${{ matrix.target.image }}:${{ matrix.target.tag }} 99 | docker pull ${DOCKER_IMAGE} 100 | docker run \ 101 | -t \ 102 | -v "$(pwd)":/repo \ 103 | ${DOCKER_IMAGE} \ 104 | /bin/bash -c 'cd /repo && \ 105 | apt-get update && \ 106 | apt-get install -y lsb-release && \ 107 | mkdir /tmp/artifacts && \ 108 | ./build.sh && mkdir /repo/debs && \ 109 | cp -r /tmp/artifacts/* /repo/debs' 110 | cp -r "$(pwd)"/debs/* /tmp/artifacts 111 | 112 | cd /tmp/artifacts 113 | #rm /tmp/artifacts/*dbg* 114 | ls -l 115 | dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz 116 | ls -l 117 | 118 | - name: Upload package artifact 119 | uses: actions/upload-artifact@v4 120 | with: 121 | name: linux-T2-${{ steps.build.outputs.tag }}-${{ matrix.target.name }} 122 | path: /tmp/artifacts/* 123 | 124 | - name: Release 125 | if: github.ref == 'refs/heads/Mainline' 126 | uses: softprops/action-gh-release@v2 127 | with: 128 | files: | 129 | /tmp/artifacts/sha256* 130 | /tmp/artifacts/*.deb 131 | /tmp/artifacts/kernel_config* 132 | tag_name: v${{ steps.build.outputs.tag }} 133 | body_path: ${{ github.workspace }}/.github/workflows/instructions.txt 134 | draft: false 135 | env: 136 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 137 | 138 | Publish: 139 | needs: [Build] 140 | runs-on: ubuntu-latest 141 | steps: 142 | 143 | - name: 'Checkout Repo' 144 | uses: actions/checkout@v4 145 | 146 | - name: Update kernel in apt repo 147 | if: github.ref == 'refs/heads/Mainline' 148 | id: publish 149 | run: | 150 | VERSION=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2) 151 | REL=$(grep "PKGREL=\d*" build.sh | cut -d = -f2) 152 | echo "ver=${VERSION}-${REL}" >> $GITHUB_ENV 153 | git clone https://github.com/AdityaGarg8/t2-ubuntu-repo.git 154 | cd t2-ubuntu-repo 155 | sed -i "s/VERSION=.*/VERSION=${VERSION}/g" ./.github/kernel/linux-t2 156 | sed -i "s/REL=.*/REL=${REL}/g" ./.github/kernel/linux-t2 157 | - name: Push changes to apt repo 158 | if: github.ref == 'refs/heads/Mainline' 159 | uses: cpina/github-action-push-to-another-repository@main 160 | env: 161 | SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} 162 | with: 163 | source-directory: 't2-ubuntu-repo' 164 | destination-github-username: 'AdityaGarg8' 165 | destination-repository-name: 't2-ubuntu-repo' 166 | user-email: github-actions[bot]@users.noreply.github.com 167 | user-name: github-actions[bot] 168 | target-branch: main 169 | commit-message: Update kernel (Mainline) to v${{ env.ver }} 170 | -------------------------------------------------------------------------------- /.github/workflows/lts.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: LTS Kernel update script package 3 | 4 | # yamllint disable-line rule:truthy 5 | on: 6 | workflow_dispatch: 7 | jobs: 8 | Publish: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: 'Checkout Repo' 12 | uses: actions/checkout@v4 13 | 14 | - name: Configure GPG Key 15 | run: | 16 | echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import 17 | env: 18 | GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} 19 | 20 | - name: Get the kernel upgrade script 21 | id: publish 22 | run: | 23 | git clone -b script https://github.com/t2linux/T2-Ubuntu-Kernel.git 24 | chmod 755 ${{ github.workspace }}/T2-Ubuntu-Kernel/t2-kernel-script-lts/DEBIAN/postinst 25 | version=$(cat ${{ github.workspace }}/T2-Ubuntu-Kernel/t2-kernel-script-lts/DEBIAN/control | grep Version | cut -d ':' -f 2 | xargs) 26 | echo "ver=${version}" >> $GITHUB_ENV 27 | cd ${{ github.workspace }}/T2-Ubuntu-Kernel 28 | dpkg-deb --build --root-owner-group t2-kernel-script-lts 29 | cd ${{ github.workspace }} 30 | git clone https://github.com/AdityaGarg8/t2-ubuntu-repo.git 31 | cp -r ${{ github.workspace }}/T2-Ubuntu-Kernel/t2-kernel-script-lts.deb ${{ github.workspace }}/t2-ubuntu-repo 32 | cd ${{ github.workspace }}/t2-ubuntu-repo 33 | # Packages & Packages.gz 34 | dpkg-scanpackages --multiversion . > Packages 35 | gzip -k -f Packages 36 | # Release, Release.gpg & InRelease 37 | apt-ftparchive release . > Release 38 | gpg --default-key "${GPG_SIGNING_EMAIL}" -abs -o - Release > Release.gpg 39 | gpg --default-key "${GPG_SIGNING_EMAIL}" --clearsign -o - Release > InRelease 40 | cd ${{ github.workspace }} 41 | env: 42 | GPG_SIGNING_EMAIL: ${{ secrets.GPG_SIGNING_EMAIL }} 43 | - name: Publish 44 | if: github.ref == 'refs/heads/Mainline' 45 | uses: cpina/github-action-push-to-another-repository@main 46 | env: 47 | SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} 48 | with: 49 | source-directory: 't2-ubuntu-repo' 50 | destination-github-username: 'AdityaGarg8' 51 | destination-repository-name: 't2-ubuntu-repo' 52 | user-email: github-actions[bot]@users.noreply.github.com 53 | user-name: github-actions[bot] 54 | target-branch: main 55 | commit-message: Update LTS kernel update script to v${{ env.ver }} 56 | -------------------------------------------------------------------------------- /.github/workflows/mainline.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Mainline Kernel update script package 3 | 4 | # yamllint disable-line rule:truthy 5 | on: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | Publish: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: 'Checkout Repo' 13 | uses: actions/checkout@v4 14 | 15 | - name: Configure GPG Key 16 | run: | 17 | echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import 18 | env: 19 | GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} 20 | 21 | - name: Get the kernel upgrade script 22 | id: publish 23 | run: | 24 | git clone -b script https://github.com/t2linux/T2-Ubuntu-Kernel.git 25 | chmod 755 ${{ github.workspace }}/T2-Ubuntu-Kernel/t2-kernel-script/DEBIAN/postinst 26 | version=$(cat ${{ github.workspace }}/T2-Ubuntu-Kernel/t2-kernel-script/DEBIAN/control | grep Version | cut -d ':' -f 2 | xargs) 27 | echo "ver=${version}" >> $GITHUB_ENV 28 | cd ${{ github.workspace }}/T2-Ubuntu-Kernel 29 | dpkg-deb --build --root-owner-group t2-kernel-script 30 | cd ${{ github.workspace }} 31 | git clone https://github.com/AdityaGarg8/t2-ubuntu-repo.git 32 | cp -r ${{ github.workspace }}/T2-Ubuntu-Kernel/t2-kernel-script.deb ${{ github.workspace }}/t2-ubuntu-repo 33 | cd ${{ github.workspace }}/t2-ubuntu-repo 34 | # Packages & Packages.gz 35 | dpkg-scanpackages --multiversion . > Packages 36 | gzip -k -f Packages 37 | # Release, Release.gpg & InRelease 38 | apt-ftparchive release . > Release 39 | gpg --default-key "${GPG_SIGNING_EMAIL}" -abs -o - Release > Release.gpg 40 | gpg --default-key "${GPG_SIGNING_EMAIL}" --clearsign -o - Release > InRelease 41 | cd ${{ github.workspace }} 42 | env: 43 | GPG_SIGNING_EMAIL: ${{ secrets.GPG_SIGNING_EMAIL }} 44 | - name: Publish 45 | if: github.ref == 'refs/heads/Mainline' 46 | uses: cpina/github-action-push-to-another-repository@main 47 | env: 48 | SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} 49 | with: 50 | source-directory: 't2-ubuntu-repo' 51 | destination-github-username: 'AdityaGarg8' 52 | destination-repository-name: 't2-ubuntu-repo' 53 | user-email: github-actions[bot]@users.noreply.github.com 54 | user-name: github-actions[bot] 55 | target-branch: main 56 | commit-message: Update Mainline kernel update script to v${{ env.ver }} 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /patches/custom-drivers.patch 2 | /releases 3 | /linux-* 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: bash 3 | 4 | os: 5 | - linux 6 | 7 | services: 8 | - docker 9 | 10 | branches: 11 | only: 12 | - master 13 | 14 | script: 15 | - ./publish.sh 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # T2 Debian and Ubuntu Kernel 2 | 3 | Debian and Ubuntu/Mint kernel with Apple T2 patches built-in. This repo will try to keep up with kernel new releases. 4 | 5 | ![Build Kernel Package](https://github.com/t2linux/T2-Debian-and-Ubuntu-Kernel/actions/workflows/kernel.yml/badge.svg?branch=Mainline) 6 | 7 | This project is closely inspired by mikeeq/mbp-fedora-kernel and marcosfad/mbp-ubuntu-kernel. Thank you @mikeeq and @marcosfad for the scripts and setup. 8 | 9 | Special thanks to @Redecorating for the CI. 10 | 11 | **If this repo helped you in any way, consider inviting a coffee to the people in the [credits](https://github.com/t2linux/T2-Debian-and-Ubuntu-Kernel#credits) (links given [here](https://wiki.t2linux.org/contribute/)).** 12 | 13 | ## INSTALLATION 14 | 15 | ### Using the apt repo 16 | 17 | Firstly add the [t2-ubuntu-repo](https://adityagarg8.github.io/t2-ubuntu-repo/) apt repo. You need to follow these steps to add it: 18 | 19 | 1. Identify your release codename. It is: 20 | 21 | a) `jammy` for **Ubuntu 22.04** 22 | 23 | b) `noble` for **Ubuntu 24.04** 24 | 25 | c) `oracular` for **Ubuntu 24.10** 26 | 27 | d) `plucky` for **Ubuntu 25.04** 28 | 29 | e) `bookworm` for **Debian 12** 30 | 31 | f) `testing` for **Debian testing** 32 | 33 | You can also run `lsb_release -a` to identify your codename. 34 | 35 | 2. Run the following (taking `noble` as the example, just replace it with your release codename in the first line): 36 | 37 | ```bash 38 | CODENAME=noble 39 | curl -s --compressed "https://adityagarg8.github.io/t2-ubuntu-repo/KEY.gpg" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/t2-ubuntu-repo.gpg >/dev/null 40 | sudo curl -s --compressed -o /etc/apt/sources.list.d/t2.list "https://adityagarg8.github.io/t2-ubuntu-repo/t2.list" 41 | echo "deb [signed-by=/etc/apt/trusted.gpg.d/t2-ubuntu-repo.gpg] https://github.com/AdityaGarg8/t2-ubuntu-repo/releases/download/${CODENAME} ./" | sudo tee -a /etc/apt/sources.list.d/t2.list 42 | sudo apt update 43 | ``` 44 | 45 | Currently, 2 types of kernel variants are available. You can use anyone as per your choice: 46 | 47 | 1. Mainline kernels: 48 | 49 | If you want to install **Mainline** kernels, install `linux-t2` package: 50 | 51 | ```bash 52 | sudo apt install linux-t2 53 | ``` 54 | 55 | 2. LTS kernels: 56 | 57 | If you want to install **LTS** kernels, install `linux-t2-lts` package: 58 | 59 | ```bash 60 | sudo apt install linux-t2-lts 61 | ``` 62 | 63 | 3. Mainline Xanmod kernels: 64 | 65 | If you want to install **Mainline Xanmod** kernels, install `linux-t2-xanmod` package: 66 | 67 | ```bash 68 | sudo apt install linux-t2-xanmod 69 | ``` 70 | 71 | 4. LTS Xanmod kernels: 72 | 73 | If you want to install **LTS Xanmod** kernels, install `linux-t2-xanmod-lts` package: 74 | 75 | ```bash 76 | sudo apt install linux-t2-xanmod-lts 77 | ``` 78 | 79 | Now, whenever a new kernel is released, you can use **Software updater** or run `sudo apt upgrade` to get it. 80 | 81 | #### Changing kernel variant: 82 | 83 | If you want to change the kernel variant, say from Mainline to LTS, first install the package of the kernel, and then remove the current kernel. Eg, if you wanna switch to LTS from Mainline, run: 84 | 85 | ```bash 86 | sudo apt install linux-t2-lts 87 | sudo apt remove linux-headers-$(uname -r) linux-image-$(uname -r) 88 | ``` 89 | 90 | Simply replace `linux-t2-lts` in the above command with the kernel variant you want to use. 91 | 92 | ### Download package manually 93 | 94 | Download the .deb packages of **linux-headers** and **linux-image** of the kernel you wish to install from the [releases](https://github.com/t2linux/T2-Debian-and-Ubuntu-Kernel/releases) section. 95 | 96 | Install **linux-headers** first and then **linux-image** using `apt` and restart your Mac. In case you do not know how to do so, follow the instructions given below. Else you are good to go. 97 | 98 | On terminal, type `sudo apt install ` and then drag and drop the **linux-headers** file to the terminal and press enter/return key. 99 | 100 | Do the similar process for **linux-images** package. 101 | 102 | Restart your Mac. 103 | 104 | ### Building yourself 105 | 106 | Clone the repo using 107 | ```bash 108 | git clone https://github.com/t2linux/T2-Debian-and-Ubuntu-Kernel 109 | ``` 110 | 111 | Open a terminal window and run 112 | 113 | ```bash 114 | cd T2-Debian-and-Ubuntu-Kernel 115 | sudo ./build.sh 116 | ``` 117 | 118 | The kernel shall take around an hour to compile. After that you shall find three .deb packages in `/root/work`. 119 | 120 | Install the **linux-headers** package first using `apt`. In case you do not know how to do so, follow the instructions described in the above **The easy way** section. Similarly install the **linux-image** package too. 121 | 122 | Restart your Mac. 123 | 124 | You may then delete the `/root/work` directory using `sudo rm -r /root/work` to free up space. 125 | 126 | ## Docs 127 | 128 | - Discord: 129 | - WiFi firmware: 130 | - 131 | - blog `Installing Fedora 31 on a 2018 Mac mini`: 132 | - iwd: 133 | - 134 | - 135 | - 136 | 137 | ### Ubuntu 138 | 139 | - 140 | - 141 | - 142 | - 143 | - 144 | - 145 | - 146 | 147 | ## Credits 148 | 149 | - @Redecorating - thanks for editing the scripts and CI for Ubuntu 150 | - @fishpm-anu - thanks for the kernel upgrade script 151 | - @marcosfad - thanks for the original script for Ubuntu 152 | - @MCMrARM - thanks for all RE work 153 | - @ozbenh - thanks for submitting NVME patch 154 | - @roadrunner2 - thanks for SPI (touchbar) driver 155 | - @aunali1 - thanks for ArchLinux Kernel CI and active support 156 | - @jamlam - thanks for providing the Correlium wifi patch 157 | - @ppaulweber - thanks for keyboard and Macbook Air patches 158 | - @mikeeq - thanks for the fedora kernel project and compilation scripts 159 | -------------------------------------------------------------------------------- /apt-repo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ARG RELEASE_VERSION=5.6.4 4 | ARG GPG_KEY=some_key 5 | ARG GPG_PASS=some_pass 6 | ARG GPG_KEY_ID=some_id 7 | 8 | ENV GITHUB_URL=github.com/marcosfad/mbp-ubuntu-kernel/releases 9 | ENV REPO_URL=mbp-ubuntu-kernel.herokuapp.com 10 | ENV LANG en_US.utf8 11 | 12 | WORKDIR /var/repo 13 | 14 | RUN DEBIAN_FRONTEND=noninteractive apt-get update \ 15 | && DEBIAN_FRONTEND=noninteractive apt-get install -y \ 16 | locales dpkg-dev dpkg-sig nginx gettext wget curl apt-utils \ 17 | && rm -rf /var/lib/apt/lists/* \ 18 | && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 19 | 20 | RUN echo "${GPG_KEY}" > PRIVATE_GPG_KEY.asc \ 21 | && gpg -v --batch --passphrase "${GPG_PASS}" --import PRIVATE_GPG_KEY.asc \ 22 | && rm PRIVATE_GPG_KEY.asc \ 23 | && gpg --list-keys \ 24 | && gpg --output /var/repo/KEY.gpg --armor --export ${GPG_KEY_ID} 25 | 26 | RUN for deb in $(curl -s https://${REPO_URL}/ -L | grep deb | grep a | cut -d'>' -f2 | cut -d'<' -f1); do \ 27 | wget -q --backups=1 https://${REPO_URL}/${deb}; \ 28 | done \ 29 | ; rm -rfv *.1 30 | 31 | RUN echo "${GPG_PASS}" > PRIVATE_GPG_PASS \ 32 | && export GPG_TTY=$(tty) && \ 33 | for deb in $(curl -s https://${GITHUB_URL}/latest -L | grep deb | grep span | cut -d'>' -f2 | cut -d'<' -f1); do \ 34 | wget -q --backups=1 https://${GITHUB_URL}/download/v${RELEASE_VERSION}/${deb} && \ 35 | dpkg-sig -k ${GPG_KEY_ID} -v --sign builder "./${deb}" \ 36 | --gpg-options="--batch --pinentry-mode loopback --no-tty --passphrase-file ./PRIVATE_GPG_PASS"; \ 37 | done \ 38 | ; rm PRIVATE_GPG_PASS \ 39 | ; rm -rfv *.1 40 | 41 | RUN apt-ftparchive --arch amd64 packages . > Packages \ 42 | && gzip -k -f Packages \ 43 | && apt-ftparchive release . > Release 44 | 45 | RUN echo "${GPG_PASS}" | gpg --batch --pinentry-mode loopback --yes --default-key "${GPG_KEY_ID}"\ 46 | --passphrase-fd 0 -abs -o Release.gpg Release \ 47 | && echo "${GPG_PASS}" | gpg --batch --pinentry-mode loopback --yes --default-key "${GPG_KEY_ID}"\ 48 | --passphrase-fd 0 --clearsign -o InRelease Release 49 | 50 | RUN chown -R www-data:www-data /var/repo && rm -rfv "/var/repo/${REPO_URL}" && ls -la /var/repo 51 | 52 | COPY --chown=www-data:www-data nginx.conf /etc/nginx/nginx.conf 53 | 54 | RUN mkdir -p /var/lib/nginx \ 55 | && chown -R www-data:www-data /var/lib/nginx 56 | 57 | RUN touch /var/run/nginx.pid && \ 58 | chown -R www-data:www-data /var/run/nginx.pid 59 | 60 | USER www-data 61 | 62 | ENV PORT=8080 63 | EXPOSE ${PORT} 64 | 65 | CMD /bin/bash -c "envsubst '\$PORT' < /etc/nginx/nginx.conf > /tmp/nginx.conf; cat /tmp/nginx.conf > /etc/nginx/nginx.conf" && nginx -g 'daemon off;' 66 | -------------------------------------------------------------------------------- /apt-repo/README.md: -------------------------------------------------------------------------------- 1 | Install the Heroku CLI 2 | 3 | Download and install the Heroku CLI. 4 | 5 | If you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key. 6 | 7 | $ heroku login 8 | Create a new Git repository 9 | 10 | Initialize a git repository in a new or existing directory 11 | 12 | $ cd my-project/ 13 | $ git init 14 | $ heroku git:remote -a mbp-ubuntu-kernel 15 | Deploy your application 16 | 17 | Commit your code to the repository and deploy it to Heroku using Git. 18 | 19 | $ git add . 20 | $ git commit -am "make it better" 21 | $ git push heroku master 22 | Existing Git repository 23 | 24 | For existing repositories, simply add the heroku remote 25 | 26 | $ heroku git:remote -a mbp-ubuntu-kernel 27 | -------------------------------------------------------------------------------- /apt-repo/apfs_ver.txt: -------------------------------------------------------------------------------- 1 | CURRENT_HASH=7d8dc8821e4177ead41d17c298d777df3bfc1c3f 2 | RELEASE_VER=0.3.14-1 3 | -------------------------------------------------------------------------------- /apt-repo/nginx.conf: -------------------------------------------------------------------------------- 1 | #NGINX main config 2 | worker_processes 1; 3 | 4 | error_log /var/log/nginx/error.log warn; 5 | pid /var/run/nginx.pid; 6 | 7 | events { 8 | worker_connections 1024; 9 | } 10 | 11 | http { 12 | include /etc/nginx/mime.types; 13 | default_type application/octet-stream; 14 | 15 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 16 | '$status $body_bytes_sent "$http_referer" ' 17 | '"$http_user_agent" "$http_x_forwarded_for"'; 18 | 19 | sendfile on; 20 | keepalive_timeout 65; 21 | 22 | server_names_hash_bucket_size 128; 23 | 24 | resolver 8.8.8.8 8.8.4.4; 25 | 26 | server { 27 | listen $PORT default_server; 28 | root /var/repo; 29 | location / { 30 | index index.php index.html index.htm; 31 | autoindex on; #enable listing of directory index 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu -o pipefail 4 | 5 | ### Environment variable 6 | export DEBIAN_FRONTEND=noninteractive 7 | 8 | ### Dependencies in docker 9 | apt-get update 10 | apt-get install -y lsb-release 11 | 12 | KERNEL_VERSION=6.15.2 13 | PKGREL=2 14 | DISTRO=$(lsb_release -i | cut -d ":" -f 2 | xargs) 15 | CODENAME=$(lsb_release -c | cut -d ":" -f 2 | xargs) 16 | 17 | if [[ ${DISTRO} = Debian ]] 18 | then 19 | CONFIG=debian 20 | else 21 | CONFIG=ubuntu 22 | fi 23 | 24 | #KERNEL_REPOSITORY=git://kernel.ubuntu.com/virgin/linux-stable.git 25 | KERNEL_REPOSITORY=https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 26 | 27 | REPO_PATH=$(pwd) 28 | WORKING_PATH=/root/work 29 | KERNEL_PATH="${WORKING_PATH}/linux-kernel" 30 | 31 | ### Debug commands 32 | echo "Kernel version: ${KERNEL_VERSION}" 33 | echo "Config distro: ${CONFIG}" 34 | echo "Working path: ${WORKING_PATH}" 35 | echo "Kernel repository: ${KERNEL_REPOSITORY}" 36 | echo "Current path: ${REPO_PATH}" 37 | echo "CPU threads: $(nproc --all)" 38 | grep 'model name' /proc/cpuinfo | uniq 39 | 40 | get_next_version () { 41 | echo $PKGREL 42 | } 43 | 44 | ### Clean up 45 | rm -rfv ./*.deb 46 | 47 | mkdir "${WORKING_PATH}" && cd "${WORKING_PATH}" 48 | cp -rf "${REPO_PATH}"/{patches,templates} "${WORKING_PATH}" 49 | rm -rf "${KERNEL_PATH}" 50 | 51 | ### Dependencies 52 | apt-get install -y build-essential fakeroot libncurses-dev bison flex libssl-dev libelf-dev \ 53 | openssl dkms libudev-dev libpci-dev libiberty-dev autoconf wget xz-utils git \ 54 | libcap-dev bc rsync cpio debhelper kernel-wedge curl gawk dwarves zstd python3 libdw-dev 55 | 56 | ### get Kernel and Drivers 57 | git clone --depth 1 --single-branch --branch "v${KERNEL_VERSION}" \ 58 | "${KERNEL_REPOSITORY}" "${KERNEL_PATH}" 59 | 60 | cd "${KERNEL_PATH}" || exit 61 | 62 | #### Create patch file with custom drivers 63 | echo >&2 "===]> Info: Creating patch file... " 64 | KERNEL_VERSION="${KERNEL_VERSION}" WORKING_PATH="${WORKING_PATH}" "${REPO_PATH}/patch_driver.sh" 65 | 66 | #### Apply patches 67 | cd "${KERNEL_PATH}" || exit 68 | 69 | echo >&2 "===]> Info: Applying patches... " 70 | [ ! -d "${WORKING_PATH}/patches" ] && { 71 | echo 'Patches directory not found!' 72 | exit 1 73 | } 74 | 75 | 76 | while IFS= read -r file; do 77 | echo "==> Adding $file" 78 | patch -p1 <"$file" 79 | done < <(find "${WORKING_PATH}/patches" -type f -name "*.patch" | sort) 80 | 81 | #chmod a+x "${KERNEL_PATH}"/debian/rules 82 | #chmod a+x "${KERNEL_PATH}"/debian/scripts/* 83 | #chmod a+x "${KERNEL_PATH}"/debian/scripts/misc/* 84 | 85 | echo >&2 "===]> Info: Bulding src... " 86 | 87 | cd "${KERNEL_PATH}" 88 | make clean 89 | 90 | # Make config friendly with vanilla kernel 91 | sed -i 's/CONFIG_VERSION_SIGNATURE=.*/CONFIG_VERSION_SIGNATURE=""/g' "${WORKING_PATH}/templates/default-config-${CONFIG}" 92 | sed -i 's/CONFIG_SYSTEM_TRUSTED_KEYS=.*/CONFIG_SYSTEM_TRUSTED_KEYS=""/g' "${WORKING_PATH}/templates/default-config-${CONFIG}" 93 | sed -i 's/CONFIG_SYSTEM_REVOCATION_KEYS=.*/CONFIG_SYSTEM_REVOCATION_KEYS=""/g' "${WORKING_PATH}/templates/default-config-${CONFIG}" 94 | 95 | # I want silent boot 96 | sed -i 's/CONFIG_CONSOLE_LOGLEVEL_DEFAULT=.*/CONFIG_CONSOLE_LOGLEVEL_DEFAULT=4/g' "${WORKING_PATH}/templates/default-config-${CONFIG}" 97 | sed -i 's/CONFIG_CONSOLE_LOGLEVEL_QUIET=.*/CONFIG_CONSOLE_LOGLEVEL_QUIET=1/g' "${WORKING_PATH}/templates/default-config-${CONFIG}" 98 | sed -i 's/CONFIG_MESSAGE_LOGLEVEL_DEFAULT=.*/CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4/g' "${WORKING_PATH}/templates/default-config-${CONFIG}" 99 | 100 | # Copy the modified config 101 | cp -v "${WORKING_PATH}/templates/default-config-${CONFIG}" "${KERNEL_PATH}/.config" 102 | 103 | # Disable debug info 104 | ./scripts/config --undefine GDB_SCRIPTS 105 | ./scripts/config --undefine DEBUG_INFO 106 | ./scripts/config --undefine DEBUG_INFO_SPLIT 107 | ./scripts/config --undefine DEBUG_INFO_REDUCED 108 | ./scripts/config --undefine DEBUG_INFO_COMPRESSED 109 | ./scripts/config --set-val DEBUG_INFO_NONE y 110 | ./scripts/config --set-val DEBUG_INFO_DWARF5 n 111 | 112 | make olddefconfig 113 | 114 | # Enable T2 drivers 115 | ./scripts/config --module CONFIG_HID_APPLETB_BL 116 | ./scripts/config --module CONFIG_HID_APPLETB_KBD 117 | ./scripts/config --module CONFIG_DRM_APPLETBDRM 118 | ./scripts/config --module CONFIG_BT_HCIBCM4377 119 | ./scripts/config --module CONFIG_APFS_FS 120 | ./scripts/config --enable CONFIG_MODULE_FORCE_UNLOAD 121 | 122 | # Get rid of the dirty tag 123 | echo "" >"${KERNEL_PATH}"/.scmversion 124 | 125 | # Build Deb packages 126 | make -j "$(getconf _NPROCESSORS_ONLN)" deb-pkg LOCALVERSION=-${PKGREL}-t2-"${CODENAME}" KDEB_PKGVERSION="$(make kernelversion)-$(get_next_version)" 127 | 128 | #### Copy artifacts to shared volume 129 | echo >&2 "===]> Info: Copying debs and calculating SHA256 ... " 130 | cp -rfv "${KERNEL_PATH}/.config" "/tmp/artifacts/kernel_config_${KERNEL_VERSION}-${CODENAME}" 131 | cp -rfv ../*.deb /tmp/artifacts/ 132 | 133 | if [[ (${#KERNEL_VERSION} = 3) || (${#KERNEL_VERSION} = 4) ]] 134 | then 135 | mv "/tmp/artifacts/linux-libc-dev_${KERNEL_VERSION}.0-${PKGREL}_amd64.deb" "/tmp/artifacts/linux-libc-dev_${KERNEL_VERSION}.0-${PKGREL}-${CODENAME}_amd64.deb" 136 | else 137 | mv "/tmp/artifacts/linux-libc-dev_${KERNEL_VERSION}-${PKGREL}_amd64.deb" "/tmp/artifacts/linux-libc-dev_${KERNEL_VERSION}-${PKGREL}-${CODENAME}_amd64.deb" 138 | fi 139 | sha256sum ../*.deb >/tmp/artifacts/sha256-"${CODENAME}" 140 | -------------------------------------------------------------------------------- /build_in_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu -o pipefail 4 | 5 | DOCKER_IMAGE=ubuntu:20.04 6 | 7 | docker pull ${DOCKER_IMAGE} 8 | docker run \ 9 | -t \ 10 | --rm \ 11 | -v "$(pwd)":/repo \ 12 | ${DOCKER_IMAGE} \ 13 | /bin/bash -c 'cd /repo && ./build.sh' 14 | -------------------------------------------------------------------------------- /patch_driver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu -o pipefail 4 | 5 | BUILD_PATH=/tmp/build-kernel 6 | 7 | # Patches 8 | T2_PATCHES_GIT_URL=https://github.com/t2linux/linux-t2-patches.git 9 | T2_PATCHES_BRANCH_NAME=main 10 | T2_PATCHES_COMMIT_HASH=HEAD 11 | 12 | rm -rf "${BUILD_PATH}" 13 | mkdir -p "${BUILD_PATH}" 14 | cd "${BUILD_PATH}" || exit 15 | 16 | ### AppleSMC and BT aunali fixes 17 | git clone --single-branch --branch ${T2_PATCHES_BRANCH_NAME} ${T2_PATCHES_GIT_URL} \ 18 | "${BUILD_PATH}/linux-mbp-arch" 19 | cd "${BUILD_PATH}/linux-mbp-arch" || exit 20 | git checkout ${T2_PATCHES_COMMIT_HASH} 21 | 22 | while IFS= read -r file; do 23 | echo "==> Adding ${file}" 24 | cp -rfv "${file}" "${WORKING_PATH}"/patches/"${file##*/}" 25 | done < <(find "${BUILD_PATH}/linux-mbp-arch" -type f -name "*.patch") 26 | -------------------------------------------------------------------------------- /patches/Readme.md: -------------------------------------------------------------------------------- 1 | Any additional patch to be applied to be put here. 2 | -------------------------------------------------------------------------------- /templates/Kconfig: -------------------------------------------------------------------------------- 1 | menuconfig TEST_DRIVER 2 | tristate "TEST_DRIVER" 3 | depends on X86 || COMPILE_TEST 4 | default m 5 | --------------------------------------------------------------------------------