View Single Post
Old 06-06-2014, 05:34 PM   #1
knc1
Going Viral
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: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
ARMhf on the Kindle(s)

An old subject, born again - -
Our plan to extend the availability of applications for the Kindle:
https://bitbucket.org/twobob/kual-system

That plan above will have to be altered to accommodate the hard-coded search behavior of the multi-lib'd dynamic loader.
And it will have to be re-written to account for the system tree change @ v-0.3

The Quick and Dirty way to get rich with Porn <<-- Do Not Read This Spoiler -->>
you might go blind.
Spoiler:

Thread Layout
Abstracts of each major milestone, with links to deeper posts holding details.
The most recently released archives as attachments here.
Some of the deeper, detail, posts have attachments also, mostly to maintain a progress record of this thread's development.

What this thread covers
The development of Kindle system, system libraries that can live in USB storage ( */extensions/system/{*} ).
These system libraries are customizations that can live and work outside of the standard "trusted directory" structure of *nix systems.

Also contained in this thread is the information required for someone else to duplicate and/or extend this part of the Kindle development.

The end result will be a set of modern system libraries that can run (the **binary** version of) applications "ported" from major Linux distributions.
In this case, the "porting" required will be editing the headers of the binaries. There is a utility tool attached here for that purpose (patchelf).

System Overview
Compiler: gnu-GCC v-4.9.0

BinUtils: v2.23.2

System library(ies): gnu-(E)glibc v-2.19
(v-2.20 requires kernels newer than the ones Amazon provides on the Kindles.)
Spoiler:

Code:
[root@kindle root]# cd /mnt/us/extensions/system/lib
[root@kindle lib]# ls
ld-linux-armhf.so.3  libc.so.6
[root@kindle lib]# ./libc.so.6
GNU C Library (Buildroot) stable release version 2.19, by Roland McGrath et al.
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.9.0.
Compiled on a Linux 3.0.101 system on 2014-06-11.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
libc ABIs: UNIQUE
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

Known problem(s), see: https://www.mobileread.com/forums/sho...0&postcount=22

Debugger: GDB v-7.5

