Skip to content

Commit 2589e86

Browse files
update documentation
Signed-off-by: randomhydrosol <[email protected]>
1 parent 1702802 commit 2589e86

File tree

2 files changed

+20
-91
lines changed

2 files changed

+20
-91
lines changed

docs/pixel-bringup.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ All commands that accept stock system images, with the exception of comparison c
1010

1111
## 1. Download factory images
1212

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:
13+
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):
1414

1515
```bash
16-
adevtool download ~/stock_images -d raven
16+
vendor/adevtool/bin/run download vendor/adevtool/dl/ -d $DEVICE -b $BUILD_ID -t factory ota
1717
```
1818

19-
The factory images ZIP will be saved in `~/stock_images`. Full OTA packages are not currently supported.
19+
The factory images ZIP will be saved in `vendor/adevtool/dl`. The Full OTA packages are used later on, during the ota-firmware step.
2020

2121
## 2. Create a config
2222

@@ -35,7 +35,7 @@ platform:
3535
- device/google/gs101-sepolicy
3636
```
3737
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`.
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 modern Pixel devices follow a format similar to `device/google/redbull-sepolicy`.
3939

4040
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.
4141

@@ -44,18 +44,19 @@ You can optionally follow the modular format of existing configs in config/pixel
4444
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:
4545

4646
```bash
47-
adevtool generate-prep -s ~/stock_images -b sq1d.211205.017 tools/adevtool/config/pixel/raven.yml
47+
sudo vendor/adevtool/bin/run generate-prep -s vendor/adevtool/dl -b $BUILD_ID vendor/adevtool/config/$DEVICE.yml
48+
chown -R $(logname):$(logname) vendor/
4849
```
4950

50-
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.
51+
Replace `$BUILD_ID` with the build ID, and `$DEVICE` with your device's codename.
5152

5253
## 4. Attempt to build
5354

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):
55+
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):
5556

5657
```bash
57-
lunch raven-user
58-
m installclean
58+
rm -rf out
59+
lunch $DEVICE-user
5960
m
6061
```
6162

@@ -70,7 +71,7 @@ Even when successful, the reference build **will not boot.** That's normal; this
7071
Use the reference build to create a state file, which contains all necessary information from the build:
7172

7273
```bash
73-
adevtool collect-state ~/raven.json -d raven
74+
vendor/adevtool/bin/run collect-state ~/$DEVICE.json -d $DEVICE
7475
```
7576

7677
Once you have a state file, the reference build is no longer necessary, so you can safely discard it.
@@ -80,7 +81,7 @@ Once you have a state file, the reference build is no longer necessary, so you c
8081
Some privileged apps have special SELinux domains assigned by signing certificate, and the default AOSP certificates don't match. Update the certificates:
8182

8283
```bash
83-
adevtool fix-certs -d raven -s ~/stock_images -b sq1d.211205.017 -p hardware/google/pixel-sepolicy device/google/gs101-sepolicy
84+
vendor/bin/adevtool/run fix-certs -d $DEVICE -s vendor/adevtool/dl -b $BUILD_ID -p hardware/google/pixel-sepolicy device/google/gs101-sepolicy
8485
```
8586

8687
Pass the list of `sepolicy_dirs` in your config as arguments after `-p`.
@@ -89,19 +90,21 @@ This only needs to be done once as it modifies SELinux policies to update certif
8990

9091
## 7. Generate vendor module
9192

92-
Now that you have a reference state file, generate the actual vendor module:
93+
Now that you have a reference state file, generate the actual vendor module. Replace `DEVICE` with the device code name and `BUILD_ID` with the build ID:
9394

9495
```bash
95-
adevtool generate-all -s ~/stock_images -c ~/raven.json -b sq1d.211205.017 tools/adevtool/config/pixel/raven.yml
96+
sudo vendor/adevtool/bin/run generate-all vendor/adevtool/config/DEVICE.yml -c vendor/state/DEVICE.json -s vendor/adevtool/dl/DEVICE-BUILD_ID-*.zip
97+
sudo chown -R $(logname):$(logname) vendor/{google_devices,adevtool}
98+
vendor/adevtool/bin/run ota-firmware vendor/adevtool/config/DEVICE.yml -f vendor/adevtool/dl/DEVICE-ota-BUILD_ID-*.zip
9699
```
97100

98-
## 8. Build the actual ROM
101+
## 8. Build the final system
99102

100-
You can now do an actual ROM build. We recommend doing an engineering build (`eng`) for easier debugging:
103+
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:
101104

102105
```bash
106+
rm -rf out
103107
lunch raven-user
104-
m installclean
105108
m
106109
```
107110

docs/pixel-generate.md

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,3 @@
11
# Generating or updating an existing device
22

3-
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:
29-
30-
```bash
31-
adevtool generate-prep -s ~/stock_images -b sq1d.211205.017 tools/adevtool/config/pixel/raven.yml
32-
33-
# For multiple devices
34-
adevtool generate-prep -s ~/stock_images -b sq1d.211205.017 tools/adevtool/config/pixel/2021.yml
35-
```
36-
37-
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)
53-
adevtool collect-state ~/device_states -d raven oriole
54-
```
55-
56-
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:
67-
68-
```bash
69-
adevtool generate-all -s ~/stock_images -c ~/raven.json -b sq1d.211205.017 tools/adevtool/config/pixel/raven.yml
70-
71-
# For multiple devices
72-
adevtool generate-all -s ~/stock_images -c ~/device_states -b sq1d.211205.017 tools/adevtool/config/pixel/2021.yml
73-
```
74-
75-
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

Comments
 (0)