View Single Post
Old 09-21-2023, 05:06 PM   #1
elinkser
Addict
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 242
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
(Pre-FBInk) rmkit on my Clara HD

***

(Pre-FBInk) rmkit on my Clara HD

* For official thread, please see:
https://www.mobileread.com/forums/sh...d.php?t=359125



***

RUNNING RMKIT APPS

rmkit-dev/rmkit
https://github.com/rmkit-dev/rmkit

$ wget https://build.rmkit.dev/master/latest/kobo/KoboRoot.tgz

Install to .kobo/

After unmounting power cycling my Kobo reader, I swiped up the verry right OR left edge of my Clara HD, straddling the display and the bezel. I swiped all the way bottom to top. Maybe tap and swipe if you have troubles.

The menu comes up with:
Nickel
animation_demo
dumbskull
input_demo
mines
rpncalc
wordlet

E.g. click to select the mines app.

Swipe up to return to the menu.

Click the menu usage stat to the right of the mines entry to kill the app.

Click the Nickel entry to return to Nickel.

Attempt to install additional packages manually:

Index of /master/latest/kobo/
https://build.rmkit.dev/master/latest/kobo/

$ wget https://build.rmkit.dev/master/lates...release.tar.gz

$ tar zxvf release.tar.gz
apps/
apps/eclear
apps/drawing_demo
apps/mines
apps/rpncalc
apps/sharenote
apps/dumbskull
apps/sha256sum.txt
apps/animation_demo
apps/proc
apps/remux
apps/wordlet
apps/ls.txt
apps/harmony
apps/remux.service
apps/simple
apps/genie
apps/dithering_demo
apps/input_demo
apps/stb.arm.o
apps/lamp
apps/iago
apps/nao.sh
apps/rmkit.h
apps/bufshot


Copied apps/drawing_demo to /mnt/onboard/.adds/rmkit/bin/apps/ on my kobo.
Also copied harmony, lamp, nao.sh, and simple.

The only one of that bunch that appeared to do anything was harmony, which presented a nice menu of tools,etc at bottom.
But when I tried to use ...->new, it froze!

It's seems like it has potential if it gets more developed:
sas: simple app script
https://rmkit.dev/apps/sas
simple is a simple app script for remarkable that lets developers write apps without needing to compile code.
an example layout:
button 50 50 200 50 I'm a button
button 50 150 400 50 I'm a different button
label 50 100 300 50 I'm some text
image 50 200 200 200 /home/root/bomb-solid.png


...

BUILDING RMKIT APPS

rmkit/docs/BUILDING.md
https://github.com/rmkit-dev/rmkit/b...cs/BUILDING.md says:

Individual Projects
You can compile an individual project by running make <project> or make <project>_docker to build the project inside a docker container.

You can change whether you are compiling for the remarkable or a PC by adjusting the TARGET environment variable. See src/actions.make for the list of targets, which include (but is not limited to) dev and arm

Linux
install okp: pip install okp
install resim viewer: pip install rmkit-sim
compile with DEV mode: ARCH=dev make harmony
run harmony with resim ./src/build/harmony

Remarkable
install okp: sudo pip install okp
install arm toolchain
on ubuntu: sudo apt install g++-arm-linux-gnueabihf


***

But in fact, using my distro's g++-arm-linux-gnueabihf cross-platform build environment resulted in a GLIBC that was too new for my venerable Kobo Clara HD.

And trying an older Linaro release like I had done here resulted in a compiler that was too old.

Thankfully, KOReader's koxtoolchain, , like a nice bowl of porridge like you might find in a cabin in the woods , was just right.


We start by trying to build the input_demo app, the same one whose prebuilt binary we tried above.

rmkit-dev/rmkit
https://github.com/rmkit-dev/rmkit

$ mkdir rmkit-build

$ cd rmkit-build/

$ pip install okp

$ pip install rmkit-sim

$ source ~/koxtoolchain/refs/x-compile.sh kobo env bare

$ sudo apt install python3-tk

$ sudo apt install python3-pil.imagetk

$ wget https://github.com/rmkit-dev/rmkit/a...ads/master.zip

$ mv master.zip rmkit-master.zip

$ unzip rmkit-master.zip

$ cd rmkit-master/

$ nano -l src/input_demo/main.cpy
Code:
 76     ds->add_options({"foo", "ba", "baz"})
...
201     ds->add_options({"foot", "bat", "baz"})
$ nano -l src/common.make
Code:
 3 CXX_BIN?=arm-kobo-linux-gnueabihf-g++
 4 CC_BIN?=arm-kobo-linux-gnueabihf-gcc
 5 STRIP_BIN?=arm-kobo-linux-gnueabihf-strip
