| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| projects:oneplus6_enchilada_lineageos_21 [2024/04/27 01:17] – [For Sure] Sean Rhone | projects:oneplus6_enchilada_lineageos_21 [2024/04/28 10:07] (current) – removed Sean Rhone |
|---|
| ====== Information ====== | |
| |
| * Custom builds of LineageOS for OnePlus 6 ''enchilada'' | |
| * ''lineage-21.0'' branch | |
| * [[https://wiki.lineageos.org/devices/enchilada/build/|LineageOS enchilada Build Notes]] | |
| |
| ===== Prerequisites ===== | |
| |
| * [[distros:fedora_kde|Fedora (KDE Plasma)]] | |
| |
| ====== Dependencies ====== | |
| |
| * :!: TODO | |
| |
| sudo dnf install java-1.8.0-openjdk-devel ImageMagick-devel ncurses-compat-libs schedtool libstdc++.i686 glibc.i686 m4 xz-lzma-compat gcc brotli && sync | |
| |
| sudo dnf install bc bison curl flex lzop gnupg2 gcc-c++ java-11-openjdk | |
| |
| build-essential ccache g++-multilib gcc-multilib git git-lfs gnupg gperf imagemagick lib32readline-dev lib32z1-dev libelf-dev liblz4-tool libsdl1.2-dev libssl-dev libxml2 libxml2-utils pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev | |
| |
| ===== For Sure ===== | |
| |
| **** | |
| |
| python3-pip repo patch make | |
| |
| ====== Prepare Build Environment ====== | |
| |
| ===== Cleanup ===== | |
| |
| **** | |
| |
| cd ~ && rm -Rf ~/'android/lineage-21.0/'* ~/'.ccache' ~/'.jack-server' ~/'.jack-settings' ~/'bin/bro' && sync | |
| |
| ===== Configure Git ===== | |
| |
| nano ~/'.gitconfig' | |
| |
| <code> | |
| [user] | |
| email = espionage724@x | |
| name = Sean Lynn Rhone | |
| |
| [color] | |
| ui = auto</code> | |
| |
| ===== Initialize Repo ===== | |
| |
| * https://github.com/LineageOS/android/tree/lineage-21.0 | |
| |
| mkdir -p ~/'android/lineage-21.0' && cd ~/'android/lineage-21.0' && repo init --manifest-url='https://github.com/LineageOS/android.git' --manifest-branch='lineage-21.0' --depth='1' --git-lfs && sync | |
| |
| ===== LineageOS for microG GMS ===== | |
| |
| * https://github.com/lineageos4microg/android_vendor_partner_gms/tree/master | |
| |
| mkdir -p ~/'android/lineage-21.0/.repo/local_manifests' && nano ~/'android/lineage-21.0/.repo/local_manifests/lineageos4microg-gms.xml' | |
| |
| <code> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <manifest> | |
| |
| <!-- LineageOS for microG GMS --> | |
| <project path="vendor/partner_gms" name="lineageos4microg/android_vendor_partner_gms" remote="github" revision="master" /> | |
| |
| </manifest></code> | |
| |
| ===== Sources Management ===== | |
| |
| ==== Pull-in and Update Sources ==== | |
| |
| === Network Sync === | |
| |
| * As of 2024/04/24, this downloads around 24.8 GB and 51,000 files for ''lineage-21.0'' | |
| * If pulling fresh sources, this command is good to leave running overnight, and then followed up with a [[#backup_sources|backup]] | |
| |
| cd ~/'android/lineage-21.0' && repo sync --current-branch --network-only --jobs='4' --force-sync --verbose && sync | |
| |
| === Complete Sync === | |
| |
| * Performs both Network and Local file sync | |
| |
| cd ~/'android/lineage-21.0' && repo sync --current-branch --network-only --jobs='4' --force-broken --force-sync --verbose && sync && repo sync --current-branch --local-only --jobs=$(nproc) && sync | |
| |
| ==== Backup Sources ==== | |
| |
| **** | |
| |
| cd ~/'android/lineage-21.0' && tar -cvzf ~/'Downloads/lineageos-21-sources-'$(date +%Y-%m-%d)'.tar.gz' '.repo' && cd ~ && sync | |
| |
| ==== Restore Sources ==== | |
| |
| **** | |
| |
| ls ~/'Downloads/lineageos-21-sources-'*'.tar.gz' && rm -Rf ~/'android/lineage-21.0/.repo' && sync && mkdir -p ~/'android/lineage-21.0/.repo/' && cd ~/'android/lineage-21.0' && tar -xvzf ~/'Downloads/lineageos-21-sources-'*'.tar.gz' && cd ~ && sync | |
| |
| ====== Modifications ====== | |
| |
| ===== ScriptTiger Hosts File ===== | |
| |
| * https://scripttiger.github.io/alts/ | |
| * Unified hosts + fakenews + gambling (Compressed) | |
| |
| mkdir -p ~/'android/lineage-21.0/system/core/rootdir/etc/' && wget -O ~/'android/lineage-21.0/system/core/rootdir/etc/hosts' 'https://scripttiger.github.io/alts/compressed/blacklist-fg.txt' | |
| |
| nano ~/'android/lineage-21.0/system/core/rootdir/etc/hosts' | |
| |
| ====== Build Prep ====== | |
| |
| ===== Cleanup ===== | |
| |
| **** | |
| |
| cd ~/'android/lineage-21.0' && make 'clobber' && sync | |
| |
| ===== Set-up Environment ===== | |
| |
| **** | |
| |
| |
| cd ~/'android/lineage-21.0' && source ~/'android/lineage-21.0/build/envsetup.sh' | |
| |
| ===== Breakfast! ===== | |
| |
| **** | |
| |
| cd ~/'android/lineage-21.0' && breakfast 'enchilada' && sync | |
| |
| ===== Environment Variables ===== | |
| |
| ==== Disable ccache ==== | |
| |
| **** | |
| |
| unset 'CCACHE_DISABLE' && export 'CCACHE_DISABLE=1' | |
| |
| ==== Jack ==== | |
| |
| **** | |
| |
| unset 'ANDROID_JACK_VM_ARGS' && export 'ANDROID_JACK_VM_ARGS=-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx8G' | |
| |
| ====== Signed Build ====== | |
| |
| ===== Key Management ===== | |
| |
| ==== Generate ==== | |
| |
| * Change the ''x'' in ''emailAddress='' | |
| * If a backup exists and is being restored, **don't run this** | |
| |
| subject='/C=US/ST=Pennsylvania/L=Charleroi/O=Realm of Espionage/OU=Android/CN=Sean Lynn Rhone/emailAddress=espionage724@x' && mkdir ~/'.android-certs' && for x in releasekey platform shared media; do ~/'android/lineage-21.0/development/tools/make_key' ~/'.android-certs'/$x "$subject"; done | |
| |
| ==== Backup ==== | |
| |
| **** | |
| |
| cd ~ && tar -cvzf ~/'Downloads/android-certs-'$(date +%Y-%m-%d)'.tar.gz' '.android-certs' && sync | |
| |
| ==== Restore ==== | |
| |
| **** | |
| |
| cd ~ && tar -xvzf ~/'Downloads/android-certs-'*'.tar.gz' '.android-certs' && rm -f ~/'Downloads/android-certs-'*'.tar.gz' && sync | |
| |
| ===== Build ===== | |
| |
| * This takes around 2 hours to complete | |
| * If ''mka'' can't be found, make sure this is being ran from the Terminal window where previous commands took place | |
| |
| cd ~/'android/lineage-21.0' && mka target-files-package dist && sync && jack-admin kill-server | |
| |
| ===== Sign Build ===== | |
| |
| **** | |
| |
| croot && ~/'android/lineage-21.0/build/tools/releasetools/sign_target_files_apks' -o -d ~/'.android-certs' ~/'android/lineage-21.0/out/dist/'*'-target_files-'*'.zip' ~/'android/lineage-21.0/signed-target_files.zip' && sync | |
| |
| ===== Generate Zip ===== | |
| |
| **** | |
| |
| ~/'android/lineage-21.0/build/tools/releasetools/ota_from_target_files' -k ~/'.android-certs/releasekey' --block --backup='true' ~/'android/lineage-21.0/signed-target_files.zip' ~/'Downloads/'$(date +%m-%d)'-oreo-los21.0-N5X-esp724.zip' && sync | |
| |
| ==== brotli Fix ==== | |
| |
| * On 2018/02/26, LineageOS's ''common.py'' script expects the ''bro_cmd'' to call an executable called ''bro'', which doesn't exist since Fedora uses the full ''brotli'' name for the executable | |
| * The following ''cat'' command checks whether or not the above is true still | |
| * This copies the ''brotli'' executable from ''/usr/bin/brotli'' to the ''~/bin'' directory | |
| * Be aware of https://github.com/CopperheadOS/platform_build/commit/5c09ccfcd149784f92719fb32890b284164c427e in-case ''brotli'' still doesn't work | |
| |
| cat ~/'android/lineage-21.0/build/make/tools/releasetools/common.py' | grep 'bro_cmd' | |
| |
| cp '/usr/bin/brotli' ~/'bin/bro' | |
| |
| ===== All-in-one ===== | |
| |
| * Builds the ROM, signs it, and generates a flashable zip | |
| * Includes the above brotli fix | |
| |
| cd ~/'android/lineage-21.0' && mka target-files-package dist && sync && jack-admin kill-server && croot && ~/'android/lineage-21.0/build/tools/releasetools/sign_target_files_apks' -o -d ~/'.android-certs' ~/'android/lineage-21.0/out/dist/'*'-target_files-'*'.zip' ~/'android/lineage-21.0/signed-target_files.zip' && sync && cp '/usr/bin/brotli' ~/'bin/bro' && ~/'android/lineage-21.0/build/tools/releasetools/ota_from_target_files' -k ~/'.android-certs/releasekey' --block --backup='true' ~/'android/lineage-21.0/signed-target_files.zip' ~/'Downloads/'$(date +%m-%d)'-oreo-los21.0-N5X-esp724.zip' && sync | |
| |
| ===== Install Zip ===== | |
| |
| * Flash ''~/Downloads/(date)-oreo-los21.0-N5X-esp724.zip'' | |
| |
| ====== Unsigned Build ====== | |
| |
| ===== Build and Generate Zip ===== | |
| |
| * This takes approximately 2 hours to complete | |
| |
| cd ~/'android/lineage-21.0' && croot && brunch 'bullhead' && sync | |
| |
| ===== Install Zip ===== | |
| |
| * Flash the 400MB+ zip found in ''~/'android/lineage-21.0/out/target/product/bullhead'' | |
| |
| ====== OnePlus 6 Configuration ====== | |
| |
| * [[devices:oneplus_6_enchilada|Notes]] | |
| |