-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR improves Toltec’s support for reMarkable 2 in a few ways: * Prevents users from installing packages that are known to be incompatible with their device (fixes #129). * Automatically installs and sets up the rm2fb server when an app that uses the framebuffer is installed. * Stops relying on LD_PRELOAD to load the rm2fb shim into apps that need it. Instead, change their dynamic dependencies to include the shim directly. Thanks to this change, we no longer need to set LD_PRELOAD globally (fixes #248) and users can launch apps that need the shim without prefixing them with `rm2fb-client`. Tooling changes (more details in the updated docs/package.md): * Added the `archs` field for declaring which device(s) a recipe is compatible with. Supported values are `rmall` (for device-independent packages), `rm1` (for reMarkable 1) and `rm2` (for reMarkable 2). When multiple arch values are set for a recipe, the recipe is generated once per entry, which allows specializing builds for specific devices. * Replaced the `depends` field with an `installdepends` field used for declaring install-time dependencies. Previously, dependencies declared in the `depends` field were fulfilled both at build time and at install time, with no way of declaring install-time-only dependencies. * Added a `replaces` field that sets the `Replaces` value in the generated package. Used for migrating users from the `rm2fb` package to the `display` and `rm2fb-shim` packages (see below). * Changed [the web package listing](https://toltec-dev.org/dev/split-architectures) to include download links for each available architecture of each package. * Packages are now stored in subdirectories named after their architecture. This is because opkg does not like seeing packages for architectures other than the ones it is configured to accept in opkg.conf. With this layout change, we can make opkg happy by only adding subdirectories for enabled architectures. Install changes: * The bootstrap script now adds the `rmall` architecture (and folder) on all installs, and the `rm1` or `rm2` architecture (and folder) depending on the type of the device it’s executed on. It will fail if the device is not of a recognized type (based on the value of `/sys/devices/soc0/machine`). * Running the new bootstrap script on an existing install will upgrade the configuration to use the new architecture subdirectories layout. rm2fb changes: * The package is split into two packages, `display` (which provides the rm2fb server on rM2 and is an empty package on rM1) and `rm2fb-shim` (which provides the client shim on rM2 and a mock shim on rM1). * The `rm2fb-server` command is removed (the most common use-case being that the display server is started from the systemd unit). * The `rm2fb-client` command is renamed to `rm2fb-shim`, with the expectation that users will not need it anymore, unless for development purposes. Apps marked as reMarkable-1-only: * appmarkable (LinusCDE/appmarkable#2) * rmservewacominput (because it depends on appmarkable) * vnsee (matteodelabre/vnsee#15) * whiteboard-hypercard (fenollp/reMarkable-tools#12) Apps marked as reMarkable-2-only: * rm2-suspend-fix Apps updated to include the rM2 shim: * calculator * chessmarkable * draft * fingerterm * keywriter * koreader (through setting LD_PRELOAD in the existing wrapper script) * oxide * plato * recrossable * remarkable-splash * retris * rmkit * xochitl (through a new wrapper script at /opt/bin/xochitl) * zshelf Test plan (on rM1 and rM2): * Starting from a clean stable or testing install of Toltec, download the updated bootstrap script and run: ```console $ toltec_branch=dev/split-architectures bash bootstrap ``` * This should update the `/opt/etc/opkg.conf` configuration file to enable the `rmall` architecture and, depending on the device you’re running this on, the `rm1` or the `rm2` architecture. * It should also replace the `src/gz toltec` line with two source lines, `src/gz toltec-rmall` and `src/gz toltec-rm1` or `src/gz toltec-rm2`, pointing to subfolders of `https://toltec-dev.org/dev/split-architectures`. * Run `opkg upgrade`. Most installed packages should get upgraded, and if you had installed any packages that use the screen, the `display` and `rm2fb-shim` packages should get installed. If you previously installed the `rm2fb` package, it should get removed automatically. * Try installing `rm2-suspend-fix` on a reMarkable 1, or `vnsee` on a reMarkable 2: both operations should fail. * Test all updated packages to make sure they can properly draw to the screen (both on rM1 and rM2) and that you can interact with them through the touchscreen and the pen, when applicable. * In particular, make sure that apps work properly when launched from draft, oxide or remux (some issues remain with oxide and remux).
- Loading branch information
1 parent
5c62066
commit a9e270e
Showing
48 changed files
with
1,130 additions
and
581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,40 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) 2020 The Toltec Contributors | ||
# Copyright (c) 2021 The Toltec Contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
pkgnames=(chessmarkable) | ||
pkgdesc="Chess game" | ||
url=https://github.com/LinusCDE/chessmarkable | ||
pkgver=0.6.0-3 | ||
pkgver=0.6.0-4 | ||
timestamp=2021-01-03T05:26Z | ||
section="games" | ||
maintainer="Linus K. <linus@cosmos-ink.net>" | ||
license=MIT | ||
installdepends=(display rm2fb-shim) | ||
makedepends=(build:patchelf) | ||
flags=(nostrip) | ||
|
||
image=rust:v1.2.1 | ||
image=rust:v1.4 | ||
source=(https://github.com/LinusCDE/chessmarkable/archive/0.6.0-1.zip) | ||
sha256sums=(3ad10a46da5a42f603947ad4dce960bdac2d646c0cd29b7bb3a60b8d308dd82a) | ||
|
||
_target="armv7-unknown-linux-gnueabihf" | ||
|
||
build() { | ||
# Fall back to system-wide config | ||
rm .cargo/config | ||
|
||
cargo build --release --bin chessmarkable | ||
|
||
# Inject rm2fb shim | ||
# (after running strip, otherwise strip removes too much information) | ||
pushd target/"$_target"/release | ||
"${CROSS_COMPILE}strip" --strip-all chessmarkable | ||
patchelf --add-needed librm2fb_client.so chessmarkable | ||
popd | ||
} | ||
|
||
package() { | ||
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/target/armv7-unknown-linux-gnueabihf/release/chessmarkable | ||
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/target/"$_target"/release/chessmarkable | ||
install -D -m 644 "$srcdir"/oxide "$pkgdir"/opt/etc/draft/chessmarkable | ||
install -D -m 644 "$srcdir"/icon.png "$pkgdir"/opt/etc/draft/icons/chessmarkable.png | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) 2021 The Toltec Contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
archs=(rm1 rm2) | ||
pkgnames=(display rm2fb-shim) | ||
timestamp=2021-02-21T01:41+00:00 | ||
maintainer="raisjn <of.raisjn@gmail.com>" | ||
license=MIT | ||
url="https://github.com/ddvk/remarkable2-framebuffer" | ||
pkgver=1.0.0-9 | ||
section="devel" | ||
|
||
image=qt:v1.4 | ||
source=( | ||
https://github.com/ddvk/remarkable2-framebuffer/archive/0724acfcc87c24ae2fcb45db4cad033981f3f4a9.zip | ||
rm2fb.service | ||
rm2fb-shim | ||
) | ||
sha256sums=( | ||
bf398905f43e189671692325444e0cac131ab9856f215adabe6b8747aaa41351 | ||
SKIP | ||
SKIP | ||
) | ||
|
||
build() { | ||
if [[ $arch = rm1 ]]; then | ||
# Create an empty client library for rM1 | ||
pushd src/client | ||
echo | "${CROSS_COMPILE}gcc" \ | ||
-fPIC -fvisibility=hidden -shared \ | ||
-o librm2fb_client.so.${pkgver%-*} \ | ||
-xc - | ||
popd | ||
else | ||
qmake | ||
make | ||
fi | ||
} | ||
|
||
display() { | ||
pkgdesc="Interface to the reMarkable framebuffer" | ||
conflicts=(rm2fb) | ||
replaces=(rm2fb) | ||
|
||
package() { | ||
if [[ $arch = rm2 ]]; then | ||
libname="librm2fb_server.so.${pkgver%-*}" | ||
install -D -m 644 -t "$pkgdir"/opt/lib "$srcdir"/src/server/"$libname" | ||
ln -s "$libname" "$pkgdir"/opt/lib/"${libname%.*}" | ||
ln -s "${libname%.*}" "$pkgdir"/opt/lib/"${libname%.*.*}" | ||
ln -s "${libname%.*.*}" "$pkgdir"/opt/lib/"${libname%.*.*.*}" | ||
install -D -m 644 -t "$pkgdir"/lib/systemd/system \ | ||
"$srcdir"/rm2fb.service | ||
fi | ||
} | ||
|
||
configure() { | ||
if [[ $arch = rm2 ]]; then | ||
systemctl daemon-reload | ||
systemctl enable rm2fb --now | ||
# Restart xochitl if it's running | ||
if systemctl --quiet is-active xochitl; then | ||
# Reset the crash count so we don't trigger remarkable-fail | ||
echo "0" > /tmp/crashnum | ||
systemctl restart xochitl | ||
fi | ||
fi | ||
} | ||
|
||
preremove() { | ||
if [[ $arch = rm2 ]]; then | ||
if systemctl list-units --full -all | grep -Fq 'rm2fb.service'; then | ||
systemctl disable rm2fb --now | ||
fi | ||
echo -n "make sure " | ||
if ! is-enabled xochitl.service; then | ||
echo "to re-enable xochitl with 'systemctl enable xochitl --now'" | ||
echo -n "and " | ||
fi | ||
echo "to disable / uninstall any launchers like draft, oxide or remux before" | ||
echo "rebooting your tablet to complete the uninstallation" | ||
fi | ||
} | ||
} | ||
|
||
rm2fb-shim() { | ||
pkgdesc="Shim to make reMarkable 1 apps work on reMarkable 2" | ||
installdepends=(display) | ||
conflicts=(rm2fb) | ||
replaces=(rm2fb) | ||
|
||
package() { | ||
libname="librm2fb_client.so.${pkgver%-*}" | ||
install -D -m 644 -t "$pkgdir"/opt/lib "$srcdir"/src/client/"$libname" | ||
install -d "$pkgdir"/usr/lib | ||
ln -s /opt/lib/"$libname" "$pkgdir"/usr/lib/"$libname" | ||
|
||
for dest in opt/lib usr/lib; do | ||
ln -s "$libname" "$pkgdir/$dest/${libname%.*}" | ||
ln -s "${libname%.*}" "$pkgdir/$dest/${libname%.*.*}" | ||
ln -s "${libname%.*.*}" "$pkgdir/$dest/${libname%.*.*.*}" | ||
done | ||
|
||
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/rm2fb-shim | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) 2021 The Toltec Contributors | ||
# SPDX-License-Identifier: MIT | ||
LD_PRELOAD=/opt/lib/librm2fb_client.so exec "$@" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.