Builds:
ARMhf-A8-VFPV3D16
( for K4 ... PW1 and will run on PW2, matches current Debian/Ubuntu applications.
See: https://wiki.debian.org/ArmHardFloatPort )
Spoiler:

Code:
BR2_ARCH="arm"
BR2_ENDIAN="LITTLE"
BR2_GCC_TARGET_ARCH="armv7-a"
BR2_GCC_TARGET_ABI="aapcs-linux"
BR2_GCC_TARGET_CPU="cortex-a8"
BR2_GCC_TARGET_FPU="vfpv3-d16"
BR2_GCC_TARGET_FLOAT_ABI="hard"
BR2_GCC_TARGET_MODE="arm"
BR2_ARM_CPU_HAS_NEON=y
BR2_ARM_CPU_HAS_VFPV2=y
BR2_ARM_CPU_HAS_VFPV3=y
BR2_ARM_CPU_HAS_THUMB2=y
BR2_cortex_a8=y
BR2_ARM_EABIHF=y
BR2_ARM_FPU_VFPV3D16=y
BR2_ARM_INSTRUCTIONS_ARM_CHOICE=y
BR2_ARM_INSTRUCTIONS_ARM=y

ARMhf-A9-NEON ( for PW2 )
Spoiler:

Code:
BR2_ARCH="arm"
BR2_ENDIAN="LITTLE"
BR2_GCC_TARGET_ARCH="armv7-a"
BR2_GCC_TARGET_ABI="aapcs-linux"
BR2_GCC_TARGET_CPU="cortex-a9"
BR2_GCC_TARGET_FPU="neon"
BR2_GCC_TARGET_FLOAT_ABI="hard"
BR2_GCC_TARGET_MODE="arm"
BR2_ARM_CPU_HAS_NEON=y
BR2_ARM_CPU_MAYBE_HAS_NEON=y
BR2_ARM_CPU_MAYBE_HAS_VFPV2=y
BR2_ARM_CPU_MAYBE_HAS_VFPV3=y
BR2_ARM_CPU_HAS_THUMB2=y
BR2_cortex_a9=y
BR2_ARM_EABIHF=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_FPU_NEON=y
BR2_ARM_INSTRUCTIONS_ARM_CHOICE=y
BR2_ARM_INSTRUCTIONS_ARM=y

and something for the K3 - am still working on that one

Compiler / Linker magic
Building for system libraries outside of the trusted locations requires additional options be passed for those building software.
Shown is the Buildroot version, but the contents of the option are the same, regardless of the build method:
Edit: Updated to V-0.3 specs.
Code:
BR2_TARGET_LDFLAGS="-Wl,--dynamic-linker=/mnt/us/esys/lib/ld-linux-armhf.so.3,-rpath=/mnt/us/esys/lib:/mnt/us/esys/usr/lib,-z,nodeflib,--enable-new-dtags"
Version 0.9999999x+
Run the bionic system libraries from USB storage.
Naw, noboby wants to run Android apps on a Kindle.
Maybe musl though. ( http://www.musl-libc.org/ )

PatchElf 0.8
A required utility for putting binaries outside of the FHS trusted locations.
See: https://www.mobileread.com/forums/sho...88&postcount=9
Usage examples: See the commented script in the "helpers" attachment.

Version 0.5
Add "Ledger v3.0" from Debian/Jessie
This will also add-in fairly complete C++ application support.

Version 0.4
Add ld.so audit support.
Package up the -dev files add-on.

Version 0.3
Note to self and others:
Do not try to package and release new system libraries on Friday the 13th.
Replaced Lua-5.1.5 with LuaJit-2.0.3 (which also runs Lua-5.1 code and source) in base system.
Added nano-2.3.2 (because I hate busybox vi - which is still there).
Redefined our external, hard-float, system tree.
Installation and Usage: https://www.mobileread.com/forums/sho...1&postcount=47
Coding example: https://www.mobileread.com/forums/sho...2&postcount=56
Note: Only tested on KPW-1, firmware 5.3.3
Linaro toolchain: http://releases.linaro.org/14.05/com...gcc-linaro/4.9

Older stuff:
"Plan B" died a horrible death at V-0.2.2 - see: https://www.mobileread.com/forums/sho...7&postcount=46
Spoiler:

Version 0.2.1
Use (correct) absolute pathnames in headers.
Picked up a few files and directories missed in v-0.2

Gottcha in this build:
You must use the form: busybox arguments to get bb-v1.22 rather than bb-v-whatever.

Install, see: https://www.mobileread.com/forums/sho...0&postcount=34

Version 0.2
The plan:
Spoiler:

Dynamic linking support:
* Remove sym-links by renaming libraries to their SONAME
(Details: https://www.mobileread.com/forums/sho...45&postcount=3)
* Add custom path to dynamic loader
* Add binary relative search paths
(Notes: https://www.mobileread.com/forums/sho...0&postcount=18)

Build-time linker support: Replace sym-links with one line load scripts
Busybox sym-links: Repace sym-links with shell wrappers (twobob style)
Packaging: Split and packaged as -run and -dev (additional files)


Current post (see also: https://www.mobileread.com/forums/sho...postcount=34):
glibc + its feature libs + busybox + lua + dependent libraries
tar-ball has the extensions/system/* sub-tree (move to device as-is)
Re-set your path per:
export PATH=/mnt/us/extensions/system/bin:/mnt/us/extensions/system/usr/bin:$PATH

Gottcha in this build:
You must use the form: busybox arguments to get bb-v1.22 rather than bb-v-whatever.

Lua is working (and loads a slue of system libraries - so that works also)
( for the non-lua fans: to exit, enter: os.exit(0) )

helpers-0.2.tar.gz is just a collection of small scripts used to make this release.

PatchElf v0.8
Like it or not, we have to have it.
The *.tar.gz is the binary and manuals
The *.zip is the source used.
Details in: https://www.mobileread.com/forums/sho...88&postcount=9

Version 0.1:
For the sake of future reference, the original, minimal (loader, glibc, busybox) tarball for */extensions/system/{bin,lib} is attached at:
https://www.mobileread.com/forums/sho...64&postcount=4
Which should work on k4, k5-touch and was minimally tested on a k5-PW1
Should also run on the PW2, although it is not optimized for the i.MX6 feature set.
Note: Expect it to fail whenever glibc has to dlopen any of its support libraries.
Attached Files
File Type: gz patchelf-0.8.tar.gz (46.6 KB, 531 views)
File Type: zip patchelf-0.8.zip (62.3 KB, 492 views)
File Type: gz base-0.3-a8_armhf_vfpv3d16.tar.gz (2.38 MB, 571 views)
File Type: gz helpers-v0.3.tar.gz (2.5 KB, 515 views)
File Type: gz base-v03-images.tar.gz (5.41 MB, 528 views)

Last edited by knc1; 06-16-2014 at 07:11 AM.
knc1 is offline   Reply With Quote