Android-x86 7.1-r2 with GAPPS installation guide

4,050 views
Skip to first unread message

alex.jo...@gmail.com

unread,
Nov 30, 2018, 10:22:13 AM11/30/18
to qubes-users
I've successfully build android-x86 7.1-r2 with gapps in whonix-14-ws AppVM.

1. Install packages in whonix-14-ws template:

sudo apt-get install openjdk-8-jdk git-core gnupg flex bison gperf build-essential zip curl 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 python-pip libyaml-dev dosfstools syslinux syslinux-utils xorriso mtools makebootfat lunzip

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

Add 30GB swap in builder VM:

sudo dd if=/dev/zero of=/rw/swapfile bs=1024 count=31457280
sudo chown root:root /rw/swapfile
sudo chmod 0600 /rw/swapfile
sudo mkswap /rw/swapfile
sudo swapon /rw/swapfile

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 /rw/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 "y...@example.com"
repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b android-x86-7.1-r2

To add GAPPS to your build you need to add the build system, and the wanted sources to your manifest.
Edit .repo/manifests/default.xml and add the following towards the end:

<remote name="opengapps" fetch="https://github.com/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="opengapps" />
<project path="vendor/opengapps/sources/x86" name="x86" clone-depth="1" revision="master" remote="opengapps" />
<project path="vendor/opengapps/sources/x86_64" name="x86_64" clone-depth="1" revision="master" remote="opengapps" />

Download sources:
repo sync --no-tags --no-clone-bundle --force-sync -j$( nproc --all )

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)

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:
. build/envsetup.sh
lunch android_x86_64-eng

Configure kernel:
make -C kernel O=$OUT/obj/kernel ARCH=x86 menuconfig
You need to edit these parameters:
XEN=yes
XEN_BLKDEV_BACKEND=yes
XEN_BLKDEV_FRONTEND=yes
XEN_NETDEV_BACKEND=no
XEN_NETDEV_FRONTEND=no
SECURITY_SELINUX_BOOTPARAM=yes
SECURITY_SELINUX_BOOTPARAM_VALUE=1
SECURITY_SELINUX_DISABLE=yes
DEFAULT_SECURITY_SELINUX=yes

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:
m -j$( nproc --all ) iso_img

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

alex.b...@gmail.com

unread,
Dec 1, 2018, 12:47:52 AM12/1/18
to qubes-users
Great guide! The whole process looks way more straightforward than I thought it is!

Do you mind sharing the resulting images for testing? I'll have hard time compiling this myself on old Core m3/8Gb machine...

alex.jo...@gmail.com

unread,
Dec 1, 2018, 11:32:59 AM12/1/18
to qubes-users
On Saturday, December 1, 2018 at 5:47:52 AM UTC, alex.b...@gmail.com wrote:
> Great guide! The whole process looks way more straightforward than I thought it is!
>
> Do you mind sharing the resulting images for testing? I'll have hard time compiling this myself on old Core m3/8Gb machine...

You can try this image, but I advise to build your own image for security reasons:
https://drive.google.com/open?id=1KGDRe9iJgjb3nSBjFlK74Sa_nn08qYiq

alex.b...@gmail.com

unread,
Dec 1, 2018, 1:25:57 PM12/1/18
to qubes-users

