Skip to content

Commit 1ea2b4d

Browse files
committed
waydroid: Update for the latest version
Patching script now uses git command for applying binary patches. (patch command does not currently support binary patches, unfortunately)
1 parent 2aabb30 commit 1ea2b4d

File tree

8 files changed

+1342
-1198
lines changed

8 files changed

+1342
-1198
lines changed

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/anbox.xml

Lines changed: 0 additions & 34 deletions
This file was deleted.

flavors/waydroid/default.nix

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@ let
99
mkMerge
1010
mkBefore
1111
;
12-
repoDirs = lib.importJSON (./. + "/repo-lineage-17.1.json");
12+
repoDirs = lib.importJSON ./repo-lineage-17.1.json;
1313
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;
1416
in mkIf (config.flavor == "waydroid")
1517
{
16-
buildDateTime = mkDefault 1629060864;
18+
buildDateTime = mkDefault maxRepoDateTime;
1719

1820
androidVersion = mkDefault 10;
19-
productNamePrefix = "lineage_anbox_";
21+
productNamePrefix = "lineage_waydroid_";
2022
variant = mkDefault "userdebug";
2123

2224
source.dirs = mkMerge [
2325
repoDirs
2426
(lib.mapAttrs (relpath: patches: {
25-
patches = (builtins.map (p: "${config.source.dirs."anbox-patches".src}/${relpath}/${p}") patches);
27+
patches = (builtins.map (p: "${config.source.dirs."vendor/extra".src}/${patches.dir}/${p}") patches.files);
2628
}) patchMetadata)
2729
];
2830

@@ -50,8 +52,11 @@ in mkIf (config.flavor == "waydroid")
5052
$ANDROID_PRODUCT_OUT/build_fingerprint.txt \
5153
$ANDROID_PRODUCT_OUT/installed-files.txt
5254
53-
cp --reflink=auto -r $ANDROID_PRODUCT_OUT/system.img $out
54-
cp --reflink=auto -r $ANDROID_PRODUCT_OUT/vendor.img $out
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
5560
'';
5661
};
5762
};

flavors/waydroid/extract-patch-metadata.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@
88

99
def main() -> None:
1010
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'])
11+
waydroid_vendor = data['vendor/extra']
12+
git_info = checkout_git(waydroid_vendor['url'], waydroid_vendor['rev'])
1313
topdir = git_info['path']
1414

1515
output = {}
16-
for dirpath, dirs, files in os.walk(topdir):
16+
patches_dir = os.path.join(topdir, 'waydroid-patches', 'base-patches')
17+
for dirpath, dirs, files in os.walk(patches_dir):
1718
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)
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+
}
2125

2226
save('patch-metadata.json', output)
2327

0 commit comments

Comments
 (0)