Skip to content

Commit

Permalink
app-emulation/anbox updates and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shiznix committed Apr 21, 2020
1 parent 6bd1f1d commit 09eb356
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 25 deletions.
8 changes: 4 additions & 4 deletions app-emulation/anbox/Manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ AUX 80-anbox-bridge.network 87 BLAKE2B 8b06e0825406adc620caae4554ae06ea2bf877c3b
AUX 99-anbox.rules 61 BLAKE2B c4ca8c09518dc4721a0a844ba4e1280c859d1e67954ff638c7e41dc7bdb21a941657ca9a0ab363b4d032b22535656f2c818bfd4d48628deaae345cb333cd56e9 SHA512 4d957368000242fcd713fd1db2fbfbcd2027012cfdbf87bd25d971c90f3fe8a9729430874feaf28d1e4270a60124a0e9c0cd44f9e02e91ef71f6503e0c287717
AUX anbox-bridge.sh 5133 BLAKE2B 954d8d689f69aa834a27b1305840a34d32f97022673689ba877a6445a8869afa5073b47707efc5fc760f4060519da22bad481d581e5bdf17aa40c1df07d5e833 SHA512 c69a8f540621edc7606060a5e3b870eeeb78c24251840b3d2aa334f9be5f926b4e2e512d9e1c04ed739c2a720870ddd5f1abb1b0fc7daf8f6563de3517d5e8d6
AUX anbox-container-manager.service 171 BLAKE2B 72af6ee7d60c55986c8704a8cbd2a520a1f248a3345109530c10a156becf1deb314646bd543c2871bd1ac0217348c187196689455af467bd795edcf6d1562237 SHA512 0f2dfa1437772f53395eb3a2a1ca951692b3633e01f1e1fb5befdc154bcc4b7c77d7362e488ad09df96da34a729be527cb2f8d7ec4fadd9af041e3f4aac5c480
AUX anbox-launch 642 BLAKE2B 6aa8d5070e1dd62da05b1a5dd32b3dd7ef90254c023426c0129cad6acc402898a6142e74ead2ba7c183f37e2eb3c1e6bb1c97dd86722fb37168b7420ca7b3450 SHA512 97cf6a3d0848c29be4bb0870204f8a1ebf938a8faa5869ba9551e727ca10ecdc9119cf0a7cf357df5f76764a182327af8769aa7507053189fc328257e4362480
AUX anbox-lxc_mk-subuid_gid 429 BLAKE2B 0b4a1f7bfa7b40b5bc7d000df9a4abe8c9136acd0c4245152bafc08a566b06a814c2ba4df297df809af7050f35e4b40b1cbad1ba7a474b7992e24d38ca21687b SHA512 de23006f8507c459e300b8ffbc0e52fbb82c229e820cfc0b90f7135d010a3bec6bb2e23eacb9172301bee3d4ff44612dcac4d6a6b932d95f93c9eb2a1f9b329c
AUX anbox-launch 476 BLAKE2B 03fbb9a6432057e66b867f30986cd0ecedee7fe33014e316615192e3713110b11de325c5c6c83927da1c598b249df0f262dd6b966c467939ece50cbda245ba89 SHA512 55c3e0a9868699119ad2215caf58f2fb89c893362e0461b307b90e0839201f8cbe45003757099d9b58a2103ef7321b1669bcdb18f8d244a8f91cd40e1b848215
AUX anbox-lxc_mk-subuid_gid 427 BLAKE2B 7135b82d0f7c4c294c68af010e5c2ee25294fce129f013e4adf45b293a544177e92d5ed5023b45e5f452e3c5867fc39d3c493af87e432f305320093069885850 SHA512 56141dd1c28a93c610531467db0630cbd9f5d148156ad120c63c68f10f0f6f0745f0229454896978d2684b94cba9250388d65c92f000c1d4d17e8da4b9b5a3c3
AUX anbox.desktop 129 BLAKE2B db06248f743301f049261bf55b92780012cef9b78fac8e0853d28d10144a7662bc237ef05b4d477689922b4d766cb98ab1daf66e0db92e5ccc6f946d90fbf279 SHA512 fbc96b177c50372592cffa13ba43feb4aaef80160d12707d097a42a0da725d7cef99cdd2d99133370352541414e6977d739ba7b2c36eec17ebbccc40bc9745b5
AUX media_codecs.xml 4276 BLAKE2B 6d24607e94bfaf0a2c60beaba20d533ca91012d1bdcc9591059e77c690e6ab7a8876414c31c3f68382bfeb90d5c10c2358bcdda1954e9485cf3089bbdc42a282 SHA512 1e38135afd3f17f1fca98492182ec04ee87bcc26bf3980c46350d7618b07558246fa1e286246b7c2710a522b1d32c1c22ac809afb8b74ba4db7e032897594e13
AUX media_codecs.xml 4647 BLAKE2B 6d17fdafc2495a76217afb13d3399dcba79bad2ff3a60ccd8f9e371bcd1f49cb50ae17e6064b1f61b9126a8b9acd27fc7c8f8c9ff58dad9a987b721bc727cd28 SHA512 0e814d7b6f6621b75e42cc8219a351df99d08d50b9d960908e8fdac009ad997947efeef917b43e57911ec160e100cb512133d4e71fee198fcbe277f6399510d6
DIST android_amd64.img 325902336 BLAKE2B 8dfe0da49e55777ae516439a46ae7db97988492ca9d270b297eed2991c666a69960f2aa5fa9eb52969e4b6e27d55cfd876bfbd4181aa703c90483abf713f17f8 SHA512 eee965a62ad266ca8447b3b202dbfc9b74227f98bbd6e736bd4d1531562cc3e0f232770e7bd2f874c8d10ecdcaa282417cd8b9d0ccfb035d6b13e64a1c1711d9
DIST houdini_y.sfs 37728256 BLAKE2B 5749b18605b79d67aa695c63b9d22d3d469c418520d56e41c59ff699c8b78e33d29aa5388d91c09dc963f0bee6920fc2d7f625bb6b6cc8247108daa2f3d66f6e SHA512 5aa84f38a2ca53736591d4e9cacdb015863f367b3a8c408b2ffbf174e37251763c9fd94da5330f8baf10606d907f32ac883a0ac6f5dfcbe90aa25542079b28d8
DIST houdini_z.sfs 37253120 BLAKE2B 7b6150f104c33eb6198e64b81fc32dd2a8fc373cdffc5dfefab503c0814a637cd517bc3812087ee872d79c8401d29d9bad6ffdee58f6d342bcbfac0f8919f68d SHA512 eceb6b3da1ca547bce71d74ed980bcea248bdc53105126b5a1ff0e3148fc00853d64a15c5925bea0982adfc28fc049ad6566543a8213dab68948ab42d9a3f074
EBUILD anbox-9999.2018.07.19-r9.ebuild 13433 BLAKE2B d507207617afcbc4be263207c35b9c702b33248c288f81384dc40c748a91ebbbe4ad6db821f9afc64b6a165bfffad11706c660519f3462ea45bc0cc6ee6a9f6f SHA512 2f16f5f36ebda40b427f30033d203dc1fa53eeb59f76ba6344e8f054587be675d2d8f3568a3496bb4755b8c8c3033fbc1773773c32f9e4bca1137508b61ddd0c
EBUILD anbox-9999.2018.07.19-r10.ebuild 14766 BLAKE2B 1075bf979cc9dad7c0894d54ea88d128118168d473107339b0289204bbb960889a213de1538e38f0b35f382026c1c8371d7cdfd3db3ee6b64d1b93338051bfb4 SHA512 c6bc55d6dc79b2be04d634792ca958bb398bc8b515130ef1a18e89122896ee49569c502a3ea1fe16bfa7cf772d04220cb3d4e5360e0c131a9dde05cff1640bf2
MISC metadata.xml 640 BLAKE2B 4cb5e6395690d380d841639cb632f2d6497e79c98974b68c9bc4f14fce0863ba16780579080740d6bfb99672b11b4a7c736fad940eada38dea89512e986c1638 SHA512 9ffa5c13b22b3888eedd06a7557640c1a577d54582c6692269b3e4a7ba22b9f31fde571ea75e37c66838ea0df2f01a7e6af56b158df9dc97c361e626873b6beb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RESTRICT="mirror"
# For fperms to be correct inside the Anbox container, LXC must start the container as 'unprivileged' #
# Otherwise fperms will appear corrupt as 'u1_<uid>' and 'u1_<gid>' #
# LXC hardcodes the use of sys-apps/shadow 'newuidmap' and 'newgidmap' (if they exist on the host) to map UID/GID from host to container #
# Anbox usually run confined inside a 'snap' environment, relies on LXC not detecting 'newuidmap' and 'newgidmap' on the host system, #
# Anbox usually runs confined inside a 'snap' environment, so relies on LXC not detecting 'newuidmap' and 'newgidmap' on the host system, #
# leading to LXC then falling through to directly setup UID/GID mapping itself #
# eliminating the need for correct setup of /etc/subuid and /etc/subgid files #
# DEBUGGING:
Expand Down Expand Up @@ -61,7 +61,7 @@ DEPEND="${RDEPEND}
dev-libs/protobuf
media-libs/glm
media-libs/libsdl2[wayland?,X?]
media-libs/mesa[egl,gles2]
>=media-libs/mesa-19.3.5[egl,gles2]
media-libs/sdl2-image
sys-apps/dbus
sys-libs/libcap
Expand Down Expand Up @@ -151,7 +151,6 @@ src_install() {
# 'anbox-launch' wrapper script to start 'session-manager' and anbox appmgr #
exeinto /usr/bin
doexe "${FILESDIR}/anbox-launch"
doexe "${FILESDIR}/anbox-lxc_mk-subuid_gid"

# anbox.desktop and icon #
insinto /usr/share/applications
Expand All @@ -175,42 +174,61 @@ src_install() {

pkg_postinst() {
if ! use privileged; then
if [ ! -e /etc/subuid ] || [ ! -e /etc/subuid ]; then
elog
elog "Oops...no /etc/subuid or /etc/subgid files have been detected on the system"
elog "LXC unprivileged container support requires permission mapping files /etc/subuid and /etc/subgid so that it can use"
elog " sys-apps/shadow's 'newuidmap' and 'newgidmap' to map UIDs/GIDs from the host to the container"
elog " See here -> https://stgraber.org/2014/01/17/lxc-1-0-unprivileged-containers/"
elog "TLDR? Here is an example of /etc/subgid and /etc/subuid files (both have the same content):"
elog " root:100000:65536"
elog " <username>:100000:65536"
elog "There is a helper script /usr/bin/anbox-lxc_mk-subuid_gid which will create the correct"
elog " /etc/subuid and /etc/subgid content based on Anbox's /var/lib/anbox/containers/default/config"
elog " You may need to run 'anbox session-manager' to create /var/lib/anbox/containers/default/config first"
if [ ! -s /etc/subuid ] || [ ! -s /etc/subgid ] && [ -e /usr/bin/newuidmap ]; then
elog
elog "Oops...$(which newuidmap) and $(which newgidmap) have been detected, but no /etc/subuid or /etc/subgid files have been detected on the system"
elog "LXC container user support (unprivileged) needs to map UIDs/GIDs from the host to the container"
elog "By default LXC does so using sys-apps/shadow's 'newuidmap' and 'newgidmap' applications configured by /etc/subuid and /etc/subgid"
elog " which can sometimes be quite complex to setup, particularly on multi-user systems (YMMV)"
elog "The preferred method is to make 'newuidmap' and 'newgidmap' inaccessible to LXC"
elog " This forces LXC to more robustly handle the UID/GID host<->container mapping itself"
elog " Anbox make them inaccessible on their preferred Ubuntu platform by running inside a SNAP environment"
elog " On Gentoo we can do the following (as root):"
elog " # echo 'EXTRA_ECONF=\"--enable-subordinate-ids=no\"' >> /etc/portage/env/remove-newsuidmap"
elog " # echo 'sys-apps/shadow remove-newsuidmap' >> /etc/portage/package.env/sys-apps_shadow-remove-newsuidmap"
elog " # emerge -1 sys-apps/shadow"
elog " NB: This method will remove 'newuidmap' and 'newgidmap', so if you need those to be present"
elog " for other purposes, then you'll need to manage the /etc/subuid and /etc/subgid method"
fi
fi

elog
elog "To run Anbox, as root:"
elog " # systemctl start anbox-container-manager"
if linux_chkconfig_present ANDROID_BINDERFS; then
elog " # mkdir /dev/binderfs"
elog " # mount -t binder none /dev/binderfs"
elog " # OR place the entry into /etc/fstab"
elog " # binderfs /dev/binderfs binder defaults 0 0"
fi
elog "Then as desktop user:"
elog " $ EGL_PLATFORM=\$XDG_SESSION_TYPE anbox session-manager --gles-driver=host"
elog " $ anbox session-manager --gles-driver=host"
elog " $ anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity"
if use softrender; then
elog "To run Anbox using software rendering, run 'session-manager' as follows, as desktop user:"
elog " $ ANBOX_FORCE_SOFTWARE_RENDERING=true EGL_PLATFORM=\$XDG_SESSION_TYPE anbox session-manager --gles-driver=host"
elog " $ ANBOX_FORCE_SOFTWARE_RENDERING=true anbox session-manager --gles-driver=host"
fi
elog
elog "To install APKs: 'adb install myapp.apk'"
elog "To copy files: 'adb push somefile /sdcard'"
elog
elog "If clicking on an installed app inside Anbox doesn't display it's window,"
elog " you may need to instead run Anbox in 'Single Window Mode', example:"
elog " $ anbox session-manager --gles-driver=host --single-window --window-size=1024,768"
elog
elog "When trying to run the stock Android Music app it will crash"
elog " This is due to https://github.com/anbox/anbox/issues/68"
elog " Solution: Install another Music player from Google's Playstore"

if use playstore; then
elog
elog "To install Google Playstore and ARM app support, close any instances of Anbox and execute:"
elog " emerge --config =${CATEGORY}/${PF}"
elog " This will download and install the latest GoogleApps into Anbox's default android.img"
elog
elog "Please note that Anbox only supports GLESv1/GLESv2"
elog "As more Playstore apps/games move up to GLESv3 they may no longer work until Anbox starts supporting GLESv3"
elog " (see https://github.com/anbox/anbox/issues/246)"
fi
}

Expand Down
3 changes: 1 addition & 2 deletions app-emulation/anbox/files/anbox-launch
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

# Always use the host's GLES driver otherwise will cause the following error: #
# anbox "eglCreateSyncKHR: error 0x3004 (EGL_BAD_ATTRIBUTE)"
# Specify EGL_PLATFORM as Mesa needs a working display to auto-detect it, which doesn't get provided until later from "anbox launch" #

if [ -z "$(ps aux | grep 'anbox session-manager' | grep -v grep)" ]; then
EGL_PLATFORM=$XDG_SESSION_TYPE anbox session-manager --gles-driver=host &
anbox session-manager --gles-driver=host &
sleep 5s
fi
anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
4 changes: 2 additions & 2 deletions app-emulation/anbox/files/anbox-lxc_mk-subuid_gid
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Generates suitable content for LXC's /etc/subuid and /etc/subgid lxc.id_map permission files #
# using UID/GIDs that Anbox is expecting from it's generated /var/lib/anbox/containers/default/config LXC config #

grep lxc.id_map /var/lib/anbox/containers/default/config | awk '{print "root:"$5":"$6}' | uniq && \
grep lxc.id_map /var/lib/anbox/containers/default/config | awk '{print "<username>:"$5":"$6}' | uniq
grep lxc.idmap /var/lib/anbox/containers/default/config | awk '{print "root:"$5":"$6}' | uniq && \
grep lxc.idmap /var/lib/anbox/containers/default/config | awk '{print "<username>:"$5":"$6}' | uniq
5 changes: 5 additions & 0 deletions app-emulation/anbox/files/media_codecs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ a texture and possibly other code, so just DON'T USE THIS QUIRK.
<MediaCodec name="OMX.google.g711.alaw.decoder" type="audio/g711-alaw" />
<MediaCodec name="OMX.google.g711.mlaw.decoder" type="audio/g711-mlaw" />
<MediaCodec name="OMX.google.vorbis.decoder" type="audio/vorbis" />
<MediaCodec name="OMX.google.opus.decoder" type="audio/opus" />
<MediaCodec name="OMX.google.wma.decoder" type="audio/wma" />
<MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" />
<MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" />
<MediaCodec name="OMX.google.h264.decoder" type="video/avc" />
Expand All @@ -96,6 +98,9 @@ a texture and possibly other code, so just DON'T USE THIS QUIRK.
<MediaCodec name="OMX.google.amrwb.encoder" type="audio/amr-wb" />
<MediaCodec name="OMX.google.aac.encoder" type="audio/mp4a-latm" />
<MediaCodec name="OMX.google.flac.encoder" type="audio/flac" />
<MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es" />
<MediaCodec name="OMX.qcom.video.encoder.h263" type="video/3gpp" >
<MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8" />
<MediaCodec name="OMX.google.vp9.encoder" type="video/x-vnd.on2.vp9">
</Encoders>
</MediaCodecs>

0 comments on commit 09eb356

Please sign in to comment.