$ nano -l scripts/build/build_kobo_root.sh
Code:
25   arm-kobo-linux-gnueabihf-strip *
$ ARCH=kobo make input_demo
rmkit.h:19622:14: error: 'ABS_MT_SLOT' was not declared in this scope
rmkit.h:19663:14: error: 'ABS_MT_DISTANCE' was not declared in this scope
rmkit.h:20554:34: error: 'SYN_DROPPED' was not declared in this scope


$ grep -r -n ABS_MT_SLOT
src/.rmkit.h_cpp/input/events.h:251: case ABS_MT_SLOT: {
src/build/rmkit.h:19622: case ABS_MT_SLOT: {
src/rmkit/input/events.cpy:241: case ABS_MT_SLOT:

$ nano -l src/.rmkit.h_cpp/input/events.h
Code:
251 //        case ABS_MT_SLOT: {
252 //          slot = data.value;
253 //          break; }
$ nano -l src/build/rmkit.h
Code:
19622 //        case ABS_MT_SLOT: {
19623 //          slot = data.value;
19624 //          break; }
$ nano -l src/rmkit/input/events.cpy
Code:
241 //        case ABS_MT_SLOT:
242 //          slot = data.value;
243 //          break
$ grep -r -n SYN_DROPPED
src/.rmkit.h_cpp/input/input.h:75: if (ev_data[i].code == SYN_DROPPED) {
src/build/rmkit.h:20554: if (ev_data[i].code == SYN_DROPPED) {
src/rmkit/input/input.cpy:69: if ev_data[i].code == SYN_DROPPED:

$ nano -l src/.rmkit.h_cpp/input/input.h
Code:
 75 //          if (ev_data[i].code == SYN_DROPPED) {
 76 //            syn_dropped = true;
 77 //            event.handle_drop(fd);
 78 //            continue; }
$ nano -l src/build/rmkit.h
Code:
20554 //          if (ev_data[i].code == SYN_DROPPED) {
20555 //            syn_dropped = true;
20556 //            event.handle_drop(fd);
20557 //            continue; }
$ nano -l src/rmkit/input/input.cpy
Code:
 69 //          if ev_data[i].code == SYN_DROPPED:
 70 //            syn_dropped = true
 71 //            event.handle_drop(fd)
 72 //            continue
$ grep -r -n ABS_MT_DISTANCE
src/.rmkit.h_cpp/input/events.h:292: case ABS_MT_DISTANCE: {
src/remux/launcher.cpy:31:#define TOUCH_FLOOD_EVENT ABS_MT_DISTANCE
src/build/rmkit.h:19663: case ABS_MT_DISTANCE: {
src/rmkit/input/events.cpy:282: case ABS_MT_DISTANCE:

$ nano -l src/.rmkit.h_cpp/input/events.h
Code:
292 //        case ABS_MT_DISTANCE: {
293 //          slots[slot].distance = this->distance = data.value;
294 //          if (this->distance > 0) {
295 //            this->left = 0; }
296 //          break; }
$ nano -l src/remux/launcher.cpy
Code:
31 #define TOUCH_FLOOD_EVENT ABS_DISTANCE
$ nano -l src/build/rmkit.h
Code:
19663 //        case ABS_MT_DISTANCE: {
19664 //          slots[slot].distance = this->distance = data.value;
19665 //          if (this->distance > 0) {
19666 //            this->left = 0; }
19667 //          break; }
$ nano -l src/rmkit/input/events.cpy
Code:
282 //        case ABS_MT_DISTANCE:
283 //          slots[slot].distance = self.distance = data.value
284 //          if self.distance > 0:
285 //            self.left = 0
286 //          break

$ grep -r -n NotoMono-Regular.ttf
Binary file src/.input_demo_cpp/main.o matches
src/.rmkit.h_cpp/fb/stb_text.h:37: filename = "/usr/share/fonts/ttf/noto/NotoMono-Regular.ttf";
src/build/rmkit.h:19247: filename = "/usr/share/fonts/ttf/noto/NotoMono-Regular.ttf";
Binary file src/build/input_demo matches
src/rmkit/fb/stb_text.cpy:33: filename = "/usr/share/fonts/ttf/noto/NotoMono-Regular.ttf";


$ nano -l src/.rmkit.h_cpp/fb/stb_text.h
Code:
 37         filename = "/mnt/onboard/.adds/koreader/fonts/noto/NotoSans-Regular.ttf";

$ nano -l src/build/rmkit.h
Code:
19247         filename = "/mnt/onboard/.adds/koreader/fonts/noto/NotoSans-Regular.ttf";
$ nano -l src/rmkit/fb/stb_text.cpy
Code:
 33         filename = "/mnt/onboard/.adds/koreader/fonts/noto/NotoSans-Regular.ttf";

$ nano -l src/common.make
Code:
 2 TARGET?=kobo

$ nano -l src/rmkit/input/events.cpy
Code:
181       invert_y = true
182       invert_x = true
183       swap_xy = false
184       switch version:
185         case util::KOBO_DEVICE_ID_E::DEVICE_KOBO_CLARA_HD:
186           // rotation++
187           rotation %= 4
188           invert_x = true
189           swap_xy = false
190           break


$ ARCH=kobo make input_demo

$ cd ..


Make a backup to your PC of /mnt/onboard/.adds/rmkit/bin/apps/input_demo on your kobo.

Copy input_demo and stb.arm.o(edit-obj file not needed for release,duh) from rmkit-master/src/build/ on your PC to /mnt/onboard/.adds/rmkit/bin/apps/ on your kobo.


Swipe all the way up the edge (right or left) of your Kobo and select the input_demo app.

(Click and swipe inside the box and see the cursor move.)

(Click the Menu, Pager, Overlay, and Options items.)

(Click in the top text entry and type using the onscreen keyboard.)


Swipe up to return to the menu.

Click the menu usage stat to the right of the input_demo entry to kill the app.

Click the Nickel entry to return to Nickel.



***

Now we try to build the Simple framework.


$ source ~/koxtoolchain/refs/x-compile.sh kobo env bare

$ cd rmkit-master/

$ ARCH=kobo make simple


Copy simple from rmkit-master/src/build/ and menu.sh from rmkit-master/src/simple/apps/ on your PC to /mnt/onboard/.adds/rmkit/bin/apps/ on your kobo.

Swipe up the right edge of your Kobo and select the menu.sh app.

(Click the option items.)

Swipe up to return to the menu.

Click the menu usage stat to the right of the menu.sh and simple entries to kill the app.

Click the Nickel entry to return to Nickel.

Now edit the menu.sh without recompiling.

$ nano -l src/simple/apps/menu.sh
Code:
  5 label 0 500 200 50 you pressed: ${option}
  6 [paragraph 0 600 500 500 ${output}]
...
 10   option=`echo "${app}" | /mnt/onboard/.adds/rmkit/bin/apps/simple | grep 'selected:' | sed 's/selected: //'`
 11   output=`cat /mnt/onboard/.kobo/version`

Copy menu.sh from rmkit-master/src/simple/apps/ on your PC to /mnt/onboard/.adds/rmkit/bin/apps/ on your kobo.

Swipe up the right edge of your Kobo and select the menu.sh app.

(Click the option items.)

Swipe up to return to the menu.

Click the menu usage stat to the right of the menu.sh and simple entries to kill the apps.

Click the Nickel entry to return to Nickel.


So we have just modified, without recompiling, an app that works on both Remarkable and Kobo devices.
* Edit - Technically, fbink can do this too, say with lua, if I ever get around to learning lua!
https://github.com/NiLuJe/FBInk

I may now die in peace...

***


Note 1 - rmkit not guaranteed to start at boot:
Since rmkit is started by /etc/udev/rules.d/99-rmkit.rules, which "runs early at boot", and "onboard *might*" (or *might not*) be mounted at that point - says so right in the comments, that means rmkit is not guaranteed to start every boot.
So we take the command from 99-rmkit.rules, and wrap it in a nice NickelMenu item, so we can start it manually:
Code:
menu_item :main    :rmkit              :cmd_spawn          :quiet :/usr/local/rmkit/startup.sh
    chain_success                      :dbg_toast          :Started rmkit
    chain_failure                      :dbg_toast          :Error starting rmkit
And another nice NickelMenu item to check if rmkit is running, before we wear out the right margin trying to swipe the rmkit launcher into life:
Code:
menu_item :main    :rmkit status       :cmd_output         :500:ps | grep remux

Note 2 - rmkit install creates /opt folder as symbolic link to /mnt/onboard/.adds/rmkit, which interferes with other apps.
First, delete the /opt symbolic link to /mnt/onboard/.adds/rmkit:
(*Note WITHOUT the trailing slash, i.e. /opt NOT /opt/)
# rm /opt
Second, recreate /opt as a normal folder:
# mkdir /opt
Then recreate symbolic links for rmkit subfolders:
# ln -s /mnt/onboard/.adds/rmkit/bin/ /opt/bin
# ln -s /mnt/onboard/.adds/rmkit/data/ /opt/data
# ln -s /mnt/onboard/.adds/rmkit/etc/ /opt/etc
# cp /mnt/onboard/.adds/rmkit/enable_remux /opt/
Now, check everything is still there:
# ls /opt/
bin data enable_remux etc
# ls /opt/bin/
apps/ remux.sh

Last edited by elinkser; 02-22-2024 at 03:18 PM. Reason: Notes,title
elinkser is offline