InSnh-Gd

InSnh-Gd 的小空间

Build LineageOS 20 system for Waydroid.

As of 2024-04-04, which is the time this article was written, Waydroid only provides LineageOS 18 container images based on Android 11. However, Waydroid is preparing LineageOS 20, which can be found on GitHub. But it has not yet reached a fully functional level and there are still many issues, such as the apparent inability to use libndk translation and the inability to run arm64 games.

LineageOS 20 vendor: https://github.com/waydroid/android_vendor_waydroid/tree/lineage-20

TIPS: If you encounter any errors during the build process, you may be able to find your problem in the Troubleshooting section.


Preparations#

I use an X86 platform running Arch Linux as the device for compiling LineageOS.

Compiling lineage-20 requires 32GB or more of RAM and around 300GB of disk space (although we may not need such a large space for building Waydroid). You also need a network that can access GitHub (but you can also clone LineageOS source code from a mirror site in China, which we will use later).

Arch Linux needs to enable the multilib repository.

To fetch LineageOS source code, you need repo git.

Building LineageOS requires installing some build dependencies: bc bison base_devel ccache curl flex git git-lfs gnupg gperf imagemagick readline lib32-zlib lib32-libelf lz4 lib32-sdl12-compat openssl libxml2 lzop pngcrush rsync schedtool squashfs-tools libxslt zip zlib

You also need to install OpenJDK 11 and Python 3, which are required for building LineageOS 20.

Building LineageOS#

First, create a directory for building lineageos-20. Here, I'll use ~/l20 as an example.

Configure git#

Since using repo requires authentication to clone the lineage-20 repository, we need to configure git identity.

Make sure git lfs is available.

Initialization#

Initialize the local repository:

Get Waydroid local_manifests:

Sync#

Sync the source code. This may take over an hour:

Then configure the local build environment:

Patch#

Apply Waydroid patches:

Start building#

Waydroid AOSP lunch has the following options:

Since I'm using the X86_64 platform, I'll use the lineage_waydroid_x86_64-userdebug option.

Next, start the build:

Note that -j$(nproc --all) will use all your threads. If you encounter out-of-memory errors during compilation, it is recommended to use fewer threads.

This will be a long process. I have an AMD Ryzen R5 7600X + 16GB RAM configuration, and the first build takes about 3-4 hours.

By default, AOSP builds "Android Sparse Image" images, but we need raw filesystems (img) format images. So we need to convert the output images to the system.img and vendor.img that we need.

You can find the output images in your HOME directory.

Using the custom built images#

We need to copy our custom images to /usr/share/waydroid-extra/images/

Then initialize Waydroid

Now we can use LineageOS 20 on Waydroid~

Here are some screenshots:
h7js.png

hNbv.png

hCvY.png

Troubleshooting#

Git-LFS not working properly#

If you encounter the above error during the build, first check if Git-LFS is installed and working properly in your environment.

If it doesn't return initialized, you need to reinstall Git LFS and fetch the files that require Git-LFS from the source code again.

You may also need to reapply Waydroid patches.

During this process, there may be some patch conflicts. Simply sync the source code again.

Try building again.


References#

https://docs.waydro.id/development/compile-waydroid-lineage-os-based-images

https://wiki.lineageos.org/emulator

This article is synchronized and updated to xLog by Mix Space.
The original link is https://blog.insnhgd.com/posts/code/2


Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.