blob: da55057fab61977d80195c3ea2c665972e41ab32 [file] [log] [blame]
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link rel="shortcut icon" href="../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.4.3">
<title>Build Guide - Team Bliss</title>
<link rel="stylesheet" href="../../assets/stylesheets/application.30686662.css">
<script src="../../assets/javascripts/modernizr.74668098.js"></script>
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono&display=fallback">
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
<link rel="stylesheet" href="../../assets/fonts/material-icons.css">
</head>
<body dir="ltr">
<svg class="md-svg">
<defs>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#build-guide" tabindex="1" class="md-skip">
Skip to content
</a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../.." title="Team Bliss" class="md-header-nav__button md-logo">
<i class="md-icon"></i>
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">
Team Bliss
</span>
<span class="md-header-nav__topic">
Build Guide
</span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
&#xE5CD;
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container">
<main class="md-main" role="main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../.." title="Team Bliss" class="md-nav__button md-logo">
<i class="md-icon"></i>
</a>
Team Bliss
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../.." title="Home" class="md-nav__link">
Home
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-2" type="checkbox" id="nav-2" checked>
<label class="md-nav__link" for="nav-2">
Bliss OS
</label>
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
<label class="md-nav__title" for="nav-2">
Bliss OS
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../" title="Index" class="md-nav__link">
Index
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Build Guide
</label>
<a href="./" title="Build Guide" class="md-nav__link md-nav__link--active">
Build Guide
</a>
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">Table of contents</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#introduction" class="md-nav__link">
Introduction
</a>
</li>
<li class="md-nav__item">
<a href="#preparation" class="md-nav__link">
Preparation
</a>
</li>
<li class="md-nav__item">
<a href="#install-the-jdk" class="md-nav__link">
Install the JDK
</a>
</li>
<li class="md-nav__item">
<a href="#install-build-tools" class="md-nav__link">
Install build tools
</a>
</li>
<li class="md-nav__item">
<a href="#install-source-code-tools" class="md-nav__link">
Install source code tools
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#what-is-source" class="md-nav__link">
What is source?
</a>
</li>
<li class="md-nav__item">
<a href="#what-if-i-need-repo-globally" class="md-nav__link">
What if I need repo globally?
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#download" class="md-nav__link">
Download
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#i-still-dont-know-how-much-cpu-threads-i-have-how-do-i-check" class="md-nav__link">
I still don't know how much CPU threads I have. How do I check?
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#easy-build-instructions" class="md-nav__link">
Easy Build Instructions
</a>
</li>
<li class="md-nav__item">
<a href="#advanced-build-instructions" class="md-nav__link">
Advanced Build Instructions
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#my-device-isnt-booting-and-userdebug-wont-print-any-adb-logcats-what-gives" class="md-nav__link">
My device isn't booting, and userdebug won't print any adb logcats. What gives?
</a>
</li>
<li class="md-nav__item">
<a href="#why-mka-and-not-make" class="md-nav__link">
Why mka and not make?
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#after-building" class="md-nav__link">
After building
</a>
</li>
<li class="md-nav__item">
<a href="#changing-the-target-kernel-branch" class="md-nav__link">
Changing the target kernel branch
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#switching-the-kernel-branch" class="md-nav__link">
Switching the kernel branch
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#using-the-patch-system-for-testing" class="md-nav__link">
Using the patch system for testing
</a>
</li>
<li class="md-nav__item">
<a href="#troubleshooting" class="md-nav__link">
Troubleshooting
</a>
</li>
<li class="md-nav__item">
<a href="#conclusion" class="md-nav__link">
Conclusion
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../extras/" title="Extras" class="md-nav__link">
Extras
</a>
</li>
<li class="md-nav__item">
<a href="../installation-guide-misc/" title="Installation Guide (Misc)" class="md-nav__link">
Installation Guide (Misc)
</a>
</li>
<li class="md-nav__item">
<a href="../installation-guide-surface-devices/" title="Installation Guide (Surface devices)" class="md-nav__link">
Installation Guide (Surface devices)
</a>
</li>
<li class="md-nav__item">
<a href="../installation-guide/" title="Installation Guide" class="md-nav__link">
Installation Guide
</a>
</li>
<li class="md-nav__item">
<a href="../taking-bug-reports/" title="Taking bug reports" class="md-nav__link">
Taking bug reports
</a>
</li>
<li class="md-nav__item">
<a href="../troubleshooting/" title="Troubleshooting" class="md-nav__link">
Troubleshooting
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3">
<label class="md-nav__link" for="nav-3">
BlissRoms
</label>
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
<label class="md-nav__title" for="nav-3">
BlissRoms
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../BlissRoms/" title="Index" class="md-nav__link">
Index
</a>
</li>
<li class="md-nav__item">
<a href="../../BlissRoms/build-guide/" title="Build Guide" class="md-nav__link">
Build Guide
</a>
</li>
<li class="md-nav__item">
<a href="../../BlissRoms/build-tips/" title="Build Tips" class="md-nav__link">
Build Tips
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4">
<label class="md-nav__link" for="nav-4">
Common
</label>
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
<label class="md-nav__title" for="nav-4">
Common
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../common/" title="Index" class="md-nav__link">
Index
</a>
</li>
<li class="md-nav__item">
<a href="../../common/git-started/" title="Git Started" class="md-nav__link">
Git Started
</a>
</li>
<li class="md-nav__item">
<a href="../../common/maintaining-proper-authorship/" title="Maintaining proper authorship" class="md-nav__link">
Maintaining proper authorship
</a>
</li>
<li class="md-nav__item">
<a href="../../common/using-dippy-bird/" title="Using `dippy-bird`" class="md-nav__link">
Using `dippy-bird`
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
<label class="md-nav__link" for="nav-5">
Infrastructure
</label>
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
<label class="md-nav__title" for="nav-5">
Infrastructure
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../infrastructure/" title="Index" class="md-nav__link">
Index
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">Table of contents</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#introduction" class="md-nav__link">
Introduction
</a>
</li>
<li class="md-nav__item">
<a href="#preparation" class="md-nav__link">
Preparation
</a>
</li>
<li class="md-nav__item">
<a href="#install-the-jdk" class="md-nav__link">
Install the JDK
</a>
</li>
<li class="md-nav__item">
<a href="#install-build-tools" class="md-nav__link">
Install build tools
</a>
</li>
<li class="md-nav__item">
<a href="#install-source-code-tools" class="md-nav__link">
Install source code tools
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#what-is-source" class="md-nav__link">
What is source?
</a>
</li>
<li class="md-nav__item">
<a href="#what-if-i-need-repo-globally" class="md-nav__link">
What if I need repo globally?
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#download" class="md-nav__link">
Download
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#i-still-dont-know-how-much-cpu-threads-i-have-how-do-i-check" class="md-nav__link">
I still don't know how much CPU threads I have. How do I check?
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#easy-build-instructions" class="md-nav__link">
Easy Build Instructions
</a>
</li>
<li class="md-nav__item">
<a href="#advanced-build-instructions" class="md-nav__link">
Advanced Build Instructions
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#my-device-isnt-booting-and-userdebug-wont-print-any-adb-logcats-what-gives" class="md-nav__link">
My device isn't booting, and userdebug won't print any adb logcats. What gives?
</a>
</li>
<li class="md-nav__item">
<a href="#why-mka-and-not-make" class="md-nav__link">
Why mka and not make?
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#after-building" class="md-nav__link">
After building
</a>
</li>
<li class="md-nav__item">
<a href="#changing-the-target-kernel-branch" class="md-nav__link">
Changing the target kernel branch
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#switching-the-kernel-branch" class="md-nav__link">
Switching the kernel branch
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#using-the-patch-system-for-testing" class="md-nav__link">
Using the patch system for testing
</a>
</li>
<li class="md-nav__item">
<a href="#troubleshooting" class="md-nav__link">
Troubleshooting
</a>
</li>
<li class="md-nav__item">
<a href="#conclusion" class="md-nav__link">
Conclusion
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<h1 id="build-guide">Build Guide</h1>
<h2 id="introduction">Introduction</h2>
<p>This is the official guide to build Bliss OS for PCs. In this guide, we will only cover building for x86 &amp; x86_64 devices. We will also go over the details of using the patch system for testing and recompiling a build with a different kernel branch.</p>
<p>The golden rule to building is patience. If something breaks, pay attention to the console output or take logs of the issue and ask for guidance in our build support chat.</p>
<p>Let’s get started.</p>
<h2 id="preparation">Preparation</h2>
<p>To get started, you need a computer with Ubuntu 18.04 (LTS), at least 200GB space of HDD, and at least 8GB RAM. A decent CPU (or CPUs if you have a server motherboard) is recommended. Other distros can work but is not officially supported in this guide.</p>
<p>Underpowered machines may crash during compilation. If that happens, you may try and restart the build as most crashes are caused by lack of memory. If your storage space has run out, then you will need to build on a different hard drive.</p>
<h2 id="install-the-jdk">Install the JDK</h2>
<p>Install OpenJDK:</p>
<pre><code>sudo apt install openjdk-8-jdk
</code></pre>
<p>From the AOSP 9.0, the AOSP uses the prebuilt JDK in code repository, so it is not required if building system based on AOSP 9.0 and above version.</p>
<h2 id="install-build-tools">Install build tools</h2>
<p>To install the required build tools, run the following command:</p>
<pre><code>sudo apt-get install git-core gnupg flex bison maven gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip squashfs-tools python-mako libssl-dev ninja-build lunzip syslinux syslinux-utils gettext genisoimage gettext bc xorriso libncurses5
</code></pre>
<h2 id="install-source-code-tools">Install source code tools</h2>
<p>Now we need to get the source code via a program named <code>repo</code>, made by Google. The primary function of <code>repo</code> is to read a manifest file located in Bliss OS's GitHub organization, and find what repositories you need to actually build Android.</p>
<p>Create a <code>~/bin</code> directory for <code>repo</code>:</p>
<pre><code>mkdir -p ~/bin
</code></pre>
<p>The <code>-p</code> flag instructs <code>mkdir</code> to <em>only</em> create the directory if it does not exist in the first place. Now download the <code>repo</code> tool into <code>~/bin</code>:</p>
<pre><code>curl https://storage.googleapis.com/git-repo-downloads/repo &gt; ~/bin/repo
</code></pre>
<p>Make <code>repo</code> executable:</p>
<pre><code>chmod a+x ~/bin/repo
</code></pre>
<p>And add it to PATH:</p>
<pre><code>nano .bashrc
</code></pre>
<p>Scroll to the end of the file and type these lines:</p>
<pre><code># Export ~/bin
export PATH=~/bin:$PATH
</code></pre>
<p>Ctrl-O and enter to save, then Ctrl-X to exit nano. Now either logout and login again (or reboot), or <code>source</code> the file:</p>
<pre><code>source .bashrc
</code></pre>
<p>Which can be shortened to:</p>
<pre><code>. .bashrc
</code></pre>
<h3 id="what-is-source">What is <code>source</code>?</h3>
<p><code>source</code> is a <code>bash</code> command to read aliases, functions, and commands from the specified file. Typically, you'll supply <code>bash</code> with a configuration file such as <code>.bashrc</code> or <code>.bash_profile</code>, or an initialization file such as <code>envsetup.sh</code>. The difference is that while the configuration file lists configuration and user-defined aliases and functions, initialization files typically hold build commands such as <code>breakfast</code>, <code>brunch</code>, and <code>lunch</code>. Without those commands building would be significantly harder as you would have to memorize the long command to invoke a build manually!</p>
<p>But why do you need to run it after modifying a file? Well, <code>bash</code> cannot automatically detect changes in our files. To solve this, we either <code>source</code> it or log out and log back in, forcing <code>bash</code> to reload configuration files. Keep this in mind, because unlike configuration files, if you forget to <code>source</code> initialization files, build commands will not function!</p>
<h3 id="what-if-i-need-repo-globally">What if I need <code>repo</code> globally?</h3>
<p>If you need the <code>repo</code> tool to be available anywhere, you will need to first download <code>repo</code> to your home directory, move it with <code>sudo</code> and give it executable permissions. The exact commands are as follows:</p>
<pre><code>curl https://storage.googleapis.com/git-repo-downloads/repo &gt; ~/repo
sudo mv ~/repo /usr/bin/
chmod a+x /usr/bin/repo
</code></pre>
<p><code>repo</code> will now work anywhere, without any <code>.bashrc</code> modifications. However, these steps aren’t recommended as <code>repo</code> might become a security risk if a vulnerability is found.</p>
<p>Now we’re ready to download the source code.</p>
<h2 id="download">Download</h2>
<p>Create a directory for the source:</p>
<pre><code>mkdir -p ~/blissos/p9.0
cd ~/blissos/p9.0
</code></pre>
<p>Before we download, we need to tell <code>repo</code> and <code>git</code> who we are. Run the following commands, substituting your information:</p>
<pre><code>git config --global user.email “randy.mcrandyface@hotmail.net”
git config --global user.name “Randy McRandyface”
</code></pre>
<p>Now, we’re ready to initialize. We need to tell <code>repo</code> which manifest to read:</p>
<pre><code>repo init -u https://github.com/BlissRoms-x86/manifest.git -b p9.0-x86
</code></pre>
<p><code>-b</code> is for the branch, and we’re on <code>p9.0-x86</code>, Android Pie. It’ll take a couple of seconds. You may need to type <code>y</code> for the color prompt.</p>
<p>Sync repo :</p>
<pre><code>repo sync -j24 -c --no-tags --no-clone-bundle
</code></pre>
<p>Problems syncing? :</p>
<pre><code>repo sync -j4 -c --no-tags --no-clone-bundle --force-sync
</code></pre>
<p><code>-j</code> is for threads. Typically, your CPU core count is your thread count, unless you’re using an older Intel CPU with hyperthreading. In that case, the thread count is double the count of your CPU cores. Newer CPUs have dropped hyperthreading unless you have the i9, so check how many threads you have. If you have four threads, you would run:</p>
<pre><code>repo sync -j4 -c
</code></pre>
<p><code>-c</code> is for pulling in only the current branch, instead of the entire history. This is useful if you need the downloads fast and don’t want the entire history to be downloaded. This is used by default unless specified otherwise.</p>
<h3 id="i-still-dont-know-how-much-cpu-threads-i-have-how-do-i-check">I still don't know how much CPU threads I have. How do I check?</h3>
<p>Run <code>nproc</code>. The output should be something like this:</p>
<pre><code>mybuildbox@test:~$ nproc
24
</code></pre>
<p>This means that there are 24 threads in your machine.</p>
<p><code>repo</code> will start downloading all the code. That’s going to be slow, even on a fiber network. Expect downloads to take more than a couple hours.</p>
<h2 id="easy-build-instructions">Easy Build Instructions</h2>
<p>This will build an x86 based .ISO for PCs.</p>
<p>Usage: <code>$ bash build-x86.sh options buildVariants blissBranch extraOptions</code>
Options:</p>
<pre><code>-c | --clean : Does make clean &amp;&amp; make clobber and resets the efi device tree
-s | --sync: Repo syncs the rom (clears out patches), then reapplies patches to needed repos
-p | --patch: Just applies patches to needed repos
-r | --proprietary: build needed items from proprietary vendor (non-public)
</code></pre>
<p>BuildVariants:</p>
<pre><code>android_x86-user : Make user build
android_x86-userdebug |: Make userdebug build
android_x86-eng : Make eng build
android_x86_64-user : Make user build
android_x86_64-userdebug |: Make userdebug build
android_x86_64-eng : Make eng build
</code></pre>
<p>BlissBranch:</p>
<pre><code>select which bliss branch to sync, default is p9.0
</code></pre>
<p>ExtraOptions:</p>
<pre><code>foss : packages microG &amp; FDroid with the build
go : packages Gapps Go with the build
gapps : packages OpenGapps with the build
gms : packages GMS with the build (requires private repo access)
none : force all extraOption flags to false.
</code></pre>
<p>To start, you must first use the -s (--sync) flag, then on following builds, it is not needed. Initial generation of the proprietary files from ChromeOS are also needed on the first build. We are able to use the -r (--proprietary) flag for that.
<strong>This step needs to be on its own because the mounting process requires root permissions, so keep a look out for it asking for your root password</strong>.</p>
<p>First you must sync with the new manifest changes:</p>
<pre><code>bash build-x86.sh -p
</code></pre>
<p>This will do initial patching. Some of the patches will show as <code>already applied</code> or <code>conflict</code>. This is normal behavior and will not effect the build process if you continue to the next step without addressing any of the conflicts.</p>
<p><strong>The only times you should worry about the conflicts is when you are adding or changing patches in <code>vendor/x86</code></strong>.</p>
<p>Next step is to download the proprietary files from ChromeOS:</p>
<pre><code>mkdir -p vendor/bliss_priv/proprietary
mkdir -p vendor/bliss_priv/source
bash build-x86.sh -r android_x86_64-userdebug
</code></pre>
<p>After that, you can build your release file:</p>
<pre><code>bash build-x86.sh android_x86_64-userdebug (to build the userdebug version for x86_64 CPUs)
</code></pre>
<h2 id="advanced-build-instructions">Advanced Build Instructions</h2>
<p>Set up the build environment:</p>
<pre><code>. build/envsetup.sh
</code></pre>
<p>This is the initialization file we talked about earlier up top. This "initializes" the environment, and imports a bunch of useful build commands required to build your device. Again, you need to remember to <code>source</code> this file every time you log out and log back in, or launch a new <code>bash</code>/Terminal instance.</p>
<p>Define what device you’re going to build. For example, the Nexus 5X, has a codename of <code>bullhead</code>. You can check your specific device's codename on GitHub or on Google. Execute:</p>
<p>For 32 bit devices:</p>
<pre><code>lunch android_x86-userdebug
</code></pre>
<p>For 64 bit devices:</p>
<pre><code>lunch android_x86_64-userdebug
</code></pre>
<p>Let's break down the command. <code>lunch</code> initializes the proper environmental variables required for the build tools to build your specific device. Things like <code>BLISS_DEVICE</code> and other variables are set in this stage, and the changed variables will be shown as output. <code>x86</code> or <code>x86_64</code> is the specific device we are building. Finally, <code>userdebug</code> means that we will build a user-debuggable variant. This is usually what most ROMs use for publishing their builds. Manufacturers typically use <code>user</code> which disables most of the useful Android Logcats.</p>
<h3 id="my-device-isnt-booting-and-userdebug-wont-print-any-adb-logcats-what-gives">My device isn't booting, and <code>userdebug</code> won't print any <code>adb logcat</code>s. What gives?</h3>
<p>There is a third build variant called <code>eng</code>, short for engineering builds. These builds will activate <code>adb logcat</code> during boot, and will show you exactly what is going wrong, where, and why. However, these builds are <strong>NOT</strong> recommended for normal usage as they are not securely hardened, have log spam that will slow down your device, and other unexpected problems like userspace utilities crashing during runtime. If you want to submit your device for mainline, do <strong>NOT</strong> submit an <code>eng</code> build!</p>
<p>If this is the first time you're running the build, you're going to want to run the proprietary build command first from the easy build instructions. Alternatively, you could also run those commands manually.</p>
<pre><code>mkdir -p vendor/bliss_priv/proprietary &amp;&amp; mkdir -p vendor/bliss_priv/source
</code></pre>
<p>Then:</p>
<pre><code>lunch android_x86_64-userdebug
mka update_engine_applier
mka proprietary
</code></pre>
<p>After that is complete, we can start the main building process. Run:</p>
<p><code>mka iso_img</code></p>
<p>And the build should start. The build process will take a long time. Prepare to wait a few hours, even on a decent machine.</p>
<h3 id="why-mka-and-not-make">Why <code>mka</code> and not <code>make</code>?</h3>
<p><code>make</code> only runs with 1 thread. <code>mka</code> is properly aliased to use all of your threads by checking <code>nproc</code>.</p>
<p>If you want to customize your thread count (maybe you're building with a fan-screaming laptop in a quiet coffee shop), use <code>make -j#</code>, replacing the hash with the number of threads (example of <code>make -j4</code>).</p>
<h2 id="after-building">After building</h2>
<p>There are two outcomes to a build - either it fails and you get a red error message from <code>make</code>, or it succeeds and you see the Bliss logo in ASCII. If you encounter the former, you need to go back and fix whatever it's complaining about. Typically, 90% of the time the problem will be in your device tree. For the other 10%, submit a bug report to the ROM developers. Be sure to include the full log of your build to help diagnose the problem, and your device tree.</p>
<p>If you face the latter, congratulations! You've successfully built BlissRoms for your device. Grab the artifacts for your device:</p>
<pre><code>cd out/target/product/x86_64/
</code></pre>
<p>In here, you’ll find an <code>.iso</code> that goes along the lines of <code>Bliss-v11.9--OFFICIAL-20190801-1619_x86_64_k-k4.9.153_m-18.3.5-pie-x86-llvm80_f-dev-kernel.org.iso</code>.</p>
<h2 id="changing-the-target-kernel-branch">Changing the target kernel branch</h2>
<p>Sometimes, you might be working on a device that requires a different kernel branch. In order to switch kernels effectively on Bliss OS, they need to be compiled with the OS at build time.</p>
<h3 id="switching-the-kernel-branch">Switching the kernel branch</h3>
<p>Start off by entering the kernel folder</p>
<pre><code>cd kernel
</code></pre>
<p>Then pull all the available kernel branched from your target repo. In this case, we are using the default <code>BR-x86</code> repo</p>
<pre><code>git fetch BR-x86
</code></pre>
<p>Then after that is finished, we need to checkout our target branch, and in this example we are choosing our <code>k4.19.50-ax86-ga</code> branch, which has added commits from the GalliumOS project for Chromebooks</p>
<pre><code>git checkout BR-x86/k4.19.50-ax86-ga
</code></pre>
<p>Next step is to clean out any configs or generated files from the previously checked out kernel. To do this, run these commands</p>
<pre><code>make clean
make mrproper
</code></pre>
<p>Once that is done, we can <code>cd</code> back to our main project folder</p>
<pre><code>cd ..
</code></pre>
<p>And run our build command again to generate the <code>.iso</code> with the target kernel we selected</p>
<pre><code>rm -rf out/target/product/x86_64/kernel
mka iso_img
</code></pre>
<h2 id="using-the-patch-system-for-testing">Using the patch system for testing</h2>
<p>We use a patching method we adapted for Bliss from Intel's Project Celadon &amp; phh-treble. This patching system allows us to bring in a good number of commits to add to the OS, and test how they apply or if there are any conflicts.</p>
<p>Our intention was to make a system that can add all the needed x86/x86_64 commits to BlissROM, as well as other ROMs too.</p>
<p>The majority of this system is found in <code>vendor/x86/utils</code>.</p>
<p>From here, you simply generate the <code>.patch</code> files from your additions, and add them to the mix.
In the following example, we are going to generate patches from <code>packages/apps/Settings</code> and add them to the proper folder for live testing.</p>
<p>From your Project folder:</p>
<pre><code>cd packages/apps/Settings
</code></pre>
<p>And generate your <code>.patch</code> files. For this example, we've added four commits on top of what was there after sync</p>
<pre><code>git format-patch -4
</code></pre>
<p>Then copy those files to the proper folder in <code>vendor/x86</code>. In this case, you will find it here:</p>
<pre><code>vendor/x86/utils/android_p/google_diff/x86
</code></pre>
<p>After that is complete, you can <code>make clean</code> and run the patch system from your main project folder.</p>
<pre><code>make clean
bash build-x86.sh -p
</code></pre>
<p>This should start patching all the source files. Once that is complete, you can rebuild.</p>
<h2 id="troubleshooting">Troubleshooting</h2>
<p>If your build failed, there are a couple things you can try.</p>
<ul>
<li>Try a fresh <code>repo sync</code> to make your repository up to date. Sometimes, the Internet connection between you and GitHub can be flaky. In rare cases a commit merge might be ongoing, and you might've grabbed an incomplete merge. Mostly, this should fix the issue 70% of the time.</li>
<li>Make sure your dependencies are installed correctly. Error messages help out a lot here! Often it will say <code>shared/linked library not found</code> or something along those lines.</li>
<li>Make sure you sourced <code>build/envsetup.sh</code>. This is especially common and worth suspecting if none of the build commands like <code>breakfast</code> and <code>lunch</code> work. If you have <code>repo sync</code>ed do this again.</li>
<li>Make sure you’re at the root of the build tree. Again, to quickly jump there, use <code>croot</code>.</li>
<li>Make sure your computer itself isn’t faulty. HDDs usually die first, followed by RAM. SSDs rarely die but failure is not unheard of. In extremely rare cases, your CPU may have a defect. If you're unsure, run a stress test using a program like Prime95.</li>
</ul>
<p>If something goes wrong and you've tried everything above, first use Google to look up your error! Most of the errors you encounter is due to misconfiguration and wrong commands entered. More often than not, Google will have the answer you are looking for. If you're still stuck and nothing fixes the problem, then ask us via our Telegram Build Support chat.</p>
<h2 id="conclusion">Conclusion</h2>
<p>Building a ROM is very hard and tedious and the results are very rewarding! If you managed to follow along, congratulations!</p>
<p>After you finish building, you can try out the Git Started guide. Make changes, commit, and send them off to our GitHub for Bliss OS repos &amp; our Gerrit for review on BlissROMs repos! Or better yet, download experimental commits not ready for the mainline repositories and review them! Again, ROM building is a fun project you can work with. I hope this guide was a lot of fun to run through!</p>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="../" title="Index" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Index
</span>
</div>
</a>
<a href="../extras/" title="Extras" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Extras
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
powered by
<a href="https://www.mkdocs.org">MkDocs</a>
and
<a href="https://squidfunk.github.io/mkdocs-material/">
Material for MkDocs</a>
</div>
</div>
</div>
</footer>
</div>
<script src="../../assets/javascripts/application.ac79c3b0.js"></script>
<script>app.initialize({version:"1.0.4",url:{base:"../.."}})</script>
</body>
</html>