You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pixel-bringup.md
+29-22Lines changed: 29 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,14 @@
1
1
# Bringing up a new Pixel device
2
2
3
-
This guide assumes basic familiarity with Android platform development. You must already have adevtool [installed](../README.md#installation).
3
+
This guide assumes basic familiarity with Android platform development.
4
+
5
+
To install adevtool, download the GrapeheneOS source and run these commands in the root of your tree:
6
+
7
+
```bash
8
+
yarn install --cwd vendor/adevtool/
9
+
source script/envsetup.sh
10
+
m aapt2
11
+
```
4
12
5
13
This guide is only for initial bringup; see [Generating or updating an existing device](pixel-generate.md) for subsequent updates.
6
14
@@ -10,13 +18,13 @@ All commands that accept stock system images, with the exception of comparison c
10
18
11
19
## 1. Download factory images
12
20
13
-
In order to extract proprietary files and other data, you need a copy of the stock ROM for your device. Download the latest factory images package for your device, replacing `raven` with your device's codename:
21
+
In order to extract proprietary files and other data, you need a copy of the stock OS for your device. Download the latest factory images package for your device, replacing `DEVICE` with your device's codename and `BUILD_ID` with the one from the factory images page [here](https://developers.google.com/android/images):
14
22
15
23
```bash
16
-
adevtool download ~/stock_images -d raven
24
+
vendor/adevtool/bin/run download vendor/adevtool/dl/ -d $DEVICE -b $BUILD_ID -t factory ota
17
25
```
18
26
19
-
The factory images ZIP will be saved in `~/stock_images`. Full OTA packages are not currently supported.
27
+
The factory images ZIP will be saved in `vendor/adevtool/dl`. The Full OTA packages are used later on, during the ota-firmware step.
20
28
21
29
## 2. Create a config
22
30
@@ -35,27 +43,30 @@ platform:
35
43
- device/google/gs101-sepolicy
36
44
```
37
45
38
-
Replace `product_makefile` with the path to your device's product makefile (including the `aosp_` prefix). All Pixel devices use `hardware/google/pixel-sepolicy`, but check your device tree for the device-specific SELinux policies and replace the path accordingly. Most Qualcomm Pixel devices follow a format similar to `device/google/redbull-sepolicy`.
46
+
Replace `product_makefile` with the path to your device's product makefile (including the `aosp_` prefix). All Pixel devices use `hardware/google/pixel-sepolicy`, but check your device tree for the device-specific SELinux policies and replace the path accordingly. Most modern Pixel devices follow a format similar to `device/google/redbull-sepolicy`.
39
47
40
48
You can optionally follow the modular format of existing configs in config/pixel to reuse common Pixel configs as much as possible. This vastly simplifies making all features work, as most parts are the same across all Pixel devices.
41
49
42
50
## 3. Prepare for reference build
43
51
52
+
You must disable inline carrier extraction from the GrapheneOS device tree. To do this, just open the relevant device tree and find the inline extraction commit. An example is [here](https://github.com/GrapheneOS/device_google_redbull/commit/d9c30ca9245c7e011441bfc10555f87909f15fbe)
53
+
44
54
To find missing files, properties, and overlays automatically, adevtool needs a reference build of AOSP to compare with the stock ROM. Navigate to the root of your AOSP tree and generate a vendor module to prepare for this:
Replace `~/stock_images` with the directory containing your factory images package, `sq1d.211205.017` with the build ID, and `raven` with your device's codename. We recommend keeping a copy of adevtool at `tools/adevtool` so the config is easy to find, but you should also adjust the path if your configs are located somewhere else.
61
+
Replace `$BUILD_ID` with the build ID, and `$DEVICE` with your device's codename.
51
62
52
63
## 4. Attempt to build
53
64
54
-
After generating the vendor module, build the ROM to get a reference build. Make sure to do a `user` build using the device codename as it appears on the stock ROM (i.e. no `aosp_` prefix; you can build with a different device name and variant later if you want, but the reference build has strict requirements):
65
+
After generating the vendor module, build the system with `m` to get a reference build. Make sure to do a `user` build using the device codename as it appears on the stock ROM (i.e. no `aosp_` prefix; you can build with a different device name and variant later if you want, but the reference build has strict requirements):
55
66
56
67
```bash
57
-
lunch raven-user
58
-
m installclean
68
+
rm -rf out
69
+
lunch $DEVICE-user
59
70
m
60
71
```
61
72
@@ -70,7 +81,8 @@ Even when successful, the reference build **will not boot.** That's normal; this
70
81
Use the reference build to create a state file, which contains all necessary information from the build:
71
82
72
83
```bash
73
-
adevtool collect-state ~/raven.json -d raven
84
+
touch vendor/state/$DEVICE.json # you only need this for new bringups
Once you have a state file, the reference build is no longer necessary, so you can safely discard it.
@@ -80,28 +92,23 @@ Once you have a state file, the reference build is no longer necessary, so you c
80
92
Some privileged apps have special SELinux domains assigned by signing certificate, and the default AOSP certificates don't match. Update the certificates:
Pass the list of `sepolicy_dirs` in your config as arguments after `-p`.
98
+
Pass the list of `sepolicy_dirs` in your config as arguments after `-p`. The above list is just an example
87
99
88
100
This only needs to be done once as it modifies SELinux policies to update certificates as necessary. You may want to fork the modified repositories.
89
101
90
102
## 7. Generate vendor module
103
+
Please remove your changes to inline carrier extraction from the device tree and follow the instructions [here](https://grapheneos.org/build#extracting-vendor-files-for-pixel-devices)
91
104
92
-
Now that you have a reference state file, generate the actual vendor module:
You can now do an actual ROM build. We recommend doing an engineering build (`eng`) for easier debugging:
107
+
You can now do an actual build. We recommend doing a userdebug build (`userdebug`) for easier debugging. Deleting the special state collection build is required to avoid weird behaviour:
This guide assumes basic familiarity with Android platform development. You must already have adevtool [installed](../README.md#installation).
4
-
5
-
While the focus of this guide is on a single device, examples are also shown for working on multiple devices at the same time. If you're working on multiple devices, many commands can be sped up by adding the `-p` argument to do the work for each device in parallel.
6
-
7
-
Most commands should be run at the root of your ROM tree, so `aapt2` and other files can be discovered automatically.
8
-
9
-
All commands that accept stock system images, with the exception of comparison commands (diff-files, diff-props, diff-vintf), support [the source formats listed here](system-source.md).
10
-
11
-
## 1. Download factory images
12
-
13
-
In order to extract proprietary files and other data, you need a copy of the stock ROM for your device. Download the latest factory images package for your device, replacing `raven` with your device's codename:
14
-
15
-
```bash
16
-
adevtool download ~/stock_images -d raven
17
-
18
-
# For multiple devices
19
-
adevtool download ~/stock_images -d raven oriole
20
-
```
21
-
22
-
The factory images ZIP will be saved in `~/stock_images`. Full OTA packages are not currently supported.
23
-
24
-
## 2. Collect state from a reference build
25
-
26
-
**Skip to [step 3](#3-generate-vendor-module) if you already have a state file. This is a one-time step.**
27
-
28
-
To find missing files, properties, and overlays automatically, adevtool needs a reference build of AOSP to compare with the stock ROM. Navigate to the root of your AOSP tree and generate a vendor module to prepare for this:
Replace `~/stock_images` with the directory containing your factory images package, `sq1d.211205.017` with the build ID, and `raven` with your device's codename. We recommend keeping a copy of adevtool at `tools/adevtool` so the config is easy to find, but you should also adjust the path if your configs are located somewhere else.
38
-
39
-
After generating the vendor module, build the ROM to get a reference build. Make sure to do a `user` build using the device codename as it appears on the stock ROM (i.e. no `aosp_` prefix; you can build with a different device name and variant later if you want, but the reference build has strict requirements):
40
-
41
-
```bash
42
-
lunch raven-user
43
-
m installclean
44
-
m
45
-
```
46
-
47
-
Then use the reference build to create a state file, which contains all necessary information from the build:
48
-
49
-
```bash
50
-
adevtool collect-state ~/raven.json -d raven
51
-
52
-
# For multiple devices (device_states is a directory)
Once you have a state file, the reference build is no longer necessary, so you can safely discard it.
57
-
58
-
### For future updates
59
-
60
-
This step is only necessary across major Android version upgrades (e.g. Android 12 to 13), or occasionally quarterly feature drops for the latest Pixel generation of Pixel devices. It's also necessary when the format of the state file changes, but we try to keep the format stable when possible.
61
-
62
-
In all other cases, you can reuse the same state file for future updates without needing to do reference builds again. You can also share the file, so other people building for the same device don't need to do their own reference builds.
63
-
64
-
## 3. Generate vendor module
65
-
66
-
Now that you have a reference state file, generating the actual vendor module is easy:
Replace `~/raven.json` with the path to your state file if you're building for a single device, or the directory containing your state files if you have multiple devices. Other arguments are the same as in previous steps.
76
-
77
-
You should now have everything you need to do a full custom ROM build!
3
+
Please see pixel-bringup.md and follow steps 1,3-5,7-8
0 commit comments