I am hacking an ARM-based device that is coming with a lightweight busybox:
[/mnt/sdcard/busybox]## busybox
BusyBox v1.24.1 (2017-09-29 00:55:28 PDT) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2015.
Licensed under GPLv2. See source distribution for detailed
copyright notices.
Usage: busybox [function [arguments]...]
or: busybox --list
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:
ash, awk, cat, chmod, clear, cp, date, dd, devmem, df, dhcprelay, dmesg, dnsdomainname, dumpleases, echo, egrep, env, fgrep, find, flock,
free, ftpd, getty, grep, halt, head, hostname, ifconfig, inetd, init, insmod, ipcs, kill, killall, killall5, linuxrc, ln, logger, login,
logread, ls, lsmod, lsusb, md5sum, mkdir, mkdosfs, mkfs.vfat, modinfo, more, mount, mv, netstat, passwd, ping, pkill, poweroff, printf, ps,
pwd, reboot, renice, reset, rm, rmmod, route, sed, sh, sleep, sort, strings, sync, sysctl, syslogd, tail, telnet, telnetd, tftp, time, top,
touch, traceroute, tty, udhcpc, udhcpd, umount, uname, unlink, uptime, usleep, vi, volname, watch, wc
It is missing a few functions that I'd like (tar, gzip...). So I have started building busybox (1.36.0), that I aim to squeeze into the firmware image. I can make a working version of busybox if I statically link its libs. But the binary is too large and I'm trying to build it with dynamic links. Everything I try ends up that way:
[~]## ./busybox
/system/bin/sh: ./busybox: not found
Which seems to indicate to me that it is not able to find or work with the required libs.
[/mnt/sdcard/busybox]## echo $LD_LIBRARY_PATH
/lib:/system/lib:/vendor/lib:/mvs/lib:/usr/lib
[/mnt/sdcard/busybox]## ls -al /lib/lib*.so.6
lrwxrwxrwx root root 2019-05-22 04:21 libc.so.6 -> libc-2.19-2014.04.so
lrwxrwxrwx root root 2019-05-22 04:21 libm.so.6 -> libm-2.19-2014.04.so
lrwxrwxrwx root root 2019-05-22 04:21 libstdc++.so.6 -> libstdc++.so.6.0.19
These seem to be the only dependencies, and they are present on the device:
[/mnt/sdcard/busybox]## echo $LD_LIBRARY_PATH
/lib:/system/lib:/vendor/lib:/mvs/lib:/usr/lib
[/mnt/sdcard/busybox]## ls /lib/lib*.so.6
/lib/libc.so.6
/lib/libm.so.6
/lib/libstdc++.so.6
Could it be a version mismatch at the kernel or library level? If yes, how do I align them?
I have tried copying the libs from my computer into the device, adding '.' to the LD_LIBRARY_PATH env variable, in vain. I note that the libs on my computer are much larger in disk size than the ones on the device.