User Tools

Site Tools


projects:bullhead-lineageos-lineage-15.1

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:bullhead-lineageos-lineage-15.1 [2018/03/16 10:16] Sean Rhoneprojects:bullhead-lineageos-lineage-15.1 [2018/04/07 06:53] (current) Sean Rhone
Line 1: Line 1:
 +====== Information ======
  
 +  * Custom builds of LineageOS for the Nexus 5X
 +  * lineage-15.1 branch
 +
 +===== Prerequisites =====
 +
 +  * [[distros:fedora_workstation_gnome | Fedora Workstation]]
 +
 +====== xda-developers ======
 +
 +  * TODO
 +
 +====== Dependencies ======
 +
 +
 +****
 +
 +  sudo dnf install java-1.8.0-openjdk-devel ImageMagick-devel patch ncurses-compat-libs schedtool libstdc++.i686 glibc.i686 m4 xz-lzma-compat gcc brotli && sync
 +
 +====== Prepare Build Environment ======
 +
 +===== Cleanup =====
 +
 +****
 +
 +  cd ~ && rm -Rf ~/'android/lineage-15.1/'* ~/'.ccache' ~/'.jack-server' ~/'.jack-settings' ~/'bin/bro' && sync
 +
 +  sudo fstrim -v -a
 +
 +===== 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 =====
 +
 +  * https://github.com/LineageOS/android/tree/lineage-15.1
 +
 +  mkdir -p ~/'android/lineage-15.1' && cd ~/'android/lineage-15.1' && repo init --manifest-url='https://github.com/LineageOS/android.git' --manifest-branch='lineage-15.1' --depth=1 && sync
 +
 +===== LGE Manifest =====
 +
 +==== lineage-15.1 ====
 +
 +  * https://github.com/TheMuppets/proprietary_vendor_lge/tree/lineage-15.1
 +
 +  mkdir -p ~/'android/lineage-15.1/.repo/local_manifests' && nano ~/'android/lineage-15.1/.repo/local_manifests/lge.xml'
 +
 +<code>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<manifest>
 +
 +  <!-- LGE -->
 +  <project path="vendor/lge" name="TheMuppets/proprietary_vendor_lge" remote="github" revision="lineage-15.1" />
 +
 +</manifest></code>
 +
 +===== Sources Management =====
 +
 +==== Pull-in and Update Sources ====
 +
 +=== Network Sync ===
 +
 +  * As of 2018/02/26, this downloads around 12.6GB and 51,542 items for ''lineage-15.1'' ((not including LGE vendor files))
 +  * If pulling fresh sources, this command is good to leave running overnight, and then followed up with a [[#backup_sources | backup]]
 +
 +  cd ~/'android/lineage-15.1' && repo sync --current-branch --network-only --jobs='4' --force-broken --force-sync && sync
 +
 +=== Complete Sync ===
 +
 +  * Performs both Network and Local file sync
 +
 +  cd ~/'android/lineage-15.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/lineage-15.1' && tar -c --use-compress-program='/usr/bin/pigz' -v -f ~/'Downloads/lineageos-lineage-15.1-'$(date +%Y-%m-%d)'.tar.gz' '.repo' && cd ~ && sync
 +
 +==== Restore Sources ====
 +
 +****
 +
 +  mkdir -p ~/'android/lineage-15.1' && cd ~/'android/lineage-15.1' && tar -xvzf ~/'Downloads/lineageos-lineage-15.1-'*'.tar.gz' '.repo' && sync
 +
 +====== Modifications ======
 +
 +===== Allow Signature Spoofing =====
 +
 +  * This allows **microG Services Core** and **FakeStore** to fake GApps properly
 +
 +  * https://github.com/FreeMobileOS/android_packages_apps_GmsCore/blob/fmo-O-for-upstream/patches/android_frameworks_base-O.patch
 +  * Keep eyes on https://github.com/microg/android_packages_apps_GmsCore/pull/418 for when this is officially merged
 +
 +  wget -O ~/'Downloads/GmsCore-android_frameworks_base-O.patch' 'https://raw.githubusercontent.com/FreeMobileOS/android_packages_apps_GmsCore/fmo-O-for-upstream/patches/android_frameworks_base-O.patch' && cd ~/'android/lineage-15.1' && patch --no-backup-if-mismatch --strip='1' --directory='frameworks/base' < ~/'Downloads/GmsCore-android_frameworks_base-O.patch' && rm -f ~/'Downloads/GmsCore-android_frameworks_base-O.patch' && sync
 +
 +===== Allow Location Providers Outside /system =====
 +
 +  * https://github.com/microg/android_packages_apps_UnifiedNlp/blob/master/patches/android_frameworks_base-N.patch
 +  * The ''N'' patch works on ''O'' ((Last tested: 2018/04/07))
 +
 +  * 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/lineage-15.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
 +
 +===== Steven Black's Unified Hosts File =====
 +
 +  * https://github.com/StevenBlack/hosts
 +
 +  * Includes ''fakenews'' and ''gambling'' extensions
 +
 +  rm -Rf '/tmp/unified-hosts' && git clone -b 'master' 'https://github.com/StevenBlack/hosts.git' '/tmp/unified-hosts' --depth '1' && python3 '/tmp/unified-hosts/updateHostsFile.py' --auto --extensions 'gambling' 'fakenews' --minimise --output ~/'android/lineage-15.1/system/core/rootdir/etc' && rm -Rf '/tmp/unified-hosts' && sync
 +
 +====== Build Prep ======
 +
 +===== Cleanup =====
 +
 +****
 +
 +  cd ~/'android/lineage-15.1' && make 'clobber' && sync
 +
 +===== Set-up Environment =====
 +
 +****
 +
 +
 +  cd ~/'android/lineage-15.1' && source ~/'android/lineage-15.1/build/envsetup.sh'
 +
 +===== Breakfast! =====
 +
 +****
 +
 +  cd ~/'android/lineage-15.1' && breakfast 'bullhead' && 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-15.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 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-15.1' && mka target-files-package dist && sync && jack-admin kill-server
 +
 +===== Sign Build =====
 +
 +****
 +
 +  croot && ~/'android/lineage-15.1/build/tools/releasetools/sign_target_files_apks' -o -d ~/'.android-certs' ~/'android/lineage-15.1/out/dist/'*'-target_files-'*'.zip' ~/'android/lineage-15.1/signed-target_files.zip' && sync
 +
 +===== Generate Zip =====
 +
 +****
 +
 +  ~/'android/lineage-15.1/build/tools/releasetools/ota_from_target_files' -k ~/'.android-certs/releasekey' --block --backup='true' ~/'android/lineage-15.1/signed-target_files.zip' ~/'Downloads/'$(date +%m-%d)'-oreo-los15.1-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-15.1/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-15.1' && mka target-files-package dist && sync && jack-admin kill-server && croot && ~/'android/lineage-15.1/build/tools/releasetools/sign_target_files_apks' -o -d ~/'.android-certs' ~/'android/lineage-15.1/out/dist/'*'-target_files-'*'.zip' ~/'android/lineage-15.1/signed-target_files.zip' && sync && cp '/usr/bin/brotli' ~/'bin/bro' && ~/'android/lineage-15.1/build/tools/releasetools/ota_from_target_files' -k ~/'.android-certs/releasekey' --block --backup='true' ~/'android/lineage-15.1/signed-target_files.zip' ~/'Downloads/'$(date +%m-%d)'-oreo-los15.1-N5X-esp724.zip' && sync
 +
 +===== Install Zip =====
 +
 +  * Flash ''~/Downloads/(date)-oreo-los15.1-N5X-esp724.zip''
 +
 +====== Unsigned Build ======
 +
 +===== Build and Generate Zip =====
 +
 +  * This takes approximately 2 hours to complete
 +
 +  cd ~/'android/lineage-15.1' && croot && brunch 'bullhead' && sync
 +
 +===== Install Zip =====
 +
 +  * Flash the 400MB+ zip found in ''~/'android/lineage-15.1/out/target/product/bullhead''
 +
 +====== Nexus 5X Configuration ======
 +
 +  * [[devices:bullhead | Proceed here]]
 +
 +====== Changelog ======
 +
 +===== Notes =====
 +
 +  * Unless otherwise specified, all uploaded builds are updated from the source (resync) prior to building
 +
 +===== Changelog =====
 +
 +  * 2018/02/26: Initial build