Thank Alex! Does not boot for me, vm halts after "Probing EDD" :(

That was the whole point of trying pre-built image (despite security implications) - your iso saved me quite a few hours of compiling.

alex.jo...@gmail.com

unread,
Dec 1, 2018, 2:05:08 PM12/1/18
to qubes-users
At which point did you get this error?
Did you create android VM according to guide?

>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
What's your Qubes version? It works on my Qubes 4.0.
I think it should be related to kernel option:
>qvm-prefs android kernel ''
https://github.com/QubesOS/qubes-issues/issues/3419

alex.b...@gmail.com

unread,
Dec 2, 2018, 12:48:08 PM12/2/18
to qubes-users

You are right, the issue was due to missing `qvm-prefs android kernel ''`.


Everything works fine now, if we can call fine inability to change screen resolution, absence of sound and file exchange and semi-defunct mouse.

nosugar...@gmail.com

unread,
Feb 19, 2019, 5:38:39 AM2/19/19
to qubes-users
Hi Alex,

Let me just start by saying a massive thank you. This guide has been great. I have used it for the 8.1 - Oreo - which was just changing:
'repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b android-x86-7.1-r2' to 'repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b oreo-x86.'

With 8.1, mouse support comes out the box and completing the last part of the guide actually makes the mouse worse in Oreo. So, disregard that part anyone following this guide for 8.1. You can change resolution by affixing 'vga=ask' and choosing your desired resolution (https://groups.google.com/forum/#!topic/qubes-users/KZm8aGJuiO0).

I have come across one issue, and I am wondering if you could help me. Android has installed great, and loads up fine. However, I simply cannot open the Settings app, as it crashes every single time. Others who have encountered this issue modified it using adb (https://stackoverflow.com/questions/3480201/how-do-you-install-an-apk-file-in-the-android-emulator?rq=1), but I don't know how to do this with a Qubes HVM. Any help with this?

Thanks in advance :)

vadimkly...@gmail.com

unread,
Feb 21, 2019, 12:20:52 AM2/21/19
to qubes-users
пятница, 30 ноября 2018 г., 15:22:13 UTC пользователь alex.jo...@gmail.com написал:
> I've successfully build android-x86 7.1-r2 with gapps in whonix-14-ws AppVM.
> You'll need 120GB for android-x86 sources and temp build files and 30GB for swap.
> Extend private storage size to 160GB via GUI or in dom0:
> qvm-volume extend android-builder:private 160g

You need 120GB + 30 GB or 160GB of space just to compile a AndroidVM? Am I reading this right?

nosugar...@gmail.com

unread,
Feb 21, 2019, 9:10:01 PM2/21/19
to qubes-users
Hi,

Yes you need the 160GB of space. I accidentally ran it with less and it failed due to no space.

alex.jo...@gmail.com

unread,
Feb 23, 2019, 9:45:09 AM2/23/19
to qubes-users

You can use adb via network:
Create tmpvm with adb.
Select Networking vm for tmpvm with adb to sys-android.
Select Networking vm for Android VM to sys-android.

In sys-android run:
sudo nft add rule ip qubes-firewall forward meta iifname eth0 accept
sudo iptables -I FORWARD 2 -i vif+ -s 10.137.0.0/24 -d 10.137.0.0/24 -p tcp -m conntrack --ctstate NEW -j ACCEPT

In android terminal run:
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd

In tmpvm witd adb run:
adb connect 10.137.0.xx:5555
Where 10.137.0.xx - android IP
And then run your commands.

nosugar...@gmail.com

unread,
Feb 24, 2019, 3:42:43 AM2/24/19
to qubes-users

Hi Alex, good to hear from you again.

Been pulling my hair out trying to get Android working. It installs great, but i can't open settings at all, so can't even do anything with the OS.

Have you had success with Oreo?

I'll try your adb steps.

799

unread,
Feb 24, 2019, 4:15:42 AM2/24/19
to alex.jo...@gmail.com, qubes-users
Hello,

<alex.jo...@gmail.com> schrieb am Fr., 30. Nov. 2018, 16:22:
I've successfully build android-x86 7.1-r2 with gapps in whonix-14-ws AppVM.
(...)

As far as I understand following the guide from Alex will result in a self compiled Android ISO, which can be used to create an Android AppVM.

Has someone ported this information over to the Qubes Docs or at least Qubes Community Docs, so that this valuable information doesn't get lost and we have one place to collect all feedback and improve it?

One more thing:
Is it also possible to use a regular fedora or Debian based AppVM as Build-VM, I don't understand why whoonix has been used.

- O

nosugar...@gmail.com

unread,
Feb 24, 2019, 4:18:11 AM2/24/19
to qubes-users
On Sunday, 24 February 2019 01:45:09 UTC+11, alex.jo...@gmail.com wrote:

Okay, adb works perfectly with your method. Thank you!

However, my settings is still broken after clearing the data of com.android.settings. I do wonder if this is part of a bigger problem, as the google play store says checking for info.. then the screen turns black. I didn't see any issues when compiling the iso, so not sure what's going on.

nosugar...@gmail.com

unread,
Feb 24, 2019, 5:29:03 AM2/24/19
to qubes-users

Think my issue might be because 'No WebView installed'? Can't open up playstore as it fails to load webview provider.

799

unread,
Feb 24, 2019, 3:39:31 PM2/24/19
to alex.jo...@gmail.com, qubes-users
On Sat, 1 Dec 2018 at 17:33, <alex.jo...@gmail.com> wrote:
On Saturday, December 1, 2018 at 5:47:52 AM UTC, alex.b...@gmail.com wrote:
> [...]

> Do you mind sharing the resulting images for testing? I'll have hard time compiling this myself on old Core m3/8Gb machine...

You can try this image, but I advise to build your own image for security reasons:
https://drive.google.com/open?id=1KGDRe9iJgjb3nSBjFlK74Sa_nn08qYiq

I agree that building an own ISO would be good, but to make a test (if Android really works) I think it's ok to use a prebuild ISO.
Even better, if it would be possible to download and install it as a template, like "qubes-testing-android-7.1-unofficial" from the testing repositories.
Is this something that is possible (technically and also from the qubes perspective, how the testing repo's can be used) or do we need something like a qubes-community-repository to separate packages better (something I would prefer)

- O

Vít Šesták

unread,
Feb 24, 2019, 4:02:41 PM2/24/19
to qubes-users
Thank you for the work. I have few points:

* If we don't verify the commit/tag, I'd suggest downloading the source through HTTPS instead: https://scm.osdn.net/gitroot/android-x86/manifest.git
* You mention that we need a 30GB swap, but you don't mention the RAM you had assigned to the VM. What was the RAM? I would probably prefer using more RAM to swapping.
* Keeping with Android security updates will feel a bit like recompiling Gentoo every month…
* I have looked for GSIs (generic system images). Unfortunately, I haven't found any for x86.
* It should be easy to make a TemplateVM. Just use the private disk image (which is typically /rw) for /data.

Regards,
Vít Šesták 'v6ak'

799

unread,
Feb 24, 2019, 4:16:32 PM2/24/19
to alex.jo...@gmail.com, qubes-users
Hello Alex,

I have succesfully used your .ISO to build a test-android AppVM, following your howto.

> 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'
I think this is a typo and should be:
qvm-prefs android netvm 'sys-android'
(while I have used sys-firewall as netvm)
> 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

Two Questions:
1) Is there any way to change the display resolution of the Android AppVM, as I am running it on a LowRes x230 and the window is slightly to high.
2) Even after launching the android AppVM without the ISO, the ISO-Boot-Up windows comes and I need to choose Other Options and then Boot from local harddisk to continue booting the AppVM - any idea how to change this?
3) The mouse seems strange, as I see two mouse pointers, the one in dom0 and the one in android and they are not synchronized.
While it is possible to use the mouse, it would be nice if there is only one mouse pointer. Can this be done?

