Mobileread
KoBox, or how to run X.org and Firefox on your Kobo
#1  NiMa 01-11-2021, 12:20 PM
Hi,
As some of you probably saw in the Developers' corner, I started to make a preinstalled image of Alpine Linux with Xorg and Firefox in it to install it on a Kobo effortlessly.
I'm now here with a first release candidate of KoBox. It is *not* perfect, even the install process could not work (though it won't brick your Kobo, I'm fairly sure).

Here's a video: https://www.youtube.com/watch?v=jICSx2SxzNM

You can find it here: https://sourceforge.net/projects/xorg-kobox/
Direct download: https://sourceforge.net/projects/xorg-kobox/files/RC-1/kobox.txz/download

The file is approx. 500 MB in size, so depending on the speed of your connection it could take a while to download.
What.... what is this file......? If you didn't recognize the .txz extension, to put things simple, it's essentially similar to .zip files, only compressed (much) more. What you'll want to do is to install 7-Zip and that will uncompress it for you.

How do I install this? The process is similar to NiLuJe's one-click packages for Plato/KOReader. You'll have to decompress the archive in the root of the KOBOeReader partition (after plugging in your Kobo, of course), not anywhere else. Then, be *sure* to properly eject it (if it says "can't eject the device, *wait*) and it should work after "updating" a little.
Caution: This being a RC-1, it sure comes with a few caveats that I'd like to have had cleared off before uploading this to SourceForge on my 150KB/s upload connection That being said:
If you already uncompressed the archive in KOBOeReader, you're not lost. Really, you only have to uncompress whats inside the "kobox" folder in the archive.
At the end you shouldn't have any "kobox" folder in the root of your KOBOeReader partition. Just new icons and a new .adds folder (if you didn't install anything else before, like Plato or KOReader).

How to launch this? Normally, if all is correct and you extracted the contents of the kobox folder in your KOBOeReader partitions, you should see a thing called "NickelMenu" in the bottom-right of your Kobo's home screen. (BTW, thanks @geek1011). Ensure you're connected on Wi-Fi, then tap on it, and you should see something called "KoBox". Take a deep breath and click on it. Things should start to show on the screen. If you make it to the tiles wallpaper, you can already be pretty sure that it will work. Touch may not work right away. If the screen orientation is bad or touch is working strangely, do this on an SSH session to your Kobo (this will change in the future):
Code
echo 1 > /sys/class/graphics/fb0/rotate
If you tap on the screen afterwards, things should work properly. *However*, your input device may not be what I programmed the script to listen for (/dev/input1). If so, please report it below. I will tell you how to get it working, if I can.

I can't shutdown!
Open gnome-terminal (Applications/System Tools/Terminal) and type:
Code
sync
poweroff
It's *very important* to do this, and not shut down your Kobo forcing the power button. This may lead to a corruption of certain files (namely /var/log/Xorg.0.log) or folders that can lead KoBox to fail launching.

Will this erase/brick my Kobo?
99% sure not. Basically, the Xorg server runs in a chroot on a disk image. If you don't understand what I just said, well you could think of it as a very secure and containerized environment.
*But* I can't guarantee anything and I strongly recommend that you make a backup of your books before you try anything of this. And if it breaks, I'm not to be considered responsible of this situation.

Spec sheet/miscellanous
Tested models
Kobo Libra H2O, Kobo Glo HD
Programs included (not exhaustive): firefox, geany, xterm, uxterm, gnome-terminal, mate-panel, x11vnc, feh, idle3.8, python3, obconf, pcmanfm, nautilus, vim, nano, htop, onboard
Installable via apk (package manager), including, but not limited to: gcc, g++, clang, qmake, falkon, midori, epiphany
You'll *want* to install another web browser. Although Firefox is OK for short-term sessions, it has a preponderance to crash when used for a longer period of time. I recommend Falkon or Midori, or you can build Luakit from source if you're brave enough.
Example:
Code
apk add falkon
to install Falkon

Things forgotten/to fix/to add/improve
- Fonts (Noto Sans Mono in Firefox is strange)
- Onboard keyboard
- Shutdown button
- Multitouch input

Credits
Thanks @NiLuJe, @geek1011 for NickelMenu, @Elektron for the name (@hobnail too, finally I decided to take KoBox instead of Xobo, but good one indeed!), schuhumi (from GitHub) who originally developed fbink-xdamage
1.png 2.png.png 3.png.png PXL_20210111_173305346-c.jpg 
Reply 

