Package Details: qemu-android-x86 9.0.r2-2

Git Clone URL: https://aur.archlinux.org/qemu-android-x86.git (read-only, click to copy)
Package Base: qemu-android-x86
Description: Android-x86 environment via QEMU and VirGL
Upstream URL: http://www.android-x86.org/
Licenses: GPL2, Apache, custom:Creative Commons 3.0 Attribution Unported
Submitter: Refutationalist
Maintainer: Refutationalist
Last Packager: Refutationalist
Votes: 7
Popularity: 1.21
First Submitted: 2019-04-26 23:52
Last Updated: 2020-05-18 18:26

Latest Comments

1 2 Next › Last »

gesh commented on 2021-07-08 22:35

Hi, thanks for the package! Have some patches to contribute, most notably:

  • GUI deps should be optdeps
  • SVG icons are good enough, no need to convert to PNG
  • Removed privilege escalation code -- qemu docs explicitly recommend using mapped-xattr security model
  • Made qemu-android shellcheck-clean
From 719313210e219536b1fa3521af025a675fbcd9ee Mon Sep 17 00:00:00 2001
From: gesh <gesh@gesh.uni.cx>
Date: Thu, 8 Jul 2021 18:00:00 +0000
Subject: [PATCH 1/3] Clean up PKGBUILD (elim deps)

* Make gui depends optional
* Use raw svg icon instea of creating pngs
* Combine mkdir+install invocations into install
---
 PKGBUILD | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/PKGBUILD b/PKGBUILD
index 71eb367..7399fa1 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,13 +2,15 @@
 pkgname=qemu-android-x86
 _pkgver="9.0-r2"
 pkgver=9.0.r2
-pkgrel=2
+pkgrel=3
 pkgdesc="Android-x86 environment via QEMU and VirGL"
 arch=("x86_64")
 url="http://www.android-x86.org/"
 license=('Apache' 'GPL2' 'custom:Creative Commons 3.0 Attribution Unported')
