==== Installing Koreader ==== Now compiled on stretch64bit VM as buster has too new GLIBC for the cross compile to work on the Kobo === fmon === == New fmon == Use fmon from baskerville as there is need to have a more robust solution regarding launching the apps based on PNG image file access. I have not had any issues yet, but see that there have been issues previously. Source from here: https://github.com/baskerville/fmon Created /usr/local/fmon folder for binary and logfile (will need to crete new KoboRoot at some point, but this was done manually for now) I created my own KoboRoot.tgz https://zappa.cx/~sunkan/files/KoboRoot.tgz (Updated 2019-10-05) drwxr-xr-x sunkan/sunkan 0 2018-04-29 07:31 etc/ drwxr-xr-x sunkan/sunkan 0 2019-10-05 09:10 etc/init.d/ -rwxr-xr-x sunkan/sunkan 423 2019-10-05 09:10 etc/init.d/on-animator.sh -rwxr-xr-x sunkan/sunkan 337 2019-07-05 15:01 etc/init.d/on-animator.sh-org drwxr-xr-x sunkan/sunkan 0 2018-04-29 07:50 usr/ drwxr-xr-x sunkan/sunkan 0 2018-04-29 07:50 usr/local/ drwxr-xr-x sunkan/sunkan 0 2018-04-29 07:50 usr/local/fmon/ drwxr-xr-x sunkan/sunkan 0 2018-04-29 07:50 usr/local/fmon/bin/ -rwxr-xr-x sunkan/sunkan 5716 2018-04-29 07:50 usr/local/fmon/bin/fmon Moved stuff to /mnt/onboard/.sunkan Moved koreader to /mnt/onbeard/.adds (required if using baskervilles fmon script unchanged) Patched baskervilles fmon to fix some compiler warnings sunkan@sunkan:~/build/fmon$ git diff a6bd0942c9e4c21c3a720733821a4ab8b2a92e62..dc49502b3c8944a7fdb29ceec468c7607d23d039 diff --git a/build b/build index fb7881f..bb2bbcc 100755 --- a/build +++ b/build @@ -1,4 +1,4 @@ #! /bin/sh CC=${CC:-"arm-linux-gnueabihf-gcc"} -$CC -s -std=c99 -o fmon fmon.c +$CC -Os -s -std=c99 -Wpedantic -Wall -Wextra -Wconversion -o fmon fmon.c diff --git a/fmon.c b/fmon.c index 0979582..376e761 100644 --- a/fmon.c +++ b/fmon.c @@ -31,7 +31,7 @@ unsigned int qhash(const char *id) unsigned int h = 0; size_t len = strlen(id); - for (int i = 0; i < len; i++) { + for (size_t i = 0; i < len; i++) { h = (h << 4) + id[i]; h ^= (h & 0xf0000000) >> 23; h &= 0x0fffffff; @@ -46,8 +46,8 @@ char *id_from_path(const char *path) size_t len = strlen(path); size_t prelen = strlen(ID_PREFIX); char *result = malloc(len + prelen + 1); - strncpy(result, ID_PREFIX, prelen); - for (int i = 0; i < len; i++) { + strncpy(result, ID_PREFIX, prelen + 1); + for (size_t i = 0; i < len; i++) { char c = path[i]; result[i + prelen] = isalnum(c) ? c : '_'; } @@ -139,9 +139,9 @@ int main(int argc, char *argv[]) err(EX_OSERR, "read"); } - int i = 0; + size_t i = 0; - while (i < len) { + while (i < (size_t) len) { struct inotify_event *event = (struct inotify_event *) &buf[i]; if (event->mask & IN_OPEN) { char *id = id_from_path(path); @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) unsigned int dir1 = hash & 0xff; unsigned int dir2 = (hash & 0xff00) >> 8; int c = 0; - for (int j = 0; j < LENGTH(TN_SUFFIXES); j++) { + for (size_t j = 0; j < LENGTH(TN_SUFFIXES); j++) { snprintf(tn, PATH_MAX, PATH_FORMAT, SD_CARD_PATH, dir1, dir2, id, TN_SUFFIXES[j]); if (access(tn, F_OK) != 0) { break; sunkan@sunkan:~/build/fmon$ == Old fmon == Reason to use fmon instead of Kobo Start Menu is because KSM is not fully open-source and quite big to try to understand all effects of it. fmon is very elegant, by monitoring the "open" call to a file (koreader.png) and then execute a script matching the name of the PNG file. Also using the on-animator.sh file for starting the fmon processes is a good choice, since that file exists in the official KoboRoot.tgz archive it was easy to verify that it will do the right thing. Also it should be easy to remove by just re-uploading the official KoboRoot.tgz I created my own KoboRoot.tgz https://zappa.cx/~sunkan/files/KoboRoot.tgz drwxr-xr-x sunkan/sunkan 0 2018-01-23 09:45 etc/ drwxr-xr-x sunkan/sunkan 0 2018-01-23 09:45 etc/init.d/ -rwxr-xr-x sunkan/sunkan 448 2018-01-23 09:45 etc/init.d/on-animator.sh drwxr-xr-x sunkan/sunkan 0 2018-01-23 09:45 mnt/ drwxr-xr-x sunkan/sunkan 0 2018-01-23 09:45 mnt/onboard/ drwxr-xr-x sunkan/sunkan 0 2018-01-23 09:45 mnt/onboard/.kobo/ -rwxr-xr-x sunkan/sunkan 152 2018-01-23 09:45 mnt/onboard/.kobo/on_start.sh drwxr-xr-x sunkan/sunkan 0 2018-03-10 21:08 mnt/onboard/.kobo/fmon/ -rwxr-xr-x sunkan/sunkan 100 2018-03-10 21:07 mnt/onboard/.kobo/fmon/fmon_koreader.sh -rwxr-xr-x sunkan/sunkan 6386 2018-01-23 09:45 mnt/onboard/.kobo/fmon/fmon It is based on pbchess_2018.01.23_kobo.zip which includes a compiled fmon in the KoboRoot.tgz archive within that zip file. I removed the default launcher and added the koreader launch script (fmon_koreader.sh) instead. http://pbchess.vlasovsoft.net/en/index.html http://pbchess.vlasovsoft.net/files/pbchess_2018.01.23_kobo.zip https://github.com/sergeyvl/vlasovsoft Some instructions are here: https://www.mobileread.com/forums/showthread.php?t=21828 == Compiling fmon on Debian == arm-linux-gnueabihf-g++ -Os -Wall -Wextra -Wno-missing-field-initializers -std=c++11 -pedantic -static-libstdc++ -Wl,-s fmon.cpp -o fmon === Koreader === Used this archive - took the koreader.sh script and used it in the KoboRoot.tgz (renamed to fmon_koreader.sh) and copied the rest of the data to the koreader folder as the instructions say. Also did upload and verify that the koreader.png opened ok before actually uploading thi KoboRoot.tgz https://github.com/koreader/koreader/releases/download/v2018.02.12-nightly/koreader-kobo-arm-kobo-linux-gnueabihf-v2015.11-1523-g78284e1.zip https://github.com/koreader/koreader === Telnet remote access === Making it easy to enable telnet access, with minimal changes in rootfs. /mnt/onboard/.kobo/remote.sh #!/bin/sh mkdir -p /dev/pts if $( mountpoint -q /dev/pts ); then echo "devpts already mounted" else echo "Mounting devpts" mount -t devpts devpts /dev/pts fi killall -q inetd inetd /mnt/onboard/.kobo/inetd.conf ip -4 address ip -6 address /mnt/onboard/.kobo/inetd.conf # # ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd # telnet stream tcp nowait root /usr/sbin/telnetd telnetd -l /bin/login #21 stream tcp nowait root /bin/busybox ftpd -w -S / 23 stream tcp nowait root /bin/busybox telnetd -i -l /bin/sh Then add symlink to make it easy to activate without too much typing. /mnt/onboard/.kobo # ln -s /mnt/onboard/.kobo/remote.sh /usr/sbin/remote.sh Now just open the terminal within koreader and enter "remote.sh" === Other Kobo stuff === Firmware download https://pgaskin.net/KoboStuff/kobofirmware.html