View Single Post
Old 05-18-2016, 11:40 PM   #249
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
I am still a bit confused about why armv4l static binaries will NOT run on later kindles. It seems to me (intuitively) that static apps ought to do ONLY standard system calls, which SHOULD be backward compatible, and that newer ARM chips SHOULD also be backward compatible. Finding what is choking newer kindles running old apps is not something I want to waste time on though, so "all kindle" apps may need a launcher script that selects which of two binaries to run based on kindle serial number prefix (B001 and B101 for K1 binary, else K2+ binary). Icky but expedicious...

Also, some of these binaries are huge "multiplex" binaries (like busybox) which contain many "programs" all bundled into one huge file. The main entry point is a multiplexor that selects which embedded function to call based on parameter zero (the filename, which is argv[0], or $0 in multiplex shell scripts). The busybox function is special in that it shifts the input parameters left and calls the main multiplexor again, or if no parameters, it displays usage and an embedded function list.

On a filesystem that supports symlinks, it is typical to create symlinks to busybox, one for each embedded function. Busybox sees the filename it was called under, and multiplexes accordingly. When storing a /bin folder on vfat (/mnt/us), there are no symlinks allowed, so it is common to copy /bin and let all those symlinks get replaced with renamed copies of the huge busybox file.

However, I plan to do it differently because the K1 has limited userstore space. I will replace symlinks with scripts that just do "/mnt/us/bin/busybox basename $0 $1 $2 $3 $4 $5 $6 $7 $8 $9", which should behave just like a symlink, but be vfat compatible. There is a precedent to this with /lib, which on some kindles contains a bunch of symlinks to a large multiplex library, and on other kindles contains text files containing a path to the multiplex library (i.e. a library loader script). You can see this in the replacement "bind" libs included in my tcc compiler package. Obviously, those loader scripts could work fine on vfat, just like the (untested) executable script replacements for symlinks mentioned above.

The reason I was thinking about this is that I want to copy a lot of stuff from my armv4l build environment to my kindle, without eating too much of its limited userstore (i.e. the shared flash drive space at /mnt/us). Instead of many copies of huge multiplex executables and libraries stored on vfat, just one of each, and a text file to substitute for each symlink. That seems (intuitively) non-icky and expedicious.

Last edited by geekmaster; 05-19-2016 at 12:07 AM.
geekmaster is offline   Reply With Quote