From d3c369bc4381ee414d585777a426f14d4cfcd19d Mon Sep 17 00:00:00 2001 From: NotKit Date: Tue, 2 Oct 2018 05:09:28 +0000 Subject: [PATCH] Update libhybris and add more related packages --- hybris/drihybris/APKBUILD | 32 +++++++ hybris/drihybrisproto/APKBUILD | 17 ++++ hybris/glamor-hybris/APKBUILD | 39 ++++++++ ...1-EGL-platform-based-on-wayland-code.patch | 89 +++++++++++-------- hybris/libhybris/APKBUILD | 44 +++++---- hybris/libhybris/libhybris-egl.post-install | 6 ++ hybris/lxc-android/APKBUILD | 40 +++++++++ hybris/lxc-android/lxc-android.init | 56 ++++++++++++ hybris/lxc-android/lxc-android.post-install | 20 +++++ hybris/lxc-android/lxc-android.sh | 4 + hybris/lxc-android/pre-start.sh | 9 ++ .../30-modules-hybris.conf | 4 + hybris/xf86-video-hwcomposer/APKBUILD | 75 ++++++++++++++++ 13 files changed, 385 insertions(+), 50 deletions(-) create mode 100644 hybris/drihybris/APKBUILD create mode 100644 hybris/drihybrisproto/APKBUILD create mode 100644 hybris/glamor-hybris/APKBUILD create mode 100644 hybris/libhybris/libhybris-egl.post-install create mode 100644 hybris/lxc-android/APKBUILD create mode 100644 hybris/lxc-android/lxc-android.init create mode 100644 hybris/lxc-android/lxc-android.post-install create mode 100644 hybris/lxc-android/lxc-android.sh create mode 100644 hybris/lxc-android/pre-start.sh create mode 100644 hybris/xf86-video-hwcomposer/30-modules-hybris.conf create mode 100644 hybris/xf86-video-hwcomposer/APKBUILD diff --git a/hybris/drihybris/APKBUILD b/hybris/drihybris/APKBUILD new file mode 100644 index 000000000..12cac36a5 --- /dev/null +++ b/hybris/drihybris/APKBUILD @@ -0,0 +1,32 @@ +pkgname=drihybris +pkgver=1.0_git20171130 +pkgrel=0 +_commit=fbaf21e7cb343e0b7cd29f256ec28c46c01c07b8 +pkgdesc="custom DRI3-based Xorg extension for use with libhybris" +url="https://github.com/NotKit/drihybris" +arch="armhf aarch64" +license="MIT" +subpackages="$pkgname-doc $pkgname-dev" +depends_dev="drihybrisproto" +makedepends="autoconf automake libtool util-macros + xorg-server-dev libxi-dev drihybrisproto" +source="$pkgname-$_commit.tar.gz::https://github.com/NotKit/drihybris/archive/$_commit.tar.gz" + +builddir="$srcdir"/$pkgname-$_commit + +build() { + cd "$builddir" + export LDFLAGS="$LDFLAGS -Wl,-z,lazy" + ./autogen.sh \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + make +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install + install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING +} +sha512sums="273fad45bfee1211195eff8dad979c97edda7440adc6da766346ff727216cad495d01132e20bdabc33b4e95b7420cf4d6c3c64b95ab5020ed5de5f58ad72ceb2 drihybris-fbaf21e7cb343e0b7cd29f256ec28c46c01c07b8.tar.gz" diff --git a/hybris/drihybrisproto/APKBUILD b/hybris/drihybrisproto/APKBUILD new file mode 100644 index 000000000..928fe0a07 --- /dev/null +++ b/hybris/drihybrisproto/APKBUILD @@ -0,0 +1,17 @@ +pkgname=drihybrisproto +pkgver=1.0_git20171130 +pkgrel=0 +_commit=fbaf21e7cb343e0b7cd29f256ec28c46c01c07b8 +pkgdesc="X11 DRIHYBRIS protocol" +url="https://github.com/NotKit/drihybris" +arch="noarch" +license="MIT" +options="!check" +depends="" + +source="$pkgname-$_commit.h::https://raw.githubusercontent.com/NotKit/drihybris/$_commit/src/$pkgname.h" + +package() { + install -Dm644 "$srcdir/$pkgname-$_commit.h" "$pkgdir/usr/include/X11/extensions/$pkgname.h" +} +sha512sums="233a07afb46d1c71062c12131022b23649a6355949c6dcbda5d1fb709ab6cca79e391cc7e29f02542e69ebb25fde8ad09280cbcb166f348b01bccbb68f540092 drihybrisproto-fbaf21e7cb343e0b7cd29f256ec28c46c01c07b8.h" diff --git a/hybris/glamor-hybris/APKBUILD b/hybris/glamor-hybris/APKBUILD new file mode 100644 index 000000000..c287d1bd7 --- /dev/null +++ b/hybris/glamor-hybris/APKBUILD @@ -0,0 +1,39 @@ +pkgname=glamor-hybris +pkgver=1.0_git20180114 +pkgrel=0 +_commit=d15da5304b6b15bc12864041267880abb5565d0c +pkgdesc="glamor Xserver 2D acceleration modified to work with libhybris drivers" +url="https://github.com/NotKit/glamor-hybris" +arch="armhf aarch64" +license="MIT" +subpackages="$pkgname-doc $pkgname-dev" +depends= +makedepends="autoconf automake util-macros libtool + xorg-server-dev libxi-dev fontsproto randrproto + videoproto renderproto drihybrisproto drihybris-dev libepoxy-dev + libhybris-dev" + +source="$pkgname-$_commit.tar.gz::https://github.com/NotKit/glamor-hybris/archive/$_commit.tar.gz" + +builddir="$srcdir"/$pkgname-$_commit + +build() { + cd "$builddir" + export LDFLAGS="$LDFLAGS -Wl,-z,lazy" + export CPPFLAGS="$CPPFLAGS -I/usr/include/android-7.1" + + ./autogen.sh \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --enable-glamor-gles2 + make +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install + mv "$pkgdir/usr/include/xorg/glamor.h" "$pkgdir/usr/include/xorg/glamor-hybris.h" + install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING +} +sha512sums="3dbeb9ca69a425f0d24bedb201d598fec7103c43fdff2b0cda491db2b0f82a58116677e410051d98c505ca651a8e3f2361fd478d37a96e05b87b4bbb3a472916 glamor-hybris-d15da5304b6b15bc12864041267880abb5565d0c.tar.gz" diff --git a/hybris/libhybris/0003-Implement-X11-EGL-platform-based-on-wayland-code.patch b/hybris/libhybris/0003-Implement-X11-EGL-platform-based-on-wayland-code.patch index fd7b90236..0b6dfbf59 100644 --- a/hybris/libhybris/0003-Implement-X11-EGL-platform-based-on-wayland-code.patch +++ b/hybris/libhybris/0003-Implement-X11-EGL-platform-based-on-wayland-code.patch @@ -1,32 +1,32 @@ -From b9251827932545a455bfecea7b259eba5677c3bd Mon Sep 17 00:00:00 2001 +From ae11619430c59ba4a23acd8659157f43b863d2ed Mon Sep 17 00:00:00 2001 From: NeKit Date: Wed, 18 Oct 2017 23:12:51 +0300 Subject: [PATCH 3/3] Implement X11 EGL platform based on wayland code. -Allow window system to hook eglGetConfigAttrib (needed for X11 -EGL_NATIVE_VISUAL_ID) +* Allow window system to hook eglGetConfigAttrib (needed for X11 EGL_NATIVE_VISUAL_ID) -Use custom DRIHYBRIS Xorg extension for buffer sharing to Xorg/glamor when -possible +* Use custom DRIHYBRIS Xorg extension for buffer sharing to Xorg/glamor when possible + Gives huge speedup over XShmPutImage, but requires patched Glamor and DDX driver to + utilize it -Gives huge speedup over XShmPutImage, but requires patched Glamor and DDX driver -to utilize it +* Check for window resizes using Present extension when possible -Check for window resizes using Present extension when possible +* x11nativewindow: use same depth as target window for pixmap. + Call xcb_present_pixmap instead of xcb_copy_area to present pixmap --- - hybris/configure.ac | 1 + - hybris/egl/egl.c | 13 +- - hybris/egl/platforms/Makefile.am | 2 +- - hybris/egl/platforms/common/eglplatformcommon.cpp | 2 +- - hybris/egl/platforms/x11/Makefile.am | 43 ++ - hybris/egl/platforms/x11/eglplatform_x11.cpp | 235 +++++++ - hybris/egl/platforms/x11/x11_window.cpp | 728 ++++++++++++++++++++++ - hybris/egl/platforms/x11/x11_window.h | 201 ++++++ - hybris/egl/platforms/x11/xcb_drihybris.c | 167 +++++ - hybris/egl/platforms/x11/xcb_drihybris.h | 122 ++++ - hybris/egl/ws.c | 9 + - hybris/egl/ws.h | 2 + - 12 files changed, 1522 insertions(+), 3 deletions(-) + hybris/configure.ac | 1 + + hybris/egl/egl.c | 13 +- + hybris/egl/platforms/Makefile.am | 2 +- + .../platforms/common/eglplatformcommon.cpp | 2 +- + hybris/egl/platforms/x11/Makefile.am | 43 + + hybris/egl/platforms/x11/eglplatform_x11.cpp | 235 ++++++ + hybris/egl/platforms/x11/x11_window.cpp | 742 ++++++++++++++++++ + hybris/egl/platforms/x11/x11_window.h | 206 +++++ + hybris/egl/platforms/x11/xcb_drihybris.c | 167 ++++ + hybris/egl/platforms/x11/xcb_drihybris.h | 122 +++ + hybris/egl/ws.c | 9 + + hybris/egl/ws.h | 2 + + 12 files changed, 1541 insertions(+), 3 deletions(-) create mode 100644 hybris/egl/platforms/x11/Makefile.am create mode 100644 hybris/egl/platforms/x11/eglplatform_x11.cpp create mode 100644 hybris/egl/platforms/x11/x11_window.cpp @@ -390,10 +390,10 @@ index 0000000..001b733 +}; diff --git a/hybris/egl/platforms/x11/x11_window.cpp b/hybris/egl/platforms/x11/x11_window.cpp new file mode 100644 -index 0000000..4363e80 +index 0000000..26e8844 --- /dev/null +++ b/hybris/egl/platforms/x11/x11_window.cpp -@@ -0,0 +1,728 @@ +@@ -0,0 +1,742 @@ +/**************************************************************************************** + ** + ** Copyright (C) 2013 Jolla Ltd. @@ -440,8 +440,8 @@ index 0000000..4363e80 +void X11NativeWindow::resize(unsigned int width, unsigned int height) +{ + lock(); -+ this->m_defaultWidth = width; -+ this->m_defaultHeight = height; ++ this->m_defaultWidth = this->m_width = width; ++ this->m_defaultHeight = this->m_height = height; + unlock(); +} + @@ -489,6 +489,7 @@ index 0000000..4363e80 + + m_width = window_attributes.width; + m_height = window_attributes.height; ++ m_depth = window_attributes.depth; + + const char *env = getenv("HYBRIS_X11_FORCE_WIDTH"); + if (env != NULL) @@ -694,6 +695,7 @@ index 0000000..4363e80 + +void X11NativeWindow::finishSwap() +{ ++ static int serial = 0; + int ret = 0; + lock(); + @@ -707,7 +709,7 @@ index 0000000..4363e80 + m_lastBuffer = wnb; + wnb->busy = 1; + -+ fronted.push_back(wnb); ++ // fronted.push_back(wnb); + + m_damage_rects = NULL; + m_damage_n_rects = 0; @@ -717,9 +719,21 @@ index 0000000..4363e80 + if (wnb->pixmap == 0) + wnb->pixmap_from_buffer(m_connection, m_window); + -+ xcb_copy_area(m_connection, wnb->pixmap, m_window, m_xcb_gc, -+ 0, 0, 0, 0, /* src_x, src_y, dst_x, dst_y */ -+ m_width, m_height); ++ xcb_present_pixmap(m_connection, ++ m_window, ++ wnb->pixmap, ++ (uint32_t) serial++, ++ 0, /* valid */ ++ 0, /* update */ ++ 0, /* x_off */ ++ 0, /* y_off */ ++ None, /* target_crtc */ ++ None, ++ NULL, ++ XCB_PRESENT_OPTION_NONE, ++ 0, ++ 0, ++ 0, 0, NULL); + xcb_flush(m_connection); + + lock(); @@ -917,7 +931,7 @@ index 0000000..4363e80 + + X11NativeWindowBuffer *wnb; + -+ wnb = new ClientX11Buffer(m_alloc, m_width, m_height, m_format, m_usage); ++ wnb = new ClientX11Buffer(m_alloc, m_width, m_height, m_format, m_usage, m_depth); + m_bufList.push_back(wnb); + ++m_freeBufs; + @@ -1112,7 +1126,7 @@ index 0000000..4363e80 + drawable, + stride * height * 4, + this->width, height, stride, -+ 32, 32, ++ windowDepth, 32, + handle->numInts, + handle->numFds, + (const uint32_t *)(handle->data + handle->numFds), @@ -1124,10 +1138,10 @@ index 0000000..4363e80 +// vim: noai:ts=4:sw=4:ss=4:expandtab diff --git a/hybris/egl/platforms/x11/x11_window.h b/hybris/egl/platforms/x11/x11_window.h new file mode 100644 -index 0000000..cceaee5 +index 0000000..e5be070 --- /dev/null +++ b/hybris/egl/platforms/x11/x11_window.h -@@ -0,0 +1,201 @@ +@@ -0,0 +1,206 @@ +/**************************************************************************************** + ** + ** Copyright (C) 2013 Jolla Ltd. @@ -1191,6 +1205,7 @@ index 0000000..cceaee5 + int busy; + int youngest; + ANativeWindowBuffer *other; ++ int windowDepth; + xcb_pixmap_t pixmap; + + void pixmap_from_buffer(xcb_connection_t *connection, xcb_drawable_t drawable); @@ -1208,7 +1223,8 @@ index 0000000..cceaee5 + unsigned int width, + unsigned int height, + unsigned int format, -+ unsigned int usage) ++ unsigned int usage, ++ unsigned int windowDepth) + { + // Base members + ANativeWindowBuffer::width = width; @@ -1226,6 +1242,8 @@ index 0000000..cceaee5 + assert(alloc_ok == 0); + this->youngest = 0; + this->common.incRef(&this->common); ++ ++ this->windowDepth = windowDepth; + this->pixmap = 0; + } + @@ -1312,6 +1330,7 @@ index 0000000..cceaee5 + X11NativeWindowBuffer *m_lastBuffer; + unsigned int m_width; + unsigned int m_height; ++ unsigned int m_depth; + unsigned int m_format; + unsigned int m_defaultWidth; + unsigned int m_defaultHeight; @@ -1668,5 +1687,5 @@ index c4811c0..92b221a 100644 #endif -- -2.15.1 +2.17.0 diff --git a/hybris/libhybris/APKBUILD b/hybris/libhybris/APKBUILD index 60b010f43..7809161e0 100644 --- a/hybris/libhybris/APKBUILD +++ b/hybris/libhybris/APKBUILD @@ -1,14 +1,14 @@ pkgname=libhybris pkgver=1.0_git20180212 -pkgrel=1 -arch="armhf aarch64" +pkgrel=2 +arch="x86 armhf aarch64" url="https://github.com/libhybris/libhybris" license="Apache" makedepends="autoconf automake libtool wayland-dev linux-headers bsd-compat-headers libx11-dev libxcb-dev libxext-dev android-headers-7.1 android-headers-7.1-caf android-headers-4.4" depends_dev="bsd-compat-headers android-headers-7.1" -_rev=54dd4749706334882f9c404fca01a19f01325d07 +_rev=4a7d95b73bf40bf6d03d12bf270974c3d0278099 source="$pkgname-$_rev.tar.gz::https://github.com/libhybris/libhybris/archive/$_rev.tar.gz 0001-Make-libhybris-compile-with-musl.patch 0002-tests-Regression-test-for-EGL-glibc-TLS-conflict.patch @@ -21,6 +21,9 @@ subpackages="$pkgname-dev $pkgname-egl $pkgname-gles $pkgname-libwayland-egl:_wa if [ "$CARCH" == "aarch64" ]; then subpackages="$pkgname-dev $pkgname-egl $pkgname-gles $pkgname-libwayland-egl:_wayland $pkgname-7.1:_specific $pkgname-7.1-caf:_specific" +elif [ "$CARCH" == "x86" ]; then +subpackages="$pkgname-dev $pkgname-egl $pkgname-gles $pkgname-libwayland-egl:_wayland + $pkgname-7.1:_specific $pkgname-4.4:_specific" fi options="!check !strip !tracedeps" @@ -56,6 +59,10 @@ build() { _vers="7.1 7.1-caf" _ldpath="/usr/libexec/droid-hybris/system/lib64:/vendor/lib64:/system/lib64" _arch="arm64" + elif [ "$CARCH" == "x86" ]; then + _vers="7.1 4.4" + _ldpath="/usr/libexec/droid-hybris/system/lib:/vendor/lib:/system/lib" + _arch="x86" fi for _headers_ver in $_vers; do @@ -91,6 +98,8 @@ package() { } _specific() { + depends="$pkgname" + for _bin in ${_bins_specific}; do install -Dm755 "${_tmppkgdir}/${subpkgname}/usr/bin/${_bin}" \ "${subpkgdir}/usr/bin/${_bin}" @@ -103,25 +112,28 @@ _specific() { } egl() { - options="!tracedeps" + depends="$pkgname" pkgdesc="libhybris libEGL runtime libraries" - install -d "$subpkgdir"/usr/lib + install="$subpkgname.post-install" + + install -d "$subpkgdir"/usr/lib/libhybris-egl mv "$pkgdir"/usr/lib/libEGL.so.* \ - "$subpkgdir"/usr/lib/ + "$subpkgdir"/usr/lib/libhybris-egl/ } gles() { - options="!tracedeps" + depends="$pkgname" pkgdesc="libhybris libGLESv2 runtime libraries" - install -d "$subpkgdir"/usr/lib + install -d "$subpkgdir"/usr/lib/libhybris-egl mv "$pkgdir"/usr/lib/libGLES*.so.* \ - "$subpkgdir"/usr/lib/ + "$subpkgdir"/usr/lib/libhybris-egl/ } _wayland() { + depends="$pkgname" pkgdesc="libhybris libwayland-egl library" - mkdir -p "$subpkgdir"/usr/lib - mv "$pkgdir"/usr/lib/libwayland-egl.so.* "$subpkgdir"/usr/lib/ \ + mkdir -p "$subpkgdir"/usr/lib/libhybris-egl + mv "$pkgdir"/usr/lib/libwayland-egl.so.* "$subpkgdir"/usr/lib/libhybris-egl/ \ || return 1 } @@ -129,8 +141,10 @@ dev() { default_dev # Avoid conflicts with mesa-dev - rm -f "$subpkgdir"/usr/lib/lib*GL*.so - rm -f "$subpkgdir"/usr/lib/libwayland-egl.so + install -d "$subpkgdir"/usr/lib/libhybris-egl + + mv "$subpkgdir"/usr/lib/lib*GL*.so "$subpkgdir"/usr/lib/libhybris-egl + mv "$subpkgdir"/usr/lib/libwayland-egl.so "$subpkgdir"/usr/lib/libhybris-egl cd "$subpkgdir"/usr/lib/pkgconfig rm -f egl.pc glesv*.pc wayland-egl.pc @@ -145,7 +159,7 @@ dev() { ln -s ../hybris/EGL/eglhybris.h . } -sha512sums="798360130e540d9dd29ec937b3d01a1b146881c45ec6a2dd1a599a0164d46886b58927d38575993b525a06e99fcc2dd46f020e70f7e5c7cc43258b840ae183f8 libhybris-54dd4749706334882f9c404fca01a19f01325d07.tar.gz +sha512sums="378ad6815f2c17dec7c0043499833e55498f48634aa6dc8d5a5c2e8bfc4281f76690bca6f35e74f47a41b364baab1533ff8d8898d61a9e5b53897deb7d180f97 libhybris-4a7d95b73bf40bf6d03d12bf270974c3d0278099.tar.gz 9655816dc3d89f329801a74f4499c3752cbc96f7ba2e052765335a2cbd7e74cdf45064260ab27537bcd9d64673144eac6f89e31af4b4c6b4a4792ad7b398555d 0001-Make-libhybris-compile-with-musl.patch 1355a4403d1af8bdf75b9e4502cbfc093b9788224ce7c24a1f6a53dd7996d385d31a3362577a4293db6b6d0dd0ae4e88140b38c658ff0a288d9acfc2753859bb 0002-tests-Regression-test-for-EGL-glibc-TLS-conflict.patch -f7d7b460af5f13c37289d7eadfa5eb52248a4a5379a1da07b74231eb4fc9c1ccda6644bcd39bbae89bd068d7f3f6c5fe4e9ae6b41991c1f3b48d6b4d59d951d8 0003-Implement-X11-EGL-platform-based-on-wayland-code.patch" +865ad86b297dcd09416a9df4e366d58429f737aeaa380308fd04943451cefd8500a18857e61c8de43cb4595c59d438d3f12855e189932ab7df8a2f354086a21c 0003-Implement-X11-EGL-platform-based-on-wayland-code.patch" diff --git a/hybris/libhybris/libhybris-egl.post-install b/hybris/libhybris/libhybris-egl.post-install new file mode 100644 index 000000000..7aba24250 --- /dev/null +++ b/hybris/libhybris/libhybris-egl.post-install @@ -0,0 +1,6 @@ +#!/bin/sh +ARCH=$(uname -m) + +if [ ! -f /etc/ld-musl-$ARCH.path ]; then + echo "/usr/lib/libhybris-egl:/lib:/usr/local/lib:/usr/lib" > /etc/ld-musl-$ARCH.path +fi diff --git a/hybris/lxc-android/APKBUILD b/hybris/lxc-android/APKBUILD new file mode 100644 index 000000000..9a3388972 --- /dev/null +++ b/hybris/lxc-android/APKBUILD @@ -0,0 +1,40 @@ +pkgname=lxc-android +pkgver=1.0_git20180311 +pkgrel=0 +arch="noarch" +url="https://github.com/Halium/lxc-android" +license="Apache" +makedepends="" +depends="lxc" +_commit=f490b2cd0ca0498543089d79f15c24f3801cd8b7 +install="$pkgname.post-install" +source="$pkgname-$_rev.tar.gz::https://github.com/Halium/$pkgname/archive/$_commit.tar.gz + pre-start.sh + lxc-android.init" +pkgdesc="Configuration for starting Halium build of Android inside LXC container" + +builddir="$srcdir/$pkgname-$_commit" + +package() { + cd "$builddir" + mkdir -p "$pkgdir" + cp -r "$builddir"/* "$pkgdir" + + # Remove unneeded udev rule override + rm -f "$pkgdir/etc/udev/rules.d/50-firmware.rules" + + # Remove systemd units + rm -rf "$pkgdir/etc/systemd" + rm -rf "$pkgdir/lib/systemd" + + # Install wrapper so pre-start.sh could be provided by device package + mv "$pkgdir/var/lib/lxc/android/pre-start.sh" "$pkgdir/var/lib/lxc/android/pre-start.default.sh" + install -m755 "$srcdir/pre-start.sh" "$pkgdir/var/lib/lxc/android/pre-start.sh" + + # OpenRC services + install -Dm755 "${srcdir}/lxc-android.init" \ + "${pkgdir}/etc/init.d/lxc-android" +} +sha512sums="aed41538bc19fd228605bef4bf089a7bbc96964211abe5932e8685d089c32fce11fa7ba1068ad28f345895fef0d02dd388c4faef3c6abdbfbdd10ba96fcbbed0 lxc-android-.tar.gz +ef7081ea55a1acd5a6c5a973b4a7fc79bad4d5fdc721bc481e4ed92962a8ba9b70634e2a0a8f0afd28c14bd1fd4e1956914f68239c3dc34e41e167254252b1df pre-start.sh +ad373e26fb4850f887ca0be76a4c5f19115e214dcbdc315cf24e41eabfd03eebf8f19085a49c97661861b16e8005355c7fd10e86acdb4593d43250e3fed998fb lxc-android.init" diff --git a/hybris/lxc-android/lxc-android.init b/hybris/lxc-android/lxc-android.init new file mode 100644 index 000000000..3f2a682dd --- /dev/null +++ b/hybris/lxc-android/lxc-android.init @@ -0,0 +1,56 @@ +#!/sbin/openrc-run +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.5 2012/07/21 05:07:15 flameeyes Exp $ + +extra_started_commands="reboot" + +description="Android/Halium LXC container" + +CONTAINER=android +: ${logdir:=/var/log/lxc} +: ${systemimage:=/var/lib/lxc/android/system.img} + +command="/usr/bin/lxc-start" +pidfile="/var/run/lxc/$CONTAINER.pid" + +depend() { + need localmount sysfs cgroups + after firewall net +} + +start() { + checkpath -d /data + checkpath -d /system + + ebegin "Mounting Android filesystems and starting Halium LXC container" + mount -o ro,loop $systemimage /system + + /usr/lib/lxc-android/mount-android + + rm -f "$logdir"/${CONTAINER}.log + + checkpath -d -m 750 -o root:wheel $logdir + + checkpath -d ${pidfile%/*} + start-stop-daemon --start $command \ + --pidfile $pidfile \ + -- \ + --daemon \ + --pidfile $pidfile \ + --name ${CONTAINER} \ + --logpriority WARN \ + --logfile $logdir/${CONTAINER}.log \ + || eend $? || return $? + lxc-wait -n ${CONTAINER} -t 5 -s RUNNING + eend $? +} + +stop() { + ebegin "Stopping container ${CONTAINER}" + lxc-stop -k --name ${CONTAINER} + start-stop-daemon --stop --pidfile ${pidfile} \ + --retry ${POWEROFF_SIGNAL:-SIGUSR2}/${TIMEOUT:-30} \ + --progress + eend $? +} diff --git a/hybris/lxc-android/lxc-android.post-install b/hybris/lxc-android/lxc-android.post-install new file mode 100644 index 000000000..9c89d0473 --- /dev/null +++ b/hybris/lxc-android/lxc-android.post-install @@ -0,0 +1,20 @@ +#!/bin/sh +groupadd -g 1000 aid_system +groupadd -g 1003 aid_graphics +groupadd -g 1004 aid_input +groupadd -g 1005 aid_audio +groupadd -g 3001 aid_net_bt_admin +groupadd -g 3002 aid_net_bt +groupadd -g 3003 aid_inet +groupadd -g 3004 aid_inet_raw +groupadd -g 3005 aid_inet_admin + +usermod -a -G aid_system,aid_graphics,aid_input,aid_audio,aid_net_bt_admin,aid_net_bt,aid_inet,aid_inet_raw,aid_inet_admin user + +rc-update add cgroups default +rc-update add lxc-android default + +# postmarketOS firmware loader conflicts with ueventd one +if [ -f "/etc/udev/rules.d/50-firmware.rules" ]; then + rm /etc/udev/rules.d/50-firmware.rules +fi diff --git a/hybris/lxc-android/lxc-android.sh b/hybris/lxc-android/lxc-android.sh new file mode 100644 index 000000000..1c72e90c0 --- /dev/null +++ b/hybris/lxc-android/lxc-android.sh @@ -0,0 +1,4 @@ +#!/bin/sh +cd / +exec chroot /run/android /init + diff --git a/hybris/lxc-android/pre-start.sh b/hybris/lxc-android/pre-start.sh new file mode 100644 index 000000000..f632bf3d4 --- /dev/null +++ b/hybris/lxc-android/pre-start.sh @@ -0,0 +1,9 @@ +#!/bin/sh +lxc_config_path="$(dirname $LXC_CONFIG_FILE)" + +# Allow pre-start.sh to be provided by device package, otherwise use the default one +if [ -f "$lxc_config_path/pre-start.custom.sh" ]; then + exec $lxc_config_path/pre-start.custom.sh +else + exec $lxc_config_path/pre-start.default.sh +fi diff --git a/hybris/xf86-video-hwcomposer/30-modules-hybris.conf b/hybris/xf86-video-hwcomposer/30-modules-hybris.conf new file mode 100644 index 000000000..ab84e6cd2 --- /dev/null +++ b/hybris/xf86-video-hwcomposer/30-modules-hybris.conf @@ -0,0 +1,4 @@ +Section "Module" + Load "drihybris" + Load "glamoreglhybris" +EndSection diff --git a/hybris/xf86-video-hwcomposer/APKBUILD b/hybris/xf86-video-hwcomposer/APKBUILD new file mode 100644 index 000000000..dd44e3e0a --- /dev/null +++ b/hybris/xf86-video-hwcomposer/APKBUILD @@ -0,0 +1,75 @@ +pkgname=xf86-video-hwcomposer +pkgver=1.0_git20180921 +pkgrel=0 +pkgdesc="X.Org driver for Android devices rendering through HWComposer API" +url="https://github.com/NotKit/xf86-video-hwcomposer" +arch="armhf aarch64" +license="MIT" +depends="drihybris glamor-hybris" +makedepends="autoconf automake util-macros libtool + xorg-server-dev libxi-dev fontsproto randrproto + videoproto renderproto xf86dgaproto drihybrisproto + glamor-hybris-dev drihybris-dev + android-headers-4.4 android-headers-7.1 android-headers-7.1-caf + libhybris-dev libhybris libhybris-7.1" +_commit=192402cd8c2917d056f63f85eb3f83816a1f4c9a +source="$pkgname-$_commit.tar.gz::https://github.com/NotKit/$pkgname/archive/$_commit.tar.gz + 30-modules-hybris.conf" + +subpackages="$pkgname-doc" + +if [ "$CARCH" == "armhf" ]; then + _vers="7.1 7.1-caf 4.4" +elif [ "$CARCH" == "aarch64" ]; then + _vers="7.1 7.1-caf" +fi + +for _ver in $_vers; do + subpackages="$subpackages $pkgname-$_ver:_specific" +done + +builddir="$srcdir/$pkgname-$_commit" +_tmppkgdir="$srcdir/tmpinstall" + +build() { + cd "$builddir" + export LDFLAGS="$LDFLAGS -Wl,-z,lazy" + export CPPFLAGS="$CPPFLAGS -I/usr/include/android-7.1 -DMESA_EGL_NO_X11_HEADERS" + + NOCONFIGURE=1 ./autogen.sh + + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --enable-drihybris \ + --enable-glamor-hybris + + for _ver in $_vers; do + msg "building $pkgname-$_ver" + + for _makefile in "Makefile src/Makefile"; do + sed -i -E "s~/usr/include/android-[^ ]+~/usr/include/android-$_ver~g" $_makefile + done + + make clean + make + make DESTDIR="${_tmppkgdir}/$pkgname-$_ver" install + done +} + +package() { + cd "$builddir" + install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING + install -Dm644 "$srcdir"/30-modules-hybris.conf \ + "$pkgdir"/etc/X11/xorg.conf.d/30-modules-hybris.conf +} + +_specific() { + _lib="xorg/modules/drivers/hwcomposer_drv.so" + install -Dm644 "${_tmppkgdir}/${subpkgname}/usr/lib/${_lib}" \ + "${subpkgdir}/usr/lib/${_lib}" +} + +sha512sums="1e567ea44b00b2941c306069579b76c4bc1c4d594e54f94550b3ae1402e047bc6b518b8568f185b7b742ee6fde56cf89e330de9211da6e38ad20963656869c24 xf86-video-hwcomposer-192402cd8c2917d056f63f85eb3f83816a1f4c9a.tar.gz +e8f9f6ec337e88ec440c4bdc3f3441a8252031d1a4265a251b500a087a2c88336861c7e3f81972019f6a492324e94253726ce031fedad60ff582dd8db73efac6 30-modules-hybris.conf"