Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 09-27-2012, 04:54 PM   #706
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 140
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
Quote:
Originally Posted by NiLuJe View Post
@Kai771: Try with -mtune set, if it wasn't already done... It should be overriden by -march, but who knows...
Yeah, already tried... no go.

I took another look at Makefile, but couldn't find any more places where *FLAGS were not passed down.

I then went to Linaro site, and downloaded 2012.04 binaries (the last ones for gnueabi - the newer ones are all gnueabihf). I got the same results as with Ubunutu's Linaro. (Not really surprising... gcc -Q -v gave this:
Code:
GNU C (crosstool-NG linaro-1.13.1-2012.04-20120426 - Linaro GCC 2012.04) version 4.7.1 20120402 (prerelease) (arm-linux-gnueabi)
	compiled by GNU C version 4.1.3 20080704 (prerelease) (Ubuntu 4.1.2-27ubuntu1), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.9
Linaro 2012.04 needs -D_GNU_SOURCE (GLIBC_2.7 error without it). It has -mtls-dialect=gnu in it's COLLECT_GCC_OPTIONS - so that's not it either.

The settings I used are supposed to override any problematic defaults:

Code:
CFLAGS:=-O3 -fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE $(SYSROOT)
CXXFLAGS:=-O3 -fno-stack-protector -U_FORTIFY_SOURCE -fno-use-cxa-atexit $(SYSROOT)
ARM_CFLAGS:=-march=armv6j -mtune=arm1136jf-s -marm -mfloat-abi=softfp -mfpu=vfp
but it doesn't work - Segmentation fault.

