Skip to content

Commit 6d73adf

Browse files
Merge pull request #183 from vroad/waydroid-pr
waydroid: initial implementation (Updated for the latest version of waydroid)
2 parents 2bcd6a1 + 39757c3 commit 6d73adf

File tree

10 files changed

+8586
-2
lines changed

10 files changed

+8586
-2
lines changed

default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ let
3939
./flavors/vanilla/11
4040
./flavors/vanilla/11/kernel
4141
./flavors/vanilla/12
42+
./flavors/waydroid
4243
./modules/10
4344
./modules/11
4445
./modules/12

docs/src/modules/flavors.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,10 @@ Anbox support may be enabled by setting `flavor = "anbox";`.
6969

7070
At the time of writing, support is experimental.
7171
Given that Anbox is based on an older Android release (7), support for Robotnix options is not guaranteed.
72+
73+
## Waydroid
74+
Waydroid is a Free and open-source container-based approach at running Android on Linux systems.
75+
Waydroid support may be enabled by setting device and flavor, e.g. `device="x86_64"; flavor="waydroid";`.
76+
LineageOS based system/vendor images can be built using `nix-build ... -A config.build.waydroid`.
77+
78+
At the time of writing, support is experimental.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
gitRepo nix-prefetch-git
3636
curl go-pup jq
3737
shellcheck
38+
wget
3839

3940
# For chromium updater script
4041
python2 cipd git

flavors/waydroid/default.nix

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# SPDX-FileCopyrightText: 2021 Daniel Fullmer
2+
# SPDX-License-Identifier: MIT
3+
4+
{ config, pkgs, lib, ... }:
5+
let
6+
inherit (lib)
7+
mkDefault
8+
mkIf
9+
mkMerge
10+
mkBefore
11+
;
12+
repoDirs = lib.importJSON ./repo-lineage-17.1.json;
13+
patchMetadata = lib.importJSON ./patch-metadata.json;
14+
repoDateTimes = lib.mapAttrsToList (name: value: value.dateTime) repoDirs;
15+
maxRepoDateTime = lib.foldl (a: b: lib.max a b) 0 repoDateTimes;
16+
in mkIf (config.flavor == "waydroid")
17+
{
18+
buildDateTime = mkDefault maxRepoDateTime;
19+
20+
androidVersion = mkDefault 10;
21+
productNamePrefix = "lineage_waydroid_";
22+
variant = mkDefault "userdebug";
23+
24+
source.dirs = mkMerge [
25+
repoDirs
26+
(lib.mapAttrs (relpath: patches: {
27+
patches = (builtins.map (p: "${config.source.dirs."vendor/extra".src}/${patches.dir}/${p}") patches.files);
28+
}) patchMetadata)
29+
];
30+
31+
envVars.RELEASE_TYPE = mkDefault "EXPERIMENTAL"; # Other options are RELEASE NIGHTLY SNAPSHOT EXPERIMENTAL
32+
33+
# Traceback (most recent call last):
34+
# File "external/mesa3d/src/panfrost/bifrost/bi_printer.c.py", line 203, in <module>
35+
# from mako.template import Template
36+
# ModuleNotFoundError: No module named 'mako'
37+
# TODO: mkBefore here is a hack
38+
envPackages = with pkgs; mkBefore [
39+
(python2.withPackages (p: with p; [ Mako ]))
40+
(python3.withPackages (p: with p; [ Mako ]))
41+
];
42+
43+
build = {
44+
waydroid = config.build.mkAndroid {
45+
name = "robotnix-${config.productName}-${config.buildNumber}";
46+
makeTargets = [ "systemimage" "vendorimage" ];
47+
installPhase = ''
48+
mkdir -p $out
49+
50+
cp -t $out \
51+
$ANDROID_PRODUCT_OUT/android-info.txt \
52+
$ANDROID_PRODUCT_OUT/build_fingerprint.txt \
53+
$ANDROID_PRODUCT_OUT/installed-files.txt
54+
55+
for v in system.img vendor.img; do
56+
${pkgs.simg2img}/bin/simg2img $ANDROID_PRODUCT_OUT/$v $out/$v
57+
${pkgs.e2fsprogs}/bin/e2fsck -fy $out/$v
58+
${pkgs.e2fsprogs}/bin/resize2fs -M $out/$v
59+
done
60+
'';
61+
};
62+
};
63+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python
2+
3+
import json
4+
import os
5+
6+
from robotnix_common import checkout_git, save
7+
8+
9+
def main() -> None:
10+
data = json.load(open('repo-lineage-17.1.json'))
11+
waydroid_vendor = data['vendor/extra']
12+
git_info = checkout_git(waydroid_vendor['url'], waydroid_vendor['rev'])
13+
topdir = git_info['path']
14+
15+
output = {}
16+
patches_dir = os.path.join(topdir, 'waydroid-patches', 'base-patches')
17+
for dirpath, dirs, files in os.walk(patches_dir):
18+
if any(f.endswith('.patch') for f in files):
19+
src_path = dirpath[len(topdir)+1:]
20+
dest_path = dirpath[len(patches_dir)+1:]
21+
output[dest_path] = {
22+
'dir': src_path,
23+
'files': sorted(files),
24+
}
25+
26+
save('patch-metadata.json', output)
27+
28+
29+
if __name__ == '__main__':
30+
main()
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
{
2+
"bionic": {
3+
"dir": "waydroid-patches/base-patches/bionic",
4+
"files": [
5+
"0001-hybris-don-t-fail-because-of-fsetxattr.patch",
6+
"0002-anbox-add-vendor_extra-lib-folders-to-default-librar.patch",
7+
"0003-linker-Allow-text-relocs-for-x86-only.patch",
8+
"0004-Add-syscalls-ioperm-and-iopl.patch",
9+
"0005-We-need-text-relocations.patch"
10+
]
11+
},
12+
"build/soong": {
13+
"dir": "waydroid-patches/base-patches/build/soong",
14+
"files": [
15+
"0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch"
16+
]
17+
},
18+
"external/wayland-protocols": {
19+
"dir": "waydroid-patches/base-patches/external/wayland-protocols",
20+
"files": [
21+
"0001-stable-Add-xdg-shell.patch"
22+
]
23+
},
24+
"frameworks/av": {
25+
"dir": "waydroid-patches/base-patches/frameworks/av",
26+
"files": [
27+
"0001-libcameraservice-Use-listByInterface.patch",
28+
"0002-media-xmlparser-Add-host-dirs-to-search-path.patch",
29+
"0003-mediacodec-Use-vendor_extra-seccomp-minijail.patch",
30+
"0004-media-Add-host-media_profiles-search-paths.patch",
31+
"0005-drm-Fix-drm-on-older-vendors.patch",
32+
"0006-codec2-Fix-media-on-older-vendors.patch",
33+
"0007-SW-encode-Fix-output-buffer-size.patch",
34+
"0007-apex-Add-vendor_extra-to-ld-search-paths.patch",
35+
"0008-Change-max-width-and-height-supported-by-H.263-decod.patch",
36+
"0009-FLACExtractor-Add-more-sample-rates-support.patch",
37+
"0010-Don-t-use-YV12-color-format-for-video-decoding.patch",
38+
"0011-Allow-screenrecord-usage-on-Android-x86.patch",
39+
"0012-media-enable-dithering-for-RGB565-conversion.patch",
40+
"0013-nuplayer-skip-bad-SAR-values.patch",
41+
"0014-stagefright-Add-support-for-loading-a-custom-OMXPlug.patch",
42+
"0015-stagefright-allow-multiple-custom-OMXPlugins.patch",
43+
"0016-libstagefright-Extended-media-support-via-FFMPEG.patch",
44+
"0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch",
45+
"0018-Setup-FFMPEG-audio-mpeg-L2-codec-correctly.patch",
46+
"0019-av-Keep-FMPEG-for-i386.patch",
47+
"0020-mediaextractor-seccomp-Allow-memfd-related-syscalls.patch"
48+
]
49+
},
50+
"frameworks/base": {
51+
"dir": "waydroid-patches/base-patches/frameworks/base",
52+
"files": [
53+
"0001-anbox-disable-SELinux-parts.patch",
54+
"0002-anbox-disable-suspend-control.patch",
55+
"0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch",
56+
"0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch",
57+
"0005-fwb-Don-t-check-vintf-compatibility.patch",
58+
"0006-Power-Add-proper-suspender.patch",
59+
"0007-core-Add-support-for-MicroG.patch",
60+
"0008-AndroidManifest-add-a-permission-group-for-signature.patch",
61+
"0009-Zygote-Disable-seccomp.patch",
62+
"0010-wm-Include-task-id-in-surface-name-for-easier-tracki.patch",
63+
"0011-wm-Disable-all-app-transitions-as-they-conflict-with.patch",
64+
"0012-clipboard-Talk-with-waydroid-host-service-to-get-cli.patch",
65+
"0013-SystemConfig-Add-host-permissions-dir.patch",
66+
"0014-Add-minimize-pip-buttons-to-freeform-windows.patch",
67+
"0015-Add-back-button-for-freeform-window.patch",
68+
"0016-Update-back-button-graphics.patch",
69+
"0017-BoringdroidSystemUI-Use-persist.sys.systemuiplugin.e.patch",
70+
"0018-Add-basic-freeform-bounds-windowing-mode-persistence.patch",
71+
"0019-Allow-boringdroid-to-use-ROM-s-navbar-button-placeme.patch",
72+
"0020-Impl-basic-window-round-corner-with-Outline.patch",
73+
"0021-base-Keep-using-our-multi-win-props.patch",
74+
"0022-base-Add-TID-to-SurfaceView-layer-name.patch",
75+
"0023-base-Limit-window-from-going-out-of-display.patch",
76+
"0024-base-Lower-windows-shadow-size.patch",
77+
"0025-base-Always-enable-caption.patch",
78+
"0026-Modify-color-inversion-matrix-to-swap-Red-and-Blue-c.patch",
79+
"0027-Update-titlebar-button-graphics.patch",
80+
"0028-Only-show-pip-button-if-activity-supports-it.patch",
81+
"0029-Use-F11-to-change-window-state-between-freeform-and-.patch"
82+
]
83+
},
84+
"frameworks/native": {
85+
"dir": "waydroid-patches/base-patches/frameworks/native",
86+
"files": [
87+
"0001-waydroid-installd-run-without-SELinux.patch",
88+
"0002-halium-disable-SELinux-checks-in-ServiceManager.patch",
89+
"0003-halium-never-set-FLAT_BINDER_FLAG_TXN_SECURITY_CTX-f.patch",
90+
"0004-Hack-EventHub-until-it-works-with-our-fake-evdev-eve.patch",
91+
"0005-surfaceflinger-Provide-layer-names-and-stuffs.patch",
92+
"0006-EventHub-Add-wayland-inputs-support.patch",
93+
"0007-inputflinger-add-absolute-event-support-for-cursor.patch",
94+
"0008-RenderEngine-support-non-RGBA_8888-format.patch",
95+
"0009-libEGL-select-pixel-format-by-EGL_NATIVE_VISUAL_ID.patch",
96+
"0010-native-Address-host-uid-services-as-system-UID.patch",
97+
"0011-GraphicBufferMapper-Skip-buffer-validation.patch"
98+
]
99+
},
100+
"hardware/libhardware": {
101+
"dir": "waydroid-patches/base-patches/hardware/libhardware",
102+
"files": [
103+
"0001-anbox-add-vendor_extra-lib-hw-to-HAL-search-path.patch",
104+
"0002-libhardware-Don-t-check-for-ro.hardware.patch",
105+
"0003-HACK-Avoid-crashes-on-SurfaceFlinger-when-using-soft.patch",
106+
"0004-libhardware-Try-system-hals-in-vndk-lite.patch",
107+
"0005-gralloc-Force-use-ashmem.patch"
108+
]
109+
},
110+
"lineage-sdk": {
111+
"dir": "waydroid-patches/base-patches/lineage-sdk",
112+
"files": [
113+
"0001-sdk-Introduce-WayDroid-Service.patch",
114+
"0002-sdk-Add-reboot-and-upgrade-to-waydroid.IHardware.patch",
115+
"0003-WayDroid-Fix-icons-permissions.patch"
116+
]
117+
},
118+
"packages/apps/LineageParts": {
119+
"dir": "waydroid-patches/base-patches/packages/apps/LineageParts",
120+
"files": [
121+
"0001-LineageParts-Kill-trust.patch"
122+
]
123+
},
124+
"packages/apps/PermissionController": {
125+
"dir": "waydroid-patches/base-patches/packages/apps/PermissionController",
126+
"files": [
127+
"0001-Utils-add-FAKE_PACKAGE_SIGNATURE-to-platform-permiss.patch"
128+
]
129+
},
130+
"packages/apps/Settings": {
131+
"dir": "waydroid-patches/base-patches/packages/apps/Settings",
132+
"files": [
133+
"0001-Settings-Disable-double_tap_sleep_gesture-by-default.patch"
134+
]
135+
},
136+
"prebuilts/vndk/v28": {
137+
"dir": "waydroid-patches/base-patches/prebuilts/vndk/v28",
138+
"files": [
139+
"0001-v28-Import-edited-libs.patch",
140+
"0002-Import-patched-media-xmlparser.patch"
141+
]
142+
},
143+
"system/core": {
144+
"dir": "waydroid-patches/base-patches/system/core",
145+
"files": [
146+
"0001-anbox-init-start-inside-LXC-container-without-SELinu.patch",
147+
"0002-anbox-init-modify-mount_all-to-skip-mounts-and-trigg.patch",
148+
"0003-anbox-add-vendor_extra-path-as-a-clone-of-vendor-ent.patch",
149+
"0004-libsync-Add-sw_sync-symbols-to-map.patch",
150+
"0005-sdcard-Bring-back-fuse.patch",
151+
"0006-sdcard-Add-full-mount-directory.patch",
152+
"0007-init-Define-host-user.patch",
153+
"0008-rootdir-Add-system-hw-to-vndk-lite-sphal-paths.patch",
154+
"0009-rootdir-Add-odm_extra-to-ld-paths.patch",
155+
"0010-core-Add-waydroid-to-product-allowed-sources.patch",
156+
"0011-core-Allow-sphal-to-access-system-libs.patch",
157+
"0012-init-Allow-setting-sys.use_memfd-before-boot.patch"
158+
]
159+
},
160+
"system/hardware/interfaces": {
161+
"dir": "waydroid-patches/base-patches/system/hardware/interfaces",
162+
"files": [
163+
"0001-suspend-Set-mUseSuspendCounter-to-true.patch"
164+
]
165+
},
166+
"system/hwservicemanager": {
167+
"dir": "waydroid-patches/base-patches/system/hwservicemanager",
168+
"files": [
169+
"0001-halium-disable-SELinux-parts.patch"
170+
]
171+
},
172+
"system/libhidl": {
173+
"dir": "waydroid-patches/base-patches/system/libhidl",
174+
"files": [
175+
"0001-ServiceManagement-Use-host_hwbinder-if-available.patch",
176+
"0002-Select-host_hwbinder-by-passing-argument-instead-of-.patch",
177+
"0003-Don-t-wait-for-host-hwbinder.patch",
178+
"0004-Always-re-new-ServiceManager.patch",
179+
"0005-Fix-ABI-breakage-headers.patch",
180+
"0006-libhidl-Add-vendor_extra-to-passthrough-paths.patch",
181+
"0007-Always-pass-useHostHwBinder-to-modified-methods-that.patch",
182+
"0008-Add-support-for-host-hals-whitelist.patch"
183+
]
184+
},
185+
"system/libhwbinder": {
186+
"dir": "waydroid-patches/base-patches/system/libhwbinder",
187+
"files": [
188+
"0001-hwbinder-Add-support-for-host_hwbinder-driver.patch",
189+
"0002-Select-host_hwbinder-by-passing-argument-instead-of-.patch",
190+
"0003-Add-mIsHost-to-missing-functions.patch",
191+
"0004-Pass-mIsHost-to-parcels.patch",
192+
"0005-Fix-expungeHandle.patch",
193+
"0006-Fix-ABI-breakage-headers.patch",
194+
"0007-Be-more-explicit-about-using-host-hwbinder.patch",
195+
"0008-Never-set-FLAT_BINDER_FLAG_TXN_SECURITY_CTX-flag.patch",
196+
"0009-Fix-host-binder-freeBuffer.patch"
197+
]
198+
},
199+
"system/netd": {
200+
"dir": "waydroid-patches/base-patches/system/netd",
201+
"files": [
202+
"0001-netd-Fix-networking.patch"
203+
]
204+
},
205+
"system/nfc": {
206+
"dir": "waydroid-patches/base-patches/system/nfc",
207+
"files": [
208+
"0001-nfc-Add-host-search-paths.patch"
209+
]
210+
},
211+
"system/security": {
212+
"dir": "waydroid-patches/base-patches/system/security",
213+
"files": [
214+
"0001-keystore-Supress-SELinux-errors.patch"
215+
]
216+
},
217+
"system/tools/hidl": {
218+
"dir": "waydroid-patches/base-patches/system/tools/hidl",
219+
"files": [
220+
"0001-anbox-Allow-host_hwbinder-to-be-used-for-HALs.patch"
221+
]
222+
},
223+
"system/vold": {
224+
"dir": "waydroid-patches/base-patches/system/vold",
225+
"files": [
226+
"0001-vold-Fix-fuse-sdcard.patch",
227+
"0002-vold-Drop-selinux-checks-on-prepare_subdirs.patch",
228+
"0003-Revert-Remove-waitpid-on-UnMount.patch",
229+
"0004-vold-Disable-fstab-check.patch"
230+
]
231+
},
232+
"vendor/lineage": {
233+
"dir": "waydroid-patches/base-patches/vendor/lineage",
234+
"files": [
235+
"0001-lineage-Add-more-build-types.patch",
236+
"0002-sdk-Kill-trust.patch",
237+
"0003-lineage-Disable-adb-secure.patch"
238+
]
239+
}
240+
}

0 commit comments

Comments
 (0)