View Single Post
Old 05-06-2015, 02:55 AM   #1
fastrobot
Connoisseur
fastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to behold
 
Posts: 53
Karma: 11844
Join Date: Jun 2014
Location: All over the place...
Device: KOBO AuraHD and GLO
Howto recompile opensource firmware for KOBO reader

Hi,
I bought a Kobo GLO revision C and AURA HD, because they have a removable SD card for the firmware, so I'm safe from bricking, and I can hack on them for personalization. But many threads on the subject here at mobile forums are out of date; eg: I had to write a telnet server to upgrade the firmware on my Aura and Glo which strangely doesn't have a telnet client like older KOBO's did... and I'm finding lots of other changes/discrepancies in the open source archive from KOBO and what's actually on their readers...

My goal is to recompile the linux kernel, and all open source portions of the KOBO firmware to prove it can be done, and they are open source compliant. If done properly, I should be able to install recompiled versions of the open source software, and leave the closed source binaries alone; eg: Nickel, and any proprietary kernel drivers, and the e-book reader should still function so long as I recompile the exact open source code that is on my reader now. That's pretty much the point of GPL software, is to make this kind of compatibility possible.

But I'm having trouble locating all the sources and compiler settings for several of the packages found in mandatory firmware update 3.12.0 and 3.12.1 ; and I'm wondering where to get that information and why KOBO hasn't released it as part of their archive...


What I did so far is to download the source to a USB memory key, by:
cd /media/memoryc1
mkdir .local
mkdir .local/bin
git clone git://github.com/kobolabs/Kobo-Reader.git KoboLabs # Create directory KoboLabs

I then ran the install program ./KoboLabs/toolchain/gcc-codesourcery-2010q1-202.bin , using my 32bit linux distribution; and chose to install the code sourcery compiler tools to .local on the memory key.

With that done, I wrote a couple of scripts to set up the bash environment variables properly, so that the code sourcery compiler tools work and can output/install KOBO binaries into a KoboLabs/deviceroot directory I created.

And at long last, I was able to change to the KoboLabs/build directory, and run ./build-all and it went through and made all the packages in the scripts directory, installing them to the deviceroot directory as planned. A Good day's worth of work...

But -- to my surprise, the scripts didn't build the latest libraries and I am not seeing all the gpl'd source code that is actually used on the Kobo reader in the git archive. Some is apparently hidden or missing...

For example; when I type into the KOBO reader
strings /lib/libc.6.so | grep GNU

It tells me that libc.6.so is "EGLIBC 2.15-0unbuntu10"
But I don't see an EGLIBC source code in the git KoboLabs/packages listing, and am not sure where it is.

Also, I found the build script is programmed ONLY for qt-4.6.2 and not qt-4.8.0, although the source code for 4.8.0 is there, the build script is NOT available. So I don't know what compiler switches were used to make qt-4.8.0...

I also noticed that the version of busybox is different, as the kobo says 1.22 but the git archieve has only 1.14.2 and 1.17.1, (And telnet is broken in the newer version, no surprise... making maintenance more difficult) and I've only just begun looking... so there are probably more discrepancies...

Clearly, then, the git archive does not contain all the information needed to clone all the open source portions of the Kobo Glo, and AuraHD's ; it's out of date. How can I clone an archive with the source code specific to firmware 3.12.0 and 3.12.1 ?

-------------------------------------

Edit: Additional information and more problems; I've discovered that binaries created with the code sourcery tool supplied by KOBO and talked about in many mobile read threads do run on the reader, but only if they are either linked to existing dynamic libraries, or else statically linked.

Surprisingly, creation of new dynamic libraries does not work with KOBO's code sourcery toolchain. As a test, I compiled ncurses, and libreadline, and installed a test binary that is dynamically linked to these libraries -- but when run the test binary exits immediately, with no error message, but with error status set to 1. If I try to check the libraries eg: with "/lib/ld-2.11.1.so --list libreadline.so" , the dynamic linker either exits with no message at all, or says "libreadline.so: error while loading shared libraries: libreadline.so: cannot open shared object file: No such file or directory" However, if I statically link the program to libreadline.a and libncurses.a , everything works perfectly.

The error message is silly, because the library is obviously right there... so it's not telling us what file is actually missing.... does anyone have any idea what is going wrong?

Doing a check on a native library, eg: /lib/ld-2.11.1.so on /lib/libz.so produces :

/lib/ld-2.11.1.so --list /lib/libz.so
libc.so.6 => /lib/libc.so.6 (0x2aac7000)
/lib/ld-2.11.1.so (0x54aaa000)

So, I know the KOBO's dynamic linker is working fine.
The only difference I can see is that the native libraries were compiled with gcc 4.8, the "linaro" ? tool? where as I'm using the code sourcery tool from the same archive. Does anyone know what the difference is in the compilers? (arm-none-linux-gnueabi-gcc-4.4.1 and arm-linux-gnueabihf-gcc-4.8.1) ?

EDIT2: The linaro/gnueabihf compiler does make dynamic libraries just fine. So it's just a problem with the CodeSourcery toolchain.... hmmm...

Last edited by fastrobot; 05-07-2015 at 08:13 PM.
fastrobot is offline   Reply With Quote