content/blog/2022-09-21-graphene-os.org

e8577d98faff1bed72ba6f2d204b8b44c6827c23
cleberg.net/content/blog/2022-09-21-graphene-os.org rendered · source · history · blame · raw

165 lines · 5120 bytes

  1#+date:        <2022-09-21 Wed 00:00:00>
  2#+title:       Installation Procedures for GrapheneOS on Pixel 6 Pro Device
  3#+description: Step-by-step instructions to perform secure installation of the GrapheneOS operating system on Google Pixel 6 Pro hardware platform.
  4#+slug:        graphene-os
  5#+filetags:    :grapheneos:pixel6pro:installation:
  6
  7* Introduction
  8
  9After using iOS for a couple of years, I finally took the plunge and
 10purchased a Pixel 6 Pro in order to test and use [GrapheneOS]
 11([[https://grapheneos.org]]).
 12
 13The installation process was rather quick once you have the tools and
 14files you need. Overall, it can be done in just a few minutes.
 15
 16* Gathering Tools & Files
 17
 18** Android Tools
 19
 20First, in order to interact with the device, we will need the
 21[[https://developer.android.com/studio/releases/platform-tools.html][Android
 22platform tools]]. Find the Linux download and save the ZIP folder to
 23your preferred location.
 24
 25Once we've downloaded the files, we will need to unzip them, enter the
 26directory, and move the necessary executables to a central location,
 27such as =/usr/bin/=. For this installation, we only need the =fastboot=
 28and =adb= executables.
 29
 30#+begin_src sh
 31cd ~/Downloads
 32#+end_src
 33
 34#+begin_src sh
 35unzip platform-tools_r33.0.3-linux.zip
 36cd platform-tools
 37sudo mv fastboot /usr/bin/
 38sudo mv adb /usr/bin
 39#+end_src
 40
 41** GrapheneOS Files
 42
 43Next, we need the [[https://grapheneos.org/releases][GrapheneOS files]]
 44for our device and model. For example, the Pixel 6 Pro is codenamed
 45=raven= on the release page.
 46
 47Once we have the links, let's download them to our working directory:
 48
 49#+begin_src sh
 50curl -O https://releases.grapheneos.org/factory.pub
 51curl -0 https://releases.grapheneos.org/raven-factory-2022091400.zip
 52curl -0 https://releases.grapheneos.org/raven-factory-2022091400.zip.sig
 53#+end_src
 54
 551. Validate Integrity
 56
 57   In order to validate the integrity of the downloaded files, we will
 58   need the =signify= package and Graphene's =factory.pub= file.
 59
 60   #+begin_src sh
 61   sudo dnf install signify
 62   #+end_src
 63
 64   #+begin_src sh
 65   curl -O https://releases.grapheneos.org/factory.pub
 66   #+end_src
 67
 68   Then we can validate the files and ensure that no data was corrupted
 69   or modified before it was saved to our device.
 70
 71   #+begin_src sh
 72   signify -Cqp factory.pub -x raven-factory-2022091400.zip.sig && echo verified
 73   #+end_src
 74
 752. Unzip Files
 76
 77   Once the files are verified, we can unzip the Graphene image and
 78   enter the directory:
 79
 80   #+begin_src sh
 81   unzip raven-factory-2022091400.zip && cd raven-factory-2022091400
 82   #+end_src
 83
 84* Installation Process
 85
 86** Enable Developer Debugging & OEM Unlock
 87
 88Before we can actually flash anything to the phone, we will need to
 89enable OEM Unlocking, as well as either USB Debugging or Wireless
 90Debugging, depending on which method we will be using.
 91
 92To start, enable developer mode by going to =Settings= > =About= and
 93tapping =Build Number= seven (7) times. You may need to enter your PIN
 94to enable this mode.
 95
 96Once developer mode is enabled, go to =Settings= > =System= >
 97=Devloper Options= and enable OEM Unlocking, as well as USB or Wireless
 98Debugging. In my case, I chose USB Debugging and performed all actions
 99via USB cable.
100
101Once these options are enabled, plug the phone into the computer and
102execute the following command:
103
104#+begin_src sh
105adb devices
106#+end_src
107
108If an unauthorized error occurs, make sure the USB mode on the phone is
109changed from charging to something like "File Transfer" or "PTP." You
110can find the USB mode in the notification tray.
111
112** Reboot Device
113
114Once we have found the device via =adb=, we can either boot into the
115bootloader interface by holding the volume down button while the phone
116reboots or by executing the following command:
117
118#+begin_src sh
119adb reboot bootloader
120#+end_src
121
122** Unlock the Bootloader
123
124The phone will reboot and load the bootloader screen upon startup. At
125this point, we are ready to start the actual flashing of GrapheneOS onto
126the device.
127
128*NOTE*: In my situation, I needed to use =sudo= with every =fastboot=
129command, but not with =adb= commands. I am not sure if this is standard
130or a Fedora quirk, but I'm documenting my commands verbatim in this
131post.
132
133First, we start by unlocking the bootloader so that we can load other
134ROMs:
135
136#+begin_src sh
137sudo fastboot flashing unlock
138#+end_src
139
140** Flashing Factory Images
141
142Once the phone is unlocked, we can flash it with the =flash-all.sh=
143script found inside the =raven-factory-2022091400= folder we entered
144earlier:
145
146#+begin_src sh
147sudo ./flash-all.sh
148#+end_src
149
150This process should take a few minutes and will print informational
151messages as things progress. Avoid doing anything on the phone while
152this process is operating.
153
154** Lock the Bootloader
155
156If everything was successful, the phone should reboot a few times and
157finally land back on the bootloader screen. At this point, we can
158re-lock the bootloader to enable full verified boot and protect the
159device from unwanted flashing or erasure of data.
160
161#+begin_src sh
162sudo fastboot flashing lock
163#+end_src
164
165Once done, the device will be wiped and ready for a fresh set-up!