├── Setup ├── python2-install.sh ├── cache.sh ├── install_apktool.sh ├── zram-setup.sh ├── install_jadx.sh ├── ubuntu_envsetup.sh ├── install_android_sdk.sh ├── setup.sh ├── alpine_envsetup.sh ├── nipeTorGateway.sh ├── gentoo_envsetup.sh ├── sshid_setup.sh ├── One-click_setup_for_Mac_Devs.sh ├── tailwind_setup.sh ├── arch_envsetup.sh ├── android_build_env.sh ├── arch_post_setup.sh └── fedora_envsetup.sh ├── AOSP ├── twrp-build.sh ├── AOSP-sync.sh ├── aosp-building.sh ├── arrow-mojito.sh ├── arrow-RMX2020.sh ├── update-symlinks.py ├── generic-rom.sh ├── universal_aosp.sh └── aosp-ci.sh ├── Kernel ├── android12-5.10_Build-script.sh ├── beryllium_perf+_kernel.sh ├── C3_eva_kernel.sh ├── C3_standalone-script.sh ├── clang9-kernel-build.sh ├── r5x-proton-blush-build.sh ├── X00T_trb_kernel.sh ├── cancunf_build_script.sh ├── cancunf_gki_build_script.sh ├── C3_build_script.sh ├── wasabi_build_script.sh ├── merge_clo_tag.sh ├── C3_CI_script.sh └── AtomX-Build-Script.sh ├── README.md └── commit-msg /Setup/python2-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz 3 | sudo tar xzf Python-2.7.9.tgz 4 | cd Python-2.7.9 5 | sudo ./configure --enable-optimizations 6 | sudo make altinstall 7 | sudo ln -sfn '/usr/local/bin/python2.7' '/usr/bin/python2' 8 | -------------------------------------------------------------------------------- /Setup/cache.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cd /tmp || exit 1 3 | git clone https://github.com/ccache/ccache.git 4 | cd ccache || exit 1 5 | ./autogen.sh 6 | ./configure --disable-man --with-libzstd-from-internet --with-libb2-from-internet 7 | make -j"$(nproc)" 8 | sudo make install 9 | rm -rf "${PWD}" 10 | cd - || exit 1 11 | -------------------------------------------------------------------------------- /Setup/install_apktool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Installing APKTOOL" 4 | 5 | wget https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool 6 | wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.9.3.jar 7 | mv apktool_2.9.3.jar apktool.jar 8 | cp -r apktool.jar /usr/local/bin 9 | cp -r apktool /usr/local/bin 10 | chmod +x /usr/local/bin/apktool 11 | chmod +x /usr/local/bin/apktool.jar 12 | apktool --version 13 | rm -rf apktool apktool.jar 14 | 15 | echo "APKTOOL WAS INSTALLED" 16 | -------------------------------------------------------------------------------- /AOSP/twrp-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Define Variables 4 | DEVICE="RMX2020" 5 | DT="https://github.com/sarthakroy2002/android_recovery_realme_RMX2020.git" 6 | OEM="realme" 7 | TW_BRANCH="12.1" 8 | TARGET=( 9 | recoveryimage 10 | ) 11 | 12 | repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-${TW_BRANCH} 13 | repo sync -j8 --force-sync --no-clone-bundle --no-tags 14 | repo sync --force-sync 15 | 16 | git clone ${DT} device/${OEM}/${DEVICE} 17 | 18 | . build/envsetup.sh 19 | export ALLOW_MISSING_DEPENDENCIES=true 20 | lunch twrp_${DEVICE}-eng 21 | mka clean 22 | mka -j$(nproc) ${TARGET} 23 | -------------------------------------------------------------------------------- /Setup/zram-setup.sh: -------------------------------------------------------------------------------- 1 | sudo apt install zram-config 2 | sudo sed -e '/swap/ s/^#*/#/' -i /etc/fstab 3 | sudo echo "zram" >> /etc/modules-load.d/zram.conf 4 | sudo echo "options zram num_devices=1" >> /etc/modprobe.d/zram.conf 5 | sudo echo '''KERNEL=="zram0", ATTR{disksize}="20480M",TAG+="systemd"''' >> /etc/udev/rules.d/99-zram.rules 6 | sudo echo ''' 7 | [Unit] 8 | Description=Swap with zram 9 | After=multi-user.target 10 | [Service] 11 | Type=oneshot 12 | RemainAfterExit=true 13 | ExecStartPre=/sbin/mkswap /dev/zram0 14 | ExecStart=/sbin/swapon /dev/zram0 15 | ExecStop=/sbin/swapoff /dev/zram0 16 | [Install] 17 | WantedBy=multi-user.target''' >> /etc/systemd/system/zram.service 18 | sudo systemctl enable zram 19 | -------------------------------------------------------------------------------- /AOSP/AOSP-sync.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This is a basic script for Syncing the entire Android Open Source Project for building. 4 | echo "============================================================" 5 | echo " Welcome to Android Open Source Project Sync Script " 6 | echo "============================================================" 7 | echo "Starting Sync" 8 | echo "Warning: Repo is needed to be installed in prior of running this script" 9 | read -r -p "Enter the branch name to sync: " branch 10 | repo init -u "https://android.googlesource.com/platform/manifest.git" -b "${branch}" 11 | echo "Starting Repo Sync" 12 | repo sync -c --force-sync --optimized-fetch --no-tags --no-clone-bundle --prune -j8 13 | -------------------------------------------------------------------------------- /Setup/install_jadx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # techyminati 3 | 4 | sudo apt install -y zip 5 | JADX_VERSION=$(curl -s "https://api.github.com/repos/skylot/jadx/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+') 6 | curl -Lo jadx.zip "https://github.com/skylot/jadx/releases/latest/download/jadx-${JADX_VERSION}.zip" 7 | unzip jadx.zip -d jadx-temp 8 | sudo mkdir -p /opt/jadx/bin 9 | sudo mv jadx-temp/bin/jadx /opt/jadx/bin 10 | sudo mv jadx-temp/bin/jadx-gui /opt/jadx/bin 11 | sudo mv jadx-temp/lib /opt/jadx 12 | echo 'export PATH=$PATH:/opt/jadx/bin' | sudo tee -a /etc/profile 13 | source /etc/profile 14 | echo "Done" 15 | jadx --version 16 | # Cleanup 17 | rm -rf jadx.zip 18 | rm -rf jadx-temp 19 | -------------------------------------------------------------------------------- /AOSP/aosp-building.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo 'Enter AOSP BRANCH:' 4 | read AOSPBRANCH 5 | repo init --depth=1 -u https://android.googlesource.com/platform/manifest -b $AOSPBRANCH 6 | repo sync -c --force-sync -j8 7 | git clone https://github.com/sarthakroy2002/vendor_realme_RMX2020 -b main vendor/realme/RMX2020 8 | git clone https://github.com/sarthakroy2002/device_realme_RMX2020 -b main device/realme/RMX2020 9 | git clone https://github.com/sarthakroy2002/device_realme_RMX2020-kernel -b main device/realme/RMX2020-kernel 10 | git clone https://github.com/ArrowOS/android_device_mediatek_sepolicy_vndr device/mediatek/sepolicy_vndr 11 | git clone https://github.com/ArrowOS/android_hardware_mediatek hardware/mediatek 12 | 13 | . build/envsetup.sh 14 | lunch RMX2020-userdebug 15 | make otapackage 16 | -------------------------------------------------------------------------------- /Kernel/android12-5.10_Build-script.sh: -------------------------------------------------------------------------------- 1 | mkdir kernel 2 | cd kernel 3 | repo init -u https://android.googlesource.com/kernel/manifest.git -b common-android12-5.10-lts --depth=1 4 | repo sync --force-sync 5 | ln -s common/build.config.gki.aarch64 build.config 6 | cd common 7 | sed -i "s|Image.lz4|Image.gz|g" build.config.gki.aarch64 8 | wget https://gist.githubusercontent.com/sarthakroy2002/4e1c6bc5b5745168f1d47f4eb1bb25d6/raw/1a70b2aa9c401262de2dad03f8231b3f03d5325d/uncommitted.patch 9 | patch -p1 < uncommitted.patch 10 | cd .. 11 | echo "Compile starting..." 12 | bash build/build.sh 13 | echo "Compilied..." 14 | git clone https://github.com/sarthakroy2002/AnyKernel3 -b android12-5.10 15 | cp -r out/android12-5.10/dist/Image.gz AnyKernel3 16 | cd AnyKernel3 17 | zip -r9 android12-5.10-AnyKernel3.zip ./* 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Personal Scripts Repository 2 | 3 | ## Overview 4 | 5 | This a repository to store all the scripts used by myself. 6 | 7 | Feel free to explore, use, and modify these scripts according to your needs. I hope you find something useful or inspiring in this repository. 8 | 9 | ## Getting Started 10 | 11 | To get started with the scripts in this repository, follow these steps: 12 | 13 | 1. Clone the repository to your local machine: 14 | 15 | ```bash 16 | git clone https://github.com/sarthakroy2002/Scripts.git 17 | ``` 18 | 19 | 2. Navigate to the repository directory: 20 | 21 | ```bash 22 | cd Scripts 23 | ``` 24 | 25 | 3. Browse the scripts and choose the ones you're interested in. 26 | 27 | 4. Follow the script-specific instructions in their respective directories. 28 | 29 | Happy coding! 30 | 31 | # Copyright (C) 2024 Sarthak Roy 32 | -------------------------------------------------------------------------------- /Setup/ubuntu_envsetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # For Personal usage (sarhakroy2002) 3 | 4 | echo 'Lets start Setup' 5 | 6 | # Install Essential stuff 7 | sudo apt update 8 | sudo apt install -y bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-gtk3-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev 9 | sudo apt install -y python tmate ssh patchelf binutils zram-config git-lfs jq 10 | echo 'Essential stuff are installed successfully' 11 | 12 | # My Git Config 13 | git config --global user.email "sarthakroy2002@gmail.com" 14 | git config --global user.name "Sarthak Roy" 15 | echo 'Your Git config is set successfully' 16 | 17 | # Install repo 18 | mkdir ~/bin && PATH=~/bin:$PATH && curl https://storage.googleapis.com/git-repo-downloads/repo >~/bin/repo && chmod a+x ~/bin/repo 19 | -------------------------------------------------------------------------------- /Setup/install_android_sdk.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (C) Harsh Shandilya 4 | # SPDX-License-Identifier: GPL-3.0-only 5 | 6 | trap 'rm -rf /tmp/tools.zip 2>/dev/null' INT TERM EXIT 7 | 8 | CUR_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)" 9 | CUR_DIR="${CUR_DIR/setup/}" 10 | SDK_TOOLS=commandlinetools-linux-7583922_latest.zip 11 | 12 | function setup_android_sdk() { 13 | echo "Installing Android SDK" 14 | SDK_DIR="${HOME:?}/Android/Sdk" 15 | mkdir -p "${SDK_DIR}" 16 | if [ ! -f "${SDK_TOOLS}" ]; then 17 | wget https://dl.google.com/android/repository/"${SDK_TOOLS}" -O /tmp/tools.zip 18 | fi 19 | unzip -qo /tmp/tools.zip -d "${SDK_DIR}" 20 | while read -r package; do 21 | yes | "${SDK_DIR}"/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_DIR}" "${package:?}" 22 | done <"${CUR_DIR}"/setup/android-sdk-minimal.txt 23 | rm /tmp/tools.zip 24 | cd - || exit 25 | } 26 | 27 | setup_android_sdk 28 | -------------------------------------------------------------------------------- /Kernel/beryllium_perf+_kernel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2021 CloudedQuartz 4 | # 5 | 6 | # Script to set up environment to build an android kernel 7 | # Assumes required packages are already installed 8 | 9 | # Config 10 | CURRENT_DIR="$(pwd)" 11 | KERNELNAME="perf+" 12 | KERNEL_DIR="$CURRENT_DIR" 13 | AK_REPO="https://github.com/sajidshahriar72543/AnyKernel3" 14 | AK_DIR="$HOME/AnyKernel3" 15 | TC_DIR="$HOME/pg-clang" 16 | # End Config 17 | 18 | # Status message function 19 | msg() { 20 | echo 21 | echo -e "\e[1;32m$*\e[0m" 22 | echo 23 | } 24 | 25 | # clone_tc - clones proton clang to TC_DIR 26 | clone_tc() { 27 | msg "|| Cloning Playground Clang ||" 28 | # git clone --depth=1 https://github.com/kdrag0n/proton-clang.git $TC_DIR 29 | git clone -b 17 --depth=1 https://gitlab.com/PixelOS-Devices/playgroundtc.git $TC_DIR 30 | 31 | } 32 | 33 | # Clones anykernel 34 | clone_ak() { 35 | msg "|| Cloning Anykernel ||" 36 | git clone $AK_REPO $AK_DIR 37 | } 38 | # Actually do stuff 39 | clone_tc 40 | clone_ak 41 | 42 | msg "|| Setup Process Done ||" 43 | 44 | msg "|| Starting Build Process ||" 45 | # Run build script 46 | . ${CURRENT_DIR}/kernel_build.sh -------------------------------------------------------------------------------- /AOSP/arrow-mojito.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | BASE_DIR="$(pwd)" 4 | SOURCEDIR="${BASE_DIR}/work" 5 | 6 | git config --global user.email "sarthakroy2002@gmail.com" && git config --global user.name "Sarthak Roy" 7 | mkdir -p "${SOURCEDIR}" 8 | cd "${SOURCEDIR}" 9 | 10 | repo init -u https://github.com/ArrowOS/android_manifest.git -b arrow-13.1 11 | repo sync -c -j4 --force-sync --no-clone-bundle --no-tags 12 | 13 | git clone --depth=1 https://github.com/ArrowOS-Devices/android_device_xiaomi_mojito.git device/xiaomi/mojito 14 | git clone --depth=1 https://github.com/ArrowOS-Devices/android_vendor_xiaomi_mojito.git vendor/xiaomi/mojito 15 | git clone --depth=1 https://github.com/ArrowOS-Devices/android_kernel_xiaomi_mojito.git kernel/xiaomi/mojito 16 | git clone --depth=1 https://github.com/StatiXOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-elf.git prebuilts/gcc/linux-x86/aarch64/aarch64-elf 17 | git clone --depth=1 https://github.com/StatiXOS/android_prebuilts_gcc_linux-x86_arm_arm-eabi.git prebuilts/gcc/linux-x86/arm/arm-eabi 18 | git clone --depth=1 https://github.com/sarthakroy2002/android_hardware_xiaomi.git hardware/xiaomi 19 | 20 | source build/envsetup.sh 21 | lunch arrow_mojito-userdebug 22 | m bacon 23 | -------------------------------------------------------------------------------- /AOSP/arrow-RMX2020.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | BASE_DIR="$(pwd)" 4 | SOURCEDIR="${BASE_DIR}/work" 5 | 6 | git config --global user.email "sarthakroy2002@gmail.com" && git config --global user.name "Sarthak Roy" 7 | mkdir -p "${SOURCEDIR}" 8 | cd "${SOURCEDIR}" 9 | 10 | repo init -u https://github.com/ArrowOS/android_manifest.git -b arrow-13.1 11 | repo sync -c -j8 --force-sync --no-clone-bundle --no-tags 12 | 13 | git clone https://github.com/ArrowOS-Devices/android_device_realme_RMX2020.git device/realme/RMX2020 14 | git clone https://github.com/ArrowOS-Devices/android_vendor_realme_RMX2020.git vendor/realme/RMX2020 15 | git clone https://github.com/ArrowOS-Devices/android_vendor_realme_RMX2020-ims.git vendor/realme/RMX2020-ims 16 | git clone https://github.com/ArrowOS-Devices/android_kernel_realme_RMX2020.git kernel/realme/RMX2020 17 | git clone https://github.com/LineageOS/android_packages_apps_Aperture.git packages/apps/Aperture 18 | git clone https://github.com/ArrowOS-Devices/android_prebuilts_clang_host_linux-x86_clang-r437112.git prebuilts/clang/host/linux-x86/clang-r437112 19 | 20 | source build/envsetup.sh 21 | 22 | repopick -t thirteen-mtk-enhancements-arrow-13.1 23 | repopick -t thirteen-ca 24 | repopick 19999 25 | 26 | lunch arrow_RMX2020-userdebug 27 | m bacon 28 | -------------------------------------------------------------------------------- /Setup/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Detecting which System Package Manager is currently installed in system. 3 | # Thanks to StackOverflow Community for this Idea. 4 | declare -A osInfo=( 5 | [/etc/dnf/dnf.conf]=dnf 6 | [/etc/arch-release]=pacman 7 | [/etc/debian_version]=apt 8 | [/etc/SuSE-release]=zypper 9 | [/etc/alpine-release]=apk 10 | [/etc/gentoo-release]=emerge 11 | ) 12 | 13 | package="" 14 | 15 | for f in "${!osInfo[@]}"; do 16 | if [[ -f $f ]]; then 17 | package="${osInfo[$f]}" 18 | break 19 | fi 20 | done 21 | 22 | if [[ "$package" == "pacman" ]]; then 23 | bash arch_envsetup.sh 24 | elif [["$package" == "dnf"]]; then 25 | bash fedora_envsetup.sh 26 | elif [[ "$package" == "apk" ]]; then 27 | bash alpine_envsetup.sh 28 | elif [[ "$package" == "emerge" ]]; then 29 | bash gentoo_envsetup.sh 30 | else 31 | bash ubuntu_envsetup.sh 32 | fi 33 | 34 | # Setting up the git config. 35 | printf 'Setting Up Git config.' 36 | echo '' 37 | printf 'Enter your github username.' 38 | # asks for user input. so by using the function 'read' here . There is no need to add any credentials. 39 | read username 40 | sleep 1 41 | git config --global user.name "$username" 42 | echo 'Enter your registered github mail id.' 43 | read mail 44 | sleep 1 45 | git config --global user.email "$mail" 46 | 47 | #End of scripts. 48 | -------------------------------------------------------------------------------- /Setup/alpine_envsetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # For Personal usage (sarhakroy2002) 3 | 4 | echo 'Lets start Setup' 5 | 6 | # Install Essential stuff 7 | apk update 8 | apk add bc bison build-base ccache curl flex g++ git gnupg gperf imagemagick ncurses-dev readline-dev zlib-dev lz4 libncurses5 libgcc libstdc++ sdl-dev openssl wxgtk3.0 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib-dev 9 | apk add python3 tmate openssh python2 patchelf binutils zram-config 10 | echo 'Essential stuff are installed successfully' 11 | 12 | # My Git Config 13 | git config --global user.email "sarthakroy2002@gmail.com" 14 | git config --global user.name "Sarthak Roy" 15 | echo 'Your Git config is set successfully' 16 | 17 | # Store my Git credentials (whenever needed to) 18 | # git config --global credential.helper store 19 | # echo 'Git will store your credentials globally' 20 | 21 | # Install repo 22 | mkdir ~/bin && export PATH=~/bin:$PATH && curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo 23 | 24 | # Setup Change-id hooks 25 | git config --global init.templatedir '~/.git-templates' 26 | mkdir -p ~/.git-templates/hooks 27 | curl -Lo ~/.git-templates/hooks/commit-msg https://raw.githubusercontent.com/sarthakroy2002/Scripts/main/commit-msg 28 | chmod 755 ~/.git-templates/hooks/commit-msg 29 | echo 'Change-id hooks are been setup successfully' 30 | 31 | # Setting up Ssh Key. 32 | sh sshid_setup.sh 33 | -------------------------------------------------------------------------------- /Kernel/C3_eva_kernel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function compile() { 4 | 5 | source ~/.bashrc && source ~/.profile 6 | export LC_ALL=C && export USE_CCACHE=1 7 | ccache -M 100G 8 | git clone --depth=1 https://github.com/StatiXOS/android_prebuilts_gcc_linux-x86_arm_arm-eabi gcc 9 | git clone --depth=1 https://github.com/StatiXOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-elf gcc64 10 | export ARCH=arm64 11 | export KBUILD_BUILD_HOST=neolit 12 | export KBUILD_BUILD_USER="sarthakroy2002" 13 | 14 | [ -d "out" ] && rm -rf out || mkdir -p out 15 | 16 | make O=out ARCH=arm64 RMX2020_defconfig 17 | 18 | PATH="${PWD}/gcc/bin:${PATH}:${PWD}/gcc64/bin:/usr/bin:$PATH" \ 19 | make -j$(nproc --all) O=out \ 20 | CROSS_COMPILE_ARM32=arm-eabi- \ 21 | CROSS_COMPILE=aarch64-elf- \ 22 | LD=aarch64-elf-ld.lld \ 23 | AR=llvm-ar \ 24 | NM=llvm-nm \ 25 | OBJCOPY=llvm-objcopy \ 26 | OBJDUMP=llvm-objdump \ 27 | CC=aarch64-elf-gcc \ 28 | STRIP=llvm-strip \ 29 | CONFIG_DEBUG_SECTION_MISMATCH=y 30 | } 31 | 32 | function zupload() { 33 | git clone --depth=1 https://github.com/sarthakroy2002/AnyKernel3.git AnyKernel 34 | cp out/arch/arm64/boot/Image.gz-dtb AnyKernel 35 | cd AnyKernel 36 | zip -r9 Test-OSS-KERNEL-RMX2020-NEOLIT.zip * 37 | #curl --upload-file Test-OSS-KERNEL-RMX2020-NEOLIT.zip https://transfer.sh/ 38 | curl -sL https://git.io/file-transfer | sh 39 | ./transfer wet Test-OSS-KERNEL-RMX2020-NEOLIT.zip 40 | } 41 | 42 | compile 43 | zupload 44 | -------------------------------------------------------------------------------- /Setup/nipeTorGateway.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # install apt repos 4 | sudo apt update && sudo apt install perl tor -y 5 | echo ......................................................................................................... 6 | # Download 7 | cd /opt || exit 8 | sudo git clone https://github.com/htrgouvea/nipe 9 | cd nipe || exit 10 | echo ......................................................................................................... 11 | 12 | # Install libs and dependencies 13 | sudo cpan install Try::Tiny Config::Simple JSON 14 | echo ......................................................................................................... 15 | 16 | # Nipe must be run as root 17 | perl nipe.pl install 18 | echo ......................................................................................................... 19 | 20 | # add launcher 21 | echo cd /opt/nipe/ \|\| exit \; sudo perl /opt/nipe/nipe.pl \$1 | sudo tee nipe 22 | echo ......................................................................................................... 23 | 24 | sudo chmod +x nipe.pl nipe 25 | echo ......................................................................................................... 26 | 27 | # create symbolic link 28 | echo 'alias nipe="/opt/nipe/nipe"' >>~/.*shrc 29 | echo ......................................................................................................... 30 | 31 | # Show help 32 | nipe 33 | echo ......................................................................................................... 34 | echo "just run nipe.pl start from terminal to start TOR" 35 | -------------------------------------------------------------------------------- /Kernel/C3_standalone-script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function compile() { 4 | 5 | source ~/.bashrc && source ~/.profile 6 | export LC_ALL=C && export USE_CCACHE=1 7 | ccache -M 100G 8 | export ARCH=arm64 9 | export KBUILD_BUILD_HOST=neolit 10 | export KBUILD_BUILD_USER="sarthakroy2002" 11 | git clone --depth=1 https://github.com/kdrag0n/proton-clang clang 12 | git clone --depth=1 https://github.com/sarthakroy2002/prebuilts_gcc_linux-x86_aarch64_aarch64-linaro-7 los-4.9-64 13 | git clone --depth=1 https://github.com/sarthakroy2002/linaro_arm-linux-gnueabihf-7.5 los-4.9-32 14 | 15 | [ -d "out" ] && rm -rf out || mkdir -p out 16 | 17 | make O=out ARCH=arm64 RMX2020_defconfig 18 | 19 | PATH="${PWD}/clang/bin:${PATH}:${PWD}/los-4.9-32/bin:${PATH}:${PWD}/los-4.9-64/bin:${PATH}" \ 20 | make -j$(nproc --all) O=out \ 21 | ARCH=arm64 \ 22 | CC="clang" \ 23 | CLANG_TRIPLE=aarch64-linux-gnu- \ 24 | CROSS_COMPILE="${PWD}/los-4.9-64/bin/aarch64-linux-gnu-" \ 25 | CROSS_COMPILE_ARM32="${PWD}/los-4.9-32/bin/arm-linux-gnueabihf-" \ 26 | AS=llvm-as \ 27 | AR=llvm-ar \ 28 | NM=llvm-nm \ 29 | OBJCOPY=llvm-objcopy \ 30 | CONFIG_NO_ERROR_ON_MISMATCH=y 31 | } 32 | 33 | function zupload() { 34 | git clone --depth=1 https://github.com/sarthakroy2002/AnyKernel3.git AnyKernel 35 | cp out/arch/arm64/boot/Image.gz-dtb AnyKernel 36 | cd AnyKernel 37 | zip -r9 Test-OSS-KERNEL-RMX2020-NEOLIT.zip * 38 | curl -sL https://git.io/file-transfer | sh 39 | ./transfer wet Test-OSS-KERNEL-RMX2020-NEOLIT.zip 40 | } 41 | 42 | compile 43 | zupload 44 | -------------------------------------------------------------------------------- /Setup/gentoo_envsetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | command_exists() { 4 | command -v "$1" >/dev/null 2>&1 5 | } 6 | 7 | if ! command_exists curl || ! command_exists git; then 8 | echo "Please install 'curl' and 'git' before running this script." 9 | exit 1 10 | fi 11 | 12 | printf "%s\n" "> Started Setting Up Build Environment." 13 | 14 | sudo emerge -av app-crypt/gnupg app-arch/zip[-natspec] app-arch/unzip dev-lang/python:2.7 dev-libs/libxslt dev-libs/libxml2 dev-util/android-tools dev-util/ccache dev-util/gperf dev-vcs/git media-libs/libsdl media-libs/mesa net-misc/curl net-misc/rsync sys-devel/bc sys-devel/bison sys-devel/flex sys-devel/gcc[cxx] sys-libs/ncurses-compat:5=[abi_x86_32,tinfo] sys-libs/readline[abi_x86_32] sys-libs/zlib[abi_x86_32] sys-process/schedtool sys-fs/squashfs-tools x11-base/xorg-proto x11-libs/libX11 x11-libs/wxGTK:3.0 15 | 16 | printf "%s\n" "> Which editor do you want to use for git? Tell the executable name (vim, nano, emacs, code, etc.):" 17 | read -r editor 18 | git config --global core.editor "$editor" 19 | 20 | printf "%s\n" "> Enter your name:" 21 | read -r name 22 | git config --global user.name "$name" 23 | printf "%s\n" "> Enter your email:" 24 | read -r email 25 | git config --global user.email "$email" 26 | 27 | printf "%s\n" "> Do you want to authenticate using gh tool (and authenticate git tool)? (y/n)" 28 | read -r gh 29 | if [ "$gh" = "y" ]; then 30 | gh auth login 31 | fi 32 | 33 | printf "%s\n" "> Installing repo tool..." 34 | sudo curl --create-dirs -L -o /usr/local/bin/repo -O -L https://storage.googleapis.com/git-repo-downloads/repo 35 | sudo chmod a+rx /usr/local/bin/repo 36 | 37 | printf "%s\n" "Done! Thanks for using this script." 38 | -------------------------------------------------------------------------------- /Kernel/clang9-kernel-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Defconfig 4 | if [[ -z ${KERNEL_DEFCONFIG} ]]; then 5 | echo -n "Enter your kernel defconfig name: " 6 | read -r NAME 7 | CONFIG=${KERNEL_DEFCONFIG} 8 | fi 9 | 10 | echo "Cloning dependencies" 11 | git clone --depth=1 https://github.com/crdroidandroid/android_prebuilts_clang_host_linux-x86_clang-5484270 -b 9.0 clang 12 | git clone --depth=1 https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9 gcc 13 | git clone --depth=1 https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9 gcc32 14 | 15 | echo "Done" 16 | KERNEL_DIR=$(pwd) 17 | IMAGE="${KERNEL_DIR}/out/arch/arm64/boot/Image.gz-dtb" 18 | TANGGAL=$(date +"%Y%m%d-%H") 19 | BRANCH="$(git rev-parse --abbrev-ref HEAD)" 20 | PATH="${KERNEL_DIR}/clang/bin:${KERNEL_DIR}/gcc/bin:${KERNEL_DIR}/gcc32/bin:${PATH}" 21 | export KBUILD_COMPILER_STRING="$(${KERNEL_DIR}/clang/bin/clang --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g')" 22 | export ARCH=arm64 23 | 24 | make O=out ARCH=arm64 ${CONFIG} 25 | 26 | # Compile plox 27 | compile() { 28 | make -j$(nproc) O=out \ 29 | ARCH=arm64 \ 30 | CC=clang \ 31 | CLANG_TRIPLE=aarch64-linux-gnu- \ 32 | CROSS_COMPILE=aarch64-linux-android- \ 33 | CROSS_COMPILE_ARM32=arm-linux-androideabi- $1 $2 $3 34 | } 35 | 36 | function zupload() { 37 | git clone --depth=1 https://github.com/SakthivelNadar/AnyKernel3-2.git AnyKernel 38 | cp out/arch/arm64/boot/Image.gz-dtb AnyKernel 39 | cd AnyKernel 40 | zip -r9 StormBreaker-r1.0-yogurt.zip * 41 | curl -sL https://git.io/file-transfer | sh 42 | ./transfer wet StormBreaker-r1.0-yogurt.zip 43 | } 44 | 45 | compile 46 | zupload 47 | -------------------------------------------------------------------------------- /Setup/sshid_setup.sh: -------------------------------------------------------------------------------- 1 | ### Currently Only for Distro's for which Pacman is the Package Manager thourgh this script. 2 | 3 | # using setup script to install prerequisite packages using different package mangers . 4 | source setup 5 | 6 | # Generating and Adding SSH Key to Github. 7 | printf 'Generating a new SSH key.' 8 | echo ' ' 9 | printf 'Enter Your registered github mail id & tap enter again.' 10 | read mailid 11 | ssh-keygen -t ed25519 -C "$mailid" 12 | 13 | printf 'Adding SSH key to the workstation.' 14 | eval "$(ssh-agent -s)" 15 | ssh-add ~/.ssh/id_ed25519 16 | printf 'Added SSH key Successfully.' 17 | 18 | # installing Pre-requisite packages. 19 | if [ "package" == "arch" || "package" == "yum" ]; then 20 | sudo pacman -S xclip konsole --noconfirm 21 | else 22 | sudo apt install xclip konsole -y 23 | fi 24 | # Using Xclip to copy the content inside the path. 25 | xclip -sel clip <~/.ssh/id_ed25519.pub 26 | printf 'SSH Key has been copied.' 27 | echo ' ' 28 | sleep 1 29 | printf 'to add it your github account. ' 30 | echo '' 31 | printf 'Opening github.com'. 32 | konsole --new-tab -e python -m webbrowser https://github.com/settings/ssh/new 33 | sleep 1 34 | echo ' ' 35 | printf 'enter creditals to login to your account if asked.' 36 | sleep 1 37 | printf 'after pasting the text , click on Add SSH key.' 38 | read -r -p "Press Enter To Continue." 39 | sleep 1 40 | printf 'yay! you are successfully added.' 41 | sleep 1 42 | echo ' ' 43 | printf 'Now Testing The Connection.' 44 | sleep 1 45 | printf '' 46 | ssh -T git@github.com 47 | 48 | # Setting up the ssh id Done. 49 | printf "Setting up the git config is Successful." 50 | echo ' ' 51 | printf 'Enjoy Baking....' 52 | 53 | # Removing Konsole from Debian based distro. 54 | if [ "package" == "apt" ]; then 55 | sudo apt remove konsole -y 56 | fi 57 | 58 | # End of Script. 59 | -------------------------------------------------------------------------------- /Setup/One-click_setup_for_Mac_Devs.sh: -------------------------------------------------------------------------------- 1 | # install homebrew 2 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 3 | 4 | brew update 5 | 6 | # docker 7 | brew cask install docker 8 | brew install docker docker-completion docker-compose-completion 9 | brew install kubernetes-cli kompose, kubernetes-helm 10 | 11 | # security 12 | brew cask install 1password 13 | 14 | # Dev 15 | brew cask install miniconda 16 | brew tap adoptopenjdk/openjdk 17 | brew cask install adoptopenjdk11 18 | brew install maven 19 | brew install bower cmake 20 | 21 | # Dev CLI 22 | brew install cocoapods tldr tree sbt tmux wget gettext 23 | 24 | # Dev IDE 25 | brew cask install atom visual-studio-code pycharm-ce intellij-idea-ce 26 | brew cask install paw sourcetree 27 | 28 | # collaboration tools 29 | brew cask install microsoft-teams mattermost slack 30 | 31 | # productivity 32 | brew cask install firefox 33 | brew cask install setapp the-unarchiver vlc 34 | brew cask install appcleaner balenaetcher daisydisk bettertouchtool 35 | 36 | # design 37 | brew cask install sf-symbols sketch 38 | 39 | # misc 40 | brew cask install sf-symbols sketch 41 | brew cask install roaringapps 42 | brew cask install wireshark 43 | 44 | # install from mac app store (e.g. mas search "final cut") 45 | brew install mas 46 | # Xcode, Final Cut Pro, Fantastical 47 | # mas install 497799835 424389933 975937182 48 | 49 | # drivers 50 | brew tap homebrew/cask-drivers 51 | brew cask install logitech-options 52 | 53 | # shell configuration 54 | #brew install zsh 55 | #sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 56 | 57 | brew cleanup 58 | 59 | # configure Atom 60 | # apm install pp-markdown markdown-to-pdf pretty-json 61 | # apm install atom-ide-ui ide-python 62 | 63 | # finally 64 | echo "Please reboot now!" 65 | -------------------------------------------------------------------------------- /Setup/tailwind_setup.sh: -------------------------------------------------------------------------------- 1 | echo "Installation of Tailwind CSS + vite" 2 | npm install -D tailwindcss postcss autoprefixer vite 3 | 4 | echo "Initialization of Tailwind to the required Directory" 5 | npx tailwindcss init -p 6 | 7 | 8 | echo "Removing the existing tailwind Config file" 9 | rm tailwind.config.js 10 | 11 | 12 | echo "Configuration of Tailwind config file with Necessary changes" 13 | echo '''/** @type {import('tailwindcss').Config} */ 14 | module.exports = { 15 | content: ["*"], 16 | theme: { 17 | extend: {}, 18 | }, 19 | plugins: [], 20 | } 21 | ''' >> tailwind.config.js 22 | 23 | 24 | echo "Removing Package Json script" 25 | rm package.json 26 | 27 | echo "Creating Package Json script with vite configuration" 28 | echo '''{ 29 | "name": "web-development", 30 | "version": "1.0.0", 31 | "description": "", 32 | "main": "index.js", 33 | "scripts": { 34 | "start": "vite" 35 | }, 36 | "author": "", 37 | "license": "ISC", 38 | "devDependencies": { 39 | "autoprefixer": "^10.4.13", 40 | "postcss": "^8.4.21", 41 | "tailwindcss": "^3.2.4", 42 | "vite": "^4.1.1" 43 | } 44 | }''' >> package.json 45 | 46 | 47 | echo "Creating Style.css with tailwind configs" 48 | echo '''@tailwind base; 49 | @tailwind components; 50 | @tailwind utilities;''' >> style.css 51 | 52 | 53 | echo "Created Index HTML with style.css Linked" 54 | echo ''' 55 | 56 | 57 | 58 | 59 | 60 | 61 | Document 62 | 63 | 64 | 65 | This is Test Page for Run build 66 | 67 | ''' >> index.html 68 | 69 | npm run start 70 | -------------------------------------------------------------------------------- /Setup/arch_envsetup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## Cherry-picked and Adapted from AkhilNarang's script. HatsOFF to him for making things simple and Easier. 4 | # 5 | # Script to setup an android build environment on Arch Based Distro With Pacman Package Manager. 6 | printf %"s\n" "Started Setting Up Build Environment." | typing 7 | 8 | # Enabling the multilib repo, incase it was commented out 9 | printf "Enabling multilib repo." 10 | sudo sed -i "/\[multilib\]/,/Include/"'s/^#//'/etc/pacman.conf 11 | 12 | # Updating the system to the latest release. 13 | printf "Updating..................." 14 | sudo pacman -Syyu --noconfirm 15 | 16 | # Installing the Packages req' for Build Environment. 17 | printf "Installing Android building prerequisites packages. " 18 | sudo pacman -Syyu --noconfirm \ 19 | multilib-devel git wget multilib-devel cmake \ 20 | svn clang lzip patchelf inetutils python2 python3 python-pip \ 21 | perl-switch zip unzip ccache java-environment repo gperf \ 22 | schedtool ninja lzop pngcrush fakeroot \ 23 | base-devel make libxcrypt-compat android-sdk-platform-tools \ 24 | android-udev esd-oss pngcrush figlet fortune-mod hub byobu 25 | 26 | # Install android build prerequisites 27 | printf "Building and Installing Android building prerequisites." 28 | 29 | # Packages needed to be build and installed. 30 | packages="ncurses5-compat-libs lib32-ncurses5-compat-libs aosp-devel xml2 lineageos-devel" 31 | for package in $packages; do 32 | printf %"s\n" "Cloning the $package." "" 33 | git clone https://aur.archlinux.org/"$package" 34 | cd "$package" || exit 35 | printf %"s\n" "Building the $package." "" 36 | makepkg -s 37 | printf %"s\n" "Installing the $package." "" 38 | makepkg -si --skippgpcheck --noconfirm --needed 39 | cd - || exit 40 | done 41 | 42 | # Installation Done. 43 | printf "Build Envirnoment is Successful" 44 | 45 | # Setting up Ssh Key. 46 | bash sshid_setup.sh 47 | -------------------------------------------------------------------------------- /Kernel/r5x-proton-blush-build.sh: -------------------------------------------------------------------------------- 1 | #!bin/bash 2 | 3 | # Install Required Packages 4 | sudo apt install make bison bc libncurses5-dev tmate git python3-pip curl build-essential zip unzip -y 5 | 6 | #Working Directory 7 | WORK_DIR=~/ 8 | 9 | #cloning 10 | if [ -d $WORK_DIR/Anykernel ]; then 11 | echo "Anykernel Directory Already Exists" 12 | else 13 | git clone --depth=1 https://github.com/JaswantTeja/AnyKernel3 -b main $WORK_DIR/Anykernel 14 | fi 15 | if [ -d $WORK_DIR/kernel ]; then 16 | echo "kernel dir exists" 17 | echo "Pulling recent changes" 18 | cd $WORK_DIR/kernel && git pull 19 | cd ../ 20 | else 21 | git clone --depth=1 https://github.com/JaswantTeja/kernel_realme_r5x -b twelve $WORK_DIR/kernel 22 | fi 23 | if [ -d $WORK_DIR/toolchains/proton-clang ]; then 24 | echo "clang dir exists" 25 | else 26 | mkdir $WORK_DIR/toolchains 27 | cd $WORK_DIR/toolchains 28 | git clone https://github.com/kdrag0n/proton-clang.git --depth=1 -b master proton-clang 29 | fi 30 | cd $WORK_DIR/kernel 31 | 32 | # Info 33 | DEVICE="Realme 5 Series (r5x)" 34 | DATE=$(TZ=GMT-5:30 date +%d'-'%m'-'%y'_'%I':'%M) 35 | VERSION=$(make kernelversion) 36 | DISTRO=$(source /etc/os-release && echo $NAME) 37 | CORES=$(nproc --all) 38 | BRANCH=$(git rev-parse --abbrev-ref HEAD) 39 | COMMIT_LOG=$(git log --oneline -n 1) 40 | COMPILER=$($WORK_DIR/toolchains/proton-clang/bin/clang --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g' -e 's/[[:space:]]*$//') 41 | 42 | BUILD_START=$(date +"%s") 43 | export ARCH=arm64 44 | export SUBARCH=arm64 45 | export PATH="$HOME/toolchains/proton-clang/bin:$PATH" 46 | cd $WORK_DIR/kernel 47 | make clean && make mrproper 48 | make O=out r5x_defconfig 49 | make -j$(nproc --all) O=out \ 50 | CROSS_COMPILE=aarch64-linux-gnu- \ 51 | CROSS_COMPILE_ARM32=arm-linux-gnueabi- \ 52 | CC=clang | tee log.txt 53 | 54 | # Zipping Into Flashable Zip with AnyKernel 55 | if [ -f out/arch/arm64/boot/Image.gz-dtb ]; then 56 | cp out/arch/arm64/boot/Image.gz-dtb $WORK_DIR/Anykernel 57 | cd $WORK_DIR/Anykernel 58 | zip -r9 Blush-r5x-$DATE.zip * -x .git README.md */placeholder 59 | cp $WORK_DIR/Anykernel/Blush-$DATE.zip $WORK_DIR/ 60 | rm $WORK_DIR/Anykernel/Image.gz-dtb 61 | rm $WORK_DIR/Anykernel/Blush-$DATE.zip 62 | BUILD_END=$(date +"%s") 63 | DIFF=$((BUILD_END - BUILD_START)) 64 | 65 | fi 66 | -------------------------------------------------------------------------------- /Kernel/X00T_trb_kernel.sh: -------------------------------------------------------------------------------- 1 | #!bin/bash 2 | 3 | # Install Required Packages 4 | sudo apt install make bison bc libncurses5-dev tmate git python3-pip curl build-essential zip unzip -y 5 | 6 | #Working Directory 7 | WORK_DIR=~/ 8 | 9 | #cloning 10 | if [ -d $WORK_DIR/Anykernel ]; then 11 | echo "Anykernel Directory Already Exists" 12 | else 13 | git clone --depth=1 https://github.com/karthik1896/AnyKernel3 -b X00T $WORK_DIR/Anykernel 14 | fi 15 | if [ -d $WORK_DIR/kernel ]; then 16 | echo "kernel dir exists" 17 | echo "Pulling recent changes" 18 | cd $WORK_DIR/kernel && git pull 19 | cd ../ 20 | else 21 | git clone --depth=1 https://github.com/karthik1896/kernel_asus_sdm660-2 -b 12.0 $WORK_DIR/kernel 22 | fi 23 | if [ -d $WORK_DIR/toolchains/trb_clang-14 ]; then 24 | echo "clang dir exists" 25 | else 26 | mkdir $WORK_DIR/toolchains 27 | cd $WORK_DIR/toolchains 28 | wget https://gitlab.com/varunhardgamer/trb_clang/-/archive/14/trb_clang-14.zip 29 | unzip trb_clang-14.zip 30 | fi 31 | cd $WORK_DIR/kernel 32 | 33 | # Info 34 | DEVICE="Asus Zenfone Max Pro M1 (X00T)" 35 | DATE=$(TZ=GMT-5:30 date +%d'-'%m'-'%y'_'%I':'%M) 36 | VERSION=$(make kernelversion) 37 | DISTRO=$(source /etc/os-release && echo $NAME) 38 | CORES=$(nproc --all) 39 | BRANCH=$(git rev-parse --abbrev-ref HEAD) 40 | COMMIT_LOG=$(git log --oneline -n 1) 41 | COMPILER=$($WORK_DIR/toolchains/trb_clang-14/bin/clang --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g' -e 's/[[:space:]]*$//') 42 | 43 | BUILD_START=$(date +"%s") 44 | export ARCH=arm64 45 | export SUBARCH=arm64 46 | export PATH="$WORK_DIR/toolchains/trb_clang-14/bin/:$PATH" 47 | cd $WORK_DIR/kernel 48 | make clean && make mrproper 49 | make O=out X00T_defconfig 50 | make -j$(nproc --all) O=out \ 51 | CROSS_COMPILE=aarch64-linux-gnu- \ 52 | CROSS_COMPILE_ARM32=arm-linux-gnueabi- \ 53 | CC=clang | tee log.txt 54 | 55 | #Zipping Into Flashable Zip 56 | if [ -f out/arch/arm64/boot/Image.gz-dtb ]; then 57 | cp out/arch/arm64/boot/Image.gz-dtb $WORK_DIR/Anykernel 58 | cd $WORK_DIR/Anykernel 59 | zip -r9 Zeus-$DATE.zip * -x .git README.md */placeholder 60 | cp $WORK_DIR/Anykernel/Zeus-$DATE.zip $WORK_DIR/ 61 | rm $WORK_DIR/Anykernel/Image.gz-dtb 62 | rm $WORK_DIR/Anykernel/Zeus-$DATE.zip 63 | BUILD_END=$(date +"%s") 64 | DIFF=$((BUILD_END - BUILD_START)) 65 | 66 | fi 67 | -------------------------------------------------------------------------------- /commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # From Gerrit Code Review 3.5.0.1-1-g05e28e622e 3 | # 4 | # Part of Gerrit Code Review (https://www.gerritcodereview.com/) 5 | # 6 | # Copyright (C) 2009 The Android Open Source Project 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | set -u 21 | 22 | # avoid [[ which is not POSIX sh. 23 | if test "$#" != 1; then 24 | echo "$0 requires an argument." 25 | exit 1 26 | fi 27 | 28 | if test ! -f "$1"; then 29 | echo "file does not exist: $1" 30 | exit 1 31 | fi 32 | 33 | # Do not create a change id if requested 34 | if test "false" = "$(git config --bool --get gerrit.createChangeId)"; then 35 | exit 0 36 | fi 37 | 38 | if git rev-parse --verify HEAD >/dev/null 2>&1; then 39 | refhash="$(git rev-parse HEAD)" 40 | else 41 | refhash="$(git hash-object -t tree /dev/null)" 42 | fi 43 | 44 | random=$({ 45 | git var GIT_COMMITTER_IDENT 46 | echo "$refhash" 47 | cat "$1" 48 | } | git hash-object --stdin) 49 | dest="$1.tmp.${random}" 50 | 51 | trap 'rm -f "${dest}"' EXIT 52 | 53 | if ! git stripspace --strip-comments <"$1" >"${dest}"; then 54 | echo "cannot strip comments from $1" 55 | exit 1 56 | fi 57 | 58 | if test ! -s "${dest}"; then 59 | echo "file is empty: $1" 60 | exit 1 61 | fi 62 | 63 | reviewurl="$(git config --get gerrit.reviewUrl)" 64 | if test -n "${reviewurl}"; then 65 | if ! git interpret-trailers --parse <"$1" | grep -q '^Link:.*/id/I[0-9a-f]\{40\}$'; then 66 | if ! git interpret-trailers \ 67 | --trailer "Link: ${reviewurl%/}/id/I${random}" <"$1" >"${dest}"; then 68 | echo "cannot insert link footer in $1" 69 | exit 1 70 | fi 71 | fi 72 | else 73 | # Avoid the --in-place option which only appeared in Git 2.8 74 | # Avoid the --if-exists option which only appeared in Git 2.15 75 | if ! git -c trailer.ifexists=doNothing interpret-trailers \ 76 | --trailer "Change-Id: I${random}" <"$1" >"${dest}"; then 77 | echo "cannot insert change-id line in $1" 78 | exit 1 79 | fi 80 | fi 81 | 82 | if ! mv "${dest}" "$1"; then 83 | echo "cannot mv ${dest} to $1" 84 | exit 1 85 | fi 86 | -------------------------------------------------------------------------------- /Kernel/cancunf_build_script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Dependencies 4 | deps() { 5 | echo "Installing dependencies" 6 | sudo apt install -y ccache 7 | echo "Done" 8 | } 9 | 10 | IMAGE=$(pwd)/out/arch/arm64/boot/Image.gz 11 | DATE=$(date +"%Y%m%d-%H%M") 12 | START=$(date +"%s") 13 | KERNEL_DIR=$(pwd) 14 | CACHE=1 15 | export CACHE 16 | export KBUILD_COMPILER_STRING="Clang 12.0.5 r416183b" 17 | export DEVICE="moto g54 5G" 18 | export CODENAME="cancunf" 19 | export COMMIT_HASH=$(git rev-parse --short HEAD) 20 | STATUS=BETA 21 | export STATUS 22 | source "${HOME}"/.bashrc && source "${HOME}"/.profile 23 | if [ $CACHE = 1 ]; then 24 | ccache -M 100G 25 | export USE_CCACHE=1 26 | fi 27 | LC_ALL=C 28 | export LC_ALL 29 | 30 | tg() { 31 | curl -sX POST https://api.telegram.org/bot"${token}"/sendMessage -d chat_id="${chat_id}" -d parse_mode=Markdown -d disable_web_page_preview=true -d text="$1" &>/dev/null 32 | } 33 | 34 | tgs() { 35 | MD5=$(md5sum "$1" | cut -d' ' -f1) 36 | curl -fsSL -X POST -F document=@"$1" https://api.telegram.org/bot"${token}"/sendDocument \ 37 | -F "chat_id=${chat_id}" \ 38 | -F "parse_mode=Markdown" \ 39 | -F "caption=$2 | *MD5*: \`$MD5\`" 40 | } 41 | 42 | # Sticker 43 | sticker() { 44 | curl -s -X POST https://api.telegram.org/bot"${token}"/sendSticker \ 45 | -d sticker="CAACAgUAAxkBAAEKwfdlVQiHDyeU33wu71hiEWMeemBHhAACTAUAAgjXqFdZ0rpx15brLTME" \ 46 | -d chat_id="${chat_id}" 47 | } 48 | 49 | # Error Sticker 50 | error_sticker() { 51 | curl -s -X POST https://api.telegram.org/bot"${token}"/sendSticker \ 52 | -d sticker="CAACAgQAAxkBAAEKxCplVkvohpIHdto0Sq0FNnsjpiFN6AACQAoAAmfRmFBaWxhVsThPHDME" \ 53 | -d chat_id="${chat_id}" 54 | } 55 | 56 | # Send Build Info 57 | sendinfo() { 58 | tg " 59 | • neOliT CI Build • 60 | *Building on*: \`Github actions\` 61 | *Date*: \`${DATE}\` 62 | *Device*: \`${DEVICE} (${CODENAME})\` 63 | *Branch*: \`$(git rev-parse --abbrev-ref HEAD)\` 64 | *Last Commit*: [${COMMIT_HASH}](${REPO}/commit/${COMMIT_HASH}) 65 | *Compiler*: \`${KBUILD_COMPILER_STRING}\` 66 | *Build Status*: \`${STATUS}\`" 67 | sticker 68 | } 69 | 70 | # Push kernel to channel 71 | push() { 72 | cd AnyKernel || exit 1 73 | ZIP=$(echo *.zip) 74 | tgs "${ZIP}" "Build took $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s). | For *${DEVICE} (${CODENAME})* | ${KBUILD_COMPILER_STRING}" 75 | } 76 | 77 | # Catch Error 78 | finderr() { 79 | curl -s -X POST "https://api.telegram.org/bot$token/sendMessage" \ 80 | -d chat_id="$chat_id" \ 81 | -d "disable_web_page_preview=true" \ 82 | -d "parse_mode=markdown" \ 83 | -d sticker="CAACAgIAAxkBAAED3JViAplqY4fom_JEexpe31DcwVZ4ogAC1BAAAiHvsEs7bOVKQsl_OiME" \ 84 | -d text="Build throw an error(s)" 85 | error_sticker 86 | exit 1 87 | } 88 | 89 | # Compile 90 | compile() { 91 | 92 | if [ -d "out" ]; then 93 | rm -rf out && mkdir -p out 94 | fi 95 | 96 | bash build.sh --clean 97 | 98 | if ! [ -a "$IMAGE" ]; then 99 | finderr 100 | exit 1 101 | fi 102 | } 103 | 104 | deps 105 | sendinfo 106 | compile 107 | END=$(date +"%s") 108 | DIFF=$((END - START)) 109 | push 110 | -------------------------------------------------------------------------------- /Kernel/cancunf_gki_build_script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Dependencies 4 | deps() { 5 | echo "Installing dependencies" 6 | sudo apt install -y ccache 7 | echo "Done" 8 | } 9 | 10 | IMAGE=$(pwd)/out/arch/arm64/boot/Image.gz 11 | DATE=$(date +"%Y%m%d-%H%M") 12 | START=$(date +"%s") 13 | KERNEL_DIR=$(pwd) 14 | CACHE=1 15 | export CACHE 16 | export KBUILD_COMPILER_STRING="Clang 12.0.5 r416183b" 17 | export DEVICE="moto g54 5G" 18 | export CODENAME="cancunf" 19 | export COMMIT_HASH=$(git rev-parse --short HEAD) 20 | STATUS=BETA 21 | export STATUS 22 | source "${HOME}"/.bashrc && source "${HOME}"/.profile 23 | if [ $CACHE = 1 ]; then 24 | ccache -M 100G 25 | export USE_CCACHE=1 26 | fi 27 | LC_ALL=C 28 | export LC_ALL 29 | 30 | tg() { 31 | curl -sX POST https://api.telegram.org/bot"${token}"/sendMessage -d chat_id="${chat_id}" -d parse_mode=Markdown -d disable_web_page_preview=true -d text="$1" &>/dev/null 32 | } 33 | 34 | tgs() { 35 | MD5=$(md5sum "$1" | cut -d' ' -f1) 36 | curl -fsSL -X POST -F document=@"$1" https://api.telegram.org/bot"${token}"/sendDocument \ 37 | -F "chat_id=${chat_id}" \ 38 | -F "parse_mode=Markdown" \ 39 | -F "caption=$2 | *MD5*: \`$MD5\`" 40 | } 41 | 42 | # Sticker 43 | sticker() { 44 | curl -s -X POST https://api.telegram.org/bot"${token}"/sendSticker \ 45 | -d sticker="CAACAgUAAxkBAAEKwfdlVQiHDyeU33wu71hiEWMeemBHhAACTAUAAgjXqFdZ0rpx15brLTME" \ 46 | -d chat_id="${chat_id}" 47 | } 48 | 49 | # Error Sticker 50 | error_sticker() { 51 | curl -s -X POST https://api.telegram.org/bot"${token}"/sendSticker \ 52 | -d sticker="CAACAgQAAxkBAAEKxCplVkvohpIHdto0Sq0FNnsjpiFN6AACQAoAAmfRmFBaWxhVsThPHDME" \ 53 | -d chat_id="${chat_id}" 54 | } 55 | 56 | # Send Build Info 57 | sendinfo() { 58 | tg " 59 | • neOliT CI Build (GKI Build) • 60 | *Building on*: \`Github actions\` 61 | *Date*: \`${DATE}\` 62 | *Device*: \`${DEVICE} (${CODENAME})\` 63 | *Branch*: \`$(git rev-parse --abbrev-ref HEAD)\` 64 | *Last Commit*: [${COMMIT_HASH}](${REPO}/commit/${COMMIT_HASH}) 65 | *Compiler*: \`${KBUILD_COMPILER_STRING}\` 66 | *Build Status*: \`${STATUS}\`" 67 | sticker 68 | } 69 | 70 | # Push kernel to channel 71 | push() { 72 | cd AnyKernel || exit 1 73 | ZIP=$(echo *.zip) 74 | tgs "${ZIP}" "Build took $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s). | For *${DEVICE} (${CODENAME})* | ${KBUILD_COMPILER_STRING}" 75 | } 76 | 77 | # Catch Error 78 | finderr() { 79 | curl -s -X POST "https://api.telegram.org/bot$token/sendMessage" \ 80 | -d chat_id="$chat_id" \ 81 | -d "disable_web_page_preview=true" \ 82 | -d "parse_mode=markdown" \ 83 | -d sticker="CAACAgIAAxkBAAED3JViAplqY4fom_JEexpe31DcwVZ4ogAC1BAAAiHvsEs7bOVKQsl_OiME" \ 84 | -d text="Build throw an error(s)" 85 | error_sticker 86 | exit 1 87 | } 88 | 89 | # Compile 90 | compile() { 91 | 92 | if [ -d "out" ]; then 93 | rm -rf out && mkdir -p out 94 | fi 95 | 96 | bash build.sh --gki --clean 97 | 98 | if ! [ -a "$IMAGE" ]; then 99 | finderr 100 | exit 1 101 | fi 102 | } 103 | 104 | deps 105 | sendinfo 106 | compile 107 | END=$(date +"%s") 108 | DIFF=$((END - START)) 109 | push 110 | -------------------------------------------------------------------------------- /Setup/android_build_env.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (C) 2018 Harsh 'MSF Jarvis' Shandilya 4 | # Copyright (C) 2018 Akhil Narang 5 | # SPDX-License-Identifier: GPL-3.0-only 6 | 7 | # Script to setup an AOSP Build environment on Ubuntu and Linux Mint 8 | 9 | LATEST_MAKE_VERSION="4.3" 10 | UBUNTU_16_PACKAGES="libesd0-dev" 11 | UBUNTU_20_PACKAGES="libncurses5 curl python-is-python3" 12 | DEBIAN_10_PACKAGES="libncurses5" 13 | DEBIAN_11_PACKAGES="libncurses5" 14 | PACKAGES="" 15 | 16 | sudo apt install software-properties-common -y 17 | sudo apt update 18 | 19 | # Install lsb-core packages 20 | sudo apt install lsb-core -y 21 | 22 | LSB_RELEASE="$(lsb_release -d | cut -d ':' -f 2 | sed -e 's/^[[:space:]]*//')" 23 | 24 | if [[ ${LSB_RELEASE} =~ "Mint 18" || ${LSB_RELEASE} =~ "Ubuntu 16" ]]; then 25 | PACKAGES="${UBUNTU_16_PACKAGES}" 26 | elif [[ ${LSB_RELEASE} =~ "Ubuntu 20" || ${LSB_RELEASE} =~ "Ubuntu 21" || ${LSB_RELEASE} =~ "Ubuntu 22" ]]; then 27 | PACKAGES="${UBUNTU_20_PACKAGES}" 28 | elif [[ ${LSB_RELEASE} =~ "Debian GNU/Linux 10" ]]; then 29 | PACKAGES="${DEBIAN_10_PACKAGES}" 30 | elif [[ ${LSB_RELEASE} =~ "Debian GNU/Linux 11" ]]; then 31 | PACKAGES="${DEBIAN_11_PACKAGES}" 32 | fi 33 | 34 | sudo DEBIAN_FRONTEND=noninteractive \ 35 | apt install \ 36 | adb autoconf automake axel bc bison build-essential \ 37 | ccache clang cmake curl expat fastboot flex g++ \ 38 | g++-multilib gawk gcc gcc-multilib git gnupg gperf \ 39 | htop imagemagick lib32ncurses5-dev lib32z1-dev libtinfo5 libc6-dev libcap-dev \ 40 | libexpat1-dev libgmp-dev '^liblz4-.*' '^liblzma.*' libmpc-dev libmpfr-dev libncurses5-dev \ 41 | libsdl1.2-dev libssl-dev libtool libxml2 libxml2-utils '^lzma.*' lzop \ 42 | maven ncftp ncurses-dev patch patchelf pkg-config pngcrush \ 43 | pngquant python2.7 python-all-dev re2c schedtool squashfs-tools subversion \ 44 | texinfo unzip w3m xsltproc zip zlib1g-dev lzip \ 45 | libxml-simple-perl libswitch-perl apt-utils \ 46 | ${PACKAGES} -y 47 | 48 | echo -e "Installing GitHub CLI" 49 | curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg 50 | sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg 51 | echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null 52 | sudo apt update 53 | sudo apt install -y gh 54 | 55 | echo -e "Setting up udev rules for adb!" 56 | sudo curl --create-dirs -L -o /etc/udev/rules.d/51-android.rules -O -L https://raw.githubusercontent.com/M0Rf30/android-udev-rules/master/51-android.rules 57 | sudo chmod 644 /etc/udev/rules.d/51-android.rules 58 | sudo chown root /etc/udev/rules.d/51-android.rules 59 | sudo systemctl restart udev 60 | 61 | if [[ "$(command -v make)" ]]; then 62 | makeversion="$(make -v | head -1 | awk '{print $3}')" 63 | if [[ ${makeversion} != "${LATEST_MAKE_VERSION}" ]]; then 64 | echo "Installing make ${LATEST_MAKE_VERSION} instead of ${makeversion}" 65 | bash "$(dirname "$0")"/make.sh "${LATEST_MAKE_VERSION}" 66 | fi 67 | fi 68 | 69 | echo "Installing repo" 70 | sudo curl --create-dirs -L -o /usr/local/bin/repo -O -L https://storage.googleapis.com/git-repo-downloads/repo 71 | sudo chmod a+rx /usr/local/bin/repo 72 | -------------------------------------------------------------------------------- /Kernel/C3_build_script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Dependencies 4 | deps() { 5 | echo "Cloning dependencies" 6 | if [ ! -d "clang" ]; then 7 | wget https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/tags/android-14.0.0_r50/clang-r510928.tar.gz -O "aosp-clang.tar.gz" 8 | mkdir clang && tar -xf aosp-clang.tar.gz -C clang && rm -rf aosp-clang.tar.gz 9 | KBUILD_COMPILER_STRING="Clang 18.0.0 r510928" 10 | PATH="${PWD}/clang/bin:${PATH}" 11 | fi 12 | sudo apt install -y ccache 13 | echo "Done" 14 | } 15 | 16 | IMAGE=$(pwd)/out/arch/arm64/boot/Image.gz-dtb 17 | DATE=$(date +"%Y%m%d-%H%M") 18 | START=$(date +"%s") 19 | KERNEL_DIR=$(pwd) 20 | CACHE=1 21 | export CACHE 22 | export KBUILD_COMPILER_STRING 23 | ARCH=arm64 24 | export ARCH 25 | KBUILD_BUILD_HOST="neOliT" 26 | export KBUILD_BUILD_HOST 27 | KBUILD_BUILD_USER="sarthakroy2002" 28 | export KBUILD_BUILD_USER 29 | DEVICE="Realme C3/Narzo 10A (Realme Monet)" 30 | export DEVICE 31 | CODENAME="RMX2020" 32 | export CODENAME 33 | DEFCONFIG="RMX2020_defconfig" 34 | export DEFCONFIG 35 | COMMIT_HASH=$(git rev-parse --short HEAD) 36 | export COMMIT_HASH 37 | PROCS=$(nproc --all) 38 | export PROCS 39 | STATUS=BETA 40 | export STATUS 41 | source "${HOME}"/.bashrc && source "${HOME}"/.profile 42 | if [ $CACHE = 1 ]; then 43 | ccache -M 100G 44 | export USE_CCACHE=1 45 | fi 46 | LC_ALL=C 47 | export LC_ALL 48 | 49 | tg() { 50 | curl -sX POST https://api.telegram.org/bot"${token}"/sendMessage -d chat_id="${chat_id}" -d parse_mode=Markdown -d disable_web_page_preview=true -d text="$1" &>/dev/null 51 | } 52 | 53 | tgs() { 54 | MD5=$(md5sum "$1" | cut -d' ' -f1) 55 | curl -fsSL -X POST -F document=@"$1" https://api.telegram.org/bot"${token}"/sendDocument \ 56 | -F "chat_id=${chat_id}" \ 57 | -F "parse_mode=Markdown" \ 58 | -F "caption=$2 | *MD5*: \`$MD5\`" 59 | } 60 | 61 | # Sticker 62 | sticker() { 63 | curl -s -X POST https://api.telegram.org/bot"${token}"/sendSticker \ 64 | -d sticker="CAACAgUAAxkBAAEKwfdlVQiHDyeU33wu71hiEWMeemBHhAACTAUAAgjXqFdZ0rpx15brLTME" \ 65 | -d chat_id="${chat_id}" 66 | } 67 | 68 | # Error Sticker 69 | error_sticker() { 70 | curl -s -X POST https://api.telegram.org/bot"${token}"/sendSticker \ 71 | -d sticker="CAACAgQAAxkBAAEKxCplVkvohpIHdto0Sq0FNnsjpiFN6AACQAoAAmfRmFBaWxhVsThPHDME" \ 72 | -d chat_id="${chat_id}" 73 | } 74 | 75 | # Send Build Info 76 | sendinfo() { 77 | tg " 78 | • neOliT CI Build • 79 | *Building on*: \`Github actions\` 80 | *Date*: \`${DATE}\` 81 | *Device*: \`${DEVICE} (${CODENAME})\` 82 | *Branch*: \`$(git rev-parse --abbrev-ref HEAD)\` 83 | *Last Commit*: [${COMMIT_HASH}](${REPO}/commit/${COMMIT_HASH}) 84 | *Compiler*: \`${KBUILD_COMPILER_STRING}\` 85 | *Build Status*: \`${STATUS}\`" 86 | sticker 87 | } 88 | 89 | # Push kernel to channel 90 | push() { 91 | cd AnyKernel || exit 1 92 | ZIP=$(echo *.zip) 93 | tgs "${ZIP}" "Build took $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s). | For *${DEVICE} (${CODENAME})* | ${KBUILD_COMPILER_STRING}" 94 | } 95 | 96 | # Catch Error 97 | finderr() { 98 | curl -s -X POST "https://api.telegram.org/bot$token/sendMessage" \ 99 | -d chat_id="$chat_id" \ 100 | -d "disable_web_page_preview=true" \ 101 | -d "parse_mode=markdown" \ 102 | -d sticker="CAACAgIAAxkBAAED3JViAplqY4fom_JEexpe31DcwVZ4ogAC1BAAAiHvsEs7bOVKQsl_OiME" \ 103 | -d text="Build throw an error(s)" 104 | error_sticker 105 | exit 1 106 | } 107 | 108 | # Compile 109 | compile() { 110 | 111 | if [ -d "out" ]; then 112 | rm -rf out && mkdir -p out 113 | fi 114 | 115 | make O=out ARCH="${ARCH}" "${DEFCONFIG}" 116 | make -j"${PROCS}" O=out \ 117 | ARCH=$ARCH \ 118 | CC="clang" \ 119 | LLVM=1 \ 120 | CONFIG_NO_ERROR_ON_MISMATCH=y 121 | 122 | if ! [ -a "$IMAGE" ]; then 123 | finderr 124 | exit 1 125 | fi 126 | 127 | git clone --depth=1 https://github.com/sarthakroy2002/AnyKernel3.git AnyKernel 128 | cp out/arch/arm64/boot/Image.gz-dtb AnyKernel 129 | } 130 | # Zipping 131 | zipping() { 132 | cd AnyKernel || exit 1 133 | zip -r9 neOliT-Test-OSS-"${BRANCH}"-RUI2-KERNEL-"${CODENAME}"-"${DATE}".zip ./* 134 | cd .. 135 | } 136 | 137 | deps 138 | sendinfo 139 | compile 140 | zipping 141 | END=$(date +"%s") 142 | DIFF=$((END - START)) 143 | push 144 | -------------------------------------------------------------------------------- /Kernel/wasabi_build_script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Dependencies 4 | deps() { 5 | echo "Cloning dependencies" 6 | 7 | if [ ! -d "clang" ]; then 8 | mkdir clang && cd clang 9 | sudo apt install libelf-dev libarchive-tools 10 | bash <(curl -s https://raw.githubusercontent.com/Neutron-Toolchains/antman/main/antman) -S 11 | bash <(curl -s https://raw.githubusercontent.com/Neutron-Toolchains/antman/main/antman) --patch=glibc 12 | ls 13 | cd .. 14 | KBUILD_COMPILER_STRING="Neutron Clang" 15 | PATH="${PWD}/clang/bin:${PATH}" 16 | fi 17 | sudo apt install -y ccache 18 | echo "Done" 19 | } 20 | 21 | IMAGE=$(pwd)/out/arch/arm64/boot/Image.gz-dtb 22 | DATE=$(date +"%Y%m%d-%H%M") 23 | START=$(date +"%s") 24 | KERNEL_DIR=$(pwd) 25 | CACHE=1 26 | export CACHE 27 | export KBUILD_COMPILER_STRING 28 | ARCH=arm64 29 | export ARCH 30 | KBUILD_BUILD_HOST="neOliT" 31 | export KBUILD_BUILD_HOST 32 | KBUILD_BUILD_USER="sarthakroy2002" 33 | export KBUILD_BUILD_USER 34 | DEVICE="Realme 6/7/Narzo 30 (Realme Wasabi/RM6785)" 35 | export DEVICE 36 | CODENAME="RM6785" 37 | export CODENAME 38 | DEFCONFIG="wasabi_defconfig" 39 | export DEFCONFIG 40 | COMMIT_HASH=$(git rev-parse --short HEAD) 41 | export COMMIT_HASH 42 | PROCS=$(nproc --all) 43 | export PROCS 44 | STATUS=BETA 45 | export STATUS 46 | source "${HOME}"/.bashrc && source "${HOME}"/.profile 47 | if [ $CACHE = 1 ]; then 48 | ccache -M 100G 49 | export USE_CCACHE=1 50 | fi 51 | LC_ALL=C 52 | export LC_ALL 53 | 54 | tg() { 55 | curl -sX POST https://api.telegram.org/bot"${token}"/sendMessage -d chat_id="${chat_id}" -d parse_mode=Markdown -d disable_web_page_preview=true -d text="$1" &>/dev/null 56 | } 57 | 58 | tgs() { 59 | MD5=$(md5sum "$1" | cut -d' ' -f1) 60 | curl -fsSL -X POST -F document=@"$1" https://api.telegram.org/bot"${token}"/sendDocument \ 61 | -F "chat_id=${chat_id}" \ 62 | -F "parse_mode=Markdown" \ 63 | -F "caption=$2 | *MD5*: \`$MD5\`" 64 | } 65 | 66 | # sticker plox 67 | sticker() { 68 | curl -s -X POST https://api.telegram.org/bot"${token}"/sendSticker \ 69 | -d sticker="CAACAgQAAxkBAAED3JFiApkFOuZg8zt0-WNrfEGwrvoRuAACAQoAAoEcoFINevKyLXEDhSME" \ 70 | -d chat_id="${chat_id}" 71 | } 72 | # Send info plox channel 73 | sendinfo() { 74 | tg " 75 | • neOliT CI Build • 76 | *Building on*: \`Github actions\` 77 | *Date*: \`${DATE}\` 78 | *Device*: \`${DEVICE} (${CODENAME})\` 79 | *Last Commit*: [${COMMIT_HASH}](${REPO}/commit/${COMMIT_HASH}) 80 | *Compiler*: \`${KBUILD_COMPILER_STRING}\` 81 | *Build Status*: \`${STATUS}\`" 82 | } 83 | # Push kernel to channel 84 | push() { 85 | cd AnyKernel || exit 1 86 | ZIP=$(echo *.zip) 87 | tgs "${ZIP}" "Build took $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s). | For *${DEVICE} (${CODENAME})* | ${KBUILD_COMPILER_STRING}" 88 | } 89 | # Find Error 90 | finderr() { 91 | curl -s -X POST "https://api.telegram.org/bot$token/sendMessage" \ 92 | -d chat_id="$chat_id" \ 93 | -d "disable_web_page_preview=true" \ 94 | -d "parse_mode=markdown" \ 95 | -d sticker="CAACAgIAAxkBAAED3JViAplqY4fom_JEexpe31DcwVZ4ogAC1BAAAiHvsEs7bOVKQsl_OiME" \ 96 | -d text="Build throw an error(s)" 97 | exit 1 98 | } 99 | # Compile plox 100 | compile() { 101 | 102 | if [ -d "out" ]; then 103 | rm -rf out && mkdir -p out 104 | fi 105 | 106 | make O=out ARCH="${ARCH}" "${DEFCONFIG}" 107 | 108 | make -j"${PROCS}" O=out \ 109 | ARCH=$ARCH \ 110 | CC="clang" \ 111 | CROSS_COMPILE=aarch64-linux-gnu- \ 112 | CROSS_COMPILE_ARM32=arm-linux-gnueabi- \ 113 | LLVM=1 \ 114 | LD=ld.lld \ 115 | AR=llvm-ar \ 116 | NM=llvm-nm \ 117 | OBJCOPY=llvm-objcopy \ 118 | OBJDUMP=llvm-objdump \ 119 | STRIP=llvm-strip \ 120 | CONFIG_NO_ERROR_ON_MISMATCH=y 121 | 122 | if ! [ -a "$IMAGE" ]; then 123 | finderr 124 | exit 1 125 | fi 126 | 127 | git clone --depth=1 https://github.com/sarthakroy2002/AnyKernel3.git -b RMX2001 AnyKernel 128 | cp out/arch/arm64/boot/Image.gz-dtb AnyKernel 129 | } 130 | # Zipping 131 | zipping() { 132 | cd AnyKernel || exit 1 133 | zip -r9 neOliT-Test-OSS-KERNEL-"${CODENAME}"-"${DATE}".zip ./* 134 | cd .. 135 | } 136 | 137 | deps 138 | sendinfo 139 | compile 140 | zipping 141 | END=$(date +"%s") 142 | DIFF=$((END - START)) 143 | push 144 | -------------------------------------------------------------------------------- /Kernel/merge_clo_tag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Simple bash script to merge CLO tags to kernel 4 | # 5 | # Usage: 6 | # ./merge_clo_tag.sh $TAG 7 | # 8 | 9 | TAG=$1 10 | 11 | if [ -z ${TAG+x} ]; then 12 | echo "Pass a valid argument" 13 | fi 14 | 15 | if [[ $2 == "-i" || $2 == "--initial" ]]; then 16 | INITIAL_MERGE=true 17 | echo "Initial merge" 18 | fi 19 | 20 | # qcacld-3.0 21 | function merge_qcacld() { 22 | echo "Merging qcacld-3.0" 23 | if ! git remote add qcacld-3.0 https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/wlan/qcacld-3.0; then 24 | git remote rm qcacld-3.0 25 | git remote add qcacld-3.0 https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/wlan/qcacld-3.0 26 | fi 27 | 28 | git fetch qcacld-3.0 $TAG 29 | 30 | if [[ ${INITIAL_MERGE} == true ]]; then 31 | git merge -s ours --no-commit --allow-unrelated-histories FETCH_HEAD 32 | git read-tree --prefix=drivers/staging/qcacld-3.0 -u FETCH_HEAD 33 | git commit -m "qcacld-3.0: Merge tag '$TAG'" 34 | echo "Merged qcacld-3.0 tag succesfully!" 35 | else 36 | if ! git merge -X subtree=drivers/staging/qcacld-3.0 FETCH_HEAD --log; then 37 | echo "Merge failed!" && exit 1 38 | else 39 | echo "Merged qcacld-3.0 tag sucessfully!" 40 | fi 41 | fi 42 | } 43 | 44 | # fw-api 45 | function merge_fw_api() { 46 | echo "Merging fw-api" 47 | if ! git remote add fw-api https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/wlan/fw-api; then 48 | git remote rm fw-api 49 | git remote add fw-api https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/wlan/fw-api 50 | fi 51 | 52 | git fetch fw-api $TAG 53 | 54 | if [[ ${INITIAL_MERGE} == true ]]; then 55 | git merge -s ours --no-commit --allow-unrelated-histories FETCH_HEAD 56 | git read-tree --prefix=drivers/staging/fw-api -u FETCH_HEAD 57 | git commit -m "fw-api: Merge tag '$TAG'" 58 | echo "Merged fw-api tag succesfully!" 59 | else 60 | if ! git merge -X subtree=drivers/staging/fw-api FETCH_HEAD --log; then 61 | echo "Merge failed!" && exit 1 62 | else 63 | echo "Merged fw-api tag sucessfully!" 64 | fi 65 | fi 66 | } 67 | 68 | # qca-wifi-host-cmn 69 | function merge_qca_wifi_host_cmn() { 70 | echo "Merging qca-wifi-host-cmn" 71 | if ! git remote add qca-wifi-host-cmn https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/wlan/qca-wifi-host-cmn; then 72 | git remote rm qca-wifi-host-cmn 73 | git remote add qca-wifi-host-cmn https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/wlan/qca-wifi-host-cmn 74 | fi 75 | 76 | git fetch qca-wifi-host-cmn $TAG 77 | 78 | if [[ ${INITIAL_MERGE} == true ]]; then 79 | git merge -s ours --no-commit --allow-unrelated-histories FETCH_HEAD 80 | git read-tree --prefix=drivers/staging/qca-wifi-host-cmn -u FETCH_HEAD 81 | git commit -m "qca-wifi-host-cmn: Merge tag '$TAG'" 82 | echo "Merged qca-wifi-host-cmn tag succesfully!" 83 | else 84 | if ! git merge -X subtree=drivers/staging/qca-wifi-host-cmn FETCH_HEAD --log; then 85 | echo "Merge failed!" && exit 1 86 | else 87 | echo "Merged qca-wifi-host-cmn tag sucessfully!" 88 | fi 89 | fi 90 | } 91 | 92 | # techpack 93 | function merge_techpack() { 94 | echo "Merging techpack" 95 | if ! git remote add techpack https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel; then 96 | git remote rm techpack 97 | git remote add techpack https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel 98 | fi 99 | 100 | git fetch techpack $TAG 101 | 102 | if [[ ${INITIAL_MERGE} == true ]]; then 103 | git merge -s ours --no-commit --allow-unrelated-histories FETCH_HEAD 104 | git read-tree --prefix=techpack/audio -u FETCH_HEAD 105 | git commit -m "techpack: Merge tag '$TAG'" 106 | echo "Merged techpack tag succesfully!" 107 | else 108 | if ! git merge -X subtree=techpack/audio FETCH_HEAD --log; then 109 | echo "Merge failed!" && exit 1 110 | else 111 | echo "Merged techpack tag sucessfully!" 112 | fi 113 | fi 114 | } 115 | 116 | # initialize script 117 | merge_qcacld 118 | merge_fw_api 119 | merge_qca_wifi_host_cmn 120 | merge_techpack 121 | -------------------------------------------------------------------------------- /AOSP/update-symlinks.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright (C) 2024 Sarthak Roy 4 | # 5 | # SPDX-License-Identifier: Apache-2.0 6 | # 7 | 8 | input_file = 'proprietary-files.txt' 9 | soc = 'mt6855' 10 | 11 | with open(input_file, 'r') as infile: 12 | lines = infile.readlines() 13 | 14 | with open(input_file, 'w') as outfile: 15 | for line in lines: 16 | line = line.strip() 17 | 18 | if f"/{soc}/" in line and "/etc/" not in line: 19 | 20 | sha1sum='' 21 | if '|' in line: 22 | sha1sum = '|'+line.split('|')[1] 23 | line=line.split('|')[0] 24 | 25 | line = line.split(';SYMLINK=')[0] 26 | parts = line.split(f'/{soc}/') 27 | 28 | if len(parts) == 2: 29 | symlink_path = f"{parts[0]}/{parts[1]}" 30 | symlink_path = symlink_path.lstrip('-') 31 | if "graphics.allocator" in symlink_path or "v3avpud" in symlink_path: 32 | symlink_path = symlink_path.replace(f".{soc}", "") 33 | 34 | modified_line = f"{line};SYMLINK={symlink_path}{sha1sum}" 35 | 36 | outfile.write(modified_line + '\n') 37 | else: 38 | outfile.write(line + '\n') 39 | 40 | elif "audio.primary.mediatek" in line: 41 | sha1sum='' 42 | if '|' in line: 43 | sha1sum = '|'+line.split('|')[1] 44 | line=line.split('|')[0] 45 | line = line.split(';SYMLINK=')[0] 46 | symlink_path = line.replace("mediatek", f"{soc}") 47 | symlink_path = symlink_path.lstrip('-') 48 | modified_line = f"{line};SYMLINK={symlink_path}{sha1sum}" 49 | outfile.write(modified_line + '\n') 50 | 51 | elif "audio.r_submix.mediatek" in line: 52 | sha1sum='' 53 | if '|' in line: 54 | sha1sum = '|'+line.split('|')[1] 55 | line=line.split('|')[0] 56 | line = line.split(';SYMLINK=')[0] 57 | symlink_path = line.replace("mediatek", f"{soc}") 58 | symlink_path = symlink_path.lstrip('-') 59 | modified_line = f"{line};SYMLINK={symlink_path}{sha1sum}" 60 | outfile.write(modified_line + '\n') 61 | 62 | elif "libSoftGatekeeper" in line: 63 | sha1sum='' 64 | if '|' in line: 65 | sha1sum = '|'+line.split('|')[1] 66 | line=line.split('|')[0] 67 | line = line.split(';SYMLINK=')[0] 68 | symlink_path = line.replace("libSoftGatekeeper", "gatekeeper.default") 69 | symlink_path = symlink_path.lstrip('-') 70 | modified_line = f"{line};SYMLINK={symlink_path}{sha1sum}" 71 | outfile.write(modified_line + '\n') 72 | 73 | elif "libMcGatekeeper" in line: 74 | sha1sum='' 75 | if '|' in line: 76 | sha1sum = '|'+line.split('|')[1] 77 | line=line.split('|')[0] 78 | line = line.split(';SYMLINK=')[0] 79 | symlink_path = line.replace("libMcGatekeeper", "gatekeeper.trustonic") 80 | symlink_path = symlink_path.lstrip('-') 81 | modified_line = f"{line};SYMLINK={symlink_path}{sha1sum}" 82 | outfile.write(modified_line + '\n') 83 | 84 | elif "kmsetkey.trustonic" in line: 85 | sha1sum='' 86 | if '|' in line: 87 | sha1sum = '|'+line.split('|')[1] 88 | line=line.split('|')[0] 89 | line = line.split(';SYMLINK=')[0] 90 | symlink_path = line.replace("kmsetkey.trustonic", "kmsetkey.default") 91 | symlink_path = symlink_path.lstrip('-') 92 | modified_line = f"{line};SYMLINK={symlink_path}{sha1sum}" 93 | outfile.write(modified_line + '\n') 94 | 95 | elif "sensors.mediatek.V2.0" in line: 96 | sha1sum='' 97 | if '|' in line: 98 | sha1sum = '|'+line.split('|')[1] 99 | line=line.split('|')[0] 100 | line = line.split(';SYMLINK=')[0] 101 | symlink_path = line.replace("sensors.mediatek.V2.0", f"sensors.{soc}") 102 | symlink_path = symlink_path.lstrip('-') 103 | modified_line = f"{line};SYMLINK={symlink_path}{sha1sum}" 104 | outfile.write(modified_line + '\n') 105 | 106 | else: 107 | outfile.write(line + '\n') 108 | -------------------------------------------------------------------------------- /Setup/arch_post_setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # print command before executing, and exit when any command fails 4 | 5 | set -xe 6 | 7 | hostname=arch 8 | 9 | # regular user name 10 | 11 | username=sarthakroy2002 12 | 13 | # password for regular user. Password for root will not be set 14 | 15 | password=user 16 | 17 | # Timezone 18 | 19 | rm -f /etc/localtime 20 | 21 | ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 22 | 23 | hwclock --systohc --utc 24 | 25 | # Locale 26 | 27 | sed -i 's/^#en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen 28 | 29 | sed -i 's/^#zh_CN.GB18030/zh_CN.GB18030/' /etc/locale.gen 30 | 31 | sed -i 's/^#zh_CN.UTF-8/zh_CN.UTF-8/' /etc/locale.gen 32 | 33 | locale-gen 34 | 35 | echo "LANG=en_US.UTF-8" >/etc/locale.conf 36 | 37 | # Hostname 38 | 39 | echo $hostname >/etc/hostname 40 | 41 | # Install intel-ucode for Intel CPU 42 | 43 | is_intel_cpu=$(lscpu | grep 'Intel' &>/dev/null && echo 'yes' || echo '') 44 | 45 | if [[ -n $is_intel_cpu ]]; then 46 | 47 | pacman -S --noconfirm intel-ucode --overwrite=/boot/intel-ucode.img 48 | 49 | fi 50 | 51 | # Bootloader 52 | 53 | # Use system-boot for EFI mode, and grub for others 54 | 55 | if [[ -d "/sys/firmware/efi/efivars" ]]; then 56 | 57 | bootctl install 58 | 59 | cat </boot/loader/entries/arch.conf 60 | 61 | title Arch Linux 62 | 63 | linux /vmlinuz-linux 64 | 65 | initrd /intel-ucode.img 66 | 67 | initrd /initramfs-linux.img 68 | 69 | options root=/dev/sda2 rw 70 | 71 | EOF 72 | 73 | cat </boot/loader/loader.conf 74 | 75 | default arch 76 | 77 | timeout 3 78 | 79 | editor no 80 | 81 | EOF 82 | 83 | if [[ -z $is_intel_cpu ]]; then 84 | 85 | sed -i '/intel-ucode/d' /boot/loader/entries/arch.conf 86 | 87 | fi 88 | 89 | # remove leading spaces 90 | 91 | sed -i 's#^ \+##g' /boot/loader/entries/arch.conf 92 | 93 | sed -i 's#^ \+##g' /boot/loader/loader.conf 94 | 95 | # modify root partion in loader conf 96 | 97 | root_partition=$(mount | grep 'on / ' | cut -d' ' -f1) 98 | 99 | root_partition=$(df / | tail -1 | cut -d' ' -f1) 100 | 101 | sed -i "s#/dev/sda2#$root_partition#" /boot/loader/entries/arch.conf 102 | 103 | else 104 | 105 | disk=$(df / | tail -1 | cut -d' ' -f1 | sed 's#[0-9]\+##g') 106 | 107 | pacman --noconfirm -S grub os-prober 108 | 109 | grub-install --target=i386-pc "$disk" 110 | 111 | grub-mkconfig -o /boot/grub/grub.cfg 112 | 113 | fi 114 | 115 | # Config sudo 116 | 117 | # allow users of group wheel to use sudo 118 | 119 | sed -i 's/^# %wheel ALL=(ALL) ALL$/%wheel ALL=(ALL) ALL/' /etc/sudoers 120 | 121 | # Create regular user 122 | 123 | useradd -m -g users -G wheel -s /bin/bash $username 124 | 125 | echo "$username:$password" | chpasswd 126 | 127 | # Desktop Environment 128 | 129 | # xorg 130 | 131 | pacman -S --noconfirm xorg-server 132 | 133 | # graphics driver 134 | 135 | nvidia=$(lspci | grep -e VGA -e 3D | grep 'NVIDIA' 2>/dev/null || echo '') 136 | 137 | amd=$(lspci | grep -e VGA -e 3D | grep 'AMD' 2>/dev/null || echo '') 138 | 139 | intel=$(lspci | grep -e VGA -e 3D | grep 'Intel' 2>/dev/null || echo '') 140 | 141 | if [[ -n $nvidia ]]; then 142 | 143 | pacman -S --noconfirm nvidia 144 | 145 | fi 146 | 147 | if [[ -n $amd ]]; then 148 | 149 | pacman -S --noconfirm xf86-video-amdgpu 150 | 151 | fi 152 | 153 | if [[ -n $intel ]]; then 154 | 155 | pacman -S --noconfirm xf86-video-intel 156 | 157 | fi 158 | 159 | if [[ -n $nvidia && -n $intel ]]; then 160 | 161 | pacman -S --noconfirm bumblebee 162 | 163 | gpasswd -a $username bumblebee 164 | 165 | systemctl enable bumblebeed 166 | 167 | fi 168 | 169 | # touchpad driver 170 | 171 | # Seem no more needed as xf86-input-libinput can be a drop-in replacement 172 | 173 | # if grep -q 'Synaptics TouchPad' /proc/bus/input/devices; then 174 | 175 | # pacman -S --noconfirm xf86-input-synaptics 176 | 177 | # fi 178 | 179 | # gnome 180 | 181 | pacman -S --noconfirm gdm gnome-shell gnome-shell-extensions gnome-keyring seahorse gnome-backgrounds 182 | 183 | gnome-control-center gnome-font-viewer xdg-user-dirs-gtk 184 | 185 | gnome-power-manager gnome-system-monitor gnome-terminal nautilus gvfs-mtp eog evince 186 | 187 | file-roller gnome-tweaks networkmanager 188 | 189 | # Native browser connector for integration with extensions.gnome.org 190 | 191 | pacman -S --noconfirm chrome-gnome-shell 192 | 193 | # start gnome by default 194 | 195 | systemctl enable gdm 196 | 197 | systemctl enable NetworkManager 198 | 199 | # compression/decompression tools 200 | 201 | pacman -S --noconfirm unrar p7zip 202 | 203 | # useful shell utils 204 | 205 | pacman -S --noconfirm bash-completion vim bind-tools dos2unix rsync wget git tree 206 | 207 | pacman -S --noconfirm net-tools whois screen inotify-tools perl-rename recode 208 | 209 | pacman -S --noconfirm openbsd-netcat 210 | 211 | # Use vim instead vi 212 | 213 | ln -s /usr/bin/vim /usr/local/bin/vi 214 | -------------------------------------------------------------------------------- /Setup/fedora_envsetup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Script to set up a Fedora 32+ server 6 | # (with minimum 16GB RAM, 8 threads CPU) for android ROM compiling 7 | # 8 | # Sudo access is mandatory to run this script 9 | # 10 | # IMPORTANT NOTICE: This script sets my personal git config, update 11 | # it with your details before you run this script! 12 | # 13 | # Usage: 14 | # ./fedora-setup.sh 15 | # 16 | 17 | # Go to home dir 18 | orig_dir=$(pwd) 19 | cd $HOME 20 | 21 | echo -e "Installing and updating dnf packages...\n" 22 | sudo dnf update -qq 23 | sudo dnf install -y -qq \ 24 | android-tools \ 25 | autoconf213 \ 26 | bison \ 27 | bzip2 \ 28 | ccache \ 29 | curl \ 30 | flex \ 31 | gawk \ 32 | gcc-c++ \ 33 | git \ 34 | glibc-devel \ 35 | glibc-static \ 36 | libstdc++-static \ 37 | libX11-devel \ 38 | make \ 39 | mesa-libGL-devel \ 40 | ncurses-devel \ 41 | neofetch \ 42 | nload \ 43 | openssl \ 44 | patch \ 45 | zlib-devel \ 46 | ncurses-devel.i686 \ 47 | readline-devel.i686 \ 48 | zlib-devel.i686 \ 49 | libX11-devel.i686 \ 50 | mesa-libGL-devel.i686 \ 51 | glibc-devel.i686 \ 52 | libstdc++.i686 \ 53 | libXrandr.i686 \ 54 | zip \ 55 | perl-Digest-SHA \ 56 | python2 \ 57 | wget \ 58 | lzop \ 59 | openssl-devel \ 60 | java-1.8.0-openjdk-devel \ 61 | ImageMagick \ 62 | ncurses-compat-libs \ 63 | schedtool \ 64 | lzip \ 65 | vboot-utils \ 66 | vim 67 | 68 | sudo dnf autoremove -y -qq 69 | echo -e "\nDone." 70 | 71 | # The package libncurses5 is not available, so we need to hack our way by symlinking the required library. 72 | sudo ln -s /usr/lib/libncurses.so.6 /usr/lib/libncurses.so.5 73 | sudo ln -s /usr/lib/libncurses.so.6 /usr/lib/libtinfo.so.5 74 | 75 | echo -e "Setting up udev rules for ADB!" 76 | sudo curl --create-dirs -L -o /etc/udev/rules.d/51-android.rules -O -L https://raw.githubusercontent.com/M0Rf30/android-udev-rules/master/51-android.rules 77 | sudo chmod 644 /etc/udev/rules.d/51-android.rules 78 | sudo chown root /etc/udev/rules.d/51-android.rules 79 | sudo udevadm control --reload-rules 80 | 81 | echo -e "\nInstalling git-repo..." 82 | wget -q https://storage.googleapis.com/git-repo-downloads/repo 83 | chmod a+x repo 84 | sudo install repo /usr/local/bin/repo 85 | rm repo 86 | echo -e "Done." 87 | 88 | echo -e "\nInstalling git-cli..." 89 | sudo dnf install 'dnf-command(config-manager)' 90 | sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo 91 | sudo dnf install gh 92 | echo -e "Done." 93 | 94 | echo -e "\nInstalling Android SDK platform tools..." 95 | wget -q https://dl.google.com/android/repository/platform-tools-latest-linux.zip 96 | unzip -qq platform-tools-latest-linux.zip 97 | rm platform-tools-latest-linux.zip 98 | echo -e "Done." 99 | 100 | echo -e "\nInstalling Google Drive CLI..." 101 | wget -q https://raw.githubusercontent.com/usmanmughalji/gdriveupload/master/gdrive 102 | chmod a+x gdrive 103 | sudo install gdrive /usr/local/bin/gdrive 104 | rm gdrive 105 | echo -e "Done." 106 | 107 | echo -e "\nInstalling apktool and JADX..." 108 | mkdir -p bin 109 | wget -q https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.6.0.jar -O bin/apktool.jar 110 | echo 'alias apktool="java -jar $HOME/bin/apktool.jar"' >>.bashrc 111 | 112 | wget -q https://github.com/skylot/jadx/releases/download/v1.4.4/jadx-1.4.4.zip 113 | unzip -qq jadx-1.4.4.zip -d jadx 114 | rm jadx-1.4.4.zip 115 | echo 'export PATH="$HOME/jadx/bin:$PATH"' >>.bashrc 116 | echo -e "Done." 117 | 118 | echo -e "\nSetting up shell environment..." 119 | if [[ $SHELL == *zsh* ]]; then 120 | sh_rc=".zshrc" 121 | else 122 | sh_rc=".bashrc" 123 | fi 124 | 125 | # Add android sdk to path 126 | cat <<'EOF' >>.profile 127 | # Add Android SDK platform tools to path 128 | if [ -d "$HOME/platform-tools" ] ; then 129 | PATH="$HOME/platform-tools:$PATH" 130 | fi 131 | EOF 132 | 133 | # Unlimited history file 134 | sed -i 's/HISTSIZE=.*/HISTSIZE=-1/g' $sh_rc 135 | sed -i 's/HISTFILESIZE=.*/HISTFILESIZE=-1/g' $sh_rc 136 | 137 | echo -e "Done." 138 | 139 | # Increase tmux scrollback buffer size 140 | echo "set-option -g history-limit 6000" >>.tmux.conf 141 | 142 | # Increase maximum ccache size 143 | ccache -M 100G 144 | 145 | ### 146 | ### IMPORTANT !!! REPLACE WITH YOUR PERSONAL DETAILS IF NECESSARY 147 | ### 148 | # Configure git 149 | echo -e "\nSetting up Git..." 150 | 151 | git config --global user.email "placeholder@mail.abc" 152 | git config --global user.name "placeholder username" 153 | 154 | git config --global alias.cp 'cherry-pick' 155 | git config --global alias.c 'commit' 156 | git config --global alias.f 'fetch' 157 | git config --global alias.rb 'rebase' 158 | git config --global alias.rs 'reset' 159 | git config --global alias.ck 'checkout' 160 | git config --global credential.helper 'cache --timeout=99999999' 161 | git config --global core.editor "nano" 162 | echo "Done." 163 | 164 | # Done! 165 | echo -e "\nALL DONE. Now sync sauces & start baking!" 166 | echo -e "Please relogin or run \`source ~/$sh_rc && source ~/.profile\` for environment changes to take effect." 167 | 168 | # Go back to original dir 169 | cd "$orig_dir" 170 | -------------------------------------------------------------------------------- /AOSP/generic-rom.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build info. 4 | LUNCH="" # (MANDATORY) Lunch command , you should not leave it empty device codename get pulled from the command! e.g. lineage_ysl-userdebug 5 | MAKE_TARGET="bacon" # (MANDATORY) Compilation target. e.g. bacon or bootimage [Default is bacon!] 6 | USE_BRUNCH="" # (MANDATORY) yes|no Set to yes if you need to use brunch to build else no for lunch and bacon 7 | CHATID="" # Your telegram group/channel chatid 8 | API_BOT="" # Your HTTP API bot token 9 | 10 | # Colour setup 11 | red=$(tput setaf 1) 12 | grn=$(tput setaf 2) 13 | ylw=$(tput setaf 3) 14 | txtbld=$(tput bold) 15 | txtrst=$(tput sgr0) 16 | bldgrn=${txtbld}$(tput setaf 2) 17 | 18 | DEVICE="$(sed -e "s/^.*_//" -e "s/-.*//" <<<"$LUNCH")" 19 | ROM_NAME="$(sed -e "s/_.*//" <<<"$LUNCH")" 20 | OUT="$(pwd)/out/target/product/$DEVICE" 21 | ERROR_LOG="out/error.log" 22 | 23 | # Parameters 24 | while [[ $# -gt 0 ]]; do 25 | 26 | case $1 in 27 | -s | --sync) 28 | SYNC="1" 29 | ;; 30 | -c | --clean) 31 | CLEAN="1" 32 | ;; 33 | -i | --installclean) 34 | INSTALLCLEAN="1" 35 | ;; 36 | -h | --help) 37 | echo -e "\nNote: • You should specify all the mandatory variables in the script! 38 | • Just run './$0' for normal build 39 | Usage: ./build_rom.sh [OPTION] 40 | Example: 41 | ./$0 -s -c or ./$0 --sync --clean 42 | 43 | Mandatory options: 44 | No option is mandatory!, just simply run the script without passing any parameter. 45 | 46 | Options: 47 | -s, --sync Sync sources before building. 48 | -c, --clean Clean build directory before compilation 49 | -i, --installclean Make installclean.\n" 50 | exit 1 51 | ;; 52 | *) 53 | echo -e "$red\nUnknown parameter passed: $1$txtrst\n" 54 | exit 1 55 | ;; 56 | esac 57 | shift 58 | done 59 | 60 | # Exit if mandatory variables are not specified 61 | if [[ $LUNCH == "" ]] || [[ $USE_BRUNCH == "" ]] || [[ $MAKE_TARGET == "" ]]; then 62 | echo -e "$red\nBRUH: Specify all mandatory variables! Exiting...$txtrst\n" 63 | exit 1 64 | fi 65 | 66 | # Setup Telegram Env 67 | export BOT_MSG_URL="https://api.telegram.org/bot$API_BOT/sendMessage" 68 | export BOT_BUILD_URL="https://api.telegram.org/bot$API_BOT/sendDocument" 69 | 70 | message() { 71 | curl -s -X POST "$BOT_MSG_URL" -d chat_id="$2" \ 72 | -d "parse_mode=html" \ 73 | -d text="$1" 74 | } 75 | 76 | error() { 77 | curl --progress-bar -F document=@"$1" "$BOT_BUILD_URL" \ 78 | -F chat_id="$2" \ 79 | -F "disable_web_page_preview=true" \ 80 | -F "parse_mode=html" 81 | } 82 | 83 | # Setup we.tl 84 | up() { 85 | curl -sL https://git.io/file-transfer | sh 86 | ./transfer wet $1 | tee -a upload.log 87 | } 88 | 89 | # Clean old logs if found 90 | if [ -f "$ERROR_LOG" ]; then 91 | rm "$ERROR_LOG" 92 | fi 93 | 94 | if [ -f log.txt ]; then 95 | rm log.txt 96 | fi 97 | 98 | if [ -f upload.log ]; then 99 | rm upload.log 100 | fi 101 | 102 | # Do if specified 103 | if [[ -n $SYNC ]]; then 104 | echo -e "$bldgrn\nSyncing sources...$txtrst\n" 105 | if ! repo sync -c --force-sync --optimized-fetch --no-tags --no-clone-bundle --prune -j$(nproc --all); then 106 | echo -e "$red\nSyncing failed!$txtrst" && echo -e "$bldgrn\nStarting build...$txtrst\n" 107 | fi 108 | fi 109 | 110 | if [[ -n $CLEAN ]]; then 111 | echo -e "$bldgrn\nClearing out directory...$txtrst\n" 112 | rm -rf out 113 | fi 114 | 115 | if [[ -n $INSTALLCLEAN ]]; then 116 | echo -e "$bldgrn\nMaking installclean...$txtrst\n" 117 | . build/envsetup.sh && make installclean 118 | fi 119 | 120 | # Send build start message on tg 121 | read -r -d '' start <Build status: Started 123 | 124 | Rom: $ROM_NAME 125 | Device: $DEVICE 126 | Source directory: $(pwd) 127 | Make target: $MAKE_TARGET 128 | EOT 129 | 130 | message "$start" "$CHATID" 131 | 132 | START=$(TZ=Asia/Kolkata date +"%s") 133 | 134 | # Build 135 | if [ "$USE_BRUNCH" == yes ]; then 136 | echo -e "$bldgrn\nSetting up build environment...$txtrst" 137 | source build/envsetup.sh 138 | 139 | echo -e "$bldgrn\nLunching $DEVICE...$txtrst" 140 | lunch "$LUNCH" 141 | 142 | if [ $? -eq 0 ]; then 143 | echo -e "$bldgrn\nStarting build...$txtrst" 144 | brunch "$DEVICE" | tee log.txt 145 | else 146 | echo -e "$bldgrn\nLunching $DEVICE failed...$txtrst" 147 | message "Build status: Failed%0A%0AFailed at lunching $DEVICE!" "$CHATID" 148 | exit 1 149 | fi 150 | 151 | else 152 | echo -e "$bldgrn\nSetting up build environment...$txtrst" 153 | source build/envsetup.sh 154 | 155 | echo -e "$bldgrn\nLunching $DEVICE...$txtrst" 156 | lunch "$LUNCH" 157 | 158 | if [ $? -eq 0 ]; then 159 | echo -e "$bldgrn\nStarting build...$txtrst" 160 | make "$MAKE_TARGET" | tee log.txt 161 | else 162 | echo -e "$bldgrn\nLunching $DEVICE failed...$txtrst" 163 | message "Build status: Failed%0A%0AFailed at lunching $DEVICE!" "$CHATID" 164 | exit 1 165 | fi 166 | fi 167 | 168 | # Upload Build 169 | END=$(TZ=Asia/Kolkata date +"%s") 170 | DIFF=$((END - START)) 171 | HOURS=$((DIFF / 3600)) 172 | MINS=$(((DIFF % 3600) / 60)) 173 | 174 | if [ -s out/error.log ]; then 175 | read -r -d '' failed <Build status: Failed%0A%0ACheck log below! 177 | EOT 178 | message "$failed" "$CHATID" 179 | error "$ERROR_LOG" "$CHATID" 180 | 181 | else 182 | if [[ $MAKE_TARGET == bacon ]]; then 183 | ZIP_PATH=$(ls "$OUT"/*2022*.zip | grep -vE 'ota|OTA' | tail -n -1) 184 | echo -e "$bldgrn\nUploading zip...$txtrst\n" 185 | zip=$(up $ZIP_PATH) 186 | filename="$(basename $ZIP_PATH)" 187 | md5sum=$(md5sum $ZIP_PATH | awk '{print $1}') 188 | size=$(ls -sh $ZIP_PATH | awk '{print $1}') 189 | url=$(cat upload.log | grep 'Download' | awk '{ print $3 }') 190 | 191 | read -r -d '' final <Build status: Completed%0ATime elapsed: $HOURS hours and $MINS minutes%0A%0ASize: $size%0AMD5: $md5sum%0ADownload: ${filename} 193 | EOT 194 | message "$final" "$CHATID" 195 | error "log.txt" "$CHATID" 196 | 197 | else 198 | message "Build status: Completed%0ATime elapsed: $HOURS hours and $MINS minutes%0A%0A$MAKE_TARGET compiled successfully!" "$CHATID" 199 | error "log.txt" "$CHATID" 200 | fi 201 | fi 202 | -------------------------------------------------------------------------------- /Kernel/C3_CI_script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # Script For Building Android Kernel 5 | # 6 | 7 | # Bail out if script fails 8 | set -e 9 | 10 | ##----------------------------------------------------------## 11 | # Basic Information 12 | KERNEL_DIR="$(pwd)" 13 | VERSION=v1 14 | MODEL=Realme C3/Narzo 10A 15 | DEVICE=RMX2020 16 | DEFCONFIG=RMX2020_defconfig 17 | IMAGE=$(pwd)/out/arch/arm64/boot/Image.gz-dtb 18 | ##----------------------------------------------------------## 19 | ## Export Variables and Info 20 | function exports() { 21 | export ARCH=arm64 22 | export SUBARCH=arm64 23 | export LOCALVERSION="-${VERSION}" 24 | export KBUILD_BUILD_USER="sarthakroy2002" 25 | export KBUILD_BUILD_VERSION="1" 26 | export PROCS=$(nproc --all) 27 | export DISTRO=$(source /etc/os-release && echo "${NAME}") 28 | 29 | # Variables 30 | KERVER=$(make kernelversion) 31 | COMMIT_HEAD=$(git log --oneline -1) 32 | DATE=$(TZ=Asia/Kolkata date +"%Y%m%d-%T") 33 | TANGGAL=$(date +"%F%S") 34 | 35 | # Compiler and Build Information 36 | TOOLCHAIN=nexus # List ( gcc = eva | nexus9 | nexus12 ) (clang = nexus | aosp | sdclang | proton | atomx ) 37 | LINKER=ld.lld # List ( ld.lld | ld.bfd | ld.gold | ld ) 38 | 39 | if [[ $TOOLCHAIN == "eva" || $TOOLCHAIN == "nexus9" || $TOOLCHAIN == "nexus12" ]]; then 40 | COMPILER=gcc 41 | elif [[ $TOOLCHAIN == "nexus" || $TOOLCHAIN == "proton" || $TOOLCHAIN == "aosp" || $TOOLCHAIN == "sdclang" || $TOOLCHAIN == "atomx" ]]; then 42 | COMPILER=clang 43 | fi 44 | 45 | VERBOSE=0 46 | ZIPNAME=NEOLIT 47 | FINAL_ZIP=${ZIPNAME}-${VERSION}-${DEVICE}-${TANGGAL}.zip 48 | 49 | # CI 50 | if [ "$CI" ]; then 51 | if [ "$CIRCLECI" ]; then 52 | export CI_BRANCH=${CIRCLE_BRANCH} 53 | elif [ "$DRONE" ]; then 54 | export CI_BRANCH=${DRONE_BRANCH} 55 | elif [ "$CIRRUS_CI" ]; then 56 | export CI_BRANCH=${CIRRUS_BRANCH} 57 | fi 58 | fi 59 | } 60 | ##----------------------------------------------------------## 61 | ## Telegram Bot Integration 62 | function post_msg() { 63 | curl -s -X POST "https://api.telegram.org/bot$token/sendMessage" \ 64 | -d chat_id="$chat_id" \ 65 | -d "disable_web_page_preview=true" \ 66 | -d "parse_mode=html" \ 67 | -d text="$1" 68 | } 69 | 70 | function push() { 71 | curl -F document=@$1 "https://api.telegram.org/bot$token/sendDocument" \ 72 | -F chat_id="$chat_id" \ 73 | -F "disable_web_page_preview=true" \ 74 | -F "parse_mode=html" \ 75 | -F caption="$2" 76 | } 77 | ##----------------------------------------------------------------## 78 | ## Get Dependencies 79 | function clone() { 80 | # Get Toolchain 81 | if [[ $TOOLCHAIN == "eva" ]]; then 82 | git clone --depth=1 https://github.com/mvaisakh/gcc-arm64 gcc64 83 | git clone --depth=1 https://github.com/mvaisakh/gcc-arm gcc32 84 | elif [[ $TOOLCHAIN == "nexus9" ]]; then 85 | git clone --depth=1 https://github.com/reaPeR1010/arm64-gcc -b gcc-9 gcc64 86 | git clone --depth=1 https://github.com/reaPeR1010/arm32-gcc -b gcc-9 gcc32 87 | elif [[ $TOOLCHAIN == "nexus12" ]]; then 88 | git clone --depth=1 https://github.com/reaPeR1010/arm64-gcc -b gcc-12 gcc64 89 | git clone --depth=1 https://github.com/reaPeR1010/arm32-gcc -b gcc-12 gcc32 90 | elif [[ $TOOLCHAIN == "proton" ]]; then 91 | git clone --depth=1 https://github.com/kdrag0n/proton-clang clang 92 | elif [[ $TOOLCHAIN == "nexus" ]]; then 93 | git clone --depth=1 https://gitlab.com/Project-Nexus/nexus-clang clang 94 | elif [[ $TOOLCHAIN == "atomx" ]]; then 95 | git clone --depth=1 https://gitlab.com/ElectroPerf/atom-x-clang.git clang 96 | elif [[ $TOOLCHAIN == "aosp" ]]; then 97 | mkdir clang 98 | cd clang || exit 99 | wget -q https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/master/clang-r450784e.tar.gz 100 | tar -xf clang* 101 | cd .. || exit 102 | git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9.git --depth=1 gcc64 103 | git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9.git --depth=1 gcc32 104 | elif [[ $TOOLCHAIN == "sdclang" ]]; then 105 | git clone --depth=1 https://github.com/ZyCromerZ/SDClang clang 106 | git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9.git --depth=1 gcc64 107 | git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9.git --depth=1 gcc32 108 | fi 109 | 110 | # Get AnyKernel3 111 | git clone --depth=1 https://github.com/sarthakroy2002/AnyKernel3 AK3 112 | 113 | # Set PATH 114 | if [[ $COMPILER == "gcc" ]]; then 115 | PATH="${KERNEL_DIR}/gcc64/bin/:${KERNEL_DIR}/gcc32/bin/:/usr/bin:${PATH}" 116 | elif [[ $TOOLCHAIN == "nexus" || $TOOLCHAIN == "proton" || $TOOLCHAIN == "atomx" ]]; then 117 | PATH="${KERNEL_DIR}/clang/bin:${PATH}" 118 | elif [[ $TOOLCHAIN == "aosp" || $TOOLCHAIN == "sdclang" ]]; then 119 | PATH="${KERNEL_DIR}/clang/bin:${KERNEL_DIR}/gcc64/bin:${KERNEL_DIR}/gcc32/bin:${PATH}" 120 | fi 121 | 122 | # Export KBUILD_COMPILER_STRING 123 | if [[ $COMPILER == "gcc" ]]; then 124 | export KBUILD_COMPILER_STRING=$(${KERNEL_DIR}/gcc64/bin/aarch64-elf-gcc --version | head -n 1) 125 | elif [[ $COMPILER == "clang" ]]; then 126 | export KBUILD_COMPILER_STRING=$(${KERNEL_DIR}/clang/bin/clang --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g' -e 's/[[:space:]]*$//') 127 | fi 128 | } 129 | ##----------------------------------------------------------------## 130 | function compile() { 131 | START=$(date +"%s") 132 | 133 | # Push Notification 134 | post_msg "$KBUILD_BUILD_VERSION CI Build Triggered%0ADocker OS: $DISTRO%0AKernel Version : $KERVER%0ADate : $(TZ=Asia/Kolkata date)%0ADevice : $MODEL [$DEVICE]%0AVersion : $VERSION%0AHost Core Count : $PROCS%0ACompiler Used : $KBUILD_COMPILER_STRING%0ALinker : $LINKER%0aBranch : $CI_BRANCH%0ATop Commit : $COMMIT_HEAD" 135 | 136 | # Generate .config 137 | if [[ $COMPILER == "gcc" ]]; then 138 | make O=out ARCH=arm64 ${DEFCONFIG} 139 | elif [[ $COMPILER == "clang" ]]; then 140 | make O=out LLVM=1 ARCH=arm64 ${DEFCONFIG} 141 | fi 142 | 143 | # Start Compilation 144 | if [[ $COMPILER == "gcc" ]]; then 145 | MAKE+=(HOSTLD=ld.lld CROSS_COMPILE_COMPAT=arm-eabi- CROSS_COMPILE=aarch64-elf- LD=aarch64-elf-${LINKER} AR=llvm-ar NM=llvm-nm OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump STRIP=llvm-strip OBJSIZE=llvm-size) 146 | elif [[ $COMPILER == "clang" ]]; then 147 | MAKE+=(LLVM=1 LLVM_IAS=1 HOSTLD=ld.lld HOSTAR=llvm-ar) 148 | if [[ $TOOLCHAIN == "aosp" || $TOOLCHAIN == "sdclang" ]]; then 149 | MAKE+=(CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-android- CROSS_COMPILE_COMPAT=arm-linux-androideabi-) 150 | else 151 | MAKE+=(CROSS_COMPILE=aarch64-linux-gnu- CROSS_COMPILE_COMPAT=arm-linux-gnueabi-) 152 | fi 153 | fi 154 | 155 | make -kj$PROCS ARCH=arm64 O=out V=$VERBOSE "${MAKE[@]}" 2>&1 | tee error.log 156 | 157 | # Verify Files 158 | if ! [ -a "$IMAGE" ]; then 159 | push "error.log" "Build Throws Errors" 160 | exit 1 161 | else 162 | post_msg " Kernel Compilation Finished. Started Zipping " 163 | fi 164 | } 165 | ##----------------------------------------------------------------## 166 | function zipping() { 167 | # Copy Files To AnyKernel3 Zip 168 | cp $IMAGE AK3 169 | 170 | # Zipping and Push Kernel 171 | cd AK3 || exit 1 172 | zip -r9 ${FINAL_ZIP} * 173 | MD5CHECK=$(md5sum "$FINAL_ZIP" | cut -d' ' -f1) 174 | push "$FINAL_ZIP" "Build took : $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s) | For $MODEL ($DEVICE) | ${KBUILD_COMPILER_STRING} | MD5 Checksum : $MD5CHECK" 175 | cd .. 176 | } 177 | ##----------------------------------------------------------## 178 | # Functions 179 | exports 180 | clone 181 | compile 182 | END=$(date +"%s") 183 | DIFF=$((END - START)) 184 | zipping 185 | ##------------------------*****-----------------------------## 186 | -------------------------------------------------------------------------------- /AOSP/universal_aosp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | BASE_DIR="$(pwd)" 4 | SOURCEDIR="${BASE_DIR}/android" 5 | 6 | # Set-up Git username & emailID 7 | read -p 'Enter your Git username: ' username 8 | read -p 'Enter your Git email-ID: ' emailID 9 | echo 10 | git config --global user.name "$username" 11 | git config --global user.email "$emailID" 12 | 13 | rm -rf "${SOURCEDIR}" 14 | mkdir -p "${SOURCEDIR}" 15 | cd "${SOURCEDIR}" 16 | 17 | #Initializing aosp_based rom sources 18 | echo "------------------------------------------------------" 19 | echo " Welcome Universal ROM Download Script " 20 | echo " Based on android 13 " 21 | echo "------------------------------------------------------" 22 | echo 23 | read -p "Do you need build environment set-up (Y/n)? be 24 | case $be in 25 | [Yy] ) echo "Setting-Up Build environment" 26 | echo "----------------------------" 27 | #Build environment setup 28 | sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig 29 | break;; 30 | [Nn] ) echo "You're good to go" 31 | echo ------------------" 32 | break;; 33 | * ) echo "Invalid Response" 34 | esac 35 | done 36 | echo " ROMs LIST " 37 | echo "-------------" 38 | echo "1) Pixelexperience" 39 | echo "2) LineageOS" 40 | echo "3) Evolution - X" 41 | echo "4) Pixelextended" 42 | echo "5) Corvus OS" 43 | echo "6) CrDroid" 44 | echo "7) CherishOS" 45 | echo "8) SpiceOS" 46 | echo "9) SuperiorOS" 47 | echo "10) Project Exilir" 48 | echo 49 | read -p "Input your choice here: " ch 50 | case $ch in 51 | #Pixelexperience 52 | [1] ) echo "You choosed Pixelexperience Source" 53 | echo "----------------------------------" 54 | read -p "Do you want to save some space? (Y/n) " Ny 55 | case $Ny in 56 | [Yy] ) echo "Doing Shallow Clone" 57 | echo "-------------------" 58 | repo init -u https://github.com/PixelExperience/manifest -b thirteen --depth=1 59 | break;; 60 | [Nn] ) echo "Doing Deep Clone" 61 | echo "----------------" 62 | repo init -u https://github.com/PixelExperience/manifest -b thirteen 63 | break;; 64 | * ) echo "Invalid Response" 65 | esac 66 | done 67 | break;; 68 | #LineageOS 69 | [2] ) echo "You choosed LineageOS Source" 70 | echo "----------------------------------" 71 | read -p "Do you want to save some space? (Y/n) " Ny 72 | case $Ny in 73 | [Yy] ) echo "Doing Shallow Clone" 74 | echo "-------------------" 75 | repo init -u https://github.com/LineageOS/android.git -b lineage-20.0 --depth=1 76 | break;; 77 | [Nn] ) echo "Doing Deep Clone" 78 | echo "----------------" 79 | repo init -u https://github.com/LineageOS/android.git -b lineage-20.0 80 | break;; 81 | * ) echo "Invalid Response" 82 | esac 83 | done 84 | break;; 85 | #Evolution-X 86 | [3] ) echo "You choosed Evolution-X Source" 87 | echo "----------------------------------" 88 | read -p "Do you want to save some space? (Y/n) " Ny 89 | case $Ny in 90 | [Yy] ) echo "Doing Shallow Clone" 91 | echo "-------------------" 92 | repo init -u https://github.com/Evolution-X/manifest -b tiramisu --depth=1 93 | break;; 94 | [Nn] ) echo "Doing Deep Clone" 95 | echo "----------------" 96 | repo init -u https://github.com/Evolution-X/manifest -b tiramisu 97 | break;; 98 | * ) echo "Invalid Response" 99 | esac 100 | done 101 | break;; 102 | #Pixelextended 103 | [4] ) echo "You choosed Pixelextended Source" 104 | echo "----------------------------------" 105 | read -p "Do you want to save some space? (Y/n) " Ny 106 | case $Ny in 107 | [Yy] ) echo "Doing Shallow Clone" 108 | echo "-------------------" 109 | repo init -u https://github.com/PixelExtended/manifest -b trece --depth=1 110 | break;; 111 | [Nn] ) echo "Doing Deep Clone" 112 | echo "----------------" 113 | repo init -u https://github.com/PixelExtended/manifest -b trece 114 | break;; 115 | * ) echo "Invalid Response" 116 | esac 117 | done 118 | break;; 119 | #CorvusOS 120 | [5] ) echo "You choosed CorvusOS Source" 121 | echo "----------------------------------" 122 | read -p "Do you want to save some space? (Y/n) " Ny 123 | case $Ny in 124 | [Yy] ) echo "Doing Shallow Clone" 125 | echo "-------------------" 126 | repo init -u https://github.com/Corvus-AOSP/android_manifest.git -b 13 --depth=1 127 | break;; 128 | [Nn] ) echo "Doing Deep Clone" 129 | echo "----------------" 130 | repo init -u https://github.com/Corvus-AOSP/android_manifest.git -b 13 131 | break;; 132 | * ) echo "Invalid Response" 133 | esac 134 | done 135 | break;; 136 | #CRdroid 137 | [6] ) echo "You choosed CRdroid Source" 138 | echo "----------------------------------" 139 | read -p "Do you want to save some space? (Y/n) " Ny 140 | case $Ny in 141 | [Yy] ) echo "Doing Shallow Clone" 142 | echo "-------------------" 143 | repo init -u https://github.com/crdroidandroid/android.git -b 13.0 --depth=1 144 | break;; 145 | [Nn] ) echo "Doing Deep Clone" 146 | echo "----------------" 147 | repo init -u https://github.com/crdroidandroid/android.git -b 13.0 148 | break;; 149 | * ) echo "Invalid Response" 150 | esac 151 | done 152 | break;; 153 | #CherishOS 154 | [7] ) echo "You choosed CherishOS Source" 155 | echo "----------------------------------" 156 | read -p "Do you want to save some space? (Y/n) " Ny 157 | case $Ny in 158 | [Yy] ) echo "Doing Shallow Clone" 159 | echo "-------------------" 160 | repo init -u https://github.com/CherishOS/android_manifest.git -b tiramisu --depth=1 161 | break;; 162 | [Nn] ) echo "Doing Deep Clone" 163 | echo "----------------" 164 | repo init -u https://github.com/CherishOS/android_manifest.git -b tiramisu 165 | break;; 166 | * ) echo "Invalid Response" 167 | esac 168 | done 169 | break;; 170 | #SpiceOS 171 | [8] ) echo "You choosed SpiceOS Source" 172 | echo "----------------------------------" 173 | read -p "Do you want to save some space? (Y/n) " Ny 174 | case $Ny in 175 | [Yy] ) echo "Doing Shallow Clone" 176 | echo "-------------------" 177 | repo init -u https://github.com/SpiceOS/manifest -b 13 --depth=1 178 | break;; 179 | [Nn] ) echo "Doing Deep Clone" 180 | echo "----------------" 181 | repo init -u https://github.com/SpiceOS/manifest -b 13 182 | break;; 183 | * ) echo "Invalid Response" 184 | esac 185 | done 186 | break;; 187 | #SuperiorOS 188 | [9] ) echo "You choosed SuperiorOS Source" 189 | echo "----------------------------------" 190 | read -p "Do you want to save some space? (Y/n) " Ny 191 | case $Ny in 192 | [Yy] ) echo "Doing Shallow Clone" 193 | echo "-------------------" 194 | repo init -u https://github.com/SuperiorOS/manifest.git -b thirteen --depth=1 195 | break;; 196 | [Nn] ) echo "Doing Deep Clone" 197 | echo "----------------" 198 | repo init -u https://github.com/SuperiorOS/manifest.git -b thirteen 199 | break;; 200 | * ) echo "Invalid Response" 201 | esac 202 | done 203 | break;; 204 | #Project-Exilir 205 | [10] ) echo "You choosed Project Exilir Source" 206 | echo "----------------------------------" 207 | read -p "Do you want to save some space? (Y/n) " Ny 208 | case $Ny in 209 | [Yy] ) echo "Doing Shallow Clone" 210 | echo "-------------------" 211 | repo init -u https://github.com/Project-Elixir/manifest -b Tiramisu --depth=1 212 | break;; 213 | [Nn] ) echo "Doing Deep Clone" 214 | echo "----------------" 215 | repo init -u https://github.com/Project-Elixir/manifest -b Tiramisu 216 | break;; 217 | * ) echo "Invalid Response" 218 | esac 219 | done 220 | break;; 221 | * ) echo "Invalid Response" 222 | esac 223 | done 224 | echo 225 | #Syncing repo. 226 | echo "Syncing repo. from the source" 227 | repo sync -c -j$(nproc --all) --force-sync --no-clone-bundle --no-tags 228 | -------------------------------------------------------------------------------- /AOSP/aosp-ci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script Configuration. Adjust the variables as per your needs. 4 | CONFIG_LUNCH="" # (MANDATORY) Lunch command , you should not leave it empty device codename get pulled from the command! e.g. lineage_ysl-userdebug 5 | CONFIG_TARGET="bacon" # (MANDATORY) Compilation target. e.g. bacon or bootimage [Default is bacon!] 6 | CONFIG_USE_BRUNCH="no" # (MANDATORY) yes|no Set to yes if you need to use brunch to build else no for lunch and bacon 7 | CONFIG_CHATID="-" # Your telegram group/channel chatid 8 | CONFIG_BOT_TOKEN="" # Your HTTP API bot token 9 | CONFIG_AUTHOR="" # The author of the build 10 | CONFIG_GAPPS_FLAG="" # The flag which is to be exported as true to make a GAPPs build 11 | CONFIG_OFFICIAL_FLAG="" # The flag which is to be exported as true to make an official build 12 | CONFIG_SYNC_JOBS=0 # How many jobs (CPU cores) to assign for the repo sync task. 13 | CONFIG_COMPILE_JOBS=0 # How many jobs (CPU cores) to assign for the make task. 14 | 15 | # Color Constants. Required variables for logging purposes. 16 | RED=$(tput setaf 1) 17 | GREEN=$(tput setaf 2) 18 | YELLOW=$(tput setaf 3) 19 | BOLD=$(tput bold) 20 | RESET=$(tput sgr0) 21 | BOLD_GREEN=${BOLD}$(tput setaf 2) 22 | 23 | VARIANT="Vanilla" 24 | 25 | # Post Constants. Required variables for posting purposes. 26 | DEVICE="$(sed -e "s/^.*_//" -e "s/-.*//" <<<"$CONFIG_LUNCH")" 27 | ROM_NAME="$(sed "s#.*/##" <<<"$(pwd)")" 28 | DATE=$(date +'%d-%m-%Y') 29 | OUT="$(pwd)/out/target/product/$DEVICE" 30 | UPLOAD_DIRECTORY="${CONFIG_AUTHOR}/${ROM_NAME}/${DATE}-TEST" 31 | 32 | # CLI parameters. Fetch whatever input the user has provided. 33 | while [[ $# -gt 0 ]]; do 34 | case $1 in 35 | -s | --sync) 36 | SYNC="1" 37 | ;; 38 | -c | --clean) 39 | CLEAN="1" 40 | ;; 41 | -g | --gapps) 42 | if [ -n "$CONFIG_GAPPS_FLAG" ]; then 43 | GAPPS="1" 44 | VARIANT="GAPPs" 45 | else 46 | echo -e "$RED\nERROR: Please specify the flag to export for GAPPs build in the configuration!!$RESET\n" 47 | exit 1 48 | fi 49 | ;; 50 | -o | --official) 51 | if [ -n "$CONFIG_OFFICIAL_FLAG" ]; then 52 | OFFICIAL="1" 53 | else 54 | echo -e "$RED\nERROR: Please specify the flag to export for official build in the configuration!!$RESET\n" 55 | exit 1 56 | fi 57 | ;; 58 | -p | --purge) 59 | rclone purge "oned:${UPLOAD_DIRECTORY}" 60 | exit 0 61 | ;; 62 | -h | --help) 63 | echo -e "\nNote: • You should specify all the mandatory variables in the script! 64 | • Just run './$0' for normal build 65 | Usage: ./build_rom.sh [OPTION] 66 | Example: 67 | ./$(basename $0) -s -c or ./$(basename $0) --sync --clean 68 | Mandatory options: 69 | No option is mandatory!, just simply run the script without passing any parameter. 70 | Options: 71 | -s, --sync Sync sources before building. 72 | -c, --clean Clean build directory before compilation. 73 | -g, --gapps Build the GAPPs variant during compilation. 74 | -o, --official Build the official variant during compilation. 75 | -p, --purge Purges the specified upload directory for the index.\n" 76 | exit 1 77 | ;; 78 | *) 79 | echo -e "$RED\nUnknown parameter(s) passed: $1$RESET\n" 80 | exit 1 81 | ;; 82 | esac 83 | shift 84 | done 85 | 86 | # Configuration Checking. Exit the script if required variables aren't set. 87 | if [[ $CONFIG_LUNCH == "" ]] || [[ $CONFIG_USE_BRUNCH == "" ]] || [[ $CONFIG_TARGET == "" ]]; then 88 | echo -e "$RED\nERROR: Please specify all of the mandatory variables!! Exiting now...$RESET\n" 89 | exit 1 90 | fi 91 | 92 | # Telegram Environment. Declare all of the related constants and functions. 93 | export BOT_MESSAGE_URL="https://api.telegram.org/bot$CONFIG_BOT_TOKEN/sendMessage" 94 | export BOT_EDIT_MESSAGE_URL="https://api.telegram.org/bot$CONFIG_BOT_TOKEN/editMessageText" 95 | export BOT_FILE_URL="https://api.telegram.org/bot$CONFIG_BOT_TOKEN/sendDocument" 96 | 97 | send_message() { 98 | local response=$(curl -s -X POST "$BOT_MESSAGE_URL" -d chat_id="$2" \ 99 | -d "parse_mode=html" \ 100 | -d "disable_web_page_preview=true" \ 101 | -d text="$1") 102 | local message_id=$(echo "$response" | jq ".result | .message_id") 103 | echo "$message_id" 104 | } 105 | 106 | edit_message() { 107 | curl -s -X POST "$BOT_EDIT_MESSAGE_URL" -d chat_id="$2" \ 108 | -d "parse_mode=html" \ 109 | -d "message_id=$3" \ 110 | -d text="$1" 111 | } 112 | 113 | send_file() { 114 | curl --progress-bar -F document=@"$1" "$BOT_FILE_URL" \ 115 | -F chat_id="$2" \ 116 | -F "disable_web_page_preview=true" \ 117 | -F "parse_mode=html" 118 | } 119 | 120 | upload_file() { 121 | RESPONSE=$(curl -T "$1" https://pixeldrain.com/api/file/) 122 | HASH=$(echo "$RESPONSE" | jq -r '.id') 123 | 124 | echo "https://pixeldrain.com/api/file/$HASH" 125 | } 126 | 127 | # Cleanup Files. Nuke all of the files from previous runs. 128 | if [ -f "out/error.log" ]; then 129 | rm "out/error.log" 130 | fi 131 | 132 | if [ -f "log" ]; then 133 | rm "log" 134 | fi 135 | 136 | # Execute Parameters. Do the work if specified. 137 | if [[ -n $SYNC ]]; then 138 | # Send a notification that the syncing process has started. 139 | 140 | sync_start_message="������ | Syncing sources!! 141 | • ROM: $ROM_NAME 142 | • DEVICE: $DEVICE 143 | • JOBS: $CONFIG_SYNC_JOBS Cores 144 | • DIRECTORY: $(pwd)" 145 | 146 | sync_message_id=$(send_message "$sync_start_message" "$CONFIG_CHATID") 147 | 148 | SYNC_START=$(TZ=Asia/Dhaka date +"%s") 149 | 150 | echo -e "$BOLD_GREEN\nStarting to sync sources now...$RESET\n" 151 | if ! repo sync -c --jobs-network=$CONFIG_SYNC_JOBS -j$CONFIG_SYNC_JOBS --jobs-checkout=$CONFIG_SYNC_JOBS --optimized-fetch --prune --force-sync --no-clone-bundle --no-tags; then 152 | echo -e "$RED\nInitial sync has failed!!$RESET" && echo -e "$BOLD_GREEN\nTrying to sync again with lesser arguments...$RESET\n" 153 | 154 | if ! repo sync -j$CONFIG_SYNC_JOBS; then 155 | echo -e "$RED\nSyncing has failed completely!$RESET" && echo -e "$BOLD_GREEN\nStarting the build now...$RESET\n" 156 | else 157 | SYNC_END=$(TZ=Asia/Dhaka date +"%s") 158 | fi 159 | else 160 | SYNC_END=$(TZ=Asia/Dhaka date +"%s") 161 | fi 162 | 163 | if [[ -n $SYNC_END ]]; then 164 | DIFFERENCE=$((SYNC_END - SYNC_START)) 165 | MINUTES=$((($DIFFERENCE % 3600) / 60)) 166 | SECONDS=$(((($DIFFERENCE % 3600) / 60) / 60)) 167 | 168 | sync_finished_message="������ | Sources synced!! 169 | • ROM: $ROM_NAME 170 | • DEVICE: $DEVICE 171 | • JOBS: $CONFIG_SYNC_JOBS Cores 172 | • DIRECTORY: $(pwd) 173 | Syncing took $MINUTES minutes(s) and $SECONDS seconds(s)" 174 | 175 | edit_message "$sync_finished_message" "$CONFIG_CHATID" "$sync_message_id" 176 | else 177 | sync_failed_message="������ | Syncing sources failed!! 178 | 179 | Trying to compile the ROM now..." 180 | 181 | edit_message "$sync_failed_message" "$CONFIG_CHATID" "$sync_message_id" 182 | fi 183 | fi 184 | 185 | if [[ -n $CLEAN ]]; then 186 | echo -e "$BOLD_GREEN\nNuking the out directory now...$RESET\n" 187 | rm -rf "out" 188 | fi 189 | 190 | # Send a notification that the build process has started. 191 | 192 | build_start_message="������ | Compiling ROM... 193 | • ROM: $ROM_NAME 194 | • DEVICE: $DEVICE 195 | • JOBS: $CONFIG_COMPILE_JOBS Cores 196 | • TYPE: $([ -n "$OFFICIAL" ] && echo "Official" || echo "Unofficial") 197 | • VARIANT: $VARIANT" 198 | 199 | build_message_id=$(send_message "$build_start_message" "$CONFIG_CHATID") 200 | 201 | BUILD_START=$(TZ=Asia/Dhaka date +"%s") 202 | 203 | # Start Compilation. Compile the ROM according to the configuration. 204 | if [ "$CONFIG_USE_BRUNCH" == yes ]; then 205 | echo -e "$BOLD_GREEN\nSetting up the build environment...$RESET" 206 | source build/envsetup.sh 207 | 208 | echo -e "$BOLD_GREEN\nStarting to lunch '$DEVICE' now...$RESET" 209 | if [[ -n $CONFIG_GAPPS_FLAG ]]; then 210 | if [[ -n $GAPPS ]]; then 211 | export "${CONFIG_GAPPS_FLAG}=true" 212 | else 213 | export "${CONFIG_GAPPS_FLAG}=false" 214 | fi 215 | fi 216 | if [[ -n $CONFIG_OFFICIAL_FLAG ]]; then 217 | if [[ -n $OFFICIAL ]]; then 218 | export "${CONFIG_OFFICIAL_FLAG}=true" 219 | else 220 | export "${CONFIG_OFFICIAL_FLAG}=false" 221 | fi 222 | fi 223 | lunch "$CONFIG_LUNCH" 224 | 225 | if [ $? -eq 0 ]; then 226 | echo -e "$BOLD_GREEN\nStarting to build now...$RESET" 227 | brunch "$DEVICE" 228 | else 229 | echo -e "$RED\nFailed to lunch '$DEVICE'$RESET" 230 | 231 | build_failed_message="������ | ROM compilation failed... 232 | 233 | Failed at lunching $DEVICE..." 234 | 235 | edit_message "$build_failed_message" "$CONFIG_CHATID" "$build_message_id" 236 | exit 1 237 | fi 238 | 239 | else 240 | echo -e "$BOLD_GREEN\nSetting up the build environment...$RESET" 241 | source build/envsetup.sh 242 | 243 | echo -e "$BOLD_GREEN\nStarting to lunch '$DEVICE' now...$RESET" 244 | if [[ -n $CONFIG_GAPPS_FLAG ]]; then 245 | if [[ -n $GAPPS ]]; then 246 | export "${CONFIG_GAPPS_FLAG}=true" 247 | else 248 | export "${CONFIG_GAPPS_FLAG}=false" 249 | fi 250 | fi 251 | if [[ -n $CONFIG_OFFICIAL_FLAG ]]; then 252 | if [[ -n $OFFICIAL ]]; then 253 | export "${CONFIG_OFFICIAL_FLAG}=true" 254 | else 255 | export "${CONFIG_OFFICIAL_FLAG}=false" 256 | fi 257 | fi 258 | lunch "$CONFIG_LUNCH" 259 | 260 | if [ $? -eq 0 ]; then 261 | echo -e "$BOLD_GREEN\nStarting to build now...$RESET" 262 | m installclean -j$CONFIG_COMPILE_JOBS && m "$CONFIG_TARGET" -j$CONFIG_COMPILE_JOBS 263 | else 264 | echo -e "$RED\nFailed to lunch '$DEVICE'$RESET" 265 | 266 | build_failed_message="������ | ROM compilation failed... 267 | 268 | Failed at lunching $DEVICE..." 269 | 270 | edit_message "$build_failed_message" "$CONFIG_CHATID" "$build_message_id" 271 | exit 1 272 | fi 273 | fi 274 | 275 | # Upload Build. Upload the output ROM ZIP file to the index. 276 | BUILD_END=$(TZ=Asia/Dhaka date +"%s") 277 | DIFFERENCE=$((BUILD_END - BUILD_START)) 278 | HOURS=$(($DIFFERENCE / 3600)) 279 | MINUTES=$((($DIFFERENCE % 3600) / 60)) 280 | 281 | if [ -s "out/error.log" ]; then 282 | # Send a notification that the build has failed. 283 | build_failed_message="������ | ROM compilation failed... 284 | 285 | Check out the log below!" 286 | 287 | edit_message "$build_failed_message" "$CONFIG_CHATID" "$build_message_id" 288 | send_file "out/error.log" "$CONFIG_CHATID" 289 | else 290 | ota_file=$(ls "$OUT"/*ota*.zip | tail -n -1) 291 | rm "$ota_file" 292 | zip_file=$(ls "$OUT"/*$DEVICE*.zip | tail -n -1) 293 | echo -e "$BOLD_GREEN\nStarting to upload the ZIP file now...$RESET\n" 294 | zip_file_url=$(upload_file "$zip_file") 295 | zip_file_md5sum=$(md5sum $zip_file | awk '{print $1}') 296 | zip_file_size=$(ls -sh $zip_file | awk '{print $1}') 297 | 298 | mv "$zip_file" ../ # Move the ZIP file to the parent directory for pushing to GitHub Releases later. 299 | 300 | build_finished_message="������ | ROM compiled!! 301 | • ROM: $ROM_NAME 302 | • DEVICE: $DEVICE 303 | • TYPE: $([ -n "$OFFICIAL" ] && echo "Official" || echo "Unofficial") 304 | • VARIANT: $VARIANT 305 | • SIZE: $zip_file_size 306 | • MD5SUM: $zip_file_md5sum 307 | • DOWNLOAD: $zip_file_url 308 | Compilation took $HOURS hours(s) and $MINUTES minutes(s)" 309 | 310 | edit_message "$build_finished_message" "$CONFIG_CHATID" "$build_message_id" 311 | fi -------------------------------------------------------------------------------- /Kernel/AtomX-Build-Script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ######################### CONFIGURATION ############################## 4 | 5 | # User details 6 | KBUILD_USER="$USER" 7 | KBUILD_HOST=$(uname -n) 8 | 9 | ############################################################################ 10 | 11 | ######################## DIRECTORY PATHS ############################### 12 | 13 | # Kernel Directory 14 | KERNEL_DIR=$(pwd) 15 | 16 | # Propriatary Directory (default paths may not work!) 17 | PRO_PATH="$KERNEL_DIR/.." 18 | 19 | # Toolchain Directory 20 | TLDR="$PRO_PATH/toolchains" 21 | 22 | # Anykernel Directories 23 | AK3_DIR="$PRO_PATH/AnyKernel3" 24 | AKVDR="$AK3_DIR/modules/vendor/lib/modules" 25 | AKVRD="$AK3_DIR/vendor_ramdisk/lib/modules" 26 | 27 | # Device Tree Blob Directory 28 | DTB_PATH="$KERNEL_DIR/work/arch/arm64/boot/dts/vendor/qcom" 29 | 30 | ############################################################################ 31 | 32 | ############################### COLORS ################################# 33 | 34 | R='\033[1;31m' 35 | G='\033[1;32m' 36 | B='\033[1;34m' 37 | W='\033[1;37m' 38 | 39 | ############################################################################ 40 | 41 | ################################ MISC ################################## 42 | 43 | # functions 44 | error() { 45 | echo -e "" 46 | echo -e "$R ${FUNCNAME[0]}: $W" "$@" 47 | echo -e "" 48 | exit 1 49 | } 50 | 51 | success() { 52 | echo -e "" 53 | echo -e "$G ${FUNCNAME[1]}: $W" "$@" 54 | echo -e "" 55 | exit 0 56 | } 57 | 58 | inform() { 59 | echo -e "" 60 | echo -e "$B ${FUNCNAME[1]}: $W" "$@" "$G" 61 | echo -e "" 62 | } 63 | 64 | muke() { 65 | if [[ -z $COMPILER || -z $COMPILER32 ]]; then 66 | error "Compiler is missing" 67 | fi 68 | if [[ $LOG != 1 ]]; then 69 | make "${MAKE_ARGS[@]}" "$@" 70 | else 71 | make "$@" "${MAKE_ARGS[@]}" 2>&1 | tee log.txt 72 | fi 73 | } 74 | 75 | usage() { 76 | inform " ./AtomX.sh 77 | --compiler Sets the compiler to be used. 78 | --compiler32 Sets the 32bit compiler to be used, 79 | (defaults to clang). 80 | --device Sets the device for kernel build. 81 | --clean Clean up build directory before running build, 82 | (default behaviour is incremental). 83 | --dtbs Builds dtbs, dtbo & dtbo.img. 84 | --dtb_zip Builds flashable zip with dtbs, dtbo. 85 | --obj Builds specified objects. 86 | --regen Regenerates defconfig (savedefconfig). 87 | --log Builds logs saved to log.txt in current dir. 88 | --silence Silence shell output of Kbuild". 89 | exit 2 90 | } 91 | 92 | ############################################################################ 93 | 94 | compiler_setup() { 95 | ############################ COMPILER SETUP ############################## 96 | # default to clang 97 | CC='clang' 98 | C_PATH="$TLDR/$CC" 99 | LLVM_PATH="$C_PATH/bin" 100 | if [[ $COMPILER == gcc ]]; then 101 | # Just override the existing declarations 102 | CC='aarch64-elf-gcc' 103 | C_PATH="$TLDR/gcc-arm64" 104 | fi 105 | 106 | C_NAME=$("$LLVM_PATH"/$CC --version | head -n 1 | perl -pe 's/\(http.*?\)//gs') 107 | if [[ $COMPILER32 == "gcc" ]]; then 108 | MAKE_ARGS+=("CC_COMPAT=$TLDR/gcc-arm/bin/arm-eabi-gcc" "CROSS_COMPILE_COMPAT=$TLDR/gcc-arm/bin/arm-eabi-") 109 | C_NAME_32=$($(echo "${MAKE_ARGS[@]}" | sed s/' '/'\n'/g | grep CC_COMPAT | cut -c 11-) --version | head -n 1) 110 | else 111 | MAKE_ARGS+=("CROSS_COMPILE_COMPAT=arm-linux-gnueabi-") 112 | C_NAME_32="$C_NAME" 113 | fi 114 | 115 | MAKE_ARGS+=("O=work" 116 | "ARCH=arm64" 117 | "DTC_EXT=$(which dtc)" 118 | "LLVM=$LLVM_PATH" 119 | "HOSTLD=ld.lld" "CC=$CC" 120 | "PATH=$C_PATH/bin:$PATH" 121 | "KBUILD_BUILD_USER=$KBUILD_USER" 122 | "KBUILD_BUILD_HOST=$KBUILD_HOST" 123 | "CROSS_COMPILE=aarch64-linux-gnu-" 124 | "LD_LIBRARY_PATH=$C_PATH/lib:$LD_LIBRARY_PATH") 125 | ############################################################################ 126 | } 127 | 128 | config_generator() { 129 | ######################### .config GENERATOR ############################ 130 | if [[ -z $CODENAME ]]; then 131 | error 'Codename not present connot proceed' 132 | exit 1 133 | fi 134 | 135 | DFCF="vendor/${CODENAME}-${SUFFIX}_defconfig" 136 | if [[ ! -f arch/arm64/configs/$DFCF ]]; then 137 | inform "Generating defconfig" 138 | 139 | export "${MAKE_ARGS[@]}" "TARGET_BUILD_VARIANT=user" 140 | 141 | bash scripts/gki/generate_defconfig.sh "${CODENAME}-${SUFFIX}_defconfig" 142 | muke vendor/"${CODENAME}"-"${SUFFIX}"_defconfig vendor/lahaina_QGKI.config 143 | else 144 | inform "Generating .config" 145 | 146 | # Make .config 147 | muke "$DFCF" 148 | fi 149 | if [[ $TEST == "1" ]]; then 150 | ./scripts/config --file work/.config -d CONFIG_LTO_CLANG 151 | ./scripts/config --file work/.config -d CONFIG_HEADERS_INSTALL 152 | fi 153 | ############################################################################ 154 | } 155 | 156 | config_regenerator() { 157 | ######################## DEFCONFIG REGENERATOR ########################### 158 | config_generator 159 | 160 | inform "Regenerating defconfig" 161 | 162 | muke savedefconfig 163 | 164 | cat work/defconfig >arch/arm64/configs/"$DFCF" 165 | 166 | success "Regeneration completed" 167 | ############################################################################ 168 | } 169 | 170 | obj_builder() { 171 | ############################## OBJ BUILD ################################# 172 | if [[ $OBJ == "" ]]; then 173 | error "obj not defined" 174 | fi 175 | 176 | config_generator 177 | 178 | inform "Building $OBJ" 179 | if [[ $OBJ =~ "defconfig" ]]; then 180 | muke "$OBJ" 181 | else 182 | muke -j"$(nproc)" INSTALL_HDR_PATH="headers" "$OBJ" 183 | fi 184 | if [[ $TEST == "1" ]]; then 185 | rm -rf arch/arm64/configs/vendor/lahaina-qgki_defconfig 186 | fi 187 | if [[ $DTB_ZIP != "1" ]]; then 188 | exit 0 189 | fi 190 | ############################################################################ 191 | } 192 | 193 | dtb_zip() { 194 | ############################## DTB BUILD ################################# 195 | obj_builder 196 | source work/.config 197 | if [[ ! -d $AK3_DIR ]]; then 198 | error 'Anykernel not present cannot zip' 199 | fi 200 | if [[ ! -d "$KERNEL_DIR/out" ]]; then 201 | mkdir "$KERNEL_DIR"/out 202 | fi 203 | cp "$DTB_PATH"/*.dtb "$AK3_DIR"/dtb 204 | cp "$DTB_PATH"/*.img "$AK3_DIR"/ 205 | cd "$AK3_DIR" || exit 206 | make zip VERSION="$(echo "$CONFIG_LOCALVERSION" | cut -c 8-)-dtbs-only" 207 | cp ./*-signed.zip "$KERNEL_DIR"/out 208 | make clean 209 | cd "$KERNEL_DIR" || exit 210 | success "dtbs zip built" 211 | ############################################################################ 212 | } 213 | 214 | kernel_builder() { 215 | ################################## BUILD ################################# 216 | if [[ $BUILD == "clean" ]]; then 217 | inform "Cleaning work directory, please wait...." 218 | muke -s clean mrproper distclean 219 | fi 220 | 221 | config_generator 222 | 223 | # Build Start 224 | BUILD_START=$(date +"%s") 225 | 226 | source work/.config 227 | MOD_NAME="$(muke kernelrelease -s)" 228 | KERNEL_VERSION=$(echo "$MOD_NAME" | cut -c -7) 229 | 230 | inform " 231 | *************Build Triggered************* 232 | Date: $(date +"%Y-%m-%d %H:%M") 233 | Linux Version: $KERNEL_VERSION 234 | Kernel Name: $MOD_NAME 235 | Device: $DEVICENAME 236 | Codename: $CODENAME 237 | Compiler: $C_NAME 238 | Compiler_32: $C_NAME_32 239 | " 240 | 241 | # Compile 242 | muke -j"$(nproc)" 243 | 244 | if [[ $CONFIG_MODULES == "y" ]]; then 245 | muke -j"$(nproc)" \ 246 | 'modules_install' \ 247 | INSTALL_MOD_STRIP=1 \ 248 | INSTALL_MOD_PATH="modules" 249 | fi 250 | 251 | # Build End 252 | BUILD_END=$(date +"%s") 253 | 254 | DIFF=$(("$BUILD_END" - "$BUILD_START")) 255 | 256 | zipper 257 | ############################################################################ 258 | } 259 | 260 | zipper() { 261 | #################################### ZIP ################################# 262 | TARGET="$(muke image_name -s)" 263 | 264 | if [[ ! -f $KERNEL_DIR/work/$TARGET ]]; then 265 | error 'Kernel image not found' 266 | fi 267 | if [[ ! -d $AK3_DIR ]]; then 268 | error 'Anykernel not present cannot zip' 269 | fi 270 | if [[ ! -d "$KERNEL_DIR/out" ]]; then 271 | mkdir "$KERNEL_DIR"/out 272 | fi 273 | 274 | # Making sure everything is ok before making zip 275 | cd "$AK3_DIR" || exit 276 | make clean 277 | cd "$KERNEL_DIR" || exit 278 | 279 | cp "$KERNEL_DIR"/work/"$TARGET" "$AK3_DIR" 280 | cp "$DTB_PATH"/*.dtb "$AK3_DIR"/dtb 281 | cp "$DTB_PATH"/*.img "$AK3_DIR"/ 282 | if [[ $CONFIG_MODULES == "y" ]]; then 283 | MOD_PATH="work/modules/lib/modules/$MOD_NAME" 284 | sed -i 's/\(kernel\/[^: ]*\/\)\([^: ]*\.ko\)/\/vendor\/lib\/modules\/\2/g' "$MOD_PATH"/modules.dep 285 | sed -i 's/.*\///g' "$MOD_PATH"/modules.order 286 | if [[ $DRM_VENDOR_MODULE == "1" ]]; then 287 | DRM_AS_MODULE=1 288 | if [ ! -d "$AK3_DIR"/vendor_ramdisk/lib/modules/ ]; then 289 | VENDOR_RAMDISK_CREATE=1 290 | mkdir -p "$AK3_DIR"/vendor_ramdisk/lib/modules/ 291 | fi 292 | mv "$(find "$MOD_PATH" -name 'msm_drm.ko')" "$AKVRD" 293 | grep drm "$MOD_PATH/modules.alias" >"$AKVRD"/modules.alias 294 | grep drm "$MOD_PATH/modules.dep" | sed 's/^........//' >"$AKVRD"/modules.dep 295 | grep drm "$MOD_PATH/modules.softdep" >"$AKVRD"/modules.softdep 296 | grep drm "$MOD_PATH/modules.order" >"$AKVRD"/modules.load 297 | sed -i s/split_boot/dump_boot/g "$AK3_DIR"/anykernel.sh 298 | fi 299 | cp $(find "$MOD_PATH" -name '*.ko') "$AKVDR"/ 300 | cp "$MOD_PATH"/modules.{alias,dep,softdep} "$AKVDR"/ 301 | cp "$MOD_PATH"/modules.order "$AKVDR"/modules.load 302 | fi 303 | 304 | LAST_COMMIT=$(git show -s --format=%s) 305 | LAST_HASH=$(git rev-parse --short HEAD) 306 | 307 | cd "$AK3_DIR" || exit 308 | 309 | make zip VERSION="$(echo "$CONFIG_LOCALVERSION" | cut -c 8-)" 310 | if [ "$DRM_AS_MODULE" = "1" ]; then 311 | if [ "$VENDOR_RAMDISK_CREATE" = "1" ]; then 312 | rm -rf "$AK3_DIR"/vendor_ramdisk/ 313 | fi 314 | sed -i s/'dump_boot; # skip unpack'/'split_boot; # skip unpack'/g "$AK3_DIR"/anykernel.sh 315 | fi 316 | 317 | inform " 318 | *************AtomX-Kernel************* 319 | Linux Version: $KERNEL_VERSION 320 | CI: $KBUILD_HOST 321 | Core count: $(nproc) 322 | Compiler: $C_NAME 323 | Compiler_32: $C_NAME_32 324 | Device: $DEVICENAME 325 | Codename: $CODENAME 326 | Build Date: $(date +"%Y-%m-%d %H:%M") 327 | Build Type: $BUILD_TYPE 328 | 329 | -----------last commit details----------- 330 | Last commit (name): $LAST_COMMIT 331 | 332 | Last commit (hash): $LAST_HASH 333 | " 334 | 335 | cp ./*-signed.zip "$KERNEL_DIR"/out 336 | 337 | make clean 338 | 339 | cd "$KERNEL_DIR" || exit 340 | 341 | success "build completed in $((DIFF / 60)).$((DIFF % 60)) mins" 342 | 343 | ############################################################################ 344 | } 345 | 346 | ############################### COMMAND_MODE ############################## 347 | if [[ -z $* ]]; then 348 | usage 349 | fi 350 | if [[ $* =~ "--log" ]]; then 351 | LOG=1 352 | fi 353 | if [[ $* =~ "--silence" ]]; then 354 | MAKE_ARGS+=("-s") 355 | fi 356 | for arg in "$@"; do 357 | case "${arg}" in 358 | "--compiler="*) 359 | COMPILER=${arg#*=} 360 | COMPILER=${COMPILER,,} 361 | if [[ -z $COMPILER ]]; then 362 | usage 363 | break 364 | fi 365 | ;& 366 | "--compiler32="*) 367 | COMPILER32=${arg#*=} 368 | COMPILER32=${COMPILER32,,} 369 | if [[ -z $COMPILER32 ]]; then 370 | COMPILER32="clang" 371 | fi 372 | compiler_setup 373 | ;; 374 | "--device="*) 375 | CODE_NAME=${arg#*=} 376 | case $CODE_NAME in 377 | lisa) 378 | DEVICENAME='Xiaomi 11 lite 5G NE' 379 | CODENAME='lisa' 380 | SUFFIX='qgki' 381 | TARGET='Image' 382 | ;; 383 | *) 384 | error 'device not supported' 385 | ;; 386 | esac 387 | ;; 388 | "--clean") 389 | BUILD='clean' 390 | ;; 391 | "--test") 392 | TEST='1' 393 | CODENAME=lahaina 394 | ;; 395 | "--dtb_zip") 396 | DTB_ZIP=1 397 | ;& 398 | "--dtbs") 399 | OBJ=dtbs 400 | dtb_zip 401 | ;; 402 | "--obj="*) 403 | OBJ=${arg#*=} 404 | obj_builder 405 | ;; 406 | "--regen") 407 | config_regenerator 408 | ;; 409 | esac 410 | done 411 | ############################################################################ 412 | 413 | kernel_builder 414 | --------------------------------------------------------------------------------