#2  Elektron 01-11-2021, 08:01 PM
EPIC!!!
Can I run Chrome (I see Firefox is working, not sure)?
Also apologies, I was too busy this weekend to install this
So still no way to return to nickel other than shut down and restart?
Edit: Also sidenote: Discord account experiencing some issues so hopefully I'll be back online in a few weeks at the latest if support gets back to me
Reply 

#3  NiMa 01-11-2021, 08:37 PM
Quote Elektron
EPIC!!!
Can I run Chrome (I see Firefox is working, not sure)?
Also apologies, I was too busy this weekend to install this
So still no way to return to nickel other than shut down and restart?
Edit: Also sidenote: Discord account experiencing some issues so hopefully I'll be back online in a few weeks at the latest if support gets back to me
Chrome? Unfortunately, no. Well, not quite yet. The package maintainer has gracefully abandoned chromium for armhf since v3.10 (why???) in favor of aarch64 (also why??? why not keep aarch64 AND armhf?) Oh well.
I'm currently trying to compile it on my Raspberry Pi (armv7l) which I could then transfer the compiled programs from to the Kobo.
Code
[4903/42486] Compiling CXX object (...)
That's going to be a long ride.
Reply 

#4  Elektron 01-11-2021, 10:51 PM
Alright got it. So I think I'll get my other microSD card from my desk drawer and get Alpine up and running within the week!!
Reply 

#5  Elektron 01-11-2021, 11:04 PM
Hypothetically you could just flash the armv7l Alpine image directly to the MicroSD but that would mean no nickel, right?
Reply 

#6  NiMa 01-12-2021, 01:02 AM
Quote Elektron
Hypothetically you could just flash the armv7l Alpine image directly to the MicroSD but that would mean no nickel, right?
Terribly bad idea. (Well not on internal SD card Kobos, though). If you brick the device, there's no way out. It's dead.
Maybe I would've tried this if I got into hacking Kobos in ~2015, but now with Kobo moving to soldered eMMC storage, I strongly prefer staying in the chroot/disk image fashion.

But to answer your question, you're right. It'd take a proper flash of the kernel/bootloader/initrd files in the first sector of the MicroSD (not in any partition, just raw data on the card), and the Kobo would've to be compatible with them. Maybe we could use the ones that are preinstalled and just reorganize the partition scheme, but I haven't tried that yet.
Reply 

#7  Elektron 01-12-2021, 01:47 AM
Oh ok. But if I did brick it, then I could take the SD out and flash the factory image to the Kobo and it'd be as good as new. I guess I can experiment a bit and see how it goes.
Reply 

#8  NiMa 01-12-2021, 12:30 PM
Quote Elektron
Oh ok. But if I did brick it, then I could take the SD out and flash the factory image to the Kobo and it'd be as good as new. I guess I can experiment a bit and see how it goes.
Yeah you can if you want
Lucky you (though my half-destroyed Glo HD stills "works" with its internal SD card slot)
Reply 

#9  geek1011 01-12-2021, 04:17 PM
kexec should work to test new kernels and initrds safely (just reboot if it goes wrong), but I haven't tried it myself. If it works, you should be able to pass kernel arguments to "boot" into a disk image and keep everything else untouched.

Also, I think this thread belongs to the developer sub-forum since it isn't part of Nickel.
Reply 

#10  NiMa 01-12-2021, 05:04 PM
Quote geek1011
kexec should work to test new kernels and initrds safely (just reboot if it goes wrong), but I haven't tried it myself. If it works, you should be able to pass kernel arguments to "boot" into a disk image and keep everything else untouched.

Also, I think this thread belongs to the developer sub-forum since it isn't part of Nickel.
Yeah. I also thought of directly editing the rcS to automatically mount the disk image, not launch Nickel and start Alpine right away.

Moderators, feel free to move this if you also think that that should belong to the devs' forum. I put it there because I thought that some people probably don't like the default web browser of Nickel, and thus providing Firefox/Falkon as a replacement and easy-to-do thing is what I've done (or at least, tried to).
Reply 

  Next »  Last »  (1/21)
Today's Posts | Search this Thread | Login | Register