- O

awokd

unread,
Feb 24, 2019, 9:02:31 PM2/24/19
to qubes...@googlegroups.com
799 wrote on 2/24/19 9:16 PM:

> 1) Is there any way to change the display resolution of the Android AppVM,
> as I am running it on a LowRes x230 and the window is slightly to high.

Don't know if this procedure applies:
https://www.mail-archive.com/qubes...@googlegroups.com/msg24510.html.
You might want just the 800x600 setting, and maybe not Cirrus...



nosugar...@gmail.com

unread,
Feb 24, 2019, 9:17:13 PM2/24/19
to qubes-users

Hi, please note that Alex's guide was created just before Android-x86 Oreo was released. If you change 'repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b android-x86-7.1-r2' to 'repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b oreo-x86', you'll have no mouse issues. Just rememeber not to do Alex's steps on fixing the mouse if you do, as you'll just recreate the mouse problem.

When you rebooted the appvm, and shut down the builder VM, the iso should have detached from the android appvm. Reboot Qubes if it hasn't.

I've been changing resolution by affixing 'vga=(desired resolution code)' to the end of the kernel. You can type vga=ask to get a list of resolution codes. You do this by pressing 'e' when you get the boot options, and then 'e' again. It will look something like 'kernel /android-2019-02-18/kernelvga=ask quiet etc, etc'.

799

unread,
Feb 25, 2019, 2:49:11 AM2/25/19
to nosugar...@gmail.com, qubes-users
Hello,

<nosugar...@gmail.com> schrieb am Mo., 25. Feb. 2019, 03:17:
(...)
Hi, please note that Alex's guide was created just before Android-x86 Oreo was released. If you change 'repo init -u git://git.osdn.net/gitro,ot/android-x86/manifest -b android-x86-7.1-r2' to 'repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b oreo-x86', you'll have no mouse issues. Just rememeber not to do Alex's steps on fixing the mouse if you do, as you'll just recreate the mouse problem.

Would you mind sharing your ISO, so that I can use it for testing? I want to know before what is working before going through the hazzle and build an own ISO.

When you rebooted the appvm, and shut down the builder VM, the iso should have detached from the android appvm. Reboot Qubes if it hasn't.

Ok, thanks - I will try this.

I've been changing resolution by affixing 'vga=(desired resolution code)' to the end of the kernel. You can type vga=ask to get a list of resolution codes.

Very good idea, haven't thought about this myself - is it also possible to change the Grub Options from within Android to make the change persistent, if I found a working Resolution?

One question that has not been answered so far is, if there is already a setup howto in Qubes Docs or the Community Docs.

- O

Foppe de Haan

unread,
Feb 25, 2019, 11:10:38 AM2/25/19
to qubes-users
On Monday, February 25, 2019 at 8:49:11 AM UTC+1, 799 wrote:
> Would you mind sharing your ISO, so that I can use it for testing? I want to know before what is working before going through the hazzle and build an own ISO.
I'd appreciate this as well. :)

Yethal

unread,
Feb 25, 2019, 6:08:36 PM2/25/19
to qubes-users
Can't we just use a prebuilt image such as PrimeOS?

799

unread,
Feb 26, 2019, 6:12:35 PM2/26/19
to awokd, qubes-users
Hello awokd,

>> [...]
>> You might want just the 800x600 setting, and maybe not Cirrus...
>> [...]

I was able to change the resolution, so that the android AppVM can run on my lowres x230:
On launch I added the follwing line to grub: video=800x600-32

Unfortunately I have to do this on each run, as I don't know how and if I can push those setting into the Android Qube.
I tried to find something like /boot from within the Android AppVM using the Terminal Emulator, but I didn't succeed.
So how can I update grub of the Android AppVM?

- O

799

unread,
Feb 26, 2019, 6:24:09 PM2/26/19
to Yethal, qubes-users
Hello Yethal,

On Tue, 26 Feb 2019 at 00:08, Yethal <grzegorz....@gmail.com> wrote:
>> Can't we just use a prebuilt image such as PrimeOS?

I downloaded PrimeOS and created a HVM but I am unable to choose a harddisk from within the PrimeOS installer.
Even when my "primeos-Qubes" has a 20G root device:

PrimeOS keeps saying "Ok. There is no hard drive to edit partitions" when I try to choose my harddrive during installation.
Have you tried to install PrimeOS within Qubes?

- O

Yethal

unread,
Feb 27, 2019, 12:10:10 AM2/27/19
to qubes-users
Interesting. I did manage to install and run PrimeOS in VirtualBox on my non-Qubes box but on Qubes I ran into the same issue. It appears the PrimeOS installer searches for block devices under /dev/sdX whereas Qubes exposes them under /dev/xvdX

