blob: eb12c6e32b2ecdae36f10f16b069b2954cad1ae6 [file] [log] [blame]
Eric Parkc9931992019-07-29 13:10:53 +09001
2
3
4
5<!doctype html>
6<html lang="en" class="no-js">
7 <head>
8
9 <meta charset="utf-8">
10 <meta name="viewport" content="width=device-width,initial-scale=1">
11 <meta http-equiv="x-ua-compatible" content="ie=edge">
12
13
14
15
16 <meta name="lang:clipboard.copy" content="Copy to clipboard">
17
18 <meta name="lang:clipboard.copied" content="Copied to clipboard">
19
20 <meta name="lang:search.language" content="en">
21
22 <meta name="lang:search.pipeline.stopwords" content="True">
23
24 <meta name="lang:search.pipeline.trimmer" content="True">
25
26 <meta name="lang:search.result.none" content="No matching documents">
27
28 <meta name="lang:search.result.one" content="1 matching document">
29
30 <meta name="lang:search.result.other" content="# matching documents">
31
32 <meta name="lang:search.tokenizer" content="[\s\-]+">
33
34 <link rel="shortcut icon" href="../../assets/images/favicon.png">
35 <meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.4.0">
36
37
38
Eric Park608ce5a2019-08-07 21:27:46 +080039 <title>Build Guide - Team Bliss</title>
Eric Parkc9931992019-07-29 13:10:53 +090040
41
42
43 <link rel="stylesheet" href="../../assets/stylesheets/application.0284f74d.css">
44
45
46
47
48 <script src="../../assets/javascripts/modernizr.74668098.js"></script>
49
50
51
52 <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
53 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono&display=fallback">
54 <style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
55
56
57 <link rel="stylesheet" href="../../assets/fonts/material-icons.css">
58
59
60
61
62
63
64 </head>
65
66 <body dir="ltr">
67
68 <svg class="md-svg">
69 <defs>
70
71
72 </defs>
73 </svg>
74 <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
75 <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
76 <label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
77
Eric Park608ce5a2019-08-07 21:27:46 +080078 <a href="#build-guide" tabindex="1" class="md-skip">
Eric Parkc9931992019-07-29 13:10:53 +090079 Skip to content
80 </a>
81
82
83 <header class="md-header" data-md-component="header">
84 <nav class="md-header-nav md-grid">
85 <div class="md-flex">
86 <div class="md-flex__cell md-flex__cell--shrink">
87 <a href="../.." title="Team Bliss" class="md-header-nav__button md-logo">
88
89 <i class="md-icon"></i>
90
91 </a>
92 </div>
93 <div class="md-flex__cell md-flex__cell--shrink">
94 <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
95 </div>
96 <div class="md-flex__cell md-flex__cell--stretch">
97 <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
98
99 <span class="md-header-nav__topic">
100 Team Bliss
101 </span>
102 <span class="md-header-nav__topic">
103
Eric Park608ce5a2019-08-07 21:27:46 +0800104 Build Guide
Eric Parkc9931992019-07-29 13:10:53 +0900105
106 </span>
107
108 </div>
109 </div>
110 <div class="md-flex__cell md-flex__cell--shrink">
111
112 <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
113
114<div class="md-search" data-md-component="search" role="dialog">
115 <label class="md-search__overlay" for="__search"></label>
116 <div class="md-search__inner" role="search">
117 <form class="md-search__form" name="search">
118 <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">
119 <label class="md-icon md-search__icon" for="__search"></label>
120 <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
121 &#xE5CD;
122 </button>
123 </form>
124 <div class="md-search__output">
125 <div class="md-search__scrollwrap" data-md-scrollfix>
126 <div class="md-search-result" data-md-component="result">
127 <div class="md-search-result__meta">
128 Type to start searching
129 </div>
130 <ol class="md-search-result__list"></ol>
131 </div>
132 </div>
133 </div>
134 </div>
135</div>
136
137 </div>
138
139 </div>
140 </nav>
141</header>
142
143 <div class="md-container">
144
145
146
147
148 <main class="md-main">
149 <div class="md-main__inner md-grid" data-md-component="container">
150
151
152 <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
153 <div class="md-sidebar__scrollwrap">
154 <div class="md-sidebar__inner">
155 <nav class="md-nav md-nav--primary" data-md-level="0">
156 <label class="md-nav__title md-nav__title--site" for="__drawer">
157 <a href="../.." title="Team Bliss" class="md-nav__button md-logo">
158
159 <i class="md-icon"></i>
160
161 </a>
162 Team Bliss
163 </label>
164
165 <ul class="md-nav__list" data-md-scrollfix>
166
167
168
169
170
171
172 <li class="md-nav__item">
Eric Park35d8ee32019-08-11 01:34:35 +0800173 <a href="../.." title="Index" class="md-nav__link">
174 Index
Eric Parkc9931992019-07-29 13:10:53 +0900175 </a>
176 </li>
177
178
179
180
181
182
183
184 <li class="md-nav__item md-nav__item--nested">
185
186 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-2" type="checkbox" id="nav-2">
187
188 <label class="md-nav__link" for="nav-2">
189 Bliss OS
190 </label>
191 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
192 <label class="md-nav__title" for="nav-2">
193 Bliss OS
194 </label>
195 <ul class="md-nav__list" data-md-scrollfix>
196
197
198
199
200
201
202
203 <li class="md-nav__item">
204 <a href="../../Bliss OS/" title="Index" class="md-nav__link">
205 Index
206 </a>
207 </li>
208
209
Eric Park608ce5a2019-08-07 21:27:46 +0800210
211
212
213
214
215 <li class="md-nav__item">
216 <a href="../../Bliss OS/extras/" title="Extras" class="md-nav__link">
217 Extras
218 </a>
219 </li>
220
221
222
223
224
225
226
227 <li class="md-nav__item">
228 <a href="../../Bliss OS/installation-guide/" title="Installation Guide" class="md-nav__link">
229 Installation Guide
230 </a>
231 </li>
232
233
234
235
236
237
238
239 <li class="md-nav__item">
240 <a href="../../Bliss OS/troubleshooting/" title="Troubleshooting" class="md-nav__link">
241 Troubleshooting
242 </a>
243 </li>
244
245
Eric Parkc9931992019-07-29 13:10:53 +0900246 </ul>
247 </nav>
248 </li>
249
250
251
252
253
254
255
256
257
258 <li class="md-nav__item md-nav__item--active md-nav__item--nested">
259
260 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3" checked>
261
262 <label class="md-nav__link" for="nav-3">
263 BlissRoms
264 </label>
265 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
266 <label class="md-nav__title" for="nav-3">
267 BlissRoms
268 </label>
269 <ul class="md-nav__list" data-md-scrollfix>
270
271
272
273
274
275
276
277 <li class="md-nav__item">
278 <a href="../" title="Index" class="md-nav__link">
279 Index
280 </a>
281 </li>
282
283
284
285
286
287
288
289
290
291 <li class="md-nav__item md-nav__item--active">
292
293 <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
294
295
296
297
298 <label class="md-nav__link md-nav__link--active" for="__toc">
Eric Park608ce5a2019-08-07 21:27:46 +0800299 Build Guide
Eric Parkc9931992019-07-29 13:10:53 +0900300 </label>
301
Eric Park608ce5a2019-08-07 21:27:46 +0800302 <a href="./" title="Build Guide" class="md-nav__link md-nav__link--active">
303 Build Guide
Eric Parkc9931992019-07-29 13:10:53 +0900304 </a>
305
306
307<nav class="md-nav md-nav--secondary">
308
309
310
311
312
313 <label class="md-nav__title" for="__toc">Table of contents</label>
314 <ul class="md-nav__list" data-md-scrollfix>
315
316 <li class="md-nav__item">
317 <a href="#updated-for-pie-p90" title="Updated for Pie (p9.0)" class="md-nav__link">
318 Updated for Pie (p9.0)
319 </a>
320
321 <nav class="md-nav">
322 <ul class="md-nav__list">
323
324 <li class="md-nav__item">
325 <a href="#introduction" title="Introduction" class="md-nav__link">
326 Introduction
327 </a>
328
329</li>
330
331 <li class="md-nav__item">
332 <a href="#preparation" title="Preparation" class="md-nav__link">
333 Preparation
334 </a>
335
336</li>
337
338 <li class="md-nav__item">
339 <a href="#install-the-jdk" title="Install the JDK" class="md-nav__link">
340 Install the JDK
341 </a>
342
343</li>
344
345 <li class="md-nav__item">
346 <a href="#install-build-tools" title="Install build tools" class="md-nav__link">
347 Install build tools
348 </a>
349
350</li>
351
352 <li class="md-nav__item">
353 <a href="#install-source-code-tools" title="Install source code tools" class="md-nav__link">
354 Install source code tools
355 </a>
356
357 <nav class="md-nav">
358 <ul class="md-nav__list">
359
360 <li class="md-nav__item">
361 <a href="#what-is-source" title="What is source?" class="md-nav__link">
362 What is source?
363 </a>
364
365</li>
366
367 <li class="md-nav__item">
368 <a href="#what-if-i-need-repo-globally" title="What if I need repo globally?" class="md-nav__link">
369 What if I need repo globally?
370 </a>
371
372</li>
373
374 </ul>
375 </nav>
376
377</li>
378
379 <li class="md-nav__item">
380 <a href="#download" title="Download" class="md-nav__link">
381 Download
382 </a>
383
Eric Park35d8ee32019-08-11 01:34:35 +0800384 <nav class="md-nav">
385 <ul class="md-nav__list">
386
387 <li class="md-nav__item">
388 <a href="#i-still-dont-know-how-much-cpu-threads-i-have-how-do-i-check" title="I still don't know how much CPU threads I have. How do I check?" class="md-nav__link">
389 I still don't know how much CPU threads I have. How do I check?
390 </a>
391
392</li>
393
394 </ul>
395 </nav>
396
Eric Parkc9931992019-07-29 13:10:53 +0900397</li>
398
399 <li class="md-nav__item">
400 <a href="#build" title="Build" class="md-nav__link">
401 Build
402 </a>
403
404 <nav class="md-nav">
405 <ul class="md-nav__list">
406
407 <li class="md-nav__item">
Eric Park608ce5a2019-08-07 21:27:46 +0800408 <a href="#my-device-isnt-booting-and-userdebug-wont-print-any-adb-logcats-what-gives" title="My device isn't booting, and userdebug won't print any adb logcats. What gives?" class="md-nav__link">
409 My device isn't booting, and userdebug won't print any adb logcats. What gives?
410 </a>
411
412</li>
413
414 <li class="md-nav__item">
Eric Park35d8ee32019-08-11 01:34:35 +0800415 <a href="#why-mka-and-not-make" title="Why mka and not make?" class="md-nav__link">
416 Why mka and not make?
417 </a>
418
419</li>
420
421 <li class="md-nav__item">
Eric Park608ce5a2019-08-07 21:27:46 +0800422 <a href="#i-get-an-error-about-no-blissify-targets-to-build-against-whats-wrong" title="I get an error about no blissify targets to build against, what's wrong?" class="md-nav__link">
423 I get an error about no blissify targets to build against, what's wrong?
Eric Parkc9931992019-07-29 13:10:53 +0900424 </a>
425
426</li>
427
428 </ul>
429 </nav>
430
431</li>
432
433 <li class="md-nav__item">
434 <a href="#after-building" title="After building" class="md-nav__link">
435 After building
436 </a>
437
438</li>
439
440 <li class="md-nav__item">
441 <a href="#troubleshooting" title="Troubleshooting" class="md-nav__link">
442 Troubleshooting
443 </a>
444
445</li>
446
447 <li class="md-nav__item">
448 <a href="#conclusion" title="Conclusion" class="md-nav__link">
449 Conclusion
450 </a>
451
452</li>
453
454 <li class="md-nav__item">
455 <a href="#looking-for-the-next-tutorial" title="Looking for the next tutorial?" class="md-nav__link">
456 Looking for the next tutorial?
457 </a>
458
459</li>
460
461 </ul>
462 </nav>
463
464</li>
465
466
467
468
469
470 </ul>
471
472</nav>
473
474 </li>
475
476
477
478
479
480
481
482 <li class="md-nav__item">
483 <a href="../build-tips/" title="Build Tips" class="md-nav__link">
484 Build Tips
485 </a>
486 </li>
487
488
489 </ul>
490 </nav>
491 </li>
492
493
494
495
496
497
498
499 <li class="md-nav__item md-nav__item--nested">
500
501 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4">
502
503 <label class="md-nav__link" for="nav-4">
504 Common
505 </label>
506 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
507 <label class="md-nav__title" for="nav-4">
508 Common
509 </label>
510 <ul class="md-nav__list" data-md-scrollfix>
511
512
513
514
515
516
517
518 <li class="md-nav__item">
519 <a href="../../common/" title="Index" class="md-nav__link">
520 Index
521 </a>
522 </li>
523
524
525
526
527
528
529
530 <li class="md-nav__item">
531 <a href="../../common/git-started/" title="Git Started" class="md-nav__link">
532 Git Started
533 </a>
534 </li>
535
536
Eric Park608ce5a2019-08-07 21:27:46 +0800537
538
539
540
541
542 <li class="md-nav__item">
543 <a href="../../common/using-dippy-bird/" title="Using `dippy-bird`" class="md-nav__link">
544 Using `dippy-bird`
545 </a>
546 </li>
547
548
Eric Parkc9931992019-07-29 13:10:53 +0900549 </ul>
550 </nav>
551 </li>
552
553
554
555
556
557
558
559 <li class="md-nav__item md-nav__item--nested">
560
561 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
562
563 <label class="md-nav__link" for="nav-5">
564 Infrastructure
565 </label>
566 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
567 <label class="md-nav__title" for="nav-5">
568 Infrastructure
569 </label>
570 <ul class="md-nav__list" data-md-scrollfix>
571
572
573
574
575
576
577
578 <li class="md-nav__item">
579 <a href="../../infrastructure/" title="Index" class="md-nav__link">
580 Index
581 </a>
582 </li>
583
584
585 </ul>
586 </nav>
587 </li>
588
589
590 </ul>
591</nav>
592 </div>
593 </div>
594 </div>
595
596
597 <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
598 <div class="md-sidebar__scrollwrap">
599 <div class="md-sidebar__inner">
600
601<nav class="md-nav md-nav--secondary">
602
603
604
605
606
607 <label class="md-nav__title" for="__toc">Table of contents</label>
608 <ul class="md-nav__list" data-md-scrollfix>
609
610 <li class="md-nav__item">
611 <a href="#updated-for-pie-p90" title="Updated for Pie (p9.0)" class="md-nav__link">
612 Updated for Pie (p9.0)
613 </a>
614
615 <nav class="md-nav">
616 <ul class="md-nav__list">
617
618 <li class="md-nav__item">
619 <a href="#introduction" title="Introduction" class="md-nav__link">
620 Introduction
621 </a>
622
623</li>
624
625 <li class="md-nav__item">
626 <a href="#preparation" title="Preparation" class="md-nav__link">
627 Preparation
628 </a>
629
630</li>
631
632 <li class="md-nav__item">
633 <a href="#install-the-jdk" title="Install the JDK" class="md-nav__link">
634 Install the JDK
635 </a>
636
637</li>
638
639 <li class="md-nav__item">
640 <a href="#install-build-tools" title="Install build tools" class="md-nav__link">
641 Install build tools
642 </a>
643
644</li>
645
646 <li class="md-nav__item">
647 <a href="#install-source-code-tools" title="Install source code tools" class="md-nav__link">
648 Install source code tools
649 </a>
650
651 <nav class="md-nav">
652 <ul class="md-nav__list">
653
654 <li class="md-nav__item">
655 <a href="#what-is-source" title="What is source?" class="md-nav__link">
656 What is source?
657 </a>
658
659</li>
660
661 <li class="md-nav__item">
662 <a href="#what-if-i-need-repo-globally" title="What if I need repo globally?" class="md-nav__link">
663 What if I need repo globally?
664 </a>
665
666</li>
667
668 </ul>
669 </nav>
670
671</li>
672
673 <li class="md-nav__item">
674 <a href="#download" title="Download" class="md-nav__link">
675 Download
676 </a>
677
Eric Park35d8ee32019-08-11 01:34:35 +0800678 <nav class="md-nav">
679 <ul class="md-nav__list">
680
681 <li class="md-nav__item">
682 <a href="#i-still-dont-know-how-much-cpu-threads-i-have-how-do-i-check" title="I still don't know how much CPU threads I have. How do I check?" class="md-nav__link">
683 I still don't know how much CPU threads I have. How do I check?
684 </a>
685
686</li>
687
688 </ul>
689 </nav>
690
Eric Parkc9931992019-07-29 13:10:53 +0900691</li>
692
693 <li class="md-nav__item">
694 <a href="#build" title="Build" class="md-nav__link">
695 Build
696 </a>
697
698 <nav class="md-nav">
699 <ul class="md-nav__list">
700
701 <li class="md-nav__item">
Eric Park608ce5a2019-08-07 21:27:46 +0800702 <a href="#my-device-isnt-booting-and-userdebug-wont-print-any-adb-logcats-what-gives" title="My device isn't booting, and userdebug won't print any adb logcats. What gives?" class="md-nav__link">
703 My device isn't booting, and userdebug won't print any adb logcats. What gives?
704 </a>
705
706</li>
707
708 <li class="md-nav__item">
Eric Park35d8ee32019-08-11 01:34:35 +0800709 <a href="#why-mka-and-not-make" title="Why mka and not make?" class="md-nav__link">
710 Why mka and not make?
711 </a>
712
713</li>
714
715 <li class="md-nav__item">
Eric Park608ce5a2019-08-07 21:27:46 +0800716 <a href="#i-get-an-error-about-no-blissify-targets-to-build-against-whats-wrong" title="I get an error about no blissify targets to build against, what's wrong?" class="md-nav__link">
717 I get an error about no blissify targets to build against, what's wrong?
Eric Parkc9931992019-07-29 13:10:53 +0900718 </a>
719
720</li>
721
722 </ul>
723 </nav>
724
725</li>
726
727 <li class="md-nav__item">
728 <a href="#after-building" title="After building" class="md-nav__link">
729 After building
730 </a>
731
732</li>
733
734 <li class="md-nav__item">
735 <a href="#troubleshooting" title="Troubleshooting" class="md-nav__link">
736 Troubleshooting
737 </a>
738
739</li>
740
741 <li class="md-nav__item">
742 <a href="#conclusion" title="Conclusion" class="md-nav__link">
743 Conclusion
744 </a>
745
746</li>
747
748 <li class="md-nav__item">
749 <a href="#looking-for-the-next-tutorial" title="Looking for the next tutorial?" class="md-nav__link">
750 Looking for the next tutorial?
751 </a>
752
753</li>
754
755 </ul>
756 </nav>
757
758</li>
759
760
761
762
763
764 </ul>
765
766</nav>
767 </div>
768 </div>
769 </div>
770
771
772 <div class="md-content">
773 <article class="md-content__inner md-typeset">
774
775
776
Eric Park608ce5a2019-08-07 21:27:46 +0800777 <h1 id="build-guide">Build Guide</h1>
Eric Parkc9931992019-07-29 13:10:53 +0900778<h2 id="updated-for-pie-p90">Updated for Pie (p9.0)</h2>
779<h3 id="introduction">Introduction</h3>
780<p>This is the official guide to build BlissRoms for your device. In this guide, we will only cover official devices with actual maintainers. We will not delve into porting devices.</p>
781<p>The golden rule to building is patience. If something breaks, wait for your maintainer to fix it, send a polite message to your maintainer, or better yet, try and fix it yourself. Then you can make a merge request and contribute!</p>
782<p>Let’s get started.</p>
783<h3 id="preparation">Preparation</h3>
Eric Park608ce5a2019-08-07 21:27:46 +0800784<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>
785<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>
Eric Parkc9931992019-07-29 13:10:53 +0900786<h3 id="install-the-jdk">Install the JDK</h3>
787<p>Install OpenJDK:</p>
788<pre><code>sudo apt install openjdk-8-jdk
789</code></pre>
790<h3 id="install-build-tools">Install build tools</h3>
Eric Park608ce5a2019-08-07 21:27:46 +0800791<p>To install the required build tools, run the following command:</p>
792<pre><code>sudo apt install git gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev lib32z1-dev ccache libgl1-mesa-dev libxml2 libxml2-utils xsltproc unzip squashfs-tools python python-mako libssl-dev ninja-build lunzip syslinux syslinux-utils gettext genisoimage bc xorriso liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-dev lzop maven pngcrush schedtool lib32readline-dev
Eric Parkc9931992019-07-29 13:10:53 +0900793</code></pre>
794<h3 id="install-source-code-tools">Install source code tools</h3>
Eric Park608ce5a2019-08-07 21:27:46 +0800795<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 BlissRoms's GitHub organization, and find what repositories you need to actually build Android.</p>
796<p>Create a <code>~/bin</code> directory for <code>repo</code>:</p>
Eric Parkc9931992019-07-29 13:10:53 +0900797<pre><code>mkdir -p ~/bin
798</code></pre>
799<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>
800<pre><code>curl https://storage.googleapis.com/git-repo-downloads/repo &gt; ~/bin/repo
801</code></pre>
802<p>Make <code>repo</code> executable:</p>
803<pre><code>chmod a+x ~/bin/repo
804</code></pre>
805<p>And add it to PATH:</p>
806<pre><code>nano .bashrc
807</code></pre>
808<p>Scroll to the end of the file and type these lines:</p>
809<pre><code># Export ~/bin
810export PATH=~/bin:$PATH
811</code></pre>
812<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>
813<pre><code>source .bashrc
814</code></pre>
815<p>Which can be shortened to:</p>
816<pre><code>. .bashrc
817</code></pre>
818<h4 id="what-is-source">What is <code>source</code>?</h4>
819<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>
820<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>
821<h4 id="what-if-i-need-repo-globally">What if I need <code>repo</code> globally?</h4>
822<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>
823<pre><code>curl https://storage.googleapis.com/git-repo-downloads/repo &gt; ~/repo
824sudo mv ~/repo /usr/bin/
825chmod a+x /usr/bin/repo
826</code></pre>
827<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>
828<p>Now we’re ready to download the source code.</p>
829<h3 id="download">Download</h3>
830<p>Create a directory for the source:</p>
831<pre><code>mkdir -p ~/bliss/p9.0
832cd ~/bliss/p9.0
833</code></pre>
834<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>
835<pre><code>git config --global user.email “randy.mcrandyface@hotmail.net”
836git config --global user.name “Randy McRandyface”
837</code></pre>
838<p>Now, we’re ready to initialize. We need to tell <code>repo</code> which manifest to read:</p>
839<pre><code>repo init -u https://github.com/BlissRoms/platform_manifest.git -b p9.0
840</code></pre>
841<p><code>-b</code> is for the branch, and we’re on <code>p9.0</code>, Android Pie. It’ll take a couple of seconds. You may need to type <code>y</code> for the color prompt.</p>
842<p>Then sync the source:</p>
843<pre><code>repo sync -j24 -c
844</code></pre>
845<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>
846<pre><code>repo sync -j4 -c
847</code></pre>
848<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>
Eric Park35d8ee32019-08-11 01:34:35 +0800849<h4 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?</h4>
850<p>Run <code>nproc</code>. The output should be something like this:</p>
851<pre><code>rwaterspf1@test:~$ nproc
85224
853</code></pre>
854<p>This means that there are 24 threads in your machine.</p>
Eric Parkc9931992019-07-29 13:10:53 +0900855<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>
856<h3 id="build">Build</h3>
857<p>Set up the build environment:</p>
858<pre><code>. build/envsetup.sh
859</code></pre>
860<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>
861<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>
862<pre><code>breakfast bullhead
863</code></pre>
864<p>What does this do? <code>breakfast</code> searches repositories for your device "tree", which contains all the details needed to make the build suitable for your device. CPU, kernel info, device screen size, whether the board has Bluetooth, NFC, what frequencies the build needs for Wi-Fi, and a bunch of other things. <code>breakfast</code> will automatically search in the <code>BlissRoms-Devices</code> GitHub repository, and grab your device tree for you.</p>
865<p>Okay, so we have the device tree set up. Feel free to browse around the source code to see what changed. You should see folders added to <code>device/</code>, <code>kernel/</code> and <code>vendor/</code>. A shortcut:</p>
866<pre><code>croot
867</code></pre>
868<p>will dump you back in the root of the source code tree. So if you’ve been going through folders and don’t have any idea where you are, you can use the above command. This command, however, requires you to have <code>source</code>d <code>build/envsetup.sh</code> earlier.</p>
Eric Park608ce5a2019-08-07 21:27:46 +0800869<p>We're ready to build, but before we teach you the easy command to execute a build, we will first try the manual method. To set up the current terminal environment for building your particular device, execute:</p>
870<pre><code>lunch bliss_bullhead-userdebug
Eric Parkc9931992019-07-29 13:10:53 +0900871</code></pre>
Eric Park608ce5a2019-08-07 21:27:46 +0800872<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>bliss_</code> is the ROM that we are building. As convention, all devices will have this prefix. <code>bullhead</code> is the specific device we are building - in this case, the Nexus 5X. 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>
873<h4 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?</h4>
874<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>
875<p>All set? Let's start the building process. Run:</p>
Eric Park35d8ee32019-08-11 01:34:35 +0800876<p><code>mka blissify</code></p>
Eric Park608ce5a2019-08-07 21:27:46 +0800877<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>
Eric Park35d8ee32019-08-11 01:34:35 +0800878<h4 id="why-mka-and-not-make">Why <code>mka</code> and not <code>make</code>?</h4>
879<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>
880<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>
Eric Park608ce5a2019-08-07 21:27:46 +0800881<h4 id="i-get-an-error-about-no-blissify-targets-to-build-against-whats-wrong">I get an error about no <code>blissify</code> targets to build against, what's wrong?</h4>
882<p>If you are building other ROMs, it is usually <code>make bacon</code>. For BlissRoms, we chose the build target of <code>blissify</code>. If that doesn't work, sometimes there is a bug, or the ROM developers do not implement a <code>bacon</code> target to build against. In this case, you will need to find what name they use to initialize a full build of the ROM. Conventionally, it is supposed to be <code>bacon</code>, but some ROM developers change this name inadvertently, or actually have a bug that causes the build target to never be found. If you cannot locate the build target, ask the developers of the ROM. Alternatively, you can try poking around in <code>build/make/core/Makefile</code> to see what the build target name is. But this is out of the scope of this article as you're not supposed to be building other ROMs (that's not what this tutorial is for, sorry!)</p>
883<p>All right, but that's annoying. You had to type <strong>three</strong> commands to build it all. What about running one command?</p>
884<pre><code>blissify bullhead
885</code></pre>
886<p>But what is <code>blissify</code>? It is a compact form of these commands:</p>
Eric Parkc9931992019-07-29 13:10:53 +0900887<pre><code>breakfast bullhead
Eric Park608ce5a2019-08-07 21:27:46 +0800888lunch bliss_bullhead-userdebug
889make blissify
Eric Parkc9931992019-07-29 13:10:53 +0900890</code></pre>
Eric Park608ce5a2019-08-07 21:27:46 +0800891<p>Sounds great, right? Once you have run the command, jump over to the next section.</p>
Eric Parkc9931992019-07-29 13:10:53 +0900892<h3 id="after-building">After building</h3>
893<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>
894<p>If you face the latter, congratulations! You've successfully built BlissRoms for your device. Grab the artifacts for your device:</p>
895<pre><code>cd out/target/product/bullhead/
896</code></pre>
Eric Park608ce5a2019-08-07 21:27:46 +0800897<p>In here, you’ll find a <code>.zip</code> that goes along the lines of <code>Bliss-v11.9-Stable-bullhead-UNOFFICIAL-20190531.zip</code>. Install TWRP, flash the build to your device, and enjoy!</p>
Eric Parkc9931992019-07-29 13:10:53 +0900898<h3 id="troubleshooting">Troubleshooting</h3>
899<p>If your build failed, there are a couple things you can try.</p>
900<ul>
901<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>
902<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>
903<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>
904<li>Make sure you’re at the root of the build tree. Again, to quickly jump there, use <code>croot</code>.</li>
905<li>Make sure you ran <code>breakfast</code> correctly and it did not error out. Missing device files will prevent successful builds.</li>
Eric Park608ce5a2019-08-07 21:27:46 +0800906<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>
Eric Parkc9931992019-07-29 13:10:53 +0900907</ul>
908<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>
909<h3 id="conclusion">Conclusion</h3>
910<p>Building a ROM is very hard and tedious and the results are very rewarding! If you managed to follow along, congratulations!</p>
911<p>After you finish building, you can try out the Git Started guide. Make changes, commit, and send them off to our Gerrit for review! 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>
912<p>-- Eric Park (ideaman924)</p>
913<h3 id="looking-for-the-next-tutorial">Looking for the next tutorial?</h3>
914<p>Check out <a href="../build-tips/">some tips to optimize your build experience.</a></p>
915
916
917
918
919
920
921
922
923
924 </article>
925 </div>
926 </div>
927 </main>
928
929
930<footer class="md-footer">
931
932 <div class="md-footer-nav">
933 <nav class="md-footer-nav__inner md-grid">
934
935 <a href="../" title="Index" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
936 <div class="md-flex__cell md-flex__cell--shrink">
937 <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
938 </div>
939 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
940 <span class="md-flex__ellipsis">
941 <span class="md-footer-nav__direction">
942 Previous
943 </span>
944 Index
945 </span>
946 </div>
947 </a>
948
949
950 <a href="../build-tips/" title="Build Tips" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
951 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
952 <span class="md-flex__ellipsis">
953 <span class="md-footer-nav__direction">
954 Next
955 </span>
956 Build Tips
957 </span>
958 </div>
959 <div class="md-flex__cell md-flex__cell--shrink">
960 <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
961 </div>
962 </a>
963
964 </nav>
965 </div>
966
967 <div class="md-footer-meta md-typeset">
968 <div class="md-footer-meta__inner md-grid">
969 <div class="md-footer-copyright">
970
971 powered by
972 <a href="https://www.mkdocs.org">MkDocs</a>
973 and
974 <a href="https://squidfunk.github.io/mkdocs-material/">
975 Material for MkDocs</a>
976 </div>
977
978 </div>
979 </div>
980</footer>
981
982 </div>
983
984 <script src="../../assets/javascripts/application.245445c6.js"></script>
985
986 <script>app.initialize({version:"1.0.4",url:{base:"../.."}})</script>
987
988
989 </body>
990</html>