Both Linaro 2012.04 and Ubuntu Linaro use -imultilib and -imultiarch, so they might be the problem. None of the other TCs I tried (and NiLuJe's version) use it.

In the end, I compiled hello.c with 2012.04 using
Code:
arm-linux-gnueabi-gcc -O3 -fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE -march=armv6j -mtune=arm1136jf-s -marm -mfloat-abi=softfp -mfpu=vfp hello.c -o hello
and tried running it on Kindle. Yeah, you guessed it - Segmentation fault.

I'm now of the opinion that Linaro/Ubuntu somehow compile their TC in a way that makes them incompatible with Kindle 3, and that switches won't fix it. (Disclaimer: Noob's opinion - possibly wrong). If someone can prove it wrong, I'd really like to hear it.

Last edited by Kai771; 09-28-2012 at 02:23 PM.
Kai771 is offline   Reply With Quote
Old 09-27-2012, 07:29 PM   #707
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,491
Karma: 5977000
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
I use that one all the time. works great.

EDIT:

I used:

Quote:
export ARCH_FLAGS="-march=armv7 -mtune=cortex-a8 -mfpu=vfpv3"
export CFLAGS="-mfloat-abi=soft -fno-stack-protector -O2 -ffast-math ${ARCH_FLAGS} -pipe -fomit-frame-pointer"
export CXXFLAGS="-fno-stack-protector" CPPFLAGS="-U_FORTIFY_SOURCE"
export HOST=i686-pc-linux
export BUILD=arm-unknown-linux-gnueabi
With the Linaro 2014.04 sf binary TC via buildroot.

I configure my system as outlined at minimodding
http://minimodding.com/article9-Kind...ng-custom-apps to run custom apps

Last edited by twobob; 12-23-2012 at 09:23 PM. Reason: added my flavour
twobob is offline   Reply With Quote
Old 09-27-2012, 08:11 PM   #708
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 5,774
Karma: 5722276
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by Kai771 View Post
Yeah, already tried... no go.

I took another look at Makefile, but couldn't find any more places where *FLAGS were not passed down.

I then went to Linaro site, and downloaded 2012.04 binaries (the last ones for gnueabi - the newer ones are all gnueabihf). I got the same results as with Ubunutu's Linaro. (Not really surprising... gcc -Q -v gave this:
Code:
GNU C (crosstool-NG linaro-1.13.1-2012.04-20120426 - Linaro GCC 2012.04) version 4.7.1 20120402 (prerelease) (arm-linux-gnueabi)
    compiled by GNU C version 4.1.3 20080704 (prerelease) (Ubuntu 4.1.2-27ubuntu1), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.9
Linaro 2012.04 needs -D_GNU_SOURCE (GLIBC_2.7 error without it). It has -mtls-dialect=gnu in it's COLLECT_GCC_OPTIONS - so that's not it either.

The settings I used are supposed to override any problematic defaults:

Code:
CFLAGS:=-O3 -fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE $(SYSROOT)
CXXFLAGS:=-O3 -fno-stack-protector -U_FORTIFY_SOURCE -fno-use-cxa-atexit $(SYSROOT)
ARM_CFLAGS:=-march=armv6j -mtune=arm1136jf-s -marm -mfloat-abi=softfp -mfpu=vfp
but it doesn't work - Segmentation fault.

Both Linaro 2012.04 and Ubuntu Linaro use -imultilib and -imultiarch, so they might be the problem. None of the other TCs I tried (and NiLuJe's version) use it.

In the end, I compiled hello.c with 2012.04 using
Code:
arm-linux-gnueabi-gcc -O3 -fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE -march=armv6j -mtune=arm1136jf-s -marm -mfloat-abi=softfp -mfpu=vfp hello.c -o hello
and tried running it on Kindle. Yeah, you guessed it - Segmentation fault.

I'm now of the opinion that Linaro/Ubuntu somehow compile their TC in a way that makes them incompatible with Kindle, and that switches won't fix it. (Disclaimer: Noob's opinion - possibly wrong). If someone can prove it wrong, I'd really like to hear it.
strace -fF YourHelloWorld application.
Let us see **when** it segfaults.

You can find a static built strace in the tools index.
knc1 is online now   Reply With Quote
Old 09-28-2012, 05:43 AM   #709
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 140
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
@twobob
Sorry if I misunderstood something, but isn't cortex-a8 and vfpv3 for Kindle 5? I have a Kindle 3. Did you try running on K3 something compiled with Linaro?

One other thing, on http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html they say:
Quote:
-march=name
This specifies the name of the target ARM architecture. GCC uses this name to determine what kind of instructions it can emit when generating assembly code. This option can be used in conjunction with or instead of the -mcpu= option. Permissible names are: `armv2', `armv2a', `armv3', `armv3m', `armv4', `armv4t', `armv5', `armv5t', `armv5e', `armv5te', `armv6', `armv6j', `armv6t2', `armv6z', `armv6zk', `armv6-m', `armv7', `armv7-a', `armv7-r', `armv7-m', `iwmmxt', `iwmmxt2', `ep9312'.

-march=native causes the compiler to auto-detect the architecture of the build computer. At present, this feature is only supported on Linux, and not all architectures are recognized. If the auto-detect is unsuccessful the option has no effect.
Can you really set -march to cortex-a8 or is it a mistake?

I wanted to ask one more thing: both you and NiLuJe use -O2 instead of -O3. Is it wrong to use -O3?

@knc1
Thanks for advice. I'll give it a go as soon as I get home
Kai771 is offline   Reply With Quote
Old 09-28-2012, 07:16 AM   #710
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,491
Karma: 5977000
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
hi when I looked at your name yesterday it said "Kindle" I thought? Perhaps not.
So, I took a best guess as you were fiddling around with "futuristic" TC's (as far as a 3 is concerned) at a touch.

FWIW I go for -02 as thumb in the air for release, I just build as-is for my own stuff, I would rather have the extra info for when things go wrong. Niluje did discuss with others at great length the pro's and cons of optimisations on several other threads which is how I came about my numbers. Relied on the shoulders of others. Happens a lot on here

I got the:
Quote:
@twobob: You don't need to kill ssp & fortify on the Touch .
wrong. oops. I'll go fix that now. You do wan't that on a 3 though.

I have a 3 also, perhaps when I get done fiddling with the Touch I'll go back and look at building some random TC's via buildroot (although the CS 2007.q3 has served me well given it's age) but it's not a priority until the current "can-build" list is exhausted.

In the future perhaps I should read back the 48 pages to check my facts. Although as I have now noticed you have "Kindle 3" as the device there is no need.

IIRC I did actually download this entire thing and run it through a build (without comment) the first time people started complaining about building it. Perhaps given a little free time there will be an opportunity to mirror your efforts this side and see what falls to pieces.

Sounds like fun, can't be today though.
Other fun on the cards.
I assume there is a good reason you have chosen such an interesting flavour of TC and given a bit of time I will be interested to hear the reasons.

Good fortune.

Last edited by twobob; 09-28-2012 at 07:22 AM.
twobob is offline   Reply With Quote
Old 09-28-2012, 08:16 AM   #711
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 140
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
@twobob
No problem at all, just wanted to be sure I didn't miss something.

Quote:
I assume there is a good reason you have chosen such an interesting flavour of TC
I hate to disappoint you, but there's no reason at all - appart from my curiosity. I started with trying to compile kpdfview (my first attempts are described here) and I first succeeded using x-tools-glibc2.5-gcc4.2.4.tar.gz, and then I wrote a guide (here).

Then I tried CS toolchains (all of them) and with a lot of help from others succeeded (with most of them). Now it's Linaro. Just wanted to see what works (and what we can make work). Kinda like "We do stuff so you don't have too" . But of course, everyone is welcome to try too.

P.S. I hope you don't find me too strange for considering this kind of thing "fun" .

Last edited by Kai771; 09-28-2012 at 08:23 AM.
Kai771 is offline   Reply With Quote
Old 09-28-2012, 08:40 AM   #712
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,491
Karma: 5977000
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
hell no. respect
twobob is offline   Reply With Quote
Old 09-28-2012, 09:17 AM   #713
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 5,774
Karma: 5722276
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by Kai771 View Post
Then I tried CS toolchains (all of them) and with a lot of help from others succeeded (with most of them). Now it's Linaro. Just wanted to see what works (and what we can make work). Kinda like "We do stuff so you don't have too" . But of course, everyone is welcome to try too.

P.S. I hope you don't find me too strange for considering this kind of thing "fun" .
Too bad you didn't either get you toolchain from the DIY-KeK resource pool; and/or
Read twobob's thread reporting the results of each CS/MG toolchain.

I guess we can call what you did as "independent confirmation" - other than the artifacts caused by your local problems.
knc1 is online now   Reply With Quote
Old 09-28-2012, 11:15 AM   #714
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 140
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
Quote:
Originally Posted by knc1 View Post
Too bad you didn't either get you toolchain from the DIY-KeK resource pool; and/or
Read twobob's thread reporting the results of each CS/MG toolchain.
If you mean this thread, I read it.

But, if I understood it correctly, the goal of that thread was to make QEMU VM, under which you run gcc, which compile linux apps.

My goal was a bit different. I was only interested in compiling kpdfview. I managed that first with x-tools-glibc2.5-gcc4.2.4.tar.gz, but since that file seemed controversial, I tried with CS next, since it was the default in kpdfview makefile. Actually, I lied in this post: the first CS TC I tried was 2008q1, because twobob said "I recommend the CS (Code Sourcery) 2008q1 now since it is the last TC that compiles natively (Runs applications without replacing the onboard system libraries) for the Kindle 3 ". It didn't work, as can be seen in my previous posts (default makefile has bugs that need to be fixed in order to be able to compile it with versions newer than 2007q3). THEN I downloaded all . So, this is "what TC can you use and how to build kpdfviewer" and not "what TCs are good for kindle cross compiling". Both topics have a lot in common, but the first one is more specific.

That said, I do plan to try out stuff from DIY - KeK a bit later. Wait for me!

Now, I followed your advice, and this is the output:
Code:
execve("./hello-linaro", ["./hello-linaro"], [/* 13 vars */]) = 0
brk(0)                                  = 0x11000
uname({sys="Linux", node="kindle", ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001b000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/var/run/ld.so.cache", O_RDONLY)  = 20
fstat64(20, {st_mode=S_IFREG|0644, st_size=14282, ...}) = 0
mmap2(NULL, 14282, PROT_READ, MAP_PRIVATE, 20, 0) = 0x4001c000
close(20)                               = 0
open("/lib/libc.so.6", O_RDONLY)        = 20
read(20, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250J\1\000"..., 512) = 512
fstat64(20, {st_mode=S_IFREG|0755, st_size=1348230, ...}) = 0
mmap2(NULL, 1135004, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 20, 0) = 0x40025000
mprotect(0x4012e000, 28672, PROT_NONE)  = 0
mmap2(0x40135000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x108) = 0x40135000
mmap2(0x40138000, 8604, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40138000
mprotect(0xbea67000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) = 0
close(20)                               = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40020000
syscall_983045(0x400204a0, 0x400204a0, 0x40024058, 0x40020b78, 0x40, 0x40024058, 0, 0xf0005, 0x6fffff40, 0x8034, 0x40024000, 0xbea67b6c, 0, 0xbea67890, 0x40014974, 0x400020c0, 0x20000010, 0x400204a0, 0, 0, 0xc764, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = 0
mprotect(0x40135000, 8192, PROT_READ)   = 0
munmap(0x4001c000, 14282)               = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 1707 detached
Any comments greatly appreciated .
Kai771 is offline   Reply With Quote
Old 09-28-2012, 11:20 AM   #715
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 5,774
Karma: 5722276
Join Date: Feb 2012
Device: Too many.
You must have skipped reading the document linked to in the topmost post.
http://knetconnect.com/KeK/KeK_reference.html

Which serves as a description of the files in the resource pool.
knc1 is online now   Reply With Quote
Old 09-28-2012, 11:29 AM   #716
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 5,774
Karma: 5722276
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by Kai771 View Post
If you mean this thread, I read it.

But, if I understood it correctly, the goal of that thread was to make QEMU VM, under which you run gcc, which compile linux apps.

My goal was a bit different. I was only interested in compiling kpdfview. I managed that first with x-tools-glibc2.5-gcc4.2.4.tar.gz, but since that file seemed controversial, I tried with CS next, since it was the default in kpdfview makefile. Actually, I lied in this post: the first CS TC I tried was 2008q1, because twobob said "I recommend the CS (Code Sourcery) 2008q1 now since it is the last TC that compiles natively (Runs applications without replacing the onboard system libraries) for the Kindle 3 ". It didn't work, as can be seen in my previous posts (default makefile has bugs that need to be fixed in order to be able to compile it with versions newer than 2007q3). THEN I downloaded all . So, this is "what TC can you use and how to build kpdfviewer" and not "what TCs are good for kindle cross compiling". Both topics have a lot in common, but the first one is more specific.

That said, I do plan to try out stuff from DIY - KeK a bit later. Wait for me!

Now, I followed your advice, and this is the output:
Code:
execve("./hello-linaro", ["./hello-linaro"], [/* 13 vars */]) = 0
brk(0)                                  = 0x11000
uname({sys="Linux", node="kindle", ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001b000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/var/run/ld.so.cache", O_RDONLY)  = 20
fstat64(20, {st_mode=S_IFREG|0644, st_size=14282, ...}) = 0
mmap2(NULL, 14282, PROT_READ, MAP_PRIVATE, 20, 0) = 0x4001c000
close(20)                               = 0
open("/lib/libc.so.6", O_RDONLY)        = 20
read(20, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250J\1\000"..., 512) = 512
fstat64(20, {st_mode=S_IFREG|0755, st_size=1348230, ...}) = 0
mmap2(NULL, 1135004, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 20, 0) = 0x40025000
mprotect(0x4012e000, 28672, PROT_NONE)  = 0
mmap2(0x40135000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x108) = 0x40135000
mmap2(0x40138000, 8604, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40138000
mprotect(0xbea67000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) = 0
close(20)                               = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40020000
syscall_983045(0x400204a0, 0x400204a0, 0x40024058, 0x40020b78, 0x40, 0x40024058, 0, 0xf0005, 0x6fffff40, 0x8034, 0x40024000, 0xbea67b6c, 0, 0xbea67890, 0x40014974, 0x400020c0, 0x20000010, 0x400204a0, 0, 0, 0xc764, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = 0
mprotect(0x40135000, 8192, PROT_READ)   = 0
munmap(0x4001c000, 14282)               = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 1707 detached
Any comments greatly appreciated .
Your program is opening the Kindle's native system libc cache:
Code:
open("/var/run/ld.so.cache", O_RDONLY)  = 20
fstat64(20, {st_mode=S_IFREG|0644, st_size=14282, ...}) = 0
mmap2(NULL, 14282, PROT_READ, MAP_PRIVATE, 20, 0) = 0x4001c000
And then seg-faulting when it tries to un-map it:
Code:
munmap(0x4001c000, 14282)               = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 1707 detached
Try instead to get your helloworld program to open the system library it was built against.

twobob has written extensively on how to do that.
knc1 is online now   Reply With Quote
Old 09-28-2012, 11:58 AM   #717
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 140
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
@knc1
Thanks for explaining what's happening. Transfering glibc that came with Linaro to Kindle, and making the app use that lib is not something I want to do. I don't want to link them statically either. I want the app to use Kindle's glibc.

So, to rephrase what I said earlier: Ubuntu/Linaro compiled their TC and it's libraries in a way that makes them incompatible with Kindle 3's libraries.

Would you say that this is correct?

If you compile Linaro gcc yourself, you can make it compatible with Kindle 3 (that's what NiLuJe did, I think), but the binaries that ship with Ubuntu, or are distributed from Linaro are not.

@NiLuJe
What's your opinion?
Kai771 is offline   Reply With Quote
Old 09-28-2012, 12:39 PM   #718
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 5,774
Karma: 5722276
Join Date: Feb 2012
Device: Too many.
Read twobob's work.

He shows how to get an application (on /mnt/us) to use system files and libraries, also on /mnt/us.
No changes required to the Kindle system files.
knc1 is online now   Reply With Quote
Old 09-28-2012, 01:13 PM   #719
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 4,020
Karma: 4131199
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW & PW2
@Kai771: Just for confirmation: run file on a binary built by the Ubuntu/Linaro TC: What minimum version of the Linux kernel does it report? [ie. ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.22, not stripped]
I'm guessing something way newer than the 2.6.22/2.6.26 of the K2/K3, which would explain why it's segfaulting on a stupid stuff: ABI mismatch. I remember that kind of error being somewhat more user-friendly on x86, where the loader actually tells you why it can't run a binary instead of segfaulting in your face, but, hey...

As for O2 vs. O3, it has the potential of starting a holy war, but basically: I'm not a huge fan of using O3 as the goto 'default' setting. Use it when you know it's gonna be useful, otherwise, it more often than not *lowers* the performance (especially on such a tiny CPU), and almost always ends up generating larger binaries. That said, Linaro does recommend defaulting to O3/Ofast on ARMv7 with their TC.
NiLuJe is online now   Reply With Quote
Old 09-28-2012, 01:21 PM   #720
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 140
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
Quote:
Originally Posted by knc1 View Post
Read twobob's work.

He shows how to get an application (on /mnt/us) to use system files and libraries, also on /mnt/us.
No changes required to the Kindle system files.
You obviously don't understand me. I read twobob's work and I do understand what he's talking about. But it's not what I'm trying to do. I don't want to copy new libs on Kindle in /mnt/us/usr/lib. I want my app to use Kindle system lib.

I read Linaro 2012.04 README (I guess I should've read it long ago... so stupid of me):
Quote:
Target compatibility
--------------------
The arm-linux-gnueabi version targets the Linaro Evaluation Build
11.10 flavour of Ubuntu 11.10 "Oneiric Ocelot". The default
configuration is:

* Runs on all Cortex-A profile devices
* Tuned for the Cortex-A9
* Thumb-2
* 'softfp' calling convention
* Uses the VFPv3-D16 FPU
* Multiarch enabled
* EGLIBC 2.13
* A GCC 4.7 series libgcc and libstdc++
It's built against EGLIBC. Kindle 3 uses GLIBC. No wonder it's not working, right?
Kai771 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Librerator - multi-format e-reader, fork of KPV Kai771 Kindle Developer's Corner 326 Today 05:59 AM
Native KOReader: a document reader for PDF, DJVU, EPUB, FB2, HTML, ... (GPLv3) hawhill Kindle Developer's Corner 447 Today 05:25 AM
Yet another PDF viewer (muPDF based) melihron PocketBook 61 Yesterday 09:28 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


All times are GMT -4. The time now is 02:36 PM.


MobileRead.com is a privately owned, operated and funded community.