Skip to content

Commit 4a04593

Browse files
author
cxxsheng
committed
android-12 supported
1 parent 4dd4c92 commit 4a04593

File tree

1 file changed

+69
-2
lines changed

1 file changed

+69
-2
lines changed

README.md

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ SecurePatchedEmulator provides a prebuilt Android emulator image with the latest
88
| Version | Security Patch | Download Link |
99
| :-------: | :------------: | :----------------------------------------------------------: |
1010
| 14.0.0_r1 | 2024-06 | [android-14.0.0_r1.zip](https://github.com/cxxsheng/SecurePatchedEmulator/releases/download/2024-06/android-14.0.0_r1.zip) |
11+
| 12.0.0_r1 | 2024-06 | [android-12.0.0_r1.zip](https://github.com/cxxsheng/SecurePatchedEmulator/releases/download/2024-06/android-12.0.0_r1.zip) |
1112

1213
### Usage
1314
To set up and launch the SecurePatchedEmulator, follow these steps:
14-
1. Download the desired Android emulator image. For example, to launch android-14.0.0_r1:
15+
1. Download the desired Android emulator image. For example, to launch `android-14.0.0_r1`:
1516

1617
```shell
1718
wget https://github.com/cxxsheng/SecurePatchedEmulator/releases/download/2024-06/android-14.0.0_r1.zip
@@ -31,4 +32,70 @@ To set up and launch the SecurePatchedEmulator, follow these steps:
3132
emulator @YourAVDName -sysdir /path/to/emulator/x86_64
3233
```
3334

34-
Replace `YourAVDName` with the name of your Android Virtual Device (AVD) and `/path/to/emulator` with the actual path where you extracted the emulator files.
35+
Replace `YourAVDName` with the name of your Android Virtual Device (AVD) and `/path/to/emulator` with the actual path where you extracted the emulator files. Ensure that the Android version used to create `YourAVDName` matches the Android version of the emulator image.
36+
37+
### Building
38+
To create a secure Android emulator image with the latest security patches, follow these steps:
39+
40+
0. Initialize and sync the AOSP repository:
41+
```shell
42+
repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r1
43+
repo sync
44+
```
45+
Replace `android-14.0.0_r1` with the desired Android version.
46+
47+
1. Identify the latest security patch tag from the[ `platform_build`](https://github.com/aosp-mirror/platform_build/tags ) repository on GitHub. For example, [`android-security-14.0.0_r9`](https://github.com/aosp-mirror/platform_build/releases/tag/android-security-14.0.0_r9):
48+
49+
2. Fetch the security patch tag across all AOSP repositories:
50+
51+
```shell
52+
2. repo forall -p -c 'git fetch aosp android-security-14.0.0_r9'
53+
```
54+
55+
Replace `android-security-14.0.0_r9` with the actual security patch tag.
56+
57+
3. Generate a diff file to review the changes between the current HEAD and the security patch:
58+
59+
```shell
60+
repo forall -p -c 'git log --oneline HEAD..FETCH_HEAD' > 14.0.0_r1-to-14.0.0_r9.diff.txt
61+
```
62+
63+
4. Merge the security patch into the AOSP repositories:
64+
65+
```shell
66+
repo forall -p -c 'git merge FETCH_HEAD'
67+
```
68+
69+
5. Modify the security patch date in the emulator image:
70+
71+
In the `build/make/core/version_defaults.mk` file, locate the `ro.build.version.security_patch` variable and change its value to the desired security patch date, e.g., `2024-06-05`.
72+
73+
6. Build the Android emulator image:
74+
75+
For Android 13 and above:
76+
77+
```shell
78+
source ./build/envsetup.sh
79+
lunch sdk_phone_x86-userdebug
80+
make emu_img_zip -j$(nproc)
81+
```
82+
83+
This generates an `sdk-repo-linux-system-images-eng.[username]].zip` file.
84+
85+
For Android 12 and below:
86+
87+
```shell
88+
source build/envsetup.sh
89+
lunch sdk_phone_x86_64-userdebug
90+
make -j$(nproc) sdk sdk_repo
91+
```
92+
93+
The `make sdk sdk_repo` command creates two files under `aosp-main/out/host/linux-x86/sdk/sdk_phone_x86_64`:
94+
95+
- `sdk-repo-linux-system-images-eng.[username].zip`
96+
- `repo-sys-img.xml`
97+
98+
### Reference:
99+
100+
1. [Merging AOSP Security Patches into Custom ROMs | Aditya Telange.](https://adityatelange.in/blog/aosp/merge-security-patches-aosp/)
101+
2. [Use Android Emulator virtual devices | Android Open Source Project.](https://source.android.com/docs/setup/create/avd#build_avd_images)

0 commit comments

Comments
 (0)