09-22-2012, 11:40 AM | #691 |
Enthusiast
Posts: 28
Karma: 10
Join Date: Sep 2011
Device: Kindle 3, Kobo Aura H2O
|
Hi,
After looking at introductions on how to install and use with launchpad or kite, I couldn't find any information whether this PDF reader supports Kindle Kb 3.4. It reads in the first post that jailbreaked kindles, but is jailbreaking needed for the launchpad only? since kite doesn't seem to require it. I have Duokan installed to dunno how jailbreaking might affect it. Please post screenshots of the reader in action. tl;dr would it work if I use PDF reader + Kite on not-jailbroken kindle 3.4 (which has Duokan installed) ? |
09-22-2012, 01:41 PM | #692 |
Zealot
Posts: 140
Karma: 23528
Join Date: Nov 2009
Location: London
Device: Kobo Aura One,HD,H2O,Touch,Mini,Kindle 3+DXG,Nook Simple Touch
|
Kozzi
jailbreak+launchpad work absolutely fine on Kindle Keyboard with firmware 3.4 |
09-22-2012, 04:16 PM | #693 |
Just a Noob
Posts: 145
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
|
I finally managed to compile kpdfview that would work on kindle using CS/MG 2012.03-57 toolchain. I was going to write a lengthy post listing all the things that I tried (and failed), but in the end I decided not to waste everyone's time. Instead, I'll just give final working solution.
1. copy stdio.h from 2007q3 over 2012.03's stdio.h in /opt/arm-2012.03/arm-none-linux-gnueabi/libc/usr/include. (You can probably use stdio.h from kindle source, but I didn't try this. If you use header from kindle source, it might need to be adapted https://github.com/hwhw/kindlepdfviewer/issues/103) 2. copy /usr/lib/libstdc++.so.6.0.8 from your kindle to your pc. Rename it to libstdc++.so.6.0.16 and copy it over existing file in /opt/arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/. (You can probably copy it without renaming, but then you'd have to delete libstdc++.so.6 and libstdc++.so and remake them to link to libstdc++.so.6.0.8. I find renaming easier). And that's it. KindlePDFViewer will now compile with 2012.03-57, and this time, it WILL work on Kindle. I suppose this will work on other versions too (from 2008q3-41 to 2011.09-70) but I didn't try it. Oh, I forgot to mention: you don't need to use STATICLIBSTDCPP when compiling. It will link dynamically. Update: As NiLuJe pointed out bellow, this is an ugly hack. Do not use it. Use this instead. Last edited by Kai771; 09-25-2012 at 01:50 AM. |
09-22-2012, 06:04 PM | #694 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@Kai771: That's... not pretty. At all. And will possibly blow up in fun & interesting ways at runtime.
You didn't answer my previous questions, (checking the full readelf output), but I'm assuming it's as simple as not having the correct *FLAGS in your env (I forgot to mention it explicitly, because I *always* have that stuff in my env) and one of the third party libs ended up using non tweaked CFLAGS, thus pulling stack-smashing/fortify/cxa_atexit stuff. |
09-22-2012, 06:44 PM | #695 | |
Just a Noob
Posts: 145
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
|
Quote:
Code:
16: 0000ac84 0 FUNC GLOBAL DEFAULT UND __aeabi_atexit@CXXABI_ARM_1.3.3 (6) 117: 0000b134 0 FUNC GLOBAL DEFAULT UND __isoc99_sscanf@GLIBC_2.7 (10) 224: 0000b5d8 0 FUNC GLOBAL DEFAULT UND __isoc99_fscanf@GLIBC_2.7 (10) Getting rid of the first one (CXXABI_ARM_1.3.3) was much harder. I googled, read numerous pages, but nothing seemed to work. Finally, I tried to link statically libstdc++ and it did work on kindle. But, I wanted it linked dynamically, so I replaced the lib using the one from my kindle in the end. It worked. About FLAGS - I don't have them in my env. Actually, I have no idea what I should have there. I use just a basic Ubuntu install, just like described in my guide. Not sure what you are reffering to with "one of the third party libs ended up using non tweaked CFLAGS, thus pulling stack-smashing/fortify/cxa_atexit stuff." I don't want to bother you too much, but if you're willing to teach, I'm willing to learn . I appreciate any suggestions you might have. Last edited by Kai771; 09-22-2012 at 07:04 PM. |
|
09-22-2012, 09:19 PM | #696 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@Kai771:
The isoc99 stuff should be gone with a GNU_SOURCE define (usually adding -D_GNU_SOURCE to CPPFLAGS is enough, although some crappy buildsystems may not honor CPPFLAGS, so, to the CFLAGS soup if it's not enough), or a tweak of the -std CFLAG, although it's been a while since I've run into those with my TC, so I may be a bit rusty (and I'd go with defining GNU_SOURCE over tweaking the standard). The __aeabi_atexit was why I'm putting -fno-use-cxa-atexit in CXXFLAGS in the Makekfile (although it may have some ties to how my TC is built) . Basically, look at the KINDLE_TC case switch near the top fn my x-compile script, after the TC setup, that's where I setup the env. (Granted, I'm a Gentoo user, so I'm used to setting this up in profiles & co). A big dumb recursive grep on the whole tree should light up the object files pulling the troublesome symbols, that may help pinpoint which buildsystem was naughty. And, since we're talking about TC, for those of us using GCC 4.7.2 or Linaro GCC 4.6/4.7: Code:
## NOTE: See http://gcc.gnu.org/gcc-4.7/changes.html & http://comments.gmane.org/gmane.linux.linaro.devel/12115 & http://comments.gmane.org/gmane.linux.ports.arm.kernel/117863 ## But, basically, if you want to build a Kernel, backport https://github.com/mirrors/linux/commit/8428e84d42179c2a00f5f6450866e70d802d1d05 [it's not in FW 2.5.8/3.4/4.1.0/5.1.2], ## or build your Kernel with -mno-unaligned-access ## You might also want to backport https://github.com/mirrors/linux/commit/088c01f1e39dbe93a13e0b00f4532ed8b79d35f4 if you intend to roll your own Kernel. ## For those interested, basically, if your kernel has this: https://github.com/mirrors/linux/commit/baa745a3378046ca1c5477495df6ccbec7690428 then you're safe in userland. ## (That's the commit merged in 2.6.28 that the GCC docs refer to). ## It's in FW 3.x/4.x/5.x, so we're good on *some* Kindles. However, it's *NOT* in FW 2.x, and the trap handler defaults to ignoring unaligned access faults. ## I haven't seen any *actual* issues yet, but the counter does increment... ## So, to be on the safe side, let's use -mno-unaligned-access on the K3 TC, to avoid going kablooey in weird & interesting ways on FW 2.x... ;) ARM_NO_UNALIGNED_ACCESS="-mno-unaligned-access" Also, if you target something running on FW 2.x, use -mno-unaligned-access for userland stuff too, it might not be safe in every cases otherwise. Last edited by NiLuJe; 09-23-2012 at 04:45 PM. Reason: Ammended (again) my whole unaligned access investigation, always better to double check things in the morning ;) |
09-24-2012, 07:14 PM | #697 |
Just a Noob
Posts: 145
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
|
@NiLuJe
I managed to compile and run kpdfview on kindle using CS/MG 2012.03-57 toolchain - this time properly (I think) without ugly hacks . This time I'll include a lengthy account of what I did - hopefully it will provide some entertainment . As a courtesy to those who're not interested in intricacies of make process, I'm putting it between spoiler tags. Summary - the default Makefile is broken (in my opinion) and doesn't pass parameters to sub-makes properly. I attached fixed Makefile. Spoiler:
Last edited by Kai771; 09-25-2012 at 02:01 PM. Reason: Sorry, had a typo in attached Makefile. Fixed now |
09-24-2012, 07:23 PM | #698 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@Kai771: Yep, I was relying on the third-party stuff obeying my env more than forcing everything in the Makefile (because I always have my env set, and also to keep the Makefile tweaks to the minimum), but you got the idea, and discovered how fun it can be to track down... ^^. (It also stems from the fact that I'm a Gentoo user, and following the 'Gentoo way', I'm more inclined to fix buildsystems to honor the env rather than to 'fix' a buildsystem by forcing more stuff down its throat ).
There's also the added fun that mupdf builds the two *dump binaries for your host, not your target, so you can't have ARM stuff passed to your host's x86/x86_64 compiler, hence the whole double defines in my diff, once with -march & co, once without . This may not concern the TC you used, but GCC's stack-smashing protection handling & glibc's fortify support may also be things to keep in mind . Everything depends on the TC you use (for exemple, while I do need to kill ssp & fortify, I don't have to define GNU_SOURCE on my setup). That said, between the two of us, we've covered most of what one might encounter when trying this kind of stuff . (The glibc_2.15 stuff is interesting, though... my best guess would be the CS/MG TC handling fortify/ssp in a weird, or at least different way than I'm used to, since it seems to be disabled by default, and actually passing those flags/defines made things worse...). Or, possibly more likely, since the 2.15 stuff was pulled by libm, that's it's defaulting to the 'old' soft (not softfp) float ABI, and asking for the vfp fpu with these settings pulled some extra soft fp stuff from libm... Last edited by NiLuJe; 09-24-2012 at 07:43 PM. |
09-25-2012, 03:21 PM | #699 |
Just a Noob
Posts: 145
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
|
I tried compiling with Linaro that comes with Ubuntu 12.04 again (sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi). I used Makefile from my previous post. Readelf showed problems with GLIBC_2.11 and GLIBC_2.15. I added -fno-stack-protector and -U_FORTIFY_SOURCE to both CFLAGS and CXXFLAGS. This time readelf was happy, but it didn't work on the kindle - Segmentation fault. Any ideas?
Oh, and Linaro doesn't need -D_GNU_SOURCE either. It doesn't hurt though. Last edited by Kai771; 09-25-2012 at 03:32 PM. |
09-25-2012, 03:25 PM | #700 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
ops:
Last edited by knc1; 09-25-2012 at 03:44 PM. |
09-25-2012, 04:25 PM | #701 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@Kai771: I'm not familiar with Ubuntu, but they may have moved to a weird multilib and/or hardfloat toolchain, and/or default to weird settings that blow up on the K3.
(Although, ideally, it should have SIGILL instead of SIGSEGV, but, I've seen some pretty weird behavior with kpdf when built with certain TCs, so, who knows...). (If you really want to look at the default flags to play spot the difference, look at the output from gcc -Q -v on a minimal C file [like a hello world]). Last edited by NiLuJe; 09-25-2012 at 04:29 PM. |
09-26-2012, 05:00 PM | #702 |
Just a Noob
Posts: 145
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
|
Well, I didn't really want to, but my curiosity got the better of me, and I tried gcc -Q -v hello.c approach. for CS/MG 2012.3 i got this (unimportant parts omitted):
Code:
gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-57) COLLECT_GCC_OPTIONS='-Q' '-v' '-march=armv5te' '-mtls-dialect=gnu' '-funwind-tables' '-D' '__CS_SOURCERYGXX_MAJ__=2012' '-D' options passed: -v -iprefix /opt/arm-2012.03/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.3/ -isysroot /opt/arm-2012.03/bin/../arm-none-linux-gnueabi/libc -D __CS_SOURCERYGXX_MAJ__=2012 -D __CS_SOURCERYGXX_MIN__=3 -D __CS_SOURCERYGXX_REV__=57 hello.c -march=armv5te -mtls-dialect=gnu -funwind-tables options enabled: -fauto-inc-dec -fbranch-count-reg -fcommon -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining -feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fident -finline-functions-called-once -fira-share-save-slots -fira-share-spill-slots -fivopts -fkeep-static-consts -fleading-underscore -fmath-errno -fmerge-debug-strings -fmove-loop-invariants -fpeephole -fprefetch-loop-arrays -freg-struct-return -fsched-critical-path-heuristic -fsched-dep-count-heuristic -fsched-group-heuristic -fsched-interblock -fsched-last-insn-heuristic -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic -fsched-stalled-insns-dep -fshow-column -fsigned-zeros -fsplit-ivs-in-unroller -fstrict-volatile-bitfields -ftrapping-math -ftree-cselim -ftree-forwprop -ftree-loop-if-convert -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-slp-vectorize -ftree-vect-loop-version -funit-at-a-time -funwind-tables -fvar-tracking -fvar-tracking-assignments -fzero-initialized-in-bss -mglibc -mlittle-endian -msched-prolog Code:
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) COLLECT_GCC_OPTIONS='-Q' '-v' '-march=armv7-a' '-mfloat-abi=softfp' '-mfpu=vfpv3-d16' '-mthumb' options passed: -v -imultilib . -imultiarch arm-linux-gnueabi hello.c -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -fstack-protector options enabled: -fauto-inc-dec -fbranch-count-reg -fcommon -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining -feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fident -finline-functions-called-once -fira-share-save-slots -fira-share-spill-slots -fivopts -fkeep-static-consts -fleading-underscore -fmath-errno -fmerge-debug-strings -fmove-loop-invariants -fpeephole -fprefetch-loop-arrays -freg-struct-return -fsched-critical-path-heuristic -fsched-dep-count-heuristic -fsched-group-heuristic -fsched-interblock -fsched-last-insn-heuristic -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic -fsched-stalled-insns-dep -fshow-column -fsigned-zeros -fsplit-ivs-in-unroller -fstack-protector -fstrict-volatile-bitfields -ftrapping-math -ftree-cselim -ftree-forwprop -ftree-loop-if-convert -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-slp-vectorize -ftree-vect-loop-version -funit-at-a-time -fvar-tracking -fvar-tracking-assignments -fzero-initialized-in-bss -mglibc -mlittle-endian -msched-prolog -mthumb -munaligned-access -mvectorize-with-neon-quad Code:
$ arm-none-linux-gnueabi-gcc -print-multi-lib .; armv4t;@march=armv4t thumb2;@mthumb@march=armv7 Code:
$ arm-linux-gnueabi-gcc -print-multi-lib .; .;@mfloat-abi=softfp hf;@mfloat-abi=hard -fextension-elimination 1 un -fpromote-loop-indices 1 un -frename-registers 1 -fschedule-insns 1 -ftree-if-to-switch-conversion 1 un -ftree-pre-partial-partial 1 un -funroll-loops 1 -funwind-tables 1 -fweb 1 -mthumb 2 -mvectorize-with-neon-quad 2 Number 1 on the right signifies that that option appeared in CS output, and not in Ubuntu Linaro. Number 2 signifies that it appeared in Ubuntu Linaro, but not in CS. I first tried setting ARM_CFLAGS:=-march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp. This gave me Illegal Instruction runtime error. I then tried adding all of the options pressent in CS to CFLAGS and CXXFLAGS. It reported unrecognized command line option for those that have "un" on the right. I removed them and tried again, but I again got Segmentation fault. I also tried setting CFLAGS and CXXFLAGS to -O2 -ffast-math -pipe -fomit-frame-pointer -fno-stack-protector -U_FORTIFY_SOURCE, and ARM_CFLAGS="-march=armv6j -mtune=arm1136jf-s -mfpu=vfp". Segmentation fault again. If anybody has some ideas, I'd be happy to try them. If not, I'll file it under "Ubuntu quirks" for now, and try it again with Ubuntu 12.10 which should come out soon. Last edited by Kai771; 09-26-2012 at 07:22 PM. |
09-26-2012, 05:13 PM | #703 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@Kai771: Ubuntu defaults to -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16, which would be okay if targeting the K4/K5, but is completely wrong for the K3.
My best guess is that something's still not picking up the right *FLAGS along the way, and thus ends up using gcc's defaults => SIGILL/SIGSEGV on the K3 because armv7 > armv6 & vfp3 > vfp. You can try with the full march/mtune/mfpu/float-abi/marm stuff in your *FLAGS & env, see if it helps. The fact that you ran CS with O3 & Ubuntu without explains the different optimization related flags (all the ones you flaged only in CS with a 1). The two others are because the Ubuntu TC is more recent & defaults to targeting the Cortex family (mvectorize-with-neon-quad), and defaults to Thumb mode instructions (mthumb). FWIW, with my ct-ng self-built TC (no args, so default opt level): Code:
gcc version 4.7.2 20120910 (prerelease) (crosstool-NG hg+default-c79d55b27724) COLLECT_GCC_OPTIONS='-Q' '-v' '-march=armv6j' '-mtune=arm1136jf-s' '-mfloat-abi=softfp' '-mfpu=vfp' '-mtls-dialect=gnu' options passed: -v /home/niluje/hello.c -march=armv6j -mtune=arm1136jf-s -mfloat-abi=softfp -mfpu=vfp -mtls-dialect=gnu options enabled: -fauto-inc-dec -fbranch-count-reg -fcommon -fdebug-types-section -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining -feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fgnu-runtime -fident -finline-atomics -fira-share-save-slots -fira-share-spill-slots -fivopts -fkeep-static-consts -fleading-underscore -fmath-errno -fmerge-debug-strings -fmove-loop-invariants -fpeephole -fprefetch-loop-arrays -freg-struct-return -fsched-critical-path-heuristic -fsched-dep-count-heuristic -fsched-group-heuristic -fsched-interblock -fsched-last-insn-heuristic -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic -fsched-stalled-insns-dep -fshow-column -fsigned-zeros -fsplit-ivs-in-unroller -fstrict-volatile-bitfields -ftrapping-math -ftree-cselim -ftree-forwprop -ftree-loop-if-convert -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-slp-vectorize -ftree-vect-loop-version -funit-at-a-time -fvar-tracking -fvar-tracking-assignments -fzero-initialized-in-bss -marm -mglibc -mlittle-endian -msched-prolog -munaligned-access -mvectorize-with-neon-quad Last edited by NiLuJe; 09-26-2012 at 05:26 PM. |
09-26-2012, 07:39 PM | #704 | |||
Just a Noob
Posts: 145
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
|
Quote:
I also went through Makefile, and fixed few more places where *FLAGS weren't passed down, but that didn't help either (I might have missed some of them. I'll check again tomorrow. I'm attaching the most recent Makefile that I used). Quote:
Code:
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) COLLECT_GCC_OPTIONS='-O3' '-fno-stack-protector' '-U' '_FORTIFY_SOURCE' '-march=armv6' '-marm' '-mfpu=vfp' '-Q' '-v' '-mfloat-abi=softfp' Quote:
I don't know if it's relevant, but my Ubunty Linaro won't accept -mtls-dialect=gnu, and I see it in both yours and CS defaults. Last edited by Kai771; 09-27-2012 at 05:50 AM. Reason: typo |
|||
09-26-2012, 08:14 PM | #705 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@Kai771: Try with -mtune set, if it wasn't already done... It should be overriden by -march, but who knows...
Oh, then it's just different/new optimization flag because of the newer GCC version . I'm pretty sure Amazon's stuff is using ARM instructions, not thumb. (Thumb1 on the K3 isn't really interesting performance-wise anyway). Yes, the vectorize stuff is probably only used on armv7-a/neon anyway . No idea about mtls-dialect, but gnu is the default anyway . |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
KOReader: a document reader for PDF, DJVU, EPUB, FB2, HTML, ... (GPLv3) | hawhill | Kindle Developer's Corner | 1268 | 02-27-2024 11:49 AM |
Librerator - multi-format e-reader, fork of KPV | Kai771 | Kindle Developer's Corner | 432 | 10-06-2017 12:20 PM |
Yet another PDF viewer (muPDF based) | melihron | PocketBook | 66 | 09-02-2014 03:03 AM |
Text-based PDF to Mobi, etc./Kindle 3 | kidblue | Calibre | 41 | 07-20-2012 03:19 PM |
muPDF on Kindle DX!! | DairyKnight | Kindle Developer's Corner | 8 | 03-21-2010 03:39 AM |