[Android] M.Tullius:
Building various ROMs for Xiaomi ginkgo/willow

My goal is to understand Android enough that I can reproduce one of the available ROMs for my phone by building it myself.

I tried several different ROMs, and the build process failed at one step or the other.

I'd like to ask help from more experienced people.

I assume the necessary tools are in place (I use Arch Linux), there should be no issue with python2/3 in repo, and similarly with Java version. For example, I can build pure AOSP.

Experiment 1 (SyberiaOS)

What I tried.

repo init -u https://github.com/syberia-project/manifest.git -b 10.0
repo sync -c -j13 --force-sync --no-clone-bundle --no-tags
curl https://raw.githubusercontent.com/TRINKET-ANDROID/platform_build/master/build-setup.sh > build-setup.sh
# edit SM8150="true" and GINKGO="true" in the file
chmod +x build-setup.sh
. build-setup.sh
. build/envsetup.sh
brunch syberia_ginkgo-userdebug > buildlog.log 2>&1

The build fails alfter 5-6 min, I think the relevant error is

"flex" is not allowed to be used.

which then triggers errors in make.

Is this the right sequence of commands? Am I using a valid branch?

Since I posted this (and got no reply) the github I used to pull vendor/device/kernel has been edited, so I'm not sure this is reproducible anymore.

Experiment 2 (Pixel experience)

Here they build things such that we only need to look at the manifest on the pixel experience github, and then 'lunch' command will edit local manifests to import relevant kernel/vendor/device. This looks cleaner, and I wonder why not everyone does that.

What I tried.

repo init -u https://github.com/PixelExperience/manifest -b ten
repo sync -c -j$(nproc --all) --force-sync --no-clone-bundle --no-tags
. build/envsetup.sh
lunch aosp_willow-userdebug
mka bacon -j13

This time it looks more promising, as everything seems to go well for over 1h, but then at

[ 89% 82713/92485] build .../build/android/pixel/out/target/product/willow/obj/PACKAGING/recovery_text_res_intermediates/installing_text.png

we get a FAILED (...some more stuff and)

Exception in thread "main" java.lang.InternalError: java.lang.reflect.InvocationTargetException
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at java.desktop/java.awt.Font.<init>(Font.java:618)
at java.desktop/java.awt.Font.createFont(Font.java:1224)
at com.android.recovery.tools.ImageGenerator.loadFontsByLocale(ImageGenerator.java:393)
at com.android.recovery.tools.ImageGenerator.createGraphics(ImageGenerator.java:492)
at com.android.recovery.tools.ImageGenerator.generateImage(ImageGenerator.java:605)
at com.android.recovery.tools.ImageGenerator.main(ImageGenerator.java:755)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
... 8 more
Caused by: java.lang.NullPointerException
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1288)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:765)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:440)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:385)
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
... 13 more

ninja: build stopped: subcommand failed.
21:50:01 ninja failed with: exit status 1

Can anyone help?

Thanks in advance.