Vít Šesták

unread,
Feb 27, 2019, 1:30:34 AM2/27/19
to qubes...@googlegroups.com
I was able to run PrimeOS live, but I had exactly the same issue with installation.

The explanation with /dev/xvdX sopunds plausible. Maybe it has a half support for Xen virtual devices – the kernel supports them (so they are not emulated like in Windows), but the installer has no idea about them…

Regards,
Vít Šesták 'v6ak'

Daniil Travnikov

unread,
Apr 25, 2019, 6:20:32 PM4/25/19
to qubes-users
I am stuck on this process already twice.

When I put the command

Download sources:
repo sync --no-tags --no-clone-bundle --force-sync -j$( nproc --all )


and when it show this:


From git://git.osdn.net/gitroot/android-x86/platform/frameworks/av
* [new branch] nougat-x86 -> x86/nougat-x86
Fetching project platform/external/android-clat
remote: Counting objects: 1, done
remote: Finding sources: 100% (793/793)
remote: Total 793 (delta 244), reused 793 (delta 244)
Receiving objects: 100% (793/793), 517.38 KiB | 0 bytes/s, done.
Resolving deltas: 100% (244/244), done.
From https://android.googlesource.com/platform/external/android-clat
* [new tag] android-7.1.2_r36 -> android-7.1.2_r36


I got nothing, I mean it's look like freeze.

alex.jo...@gmail.com

unread,
Apr 27, 2019, 5:35:19 PM4/27/19
to qubes-users

Did you try to remove downloaded repo and sync it again from scratch? The OpenGAPPS repo changed, see below, maybe it's somehow related.

I'd recommend to build Android 8 release, the mouse works fine there. Also the Settings bug is fixed if you use userdebug build variant instead of eng.
The guide in the same as in first post except:

Android 8 will take 211GB to build. I've build it with 32GB RAM without swap, maybe it'll work with less RAM.

repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b oreo-x86 -m android-x86-8.1-r1.xml
instead of

repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b android-x86-7.1-r2

<remote name="opengapps" fetch="https://github.com/opengapps/" />
<remote name="nezor" fetch="https://gitlab.nezorfla.me/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="nezor" />
<project path="vendor/opengapps/sources/x86" name="x86" clone-depth="1" revision="master" remote="nezor" />
<project path="vendor/opengapps/sources/x86_64" name="x86_64" clone-depth="1" revision="master" remote="nezor" />
instead of


<remote name="opengapps" fetch="https://github.com/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="opengapps" />
<project path="vendor/opengapps/sources/x86" name="x86" clone-depth="1" revision="master" remote="opengapps" />
<project path="vendor/opengapps/sources/x86_64" name="x86_64" clone-depth="1" revision="master" remote="opengapps" />

lunch android_x86_64-userdebug
instead of
lunch android_x86_64-eng

/usr/bin/make -C kernel O=$OUT/obj/kernel ARCH=x86_64 menuconfig
instead of
make -C kernel O=$OUT/obj/kernel ARCH=x86_64 menuconfig

alex.jo...@gmail.com

unread,
Apr 27, 2019, 7:29:08 PM4/27/19
to qubes-users

I've uploaded the working Android 8.1 iso for those who need it for a test, but I don't recommend to use it for security reasons and it's better to build the iso yourself:
https://drive.google.com/open?id=1Y4P77mlPPlXBzYrJ5yHJ7XM6gLVsQQm0

md5sum android_x86_64-oreo-nogapps.iso
b3af7a84820dd9fb32dd40c68f285993 android_x86_64-oreo-nogapps.iso

sha1sum android_x86_64-oreo-nogapps.iso
16e9bcf0da44929b223fc2ab1df97de0df26d9fb android_x86_64-oreo-nogapps.iso
sha256sum

sha256sum android_x86_64-oreo-nogapps.iso
b7d9aa5f9c401202ea24b63e95bb0f38d1f981381a719257c1a2f526e0cf636f android_x86_64-oreo-nogapps.iso

