Skip to content

Instantly share code, notes, and snippets.

@amdev01
Last active July 17, 2022 20:14
Show Gist options
  • Save amdev01/38ae55cfd6ad5b69049c7b5f0608f6a3 to your computer and use it in GitHub Desktop.
Save amdev01/38ae55cfd6ad5b69049c7b5f0608f6a3 to your computer and use it in GitHub Desktop.
very basic script for linode building
#!/bin/bash
# update
sudo apt update && apt -y upgrade
# get build tools
sudo apt -y install 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 libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev libwxgtk3.0-gtk3-dev openjdk-8-jdk python2 gcc-10-multilib # for los 15.1
# symlink for python
sudo ln -s /usr/bin/python2 /usr/bin/python
cd
# dir setup
mkdir -p ~/bin
mkdir -p ~/android/lineage
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
# set PATH so it includes user's private bin if it exists
echo 'if [ -d "${HOME}/bin" ] ; then PATH="${HOME}/bin:${PATH}" ; fi' >> ~/.bashrc
source ~/.bashrc
# git repo
git config --global user.email "16246587+amdev01@users.noreply.github.com"
git config --global user.name "AMDEV01"
# ccache
export USE_CCACHE=1
export CCACHE_EXEC=/usr/bin/ccache
ccache -M 100G
# init
cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-15.1
# device
git clone https://github.com/amdev01/local_manifests .repo/local_manifests -b lineage-15.1-devel
repo sync --jobs=8 --fetch-submodules --current-branch --no-clone-bundle
# Jack
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
# Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms in /etc/java-8-openjdk/security/java.security file
# Restart the jack server: cd /prebuilts/sdk/tools/ ./jack-admin kill-server ./jack-admin start-server
sed -i "s|jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA|jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA|g" /etc/java-8-openjdk/security/java.security
# set to gcc 10
alias gcc="/usr/bin/gcc-10"
# assert
cd ~/android/lineage/build/make && git fetch https://github.com/LineageOS/android_build refs/changes/87/186687/1 && git cherry-pick FETCH_HEAD && croot
# legcay adb
# system/sepolicy
cd ~/android/lineage/system/sepolicy && git revert 694d9627a6cdce9be16e7784a6382644b8cdbd4d && croot
# system/core
cd ~/android/lineage/system/core && git revert 61a084ecc39d02f6d609c5b69841896301ba68c1 && croot
# reboot to bootloader on kernel panic
# cd ~/android/lineage/system/core && git fetch https://github.com/LineageOS/android_system_core refs/changes/61/206061/2 && git cherry-pick FETCH_HEAD && croot
# set blobs to correct commit
cd ~/android/lineage/vendor/lge && git reset --hard 49d1e02a052e013bc09aa7cecee067de60f73e63 && croot
echo 'add_lunch_combo lineage_v400-eng' > device/lge/v400/vendorsetup.sh && chmod +x device/lge/v400/vendorsetup.sh
echo 'add_lunch_combo lineage_v410-eng' > device/lge/v410/vendorsetup.sh && chmod +x device/lge/v410/vendorsetup.sh
source build/envsetup.sh
lunch lineage_v410-eng
mka -j10 bacon
cout && cp lineage-15.1-*.zip ~/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment