aboutsummaryrefslogtreecommitdiff
path: root/content/blog/2022-09-21-graphene-os.org
blob: cef1d008504d1a8c228b7dd3c7e0bc810b885053 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#+date:        [2022-09-21 Wed 00:00:00]
#+title:       Installing GrapheneOS on Pixel 6 Pro
#+description: How to install GrapheneOS on a Pixel 6 Pro.
#+slug:        graphene-os
#+filetags:    :linux:privacy:

* Introduction

After using iOS for a couple of years, I finally took the plunge and purchased a
Pixel 6 Pro in order to test and use [[https://grapheneos.org][GrapheneOS]].

The installation process was rather quick once you have the tools and files you
need. Overall, it can be done in just a few minutes.

* Gathering Tools & Files

** Android Tools

First, in order to interact with the device, we will need the [[https://developer.android.com/studio/releases/platform-tools.html][Android platform
tools]]. Find the Linux download and save the ZIP folder to your preferred
location.

Once we've downloaded the files, we will need to unzip them, enter the
directory, and move the necessary executables to a central location, such as
=/usr/bin/=. For this installation, we only need the =fastboot= and =adb=
executables.

#+begin_src sh
cd ~/Downloads
#+end_src

#+begin_src sh
unzip platform-tools_r33.0.3-linux.zip
cd platform-tools
sudo mv fastboot /usr/bin/
sudo mv adb /usr/bin
#+end_src

** GrapheneOS Files

Next, we need the [[https://grapheneos.org/releases][GrapheneOS files]] for our device and model. For example, the
Pixel 6 Pro is codenamed =raven= on the release page.

Once we have the links, let's download them to our working directory:

#+begin_src sh
curl -O https://releases.grapheneos.org/factory.pub
curl -0 https://releases.grapheneos.org/raven-factory-2022091400.zip
curl -0 https://releases.grapheneos.org/raven-factory-2022091400.zip.sig
#+end_src

1. Validate Integrity

   In order to validate the integrity of the downloaded files, we will need the
   =signify= package and Graphene's =factory.pub= file.

   #+begin_src sh
   sudo dnf install signify
   #+end_src

   #+begin_src sh
   curl -O https://releases.grapheneos.org/factory.pub
   #+end_src

   Then we can validate the files and ensure that no data was corrupted or
   modified before it was saved to our device.

   #+begin_src sh
   signify -Cqp factory.pub -x raven-factory-2022091400.zip.sig && echo verified
   #+end_src

2. Unzip Files

   Once the files are verified, we can unzip the Graphene image and enter the
   directory:

   #+begin_src sh
   unzip raven-factory-2022091400.zip && cd raven-factory-2022091400
   #+end_src

* Installation Process

** Enable Developer Debugging & OEM Unlock

Before we can actually flash anything to the phone, we will need to enable OEM
(Original Equipment Manufacturer) Unlocking, as well as either USB (Universal
Serial Bus) Debugging or Wireless Debugging, depending on which method we will
be using.

To start, enable developer mode by going to =Settings= > =About= and tapping
=Build Number= seven (7) times. You may need to enter your personal identified
number (PIN) to enable this mode.

Once developer mode is enabled, go to =Settings= > =System= > =Devloper Options=
and enable OEM Unlocking, as well as USB or Wireless Debugging. In my case, I
chose USB Debugging and performed all actions via USB cable.

Once these options are enabled, plug the phone into the computer and execute the
following command:

#+begin_src sh
adb devices
#+end_src

If an unauthorized error occurs, make sure the USB mode on the phone is changed
from charging to something like "File Transfer" or "PTP" (Picture Transfer
Protocol). You can find the USB mode in the notification tray.

** Reboot Device

Once we have found the device via =adb=, we can either boot into the bootloader
interface by holding the volume down button while the phone reboots or by
executing the following command:

#+begin_src sh
adb reboot bootloader
#+end_src

** Unlock the Bootloader

The phone will reboot and load the bootloader screen upon startup. At this
point, we are ready to start the actual flashing of GrapheneOS onto the device.

*NOTE*: In my situation, I needed to use =sudo= with every =fastboot= command,
but not with =adb= commands. I am not sure if this is standard or a Fedora
quirk, but I'm documenting my commands verbatim in this post.

First, we start by unlocking the bootloader so that we can load other ROMs:

#+begin_src sh
sudo fastboot flashing unlock
#+end_src

** Flashing Factory Images

Once the phone is unlocked, we can flash it with the =flash-all.sh= script found
inside the =raven-factory-2022091400= folder we entered earlier:

#+begin_src sh
sudo ./flash-all.sh
#+end_src

This process should take a few minutes and will print informational messages as
things progress. Avoid doing anything on the phone while this process is
operating.

** Lock the Bootloader

If everything was successful, the phone should reboot a few times and finally
land back on the bootloader screen. At this point, we can re-lock the bootloader
to enable full verified boot and protect the device from unwanted flashing or
erasure of data.

#+begin_src sh
sudo fastboot flashing lock
#+end_src

Once done, the device will be wiped and ready for a fresh set-up!