Re: Android-x86 7.1-r2 with GAPPS installation guide

86 views
Skip to first unread message

John...@eclipso.email

unread,
Sep 1, 2020, 2:43:52 AM9/1/20
to qubes...@googlegroups.com
Hi,
i updated to previous versions to build the recent android-9.0-r2, which works fine, but opengapps won't compile.
I can't remember the correct error message, something with
vendor/opengapps/build/opengapps-packages.mk not found.
Will try again later.
Anyone?


# Create a builder AppVM based on (whonix-14-ws or) Debian in which you'll build android-x86.
# You'll need 300GB for android-x86 sources and temp build files and swap.
# Extend private storage size to 300GB via GUI or in dom0:
# qvm-volume extend android-builder:private 300g

# Add 30GB swap in builder VM:
sudo fallocate -l 30G /home/user/swapfile
sudo chmod 0600 /home/user/swapfile
sudo mkswap /home/user/swapfile
sudo swapon /home/user/swapfile



# Add the following repository to /etc/apt/sources.list (openjdk-8 is required, but it is not available under Debian 10):
# skipped, works with openjdk-11 too
# deb https://deb.debian.org/debian sid main



# Install packages in whonix-14-ws (or Debian) template:
sudo apt-get update
sudo apt-get install openjdk-11-jdk gnupg flex bison gperf build-essential \
zip zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev \
x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils \
xsltproc unzip gettext libyaml-dev dosfstools syslinux syslinux-utils \
xorriso mtools makebootfat lunzip git-core curl python-pip libssl-dev bc \
libelf-dev git-lfs python-pip git-core curl clang libncurses5 \
libncurses5-dev



# In builder VM run:
sudo ln -s /sbin/mkdosfs /usr/local/bin/mkdosfs
sudo pip install prettytable Mako pyaml dateutils --upgrade
export _JAVA_OPTIONS="-Xmx8G"
echo 'export _JAVA_OPTIONS="-Xmx8G"' >> ~/.profile
echo "sudo swapon /tmp/swapfile" >> /rw/config/rc.local


# Download android-x86 sources:
mkdir android-x86
cd android-x86
curl https://storage.googleapis.com/git-repo-downloads/repo > repo
chmod a+x repo
sudo install repo /usr/local/bin
rm repo
git config --global user.name "Your Name"
git config --global user.email "ro...@example.com"
# chose what version: https://www.android-x86.org/source.html , https://osdn.net/projects/android-x86/releases/71931
# repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b oreo-x86 -m android-x86-8.1-r1.xml
repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b pie-x86 -m android-x86-9.0-r2.xml




# ::TODO:: needs fixing
# To add GAPPS to your build you need to add the build system, and the wanted sources to your manifest.
## Edit .repo/manifests/android-x86-8.1-r1.xml and add the following towards the end:
# Edit .repo/manifests/android-x86-9.0-r2.xml and add the following towards the end:
#
<remote name="opengapps" fetch="https://github.com/opengapps/" />
<remote name="gitlab" fetch="https://gitlab.opengapps.org/opengapps/" />
<project path="vendor/opengapps/build" name="aosp_build" revision="master" remote="opengapps" />
<project path="vendor/opengapps/sources/all" name="all" clone-depth="1" revision="master" remote="gitlab" />
<!-- arm64 depends on arm -->
<project path="vendor/opengapps/sources/arm" name="arm" clone-depth="1" revision="master" remote="gitlab" />
<project path="vendor/opengapps/sources/arm64" name="arm64" clone-depth="1" revision="master" remote="gitlab" />
<project path="vendor/opengapps/sources/x86" name="x86" clone-depth="1" revision="master" remote="gitlab" />
<project path="vendor/opengapps/sources/x86_64" name="x86_64" clone-depth="1" revision="master" remote="gitlab" />
</manifest>



# Download sources:
# download ~27GB, disk usage ~63GB
# repo sync --no-tags --no-clone-bundle --force-sync -j$( nproc --all )
# 2 threads sufficient
repo sync --no-tags --no-clone-bundle --force-sync -j2




# If you choose to add GAPPS, then edit file device/generic/common/device.mk
# and add at the beginning:
#
# OpenGAPPS
GAPPS_VARIANT := pico
GAPPS_PRODUCT_PACKAGES += Chrome \
KeyboardGoogle \
LatinImeGoogle \
GoogleTTS \
YouTube \
PixelIcons \
PixelLauncher \
Wallpapers \
PixelLauncherIcons \
WebViewGoogle \
GoogleServicesFramework \
GoogleLoginService
GAPPS_FORCE_BROWSER_OVERRIDES := true
GAPPS_FORCE_PACKAGE_OVERRIDES := true
GAPPS_EXCLUDED_PACKAGES := FaceLock \
AndroidPlatformServices \
PrebuiltGmsCoreInstantApps


# And at the end add:
#
# OpenGAPPS
$(call inherit-product, vendor/opengapps/build/opengapps-packages.mk)



# OpenGapps changed their repo to require git-lfs. There may be a better way to do this,
# but if you're building with GApps, this gets the right files. It takes a while:
# disk usage opengapps ~37GB
#
cd vendor
rm -r opengapps
git clone https://github.com/opengapps/opengapps.git
cd opengapps
git lfs install
./download_sources.sh --shallow x86_64
cd ../../



