Skip to content

Commit 2aabb30

Browse files
danielfullmervroad
authored andcommitted
waydroid: initial implementation
Successfully builds, but untested.
1 parent a9db619 commit 2aabb30

File tree

8 files changed

+8434
-1
lines changed

8 files changed

+8434
-1
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

flavors/waydroid/anbox.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<manifest>
3+
<!-- Remove replaced Projects -->
4+
<remove-project name="platform/system/libhidl" />
5+
<remove-project name="LineageOS/android_system_libhwbinder" />
6+
<remove-project name="platform/external/libdrm" />
7+
<remove-project name="platform/external/mesa3d" />
8+
<remove-project name="platform/hardware/intel/common/libva" />
9+
10+
<project path="system/libhidl" name="Anbox-halium/android_system_libhidl" />
11+
<project path="system/libhwbinder" name="Anbox-halium/android_system_libhwbinder" />
12+
<project path="external/libdrm" name="Anbox-halium/android_external_libdrm" />
13+
<project path="external/mesa3d" name="Anbox-halium/android_external_mesa3d" />
14+
<project path="hardware/intel/common/libva" name="Anbox-halium/android_hardware_intel_common_libva" />
15+
16+
<!-- Anbox Projects -->
17+
<project path="anbox-patches" name="Anbox-halium/anbox-patches" />
18+
<project path="device/halium/anbox" name="Anbox-halium/android_device_halium_anbox" />
19+
<project path="hardware/anbox/interfaces" name="Anbox-halium/android_hardware_anbox_interfaces" />
20+
21+
<!-- Audio -->
22+
<project path="external/alsa-lib" name="Anbox-halium/android_external_alsa-lib" />
23+
<project path="external/alsa-plugins" name="Anbox-halium/android_external_alsa-plugins" />
24+
<project path="external/libsndfile" name="Anbox-halium/android_external_libsndfile" />
25+
<project path="external/pulseaudio" name="Anbox-halium/android_external_pulseaudio" />
26+
27+
<!-- Display -->
28+
<project path="external/llvm90" name="Anbox-halium/android_external_llvm90" />
29+
30+
<!-- Media -->
31+
<project path="external/ffmpeg" name="Anbox-halium/android_external_ffmpeg" />
32+
<project path="external/stagefright-plugins" name="Anbox-halium/android_external_stagefright-plugins" />
33+
34+
</manifest>

