User Tools

Site Tools


projects:shamu_lineageos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
projects:shamu_lineageos [2017/10/31 11:58] – [Remove Deprecated HWUI GCC Flag] Sean Rhoneprojects:shamu_lineageos [2017/11/02 08:48] (current) – [Quick Command] Sean Rhone
Line 1: Line 1:
 +====== Information ======
  
 +  * Custom builds of LineageOS for the Nexus 6
 +  * cm-14.1 branch
 +
 +===== Prerequisites =====
 +
 +  * [[distros:fedora_workstation_gnome | Fedora Workstation]]
 +
 +====== xda-developers ======
 +
 +  * https://forum.xda-developers.com/nexus-6/development/rom-lineageos-easy-microg-unifiednlp-t3632360
 +
 +====== Dependencies ======
 +
 +****
 +
 +  sudo dnf install java-1.8.0-openjdk-devel ImageMagick-devel patch ncurses-compat-libs schedtool libstdc++.i686 glibc.i686 m4 gcc && sync
 +
 +====== Prepare Build Environment ======
 +
 +===== Cleanup =====
 +
 +****
 +
 +  cd ~ && sudo rm -Rf ~/'android/cm-14.1/'* ~/'.ccache' ~/'.jack-server' ~/'.jack-settings' && sync
 +
 +===== Install git-repo =====
 +
 +  * https://code.google.com/archive/p/git-repo
 +
 +  mkdir -p ~/'bin' && wget -O ~/'bin/repo' 'https://storage.googleapis.com/git-repo-downloads/repo' && chmod +x ~/'bin/repo'
 +
 +===== Configure Git =====
 +
 +  nano ~/'.gitconfig'
 +
 +  [user]
 +  email = espionage724@x
 +  name = Sean Lynn Rhone
 +  
 +  [color]
 +  ui = auto
 +
 +===== Initialize Repo =====
 +
 +****
 +
 +  mkdir -p ~/'android/cm-14.1' && cd ~/'android/cm-14.1' && repo init --manifest-url='https://github.com/LineageOS/android.git' --manifest-branch='cm-14.1' --depth=1 && sync
 +
 +===== Motorola Manifest =====
 +
 +  * If pulling in fresh sources, do not add this until the sources are backed-up ((that way the backup can be a clean-slate and be used for other non-Moto devices))
 +
 +  mkdir -p ~/'android/cm-14.1/.repo/local_manifests' && nano ~/'android/cm-14.1/.repo/local_manifests/motorola.xml'
 +
 +<code>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<manifest>
 +
 +  <!-- Motorola -->
 +  <project path="vendor/motorola" name="TheMuppets/proprietary_vendor_motorola" remote="github" revision="cm-14.1" />
 +
 +</manifest></code>
 +
 +===== Sources Management =====
 +
 +==== Pull-in and Update Sources ====
 +
 +=== Network Sync ===
 +
 +  * As of 2017/07/07, this downloads around 10GB for ''cm14.1''
 +  * If pulling fresh sources, this command is good to leave running overnight, and then followed up with a [[#backup_sources | backup]]
 +
 +  cd ~/'android/cm-14.1' && repo sync --current-branch --network-only --jobs='4' --force-broken --force-sync && sync
 +
 +=== Complete Sync ===
 +
 +  * Performs both Network and Local file sync
 +  * Add the [[#motorola_manifest | Motorola Manifest]] before doing this
 +
 +  cd ~/'android/cm-14.1' && repo sync --current-branch --network-only --jobs='4' --force-broken --force-sync && sync && repo sync --current-branch --local-only --jobs='16' && sync
 +
 +==== Backup Sources ====
 +
 +****
 +
 +  cd ~/'android/cm-14.1' && tar -cvzf ~/'Downloads/lineageos-cm14.1-'$(date +%Y-%m-%d)'.tar.gz' '.repo' && cd ~ && sync
 +
 +==== Restore Sources ====
 +
 +****
 +
 +  mkdir -p ~/'android/cm-14.1' && cd ~/'android/cm-14.1' && tar -xvzf ~/'Downloads/lineageos-cm14.1-'*'.tar.gz' '.repo' && sync
 +
 +====== Modifications ======
 +
 +===== Allow Signature Spoofing =====
 +
 +  * https://github.com/microg/android_packages_apps_GmsCore/blob/master/patches/android_frameworks_base-N.patch
 +
 +  * This allows **microG Services Core** and **FakeStore** to fake Google Play Services and Play Store respectively
 +
 +  wget -O ~/'Downloads/GmsCore-android_frameworks_base-N.patch' 'https://raw.githubusercontent.com/microg/android_packages_apps_GmsCore/master/patches/android_frameworks_base-N.patch' && cd ~/'android/cm-14.1' && patch --no-backup-if-mismatch --strip='1' --directory='frameworks/base' < ~/'Downloads/GmsCore-android_frameworks_base-N.patch' && rm -f ~/'Downloads/GmsCore-android_frameworks_base-N.patch' && sync
 +
 +===== Allow Location Providers Outside /system =====
 +
 +  * https://github.com/microg/android_packages_apps_UnifiedNlp/blob/master/patches/android_frameworks_base-N.patch
 +
 +  * This allows ** microG Services Core** to provide **UnifiedNlp** without having to be installed to ''/system/priv-app'' or having to have an outdated ''NetworkLocation.apk'' there
 +
 +  wget -O ~/'Downloads/UnifiedNlp-android_frameworks_base-N.patch' 'https://raw.githubusercontent.com/microg/android_packages_apps_UnifiedNlp/master/patches/android_frameworks_base-N.patch' && cd ~/'android/cm-14.1' && patch --no-backup-if-mismatch --strip='1' --directory='frameworks/base' < ~/'Downloads/UnifiedNlp-android_frameworks_base-N.patch' && rm -f ~/'Downloads/UnifiedNlp-android_frameworks_base-N.patch' && sync
 +
 +===== Remove Deprecated HWUI GCC Flag =====
 +
 +  * https://github.com/ValidusOs/frameworks_base/commit/f6e00f8ffba193ebe4b67da8a00b9122ff55ed73
 +
 +  * Removes the deprecated ''-mapcs'' flag and prevents clang++ from reporting an error about it later on
 +  * Only has effect and needed if ''HWUI_COMPILE_FOR_PERF'' is ''true''
 +
 +  sed -i 's/-marm -mapcs/-marm/g' ~/'android/cm-14.1/frameworks/base/libs/hwui/Android.mk'
 +
 +===== Tweaks =====
 +
 +  * If this file doesn't exist, this is likely being ran on fresh sources, and requires [[#breakfast | breakfast]] to be served first
 +  * Place this at the **top** of the file underneath the copyright ((this ensures the custom ''PRODUCT_PROPERTY_OVERRIDES'' are used, [[https://groups.google.com/d/msg/android-building/Y8Z1hWqL0lY/1NytPiDGg9oJ | see comment]]))
 +
 +  nano ~/'android/cm-14.1/device/moto/shamu/device.mk'
 +
 +<code>
 +# Begin Custom Stuff
 +
 +# Dalvik/ART Tweaks
 +PRODUCT_PROPERTY_OVERRIDES += \
 +    dalvik.vm.image-dex2oat-filter=everything \
 +    dalvik.vm.dex2oat-filter=everything \
 +    dalvik.vm.check-dex-sum=false \
 +    dalvik.vm.checkjni=false \
 +    dalvik.vm.usejit=true \
 +    dalvik.vm.dexopt-flags=v=a,o=v \
 +    dalvik.vm.dex2oat-swap=false \
 +    dalvik.vm.dex2oat-threads=4 \
 +    dalvik.vm.boot-dex2oat-threads=4 \
 +    dalvik.vm.image-dex2oat-threads=4 \
 +    dalvik.vm.heaptargetutilization=0.9 \
 +    dalvik.vm.heapgrowthlimit=288m
 +
 +# Single-user
 +PRODUCT_PROPERTY_OVERRIDES += \
 +    fw.max_users=1
 +
 +# HWUI Performance Compiler Options
 +HWUI_COMPILE_FOR_PERF := true
 +
 +# Graphics Tweaks
 +PRODUCT_PROPERTY_OVERRIDES += \
 +    persist.sys.ui.hw=true
 +
 +# Native Density
 +PRODUCT_PROPERTY_OVERRIDES += \
 +    ro.sf.lcd_density=493
 +
 +# Freedom
 +PRODUCT_PROPERTY_OVERRIDES += \
 +    persist.sys.hdcp_checking=never
 +
 +# End Custom Stuff</code>
 +
 +===== Steven Black's Unified Hosts File =====
 +
 +  * https://github.com/StevenBlack/hosts
 +
 +  * Includes ''fakenews'' and ''gambling'' extensions
 +
 +  rm -Rf '/tmp/master.zip' '/tmp/hosts-master' && wget 'https://github.com/StevenBlack/hosts/archive/master.zip' -O '/tmp/master.zip' && unzip '/tmp/master.zip' -d '/tmp' && python3 '/tmp/hosts-master/updateHostsFile.py' --auto --extensions 'fakenews' 'gambling' --output ~/'android/cm-14.1/system/core/rootdir/etc' && rm -Rf '/tmp/master.zip' '/tmp/hosts-master' && sync
 +
 +====== Build Prep ======
 +
 +===== Quick Command =====
 +
 +  * This expects [[#key_management | signing keys]] in-place
 +  * This does the next 9 commands in-order and produces a flashable zip
 +
 +  cd ~/'android/cm-14.1' && make 'clobber' && sync && source ~/'android/cm-14.1/build/envsetup.sh' && breakfast 'shamu' && sync && unset 'CCACHE_DISABLE' && export 'CCACHE_DISABLE=1' && unset 'ANDROID_JACK_VM_ARGS' && export 'ANDROID_JACK_VM_ARGS=-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx12G' && mka target-files-package dist && sync && croot && ~/'android/cm-14.1/build/tools/releasetools/sign_target_files_apks' -o -d ~/'.android-certs' ~/'android/cm-14.1/out/dist/'*'-target_files-'*'.zip' ~/'android/cm-14.1/signed-target_files.zip' && sync && ~/'android/cm-14.1/build/tools/releasetools/ota_from_target_files' -k ~/'.android-certs/releasekey' --block --backup='true' ~/'android/cm-14.1/signed-target_files.zip' ~/'Downloads/'$(date +%m-%d)'-oreo-los-N6-esp724.zip' && sync && jack-admin kill-server
 +
 +===== Cleanup =====
 +
 +****
 +
 +  cd ~/'android/cm-14.1' && make 'clobber' && sync
 +
 +===== Set-up Environment =====
 +
 +****
 +
 +
 +  cd ~/'android/cm-14.1' && source ~/'android/cm-14.1/build/envsetup.sh'
 +
 +===== Breakfast! =====
 +
 +  * Be sure to run [[#tweaks | Tweaks]] after serving ''breakfast'' if using fresh sources
 +
 +  cd ~/'android/cm-14.1' && breakfast 'shamu' && 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 -Xmx12G'
 +
 +====== 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/cm-14.1/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 approximately 1 hour 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/cm-14.1' && mka target-files-package dist && sync
 +
 +===== Sign Build =====
 +
 +****
 +
 +  croot && ~/'android/cm-14.1/build/tools/releasetools/sign_target_files_apks' -o -d ~/'.android-certs' ~/'android/cm-14.1/out/dist/'*'-target_files-'*'.zip' ~/'android/cm-14.1/signed-target_files.zip' && sync
 +
 +===== Generate Zip =====
 +
 +****
 +
 +  ~/'android/cm-14.1/build/tools/releasetools/ota_from_target_files' -k ~/'.android-certs/releasekey' --block --backup='true' ~/'android/cm-14.1/signed-target_files.zip' ~/'Downloads/'$(date +%m-%d)'-nougat-los-N6-esp724.zip' && sync
 +
 +===== Kill Jack Server =====
 +
 +  * It remains running in the background after the build is complete
 +
 +  jack-admin kill-server
 +
 +===== Install Zip =====
 +
 +  * Flash ''~/Downloads/lineageos-cm14.1-shamu-unofficial-(date).zip''
 +
 +====== Unsigned Build ======
 +
 +===== Build and Generate Zip =====
 +
 +  * This takes approximately 1 hour to complete
 +
 +  cd ~/'android/cm-14.1' && croot && brunch 'shamu' && sync
 +
 +===== Install Zip =====
 +
 +  * Flash the 400MB+ zip found in ''~/android/cm-14.1/out/target/product/shamu''
 +
 +====== Nexus 6 Configuration ======
 +
 +  * [[devices:shamu | Proceed here]]
 +
 +====== Changelog ======
 +
 +===== Notes =====
 +
 +  * Unless otherwise specified, all uploaded builds are updated from the source (resync) prior to building
 +
 +===== Changelog =====
 +
 +  * https://review.lineageos.org/#/q/status:merged
 +  * https://review.lineageos.org/#/q/project:LineageOS/android_device_moto_shamu
 +
 +  * 2017/10/31: More Dalvik/ART tweaks, HWUI compiled in performance mode, disable HDCP checking, force 2D GPU acceleration
 +  * 2017/10/29: Dalvik/ART tweaks, disabled multi-user
 +  * 2017/10/18: Resync
 +  * 2017/09/29: Resync
 +  * 2017/09/26: Resync
 +  * 2017/09/23: Add fakenews and gambling extensions back for Steven Black's hosts file
 +  * 2017/09/21: Resync
 +  * 2017/07/22: Resync
 +  * 2017/07/19: Remove Dalvik/ART Tweaks, re-enable multi-user
 +  * 2017/07/17: Dalvik/ART Tweaks, disabled multi-user
 +  * 2017/07/16: Back to userdebug build
 +  * 2017/07/13: Resync
 +  * 2017/07/11: Resync
 +  * 2017/07/09: Removed gambling, fakenews, and porn filters for Steven Black's host file (the default hosts are included still)
 +  * 2017/07/07: Now includes all default apps, [[https://github.com/StevenBlack/hosts | Steven Black's Unified Hosts File]] built-in with the gambling, fakenews, and porn filters enabled
 +  * 2017/07/06: DPI to 493, user build (changed from userdebug)
 +  * 2017/07/05: Initial build, removal of some default apps