# Edit android-x86 sources for XEN compatibility:
sed -i -e 's|/sys/block/\[shv\]d\[a-z\]|/sys/block/\[shv\]d\[a-z\] /sys/block/xvd\[a-z\]|g' bootable/newinstaller/install/scripts/1-install
sed -i -e 's|/sys/block/\[shv\]d\$h/\$1|/sys/block/\[shv\]d\$h/\$1 /sys/block/xvd\$h/\$1|g' bootable/newinstaller/install/scripts/1-install
sed -i -e 's|hmnsv|hmnsvx|g' bootable/newinstaller/initrd/init



# Edit android-x86 sources for Debian build environment:
sed -i -e 's|genisoimage|xorriso -as mkisofs|g' bootable/newinstaller/Android.mk




# Configure build target:
# https://source.android.com/setup/build/building
#
# user Limited access; suited for production
# userdebug Like user but with root access and debug capability; preferred for debugging
# eng Development configuration with additional debugging tools
#
. build/envsetup.sh
lunch android_x86_64-userdebug


# ::TODO:: breaks here
# mkdir vendor/opengapps/build
# touch vendor/opengapps/build/opengapps-packages.mk



# Configure kernel:
/usr/bin/make -C kernel O=$OUT/obj/kernel ARCH=x86_64 menuconfig


# You need to edit these parameters:
# CONFIG_XEN=yes
# CONFIG_XEN_BLKDEV_BACKEND=yes
# CONFIG_XEN_BLKDEV_FRONTEND=yes
# CONFIG_XEN_NETDEV_BACKEND=no
# CONFIG_XEN_NETDEV_FRONTEND=no
# CONFIG_DEFAULT_SECURITY_SELINUX=yes
# CONFIG_SECURITY_SELINUX_BOOTPARAM=yes
# CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
# CONFIG_SECURITY_SELINUX_DISABLE=yes
Processor type and features -> Linux guest support -> Enable paravirtualization code -> Xen guest support (Y)
Device Drivers -> Block Devices -> Xen virtual block device support (Y)
Device Drivers -> Block Devices -> Xen block-device backend driver (Y)
Device Drivers -> Network device support -> Xen network device frontend driver (N)
Device Drivers -> Network device support -> Xen backend network device (N)
Security Options -> NSA SELinux Support (Y)
Security Options -> NSA SELinux boot paramter (Y)
Security Options -> NSA SELinux boot paramter default value (1)
Security Options -> NSA SELinux runtime disable (Y)





# The kernel config will be in out/target/product/x86_64/obj/kernel/.config

# Also, you can edit the config to set the device type from tablet to phone.
# Edit device/generic/common/device.mk and change PRODUCT_CHARACTERISTICS from tablet to default:
# PRODUCT_CHARACTERISTICS := default


# Start the build:
# took ~5-6 hours
# if memory runs out, just try again, or use more vram, or use less threads, or install swap file
# disk usage after compilation ~209GB, with opengapps ~245GB
make -j$( nproc --all ) iso_img



# skipped rest #


# After you got the iso, create the android network VM. If you choose the
android VM's netvm as sys-whonix directly, the network won't work. You need
to have intermediate netvm between android VM and sys-whonix. Create new
AppVM sys-android based on fedora template with netvm sys-whonix and set
"provides network".

# Create android VM in dom0:
qvm-create --class StandaloneVM --label green --property virt_mode=hvm android
qvm-prefs android kernel ''
qvm-prefs android 'sys-android'
qvm-prefs android memory '2048'
qvm-prefs android maxmem '2048'
qvm-volume extend android:root 20g


# Start the android VM with iso:
qvm-start android --cdrom=android-builder:/home/user/android-x86/out/target/product/x86_64/android_x86_64.iso



# Install android-x86 on xvda and reboot.
# Start android VM without iso:
qvm-start android


# When it'll start, kill the VM and wait for it to halt.
# Configure android VM to use the mouse in dom0:
sudo mkdir -p /etc/qubes/templates/libvirt/xen/by-name/
sudo cp /etc/libvirt/libxl/android.xml /etc/qubes/templates/libvirt/xen/by-name/android.xml
sudo sed -i -e 's/tablet/mouse/g' /etc/qubes/templates/libvirt/xen/by-name/android.xml


# Start android VM without iso and it should work fine:
qvm-start android



---

________________________________________________________
Ihre E-Mail-Postfächer sicher & zentral an einem Ort. Jetzt wechseln und alte E-Mail-Adresse mitnehmen! https://www.eclipso.de


John...@eclipso.email

unread,
Sep 2, 2020, 2:26:43 AM9/2/20
to qubes...@googlegroups.com
­Hi,
the error message is:

$ lunch android_x86_64-userdebug
hardware/libsensors/sensors.mk:3: error: _nic.PRODUCTS.[[device/generic/x86_64/android_x86_64.mk]]: "vendor/opengapps/build/opengapps-packages.mk" does not exist.
08:18:12 dumpvars failed with: exit status 1

Just creating the missing file, of course, doesn't fix that problem.
Anyone an idea?


>Hi,
>i updated to previous versions to build the recent android-9.0-r2, which works fine, but opengapps won't compile.
>I can't remember the correct error message, something with
>vendor/opengapps/build/opengapps-packages.mk not found.
>Will try again later.
>Anyone?

John...@eclipso.email

unread,
Sep 2, 2020, 2:27:16 AM9/2/20
to qubes...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages