View Single Post
Old 06-06-2014, 09:42 PM   #4
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
Quote:
Originally Posted by NiLuJe View Post
You'll also have to push the full hardf libc suite matching the TC used to the libdir the rpath points to, or things will go kaboom in fun & interesting ways .
The first (simplest case) testing:
Spoiler:

Code:
[root@kindle system]# pwd
/mnt/us/extensions/system
[root@kindle system]# ls -l *
bin:
-rwxr-xr-x    1 root     root        605348 Jun  6  2014 busybox

lib:
-rwxr-xr-x    1 root     root        130228 Jun  6  2014 ld-2.19.so
-rwxr-xr-x    1 root     root       1234140 Jun  6  2014 libc.so.6
[root@kindle system]# bin/busybox
BusyBox v1.22.1 (2014-06-06 15:39:01 CDT) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2012.
Licensed under GPLv2. See source distribution for detailed
copyright notices.

Usage: busybox [function [arguments]...]
   or: busybox --list[-full]
   or: busybox --install [-s] [DIR]
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as.

Currently defined functions:
        [, [[, addgroup, adduser, ar, arping, ash, awk, basename, blkid, bunzip2, bzcat, cat, catv, chattr,
        chgrp, chmod, chown, chroot, chrt, chvt, cksum, clear, cmp, cp, cpio, crond, crontab, cut, date,
        dc, dd, deallocvt, delgroup, deluser, devmem, df, diff, dirname, dmesg, dnsd, dnsdomainname,
        dos2unix, du, dumpkmap, echo, egrep, eject, env, ether-wake, expr, false, fdflush, fdformat, fgrep,
        find, fold, free, freeramdisk, fsck, fstrim, fuser, getopt, getty, grep, gunzip, gzip, halt,
        hdparm, head, hexdump, hostid, hostname, hwclock, id, ifconfig, ifdown, ifup, inetd, init, insmod,
        install, ip, ipaddr, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kill, killall, killall5,
        klogd, last, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login, logname,
        losetup, ls, lsattr, lsmod, lsof, lspci, lsusb, lzcat, lzma, makedevs, md5sum, mdev, mesg,
        microcom, mkdir, mkfifo, mknod, mkswap, mktemp, modprobe, more, mount, mountpoint, mt, mv, nameif,
        netstat, nice, nohup, nslookup, od, openvt, passwd, patch, pidof, ping, pipe_progress, pivot_root,
        poweroff, printenv, printf, ps, pwd, rdate, readlink, readprofile, realpath, reboot, renice, reset,
        resize, rm, rmdir, rmmod, route, run-parts, runlevel, sed, seq, setarch, setconsole, setkeycodes,
        setlogcons, setserial, setsid, sh, sha1sum, sha256sum, sha3sum, sha512sum, sleep, sort,
        start-stop-daemon, strings, stty, su, sulogin, swapoff, swapon, switch_root, sync, sysctl, syslogd,
        tail, tar, tee, telnet, test, tftp, time, top, touch, tr, traceroute, true, tty, udhcpc, umount,
        uname, uniq, unix2dos, unlzma, unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock,
        watch, watchdog, wc, wget, which, who, whoami, xargs, xz, xzcat, yes, zcat

[root@kindle system]# bin/busybox free
             total         used         free       shared      buffers
Mem:        256192       220716        35476            0        19956
-/+ buffers:             200760        55432
Swap:            0            0            0

[root@kindle system]#
Whoot!!
Our own loader and a modern, hard float, glibc.
Code:
[root@kindle lib]# ./ld-2.19.so
Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]
You have invoked `ld.so', the helper program for shared library executables.
This program usually lives in the file `/lib/ld.so', and special directives
in executable files using ELF shared libraries tell the system's program
loader to load the helper program from this file.  This helper program loads
the shared libraries needed by the program executable, prepares the program
to run, and runs it.  You may invoke this helper program directly from the
command line to load and run an ELF executable file; this is like executing
that file itself, but always uses this helper program from the file you
specified, instead of the helper program file specified in the executable
file you run.  This is mostly of use for maintainers to test new versions
of this helper program; chances are you did not intend to run this program.

  --list                list all dependencies and how they are resolved
  --verify              verify that given object really is a dynamically linked
                        object we can handle
  --inhibit-cache       Do not use /etc/ld.so.cache
  --library-path PATH   use given PATH instead of content of the environment
                        variable LD_LIBRARY_PATH
  --inhibit-rpath LIST  ignore RUNPATH and RPATH information in object names
                        in LIST
  --audit LIST          use objects named in LIST as auditors
Also, a modern (hardfloat - not that it matters) busybox.

Give me a few to tar this up with the proper */extensions/system/{lib,bin} paths and I'll attach this pre-alpha thing here. Done.

tomorrow - a hard float Lua
(Lua only has one numeric type: double (precision floating point) and makes heavy us of dlopen. - should be a good test vehicle of my library munging skills.)

Edit: This libc has the default loader hardcoded, but since it is a library, it doesn't seem to matter.
I will put building a "patchelf" high on my todo list to have on hand, just in case it does matter.
Ref: http://anonscm.debian.org/gitweb/?p=....git;a=summary
(Which happens to be written in C++, one of this thread's goals to support.)
Attached Files
File Type: gz ARMhf-0.1-minimal.tar.gz (982.0 KB, 494 views)

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