flavors/waydroid/default.nix

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
in mkIf (config.flavor == "waydroid")
15+
{
16+
buildDateTime = mkDefault 1629060864;
17+
18+
androidVersion = mkDefault 10;
19+
productNamePrefix = "lineage_anbox_";
20+
variant = mkDefault "userdebug";
21+
22+
source.dirs = mkMerge [
23+
repoDirs
24+
(lib.mapAttrs (relpath: patches: {
25+
patches = (builtins.map (p: "${config.source.dirs."anbox-patches".src}/${relpath}/${p}") patches);
26+
}) patchMetadata)
27+
];
28+
29+
envVars.RELEASE_TYPE = mkDefault "EXPERIMENTAL"; # Other options are RELEASE NIGHTLY SNAPSHOT EXPERIMENTAL
30+
31+
# Traceback (most recent call last):
32+
# File "external/mesa3d/src/panfrost/bifrost/bi_printer.c.py", line 203, in <module>
33+
# from mako.template import Template
34+
# ModuleNotFoundError: No module named 'mako'
35+
# TODO: mkBefore here is a hack
36+
envPackages = with pkgs; mkBefore [
37+
(python2.withPackages (p: with p; [ Mako ]))
38+
(python3.withPackages (p: with p; [ Mako ]))
39+
];
40+
41+
build = {
42+
waydroid = config.build.mkAndroid {
43+
name = "robotnix-${config.productName}-${config.buildNumber}";
44+
makeTargets = [ "systemimage" "vendorimage" ];
45+
installPhase = ''
46+
mkdir -p $out
47+
48+
cp -t $out \
49+
$ANDROID_PRODUCT_OUT/android-info.txt \
50+
$ANDROID_PRODUCT_OUT/build_fingerprint.txt \
51+
$ANDROID_PRODUCT_OUT/installed-files.txt
52+
53+
cp --reflink=auto -r $ANDROID_PRODUCT_OUT/system.img $out
54+
cp --reflink=auto -r $ANDROID_PRODUCT_OUT/vendor.img $out
55+
'';
56+
};
57+
};
58+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
anbox_patches = data['anbox-patches']
12+
git_info = checkout_git(anbox_patches['url'], anbox_patches['rev'])
13+
topdir = git_info['path']
14+
15+
output = {}
16+
for dirpath, dirs, files in os.walk(topdir):
17+
if any(f.endswith('.patch') for f in files):
18+
if dirpath.startswith(topdir):
19+
dirpath = dirpath[len(topdir)+1:]
20+
output[dirpath] = sorted(files)
21+
22+
save('patch-metadata.json', output)
23+
24+
25+
if __name__ == '__main__':
26+
main()
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"bionic": [
3+
"0001-hybris-don-t-fail-because-of-fsetxattr.patch",
4+
"0002-anbox-add-vendor_extra-lib-folders-to-default-librar.patch"
5+
],
6+
"build/soong": [
7+
"0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch"
8+
],
9+
"external/wayland-protocols": [
10+
"0001-stable-Add-xdg-shell.patch"
11+
],
12+
"frameworks/av": [
13+
"0001-libcameraservice-Use-listByInterface.patch",
14+
"0002-media-xmlparser-Add-host-dirs-to-search-path.patch",
15+
"0003-mediacodec-Use-vendor_extra-seccomp-minijail.patch",
16+
"0004-media-Add-host-media_profiles-search-paths.patch",
17+
"0005-drm-Fix-drm-on-older-vendors.patch",
18+
"0006-codec2-Fix-media-on-older-vendors.patch",
19+
"0007-SW-encode-Fix-output-buffer-size.patch",
20+
"0007-apex-Add-vendor_extra-to-ld-search-paths.patch",
21+
"0008-Change-max-width-and-height-supported-by-H.263-decod.patch",
22+
"0009-FLACExtractor-Add-more-sample-rates-support.patch",
23+
"0010-Don-t-use-YV12-color-format-for-video-decoding.patch",
24+
"0011-Allow-screenrecord-usage-on-Android-x86.patch",
25+
"0012-media-enable-dithering-for-RGB565-conversion.patch",
26+
"0013-nuplayer-skip-bad-SAR-values.patch",
27+
"0014-stagefright-Add-support-for-loading-a-custom-OMXPlug.patch",
28+
"0015-stagefright-allow-multiple-custom-OMXPlugins.patch",
29+
"0016-libstagefright-Extended-media-support-via-FFMPEG.patch",
30+
"0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch",
31+
"0018-Setup-FFMPEG-audio-mpeg-L2-codec-correctly.patch"
32+
],
33+
"frameworks/base": [
34+
"0001-anbox-disable-SELinux-parts.patch",
35+
"0002-anbox-disable-suspend-control.patch",
36+
"0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch",
37+
"0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch",
38+
"0005-fwb-Don-t-check-vintf-compatibility.patch",
39+
"0006-Prevent-the-system-from-entering-a-sleep-state.patch",
40+
"0007-core-Add-support-for-MicroG.patch",
41+
"0008-AndroidManifest-add-a-permission-group-for-signature.patch",
42+
"0009-Zygote-Disable-seccomp.patch"
43+
],
44+
"frameworks/native": [
45+
"0001-anbox-installd-run-without-SELinux.patch",
46+
"0002-halium-disable-SELinux-checks-in-ServiceManager.patch",
47+
"0003-halium-never-set-FLAT_BINDER_FLAG_TXN_SECURITY_CTX-f.patch",
48+
"0004-Hack-EventHub-until-it-works-with-our-fake-evdev-eve.patch",
49+
"0005-surfaceflinger-Provide-layer-names-and-stuffs.patch",
50+
"0006-EventHub-Add-wayland-inputs-support.patch",
51+
"0007-inputflinger-add-absolute-event-support-for-cursor.patch",
52+
"0008-RenderEngine-support-non-RGBA_8888-format.patch",
53+
"0009-libEGL-select-pixel-format-by-EGL_NATIVE_VISUAL_ID.patch"
54+
],
55+
"hardware/libhardware": [
56+
"0001-anbox-add-vendor_extra-lib-hw-to-HAL-search-path.patch",
57+
"0002-libhardware-Don-t-check-for-ro.hardware.patch"
58+
],
59+
"packages/apps/PermissionController": [
60+
"0001-Utils-add-FAKE_PACKAGE_SIGNATURE-to-platform-permiss.patch"
61+
],
62+
"packages/apps/Settings": [
63+
"0001-Settings-Disable-double_tap_sleep_gesture-by-default.patch"
64+
],
65+
"system/core": [
66+
"0001-anbox-init-start-inside-LXC-container-without-SELinu.patch",
67+
"0002-anbox-init-modify-mount_all-to-skip-mounts-and-trigg.patch",
68+
"0003-anbox-healthd-adjust-backup-service-name-to-avoid-co.patch",
69+
"0004-temp-anbox-temporary-disable-adbd.patch",
70+
"0005-anbox-add-vendor_extra-path-as-a-clone-of-vendor-ent.patch",
71+
"0006-libsync-Add-sw_sync-symbols-to-map.patch",
72+
"0007-sdcard-Bring-back-fuse.patch",
73+
"0008-sdcard-Add-full-mount-directory.patch"
74+
],
75+
"system/hardware/interfaces": [
76+
"0001-suspend-Set-mUseSuspendCounter-to-true.patch"
77+
],
78+
"system/hwservicemanager": [
79+
"0001-halium-disable-SELinux-parts.patch"
80+
],
81+
"system/netd": [
82+
"0001-netd-Fix-networking.patch"
83+
],
84+
"system/nfc": [
85+
"0001-nfc-Add-host-search-paths.patch"
86+
],
87+
"system/security": [
88+
"0001-keystore-Supress-SELinux-errors.patch"
89+
],
90+
"system/tools/hidl": [
91+
"0001-anbox-Allow-host_hwbinder-to-be-used-for-HALs.patch"
92+
],
93+
"system/vold": [
94+
"0001-vold-Fix-fuse-sdcard.patch",
95+
"0002-vold-Drop-selinux-checks-on-prepare_subdirs.patch",
96+
"0003-Revert-Remove-waitpid-on-UnMount.patch"
97+
]
98+
}

0 commit comments

Comments
 (0)