![]() |
#1 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
![]()
UPDATE: New v1.6 adds fixes for libpthread library problems on v3.3 and v5.1.0 kindle firmware. As we discover new problems with kindle firmware (more broken loadable libraries), we will add fixes for them to new tcc package versions downloadable in this first post. [v1.6a removes include.tar.gz file that did not belong in v1.6].
I successfully built and ran a modified version of dithermatron.c (demo.c included in the install package) on my DX, K3, and K5(touch), like this: 1) download and extract kindle-tcc-1.3.tar.gz (below) to /mnt/us (USB drive) 2) install: "/mnt/us/tcc/install" 3) compile: "tccmake demo" 4) run: "./demo" 5) Watch the kindle draw square and round tubes on its eink screen. For original dithermatron.c and other fun little kindle C programs, go here: For the simple "monolithic" programs I usually write, this download package provides all I need. For programs that use extended library functions, you might need to link to some libraries too. For details and other good tips about using tcc, read this (the download link on that page is dead, so that download is attached below): History and tech notes: Spoiler:
The kindle-tcc-1.6a.tar.gz file attached below contains lrizzo's tcc build downloaded from his website (after fixing his bad download URL), and the tcc include folder downloaded from the tinycc arm source repository, and the include folder from amazon gpl source code version 5.0.0. I also added install and uninstall scripts, and a "bind mount" replacement libc.so loader script that allows tcc to work on the k4 and k5. To use the replacement libc.so, just compile with the tccmake script, or copy the "bind mount" command from that script file for you own use. To make this fun and easy to test, this package also includes the demo.c program mentioned above. ![]() NOTE: Earlier kindle models might need DIFFERENT header files (such as for framebuffer support) from an earlier version of the firmware source code. I do NOT use these in my code. I prefer to COPY individual definitions from kindle version-specific include files to my source program. Also, for incompatible version-specific libraries, I like to add "-static" to my build, so that the library code I need is included inside my compiled program executable file, making it work on all the kindle models (at the expense of a larger executable file). Be aware that although this compiler is convenient, and great for small utility programs, more complex programs such as my dithermatron and cosmegg demos run several times faster when cross-compiled with arm-linux-gcc (from CodeSourcery) than they do with this compiler, so I like to do a final cross-build for a fast executable to include with my demo programs. But for fast development and testing directly on the kindle, this tcc compiler is GREAT! You can always recompile with cross-tools later. And even when compiled with tcc, my C demo programs are much faster than my /bin/sh demo programs. Enjoy and learn! ![]() Last edited by geekmaster; 09-30-2012 at 11:34 AM. Reason: more awesomized :D |
![]() |
![]() |
![]() |
#2 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
|
Thanks.
Would you please also provide the link to get amazon gpl 5.0.0 include folder. Is it on the Kindle? Thanks, James |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
![]() Last edited by geekmaster; 04-19-2012 at 11:51 AM. |
|
![]() |
![]() |
![]() |
#4 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
|
Thanks for the attachment.
This works great! Now to build the VNC client... Best Regards, James Last edited by jmseight; 04-18-2012 at 11:45 PM. |
![]() |
![]() |
![]() |
#5 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
![]() Last edited by geekmaster; 04-19-2012 at 12:31 AM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Version 1.1 of tcc works great on the K3, but on the K5(touch) it has a problem parsing one of the new load library scripts.
Code:
# cat /usr/lib/libc.so
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.3 ) )
tcc: file '/usr/lib/libc_nonshared.a' not found So, I just solved this problem by bind-mounting a stripped-down libc.so script file that tcc knows how to parse. I added the script to the /mnt/us/tcc directory, and I added the mount and umount statements to the tccmake script. It works great. I packaged that up into a v1.3 download package, available at the first post in this thread. This new version should work on all the kindles. ![]() Last edited by geekmaster; 03-22-2016 at 04:21 PM. |
![]() |
![]() |
![]() |
#7 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 32
Karma: 46558
Join Date: Feb 2012
Device: Kindle4NT
|
Code:
# tccmake ./demo tcc: undefined symbol '__libc_csu_fini' tcc: undefined symbol '__libc_csu_init' |
![]() |
![]() |
![]() |
#8 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
![]() To fix this, I need to reproduce your problem so that I can investigate it. I need more information about how your kindle is different from mine. Q1) What version of firmware is installed on your kindle? Q2) What hacks are installed on your kindle? Q3) Does it fail when you boot from main? Q4) Does it fail when you boot from diags? UPDATE: According to this page:[http://www.linuxquestions.org/questi...u_fini-849247/ this is the same problem with the libc.so TEXT file that was fixed with the "bind mount" in the "tccmake" script. It is possible that the bind mount failed. Perhaps another hack already did a similar hack that is preventing tcc from working. Here is "tccmake": PHP Code:
PHP Code:
Last edited by geekmaster; 04-21-2012 at 11:37 AM. |
|
![]() |
![]() |
![]() |
#9 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 58
Karma: 9096
Join Date: Apr 2012
Device: none
|
Thanks for work!
Thanks for work!
Now i have a good environment to study linux on kindle everywhere and it is less harmful to my eyes. Linux is so great.I love it now. ![]() |
![]() |
![]() |
![]() |
#10 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 32
Karma: 46558
Join Date: Feb 2012
Device: Kindle4NT
|
I think you meant
Code:
cat /usr/lib/libc.so ls -al /usr/lib Code:
# cat /usr/lib/libc.so GROUP ( /lib/libc.so.6 ) # mount fsp on /usr/lib/libc.so type fuse.fsp (rw,nosuid,nodev,noatime,user_id=0,group_id=0) |
![]() |
![]() |
![]() |
#11 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
It would help a LOT if I could duplicate your problem on one of my kindles. It would help if you answered my 4 questions in the earlier post. Please answer them so that I can help you. |
|
![]() |
![]() |
![]() |
#12 | |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 32
Karma: 46558
Join Date: Feb 2012
Device: Kindle4NT
|
Quote:
2) Jailbreak, Russian keyboard, Kite, Optware in loop-mounted filesystem 3) Yes, it normal boot, I launched tccmake via ssh (wifi) 4) Did not try |
|
![]() |
![]() |
![]() |
#13 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
![]() When I fix a K4, I will figure this out and fix it. ![]() ![]() Last edited by geekmaster; 04-21-2012 at 06:03 PM. |
|
![]() |
![]() |
![]() |
#14 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Okay, I got one K4 running. I just needed to charge the battery awhile and boot to main with MfgTool, then it saw ENABLE_DIAGS and booted back to diags, but not at the all-black diags screen they were both stuck at. Perhaps they both had dead batteries that could not completely boot to diags, but WOULD NOT CHARGE in that mode. I had to change modes with MfgTool just so they could charge.
I opened a diags SSH session on a K4 running 4.0.1 firmware. I installed tcc according to above instructions, compiled the demo, and it is drawing square and round tubes on the eink screen as I type this. I will try again in main to see if I can duplicate your problem there. I need to install usbnet on it first... So, my K4 4.0.1 runs tccmake just fine (in diags mode). I will test main boot mode (soon). UPDATE: Okay, both K4s are working now. Apparently, they drain the battery completely empty then act bricked if you unplug them from USB while they are left in diags mode, and then plugging in the USB does not seem to charge them in that mode. Need MfgTool boot to main to get them where you can charge them with a wall charger... Or something like that. The key is, do not leave them in diags with USB disconnected, for any length of time -- always exit diags for power down. ![]() Last edited by geekmaster; 04-21-2012 at 06:10 PM. |
![]() |
![]() |
![]() |
#15 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
I am accessing my K4 from wifi now, and I was able to install tcc and compile and run demo.c -- it must be one of your installed hacks somehow interfering or something.
You have optware installed, but are you running tcc in it? Try running with optware NOT running. In optware, you can just use gcc instead of tcc. The benefit of tcc is that you do not NEED any hacks installed. You can use it from diags SSH, or from wifi SSH on main. If optware is not running, it should not interfere with tcc. The jailbreak is just a key file, so it should not interfere. Unless the russian keyboard messes with glibc, I do not see why it should interfere. Regarding kite, I did not know that works on the K4 -- I thought it was for the K3. I will have to check into it. If any of your hacks could be causing tcc to fail, that is the only one that is suspicious (I need to check into it). You have optware, so why not just use gcc there -- that is what I did early on in K4 development. |
![]() |
![]() |
![]() |
Tags |
tcc, tinycc |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
geekmaster simple touchscreen script support hack | geekmaster | Kindle Developer's Corner | 12 | 04-21-2021 11:38 PM |
Very simple guide to reading newspapers on the kindle, please? :) | Pismire | Amazon Kindle | 7 | 06-01-2012 11:26 PM |
Free (Kindle/Nook/ChristianBook) The Invitation: A Simple Guide to the Bible | arcadata | Deals and Resources (No Self-Promotion or Affiliate Links) | 4 | 08-22-2011 01:05 PM |
Simple guide to choosing a Creative Commons license for your work | Bob Russell | News | 0 | 12-26-2006 11:10 AM |