Official guide:

http://www.android-x86.org/getsourcecode

some unlisted apt install and pip install:

1
2
3
sudo apt-get install libyaml-dev gettext mtools genisoimage syslinux-utils syslinux libelf-dev lunzip
sudo apt-get install python-pip
sudo pip install prettytable Mako pyaml dateutils --upgrade

lunch android_x86_64-user might not boot, build with userdebug.

91 bytes ought to be enough for anybody.

and you also need to modify this file:

1
frameworks/native/cmds/installd/installd_deps.h

init script is:

1
repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b oreo-x86

x86 ELF work-around:
https://github.com/microsoft/wsl/issues/2468#issuecomment-374904520

IJar issue:
replace prebuilts/build-tools/linux-x86/bin/ijar with patched ijar with this patch,
https://github.com/Microsoft/WSL/issues/3157
https://review.lineageos.org/#/c/LineageOS/android_build/+/208102/5/tools/ijar/zip.cc

dex2oat hangs:
https://github.com/Microsoft/WSL/issues/2948
https://review.lineageos.org/#/c/LineageOS/android_build/+/214842/

You will need to add -j1 to dex_preopt_libart.mk and dex_preopt_libart_boot.mk

GPD Win2 patches:

Screen orientation:
https://github.com/Black-Seraph/android_patches_gpdwin/blob/f537ee4f757957e3319f652cd84bf1da7ee31380/diff/frameworks_base_rotate_screen.diff
Thanks Black-Seraph! android_patches_gpdwin

Touchscreen driver (already included in recent kernel):
https://github.com/torvalds/linux/commit/5ca4d1ae9bad0f59bd6f851c39b19f5366953666

Xpad driver:
https://github.com/torvalds/linux/commit/c1ba08390a8bb13c927e699330896adc15b78205

You need to add ‘nomodeset’ to grub boot parameters to boot with hardware acceleration:
http://www.android-x86.org/documents/how-to-boot-the-android-x86-live-cd-when-you-have-problems-with-your-graphiccard

Getting Gapps integrated:
Edit local manifest:
https://github.com/opengapps/aosp_build
then apply gapps part from patch:
https://github.com/Black-Seraph/android_patches_gpdwin/blob/master/diff/device_generic_common_gpdwin.diff

If you’ve finished builds without gapps before applying these patch, remember to clear out/*/system/* before rebuild, redundence packages won’t be cleared and you might not able to boot.