-depends=('rxvt-unicode' 'zenity' 'qemu' 'hicolor-icon-theme')
-makedepends=('inkscape')
+depends=('qemu' 'hicolor-icon-theme')
+optdepends=(
+    'rxvt-unicode: for GUI support'
+    'zenity: for GUI support')
 install="qemu-android-x86.install"
 source=("android-x86-${_pkgver}.${arch}.rpm::https://osdn.net/frs/redir.php?m=constant&f=android-x86%2F71931%2Fandroid-x86-${_pkgver}.${arch}.rpm"
        "https://upload.wikimedia.org/wikipedia/commons/d/d7/Android_robot.svg"
@@ -21,21 +23,14 @@ sha256sums=('6e54e25d945e050cf6a6ad2ac3e0775add04b1d586989e29276499c8d11e629f'
             'e9524cdb27c57e6650af763b2231d67ff3e2beb12f52133e7e95eda4f16b0881'
             '8a5ed6a6c1a4dfd1c8af0ff5de48965ec2dc6b50f87e5f990d33c7025f63c8ec')

-#PKGEXT=".pkg.tar"
-
 package() {

-   mkdir -p $pkgdir/usr/share/android-x86 $pkgdir/usr/bin $pkgdir/usr/share/applications
-   install -m0644 $srcdir/android-${_pkgver}/* $pkgdir/usr/share/android-x86
-   install -m0644 $srcdir/usr/bin/qemu-android $pkgdir/usr/share/android-x86/original.qemu-android
-   install -m0644 $srcdir/config $pkgdir/usr/share/android-x86
-   install -m0644 $srcdir/qemu-android.desktop $pkgdir/usr/share/applications
-   install -m0755 $srcdir/qemu-android $pkgdir/usr/bin/qemu-android
+    install -Dm0644 "$srcdir/config" "$srcdir/android-${_pkgver}"/* -t "$pkgdir/usr/share/android-x86"
+    install -Dm0644 "$srcdir/usr/bin/qemu-android" "$pkgdir/usr/share/android-x86/original.qemu-android"
+    install -Dm0644 "$srcdir/qemu-android.desktop" "$pkgdir/usr/share/applications/qemu-android.desktop"
+    install -Dm0755 "$srcdir/qemu-android" "$pkgdir/usr/bin/qemu-android"

-   iconsizes=(16 32 64 128 256 512)
-   for size in "${iconsizes[@]}"; do
-       mkdir -p $pkgdir/usr/share/icons/hicolor/${size}x${size}/apps
-       inkscape -o $pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/qemu-android.png -w $size -h $size $srcdir/Android_robot.svg
-   done
+    install -Dm0644 "$srcdir/Android_robot.svg" \
+        "$pkgdir/usr/share/icons/hicolor/scalable/apps/qemu-android.svg"

 }
-- 
2.32.0
From 35b12931dd8744e0db070ee751769e4d8ab5ece5 Mon Sep 17 00:00:00 2001
From: gesh <gesh@gesh.uni.cx>
Date: Thu, 8 Jul 2021 18:00:00 +0000
Subject: [PATCH 2/3] Remove need for sudo

Use security_model=mapped-xattr for 9p virtfs, as recommended by docs
Model used before this (passthrough) would use same UID/GID as in guest,
potentially clashing with host UID/GID
https://wiki.qemu.org/Documentation/9psetup
---
 PKGBUILD     | 2 +-
 qemu-android | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/PKGBUILD b/PKGBUILD
index 7399fa1..4f65755 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -19,7 +19,7 @@ source=("android-x86-${_pkgver}.${arch}.rpm::https://osdn.net/frs/redir.php?m=co
        "qemu-android.desktop")
 sha256sums=('6e54e25d945e050cf6a6ad2ac3e0775add04b1d586989e29276499c8d11e629f'
             '8c80b881727efc8831c8ef53806e7c1d0427607e145aae09061c4870b6cd402f'
-            'e53911e378a6048d88d4fbaeb870c58f57c44142450527ee99b3c12baa15099a'
+            '9d856c33ed81529b2a07230e8a2e9586d4fa515eea713941259f6ae46274065d'
             'e9524cdb27c57e6650af763b2231d67ff3e2beb12f52133e7e95eda4f16b0881'
             '8a5ed6a6c1a4dfd1c8af0ff5de48965ec2dc6b50f87e5f990d33c7025f63c8ec')

diff --git a/qemu-android b/qemu-android
index 3ae16d3..5ae2885 100644
--- a/qemu-android
+++ b/qemu-android
@@ -39,7 +39,6 @@ else
 fi

 # Set meaningful defaults
-IN_SUDO=0
 IN_TERMINAL=0
 RAM=${RAM:-2048}
 CORES=${CORES:-2}
@@ -73,8 +72,7 @@ if [ $DATA == "none" ]; then
    DATA_CMDLINE=""
 elif [ -d $DATA ]; then
    echo "9p mode selected."
-   IN_SUDO=1
-   DATA_QEMULINE="-virtfs local,id=data,path=${DATA},security_model=passthrough,mount_tag=data"
+   DATA_QEMULINE="-virtfs local,id=data,path=${DATA},security_model=mapped-xattr,mount_tag=data"
    DATA_CMDLINE="DATA=9p"
 else
    # sudo should only be needed for 9p, if KVM is set up right
@@ -135,7 +133,6 @@ do_qemu() {
    DO_CMD=""

    [ $IN_TERMINAL -eq 1 ] && [ $GUI -eq 1 ] && DO_CMD+="$URXVT -title Android-x86_Console -e "
-   [ $IN_SUDO -eq 1 ] && DO_CMD+="/usr/bin/sudo "
    DO_CMD+=$QEMU


-- 
2.32.0
From b61ae8e472952146d231f7871fda731b5b0c94e7 Mon Sep 17 00:00:00 2001
From: gesh <gesh@gesh.uni.cx>
Date: Thu, 8 Jul 2021 18:00:00 +0000
Subject: [PATCH 3/3] XDGify, clean up logic

---
 PKGBUILD                 |  2 +-
 qemu-android             | 19 ++++++++++++-------
 qemu-android-x86.install |  4 ++--
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/PKGBUILD b/PKGBUILD
index 4f65755..c693ac0 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -19,7 +19,7 @@ source=("android-x86-${_pkgver}.${arch}.rpm::https://osdn.net/frs/redir.php?m=co
        "qemu-android.desktop")
 sha256sums=('6e54e25d945e050cf6a6ad2ac3e0775add04b1d586989e29276499c8d11e629f'
             '8c80b881727efc8831c8ef53806e7c1d0427607e145aae09061c4870b6cd402f'
-            '9d856c33ed81529b2a07230e8a2e9586d4fa515eea713941259f6ae46274065d'
+            'e000cae3acd841686e8765c32bc203e8764f556e8a2bb32892d437bf3cad11b3'
             'e9524cdb27c57e6650af763b2231d67ff3e2beb12f52133e7e95eda4f16b0881'
             '8a5ed6a6c1a4dfd1c8af0ff5de48965ec2dc6b50f87e5f990d33c7025f63c8ec')

diff --git a/qemu-android b/qemu-android
index 5ae2885..ca85763 100644
--- a/qemu-android
+++ b/qemu-android
@@ -30,19 +30,22 @@ nope() {
    exit 1
 }

+SYSCONFIG=/usr/share/android-x86/config
+CONFIGDIR="${XDG_CONFIG_HOME:-$HOME/.config}"/android-x86
+CONFIG="$CONFIGDIR"/config

 # Check for config file, source
-if [ -e $HOME/.config/android-x86/config ]; then
-   . $HOME/.config/android-x86/config
+if [ -r "$CONFIG" ]; then
+   . "$CONFIG"
 else
-   nope "Copy /usr/share/android-x86/config to ${HOME}/.config/android-x86 and modify.  It explains things."
+   nope "Copy $SYSCONFIG to $CONFIGDIR and modify. It explains things."
 fi

 # Set meaningful defaults
 IN_TERMINAL=0
 RAM=${RAM:-2048}
 CORES=${CORES:-2}
-DATA=${DATA:-"${HOME}/.config/android-x86/data.img"}
+DATA=${DATA:-"$CONFIGDIR/data.img"}
 DATASIZE=${DATASIZE:-2048}
 CPU=${CPU:-"host"}
 NETPORT=${NETPORT:-47000}
@@ -56,9 +59,11 @@ INITRD=${INITRD:-"/usr/share/android-x86/initrd.img"}
 RAMDISK=${RAMDISK:-"/usr/share/android-x86/ramdisk.img"}
 KERNEL=${KERNEL:-"/usr/share/android-x86/kernel"}

-if [ ! -e $SYSTEMIMG ] || [ ! -e $INITRD ] || [ ! -e $RAMDISK ] || [ ! -e $KERNEL ]; then
-   nope "System images aren't installed.  Check your android-x86 package."
-fi
+for i in "$SYSTEMIMG" "$INITRD" "$RAMDISK" "$KERNEL"; do
+   if [ ! -e "$i" ]; then
+       nope "System image $i isn't installed.  Check your android-x86 package."
+   fi
+done

 #QEMU=qemu-system-${QEMU_ARCH}
 # Archlinux is x86_64 only
diff --git a/qemu-android-x86.install b/qemu-android-x86.install
index 9d44659..1a4def8 100644
--- a/qemu-android-x86.install
+++ b/qemu-android-x86.install
@@ -2,8 +2,8 @@ post_install() {
   gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
   update-desktop-database -q
   echo "To use, per user:"
-  echo "   mkdir ~/.config/android-x86 &&"
-  echo "       cp /usr/share/android-x86/config ~/.config/android-x86"
+  echo "$ mkdir ~/.config/android-x86 && \\"
+  echo "  cp /usr/share/android-x86/config \$XDG_CONFIG_HOME/android-x86"
   echo "And then edit the config file to taste."
 }

-- 
2.32.0

viperML commented on 2021-05-28 08:34

I integrated the changes to the script to unsquash the system.sfs into a system.img, which is copied into the user's directory, as in the comment by jwty. And changed the ports to enable ADB support out of the box:

https://github.com/viperML/qemu-android-x86

Khaithang commented on 2021-05-17 20:05

the links in /system/bin/enable_nativebridge

aren't working except urls[3]= http://tinyurl.com/y6azmjas which happens to be for houdini9_y (32 bit ARM support). Links:

urls[0]=http://t.cn/EJrmzZv
urls[1]=http://t.cn/EJrmYMH
urls[2]=http://t.cn/EJrmrA7

seems to be some chinese servers and aren't working.

Links:

#houdini9_x
urls[3]=http://tinyurl.com/y3nagyza

and

#houdini9_z(Aarch64)
urls[5]=http://tinyurl.com/y6g6cx27

tells that the files are not there!. kindly check if the links are proper or not. Thanks

jwty commented on 2021-05-10 14:33

Workaround for getting read-write access to /system, without having to mess with initrd –

First, unsquashfs the system.sfs file provided by this package, move resulting .img file somewhere safe and then set SYSTEMIMG path in qemu-android config file to its path, for example SYSTEMIMG="$HOME/.config/android-x86/system.img".

Then you will need to modify qemu-android script from this package, by removing readonly option from line 150.

Then boot android and remount system as read-write with mount -o rw,remount /system command and create two files (for example with vi provided by Android-x86):

console:/ # cat /system/etc/init/remount-system.rc                             
on property:sys.boot_completed=1
    start remount-system
service remount-system /system/bin/remount-system
    user root
    oneshot
console:/ # cat /system/bin/remount-system                                     
#!/system/bin/sh
mount -o rw,remount /system

Lastly chmod +x /system/bin/remount-system and reboot, now /system should be read-writeable. If you need to use arm native bridge add /system/bin/enable_nativebridge to /system/bin/remount-system since from my observations it has to be re-enabled on each reboot. Note that in my case enable_nativebridge failed to download houdini library and I had to download it manually.

Janhouse commented on 2020-12-18 23:57

Could you please add option to remove ",format=raw,readonly" from system image line? It is handy to convert the image to qcow2 format and make it writable if necessary.

cosarara97 commented on 2020-12-09 20:22

How does one cleanly shut down the emulator? That is, is there any way to simulate the power button long press and access the shutdown menu?

Zeioth commented on 2020-09-05 01:29

It's been so easy to configure! Thank you for making this package!!

archmanjaro commented on 2020-09-03 17:36

I have installed the package in "Manjaro-KDE", everything is working fine but the audio/sound is crackling. It is horrible! please help me!

candybar commented on 2020-09-03 00:44

Is there a way to use a different resolution? If it's not 1280x720x32 then all I get is a black screen. I don't see anything useful from console :( Thanks. Version : 9.0.r2-2 Update/Edit: I am able to get normal display using VIDEO="768x1280". The mouse/cursor is offset incorrectly, however full screening the window fixes the mouse.

Popolon commented on 2020-05-17 15:43

inkscape 1.0 doesn't support -z anymore, I don't know what this option was for. -e is replaced by -o to export file name, so the line to build the icons in PKGBUILD, should be now : inkscape -o $pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/qemu-android.png -w $size -h $size $srcdir/Android_robot.svg