sha512sum android_x86_64-oreo-nogapps.iso
16f2666a20499f31472fc933a670c47070e0db14686b605b69254d054dcc63893b564e5a35e84e1daf7b7fd80f955a2834956a1bb029e93563b7d8c44787666b android_x86_64-oreo-nogapps.iso

arthur....@gmail.com

unread,
Dec 12, 2019, 10:20:54 PM12/12/19
to qubes-users
Are the instructions in the first post edited and updated, or are there more recent instructions which should be used? I'm personally interested in an image with GApps (I downloaded the nogapps ISO and tried to somehow install GApps, but to no avail - I wasn't sure if the image provided up near the start of the thread was functional). If there are updated/verified instructions that could be provided, that would be awesome!

arthur....@gmail.com

unread,
Dec 18, 2019, 3:21:19 PM12/18/19
to qubes-users
So, I managed to get the instructions to work (albeit with a few modifications - I'll post them when/if I can figure out the GApps issue). However, I'm having issues whenever I try to include and compile GApps. I can confirm that Android-x86 will build successfully on its own, but when I include GApps in my device.mk, I get a lot of these after every GApps app build:
End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive.

I then get these for each app before it all fails:
Unable to open 'out/target/product/x86_64/obj/APPS/PixelLauncherIcons_intermediates/package.apk' for verification

I've got the complete log, my device.mk, etc, but does anyone know what's up?

arthur....@gmail.com

unread,
Jan 3, 2020, 11:39:08 AM1/3/20
to qubes-users
Here are my modified instructions. There were a few tweaks such as adding a few more packages to get via apt, editing a different manifest, and retrieving OpenGapps via git lfs:

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


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


# Add the following repository to /etc/apt/sources.list (openjdk-8 is required, but it is not available under Debian 10):
# 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-8-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
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"
repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b oreo-x86 -m android-x86-8.1-r1.xml


# 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:
<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" />


# Download sources:
repo sync --no-tags --no-clone-bundle --force-sync -j$( nproc --all )


# 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 awhile:
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:
. build/envsetup.sh
lunch android_x86_64-userdebug


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


# You need to edit these parameters:
XEN=yes
XEN_BLKDEV_BACKEND=yes
XEN_BLKDEV_FRONTEND=yes
XEN_NETDEV_BACKEND=no
XEN_NETDEV_FRONTEND=no
SECURITY_SELINUX_BOOTPARAM=yes
SECURITY_SELINUX_BOOTPARAM_VALUE=1
SECURITY_SELINUX_DISABLE=yes
DEFAULT_SECURITY_SELINUX=yes


# 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:
make -j$( nproc --all ) iso_img


# 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

While the ISO boots and installs and the mouse works fine, the system can't get past the initial Google first run wizard. After clicking the button to set up a new device (vs transferring from an existing phone), the screen turns black, and it doesn't go anywhere. It's still responsive - I can click on the back button, and it will get highlighted as if I had actually clicked it. However, nothing happens.

Thoughts?

christoph...@gmail.com

unread,
May 11, 2020, 10:20:57 PM5/11/20
to qubes-users
Hi, I'm also trying to build an ISO with gapps. I'm following the updated instructions, but I'm stuck at the configure kernel part, I don't understand what I am supposed to do in the menuconfig. And I don't know where to edit the parameters for XEN and SELINUX. Someone could provide me instructions about what to do ?
Thanks
.

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


# You need to edit these parameters:
XEN=yes
XEN_BLKDEV_BACKEND=yes
XEN_BLKDEV_FRONTEND=yes
XEN_NETDEV_BACKEND=no
XEN_NETDEV_FRONTEND=no
SECURITY_SELINUX_BOOTPARAM=yes
SECURITY_SELINUX_BOOTPARAM_VALUE=1
SECURITY_SELINUX_DISABLE=yes
DEFAULT_SECURITY_SELINUX=yes


# 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:
make -j$( nproc --all ) iso_img

Reply all
Reply to author
Forward
0 new messages