In order for me to do any real testing of this IPMI firmware, I need the ability to run the binaries on a normal x86 system. Attempting to do any serious work on the embedded ARM system is going to be a huge waste of time (it’s just not powerful enough).
Thankfully, qemu can run individual binaries, though this is a little tricky to do.
My first shot was just running it:
$ qemu-arm-static ./bin/busybox
/lib/ld-linux.so.2: Invalid ELF image for this architecture
This error was a little confusing at first. Doing some research I found this post and realize what the error actually means. What’s happening is qemu starts executing the ARM binary, then goes to try and load /lib/ld-linux.so.2 in order to go further. It finds the host’s x86-64 binary, which is not actually compatible. That same post gives instructions on how to actually run binaries:
$ sudo cp `whereis qemu-arm-static | cut -d" " -f2` .
$ sudo chroot . ./qemu-arm-static ./bin/busybox
BusyBox v1.12.0 (2014-01-02 18:15:33 PST) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.
Usage: busybox [function] [arguments]...
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:
arp, arping, ash, awk, bbconfig, cat, chmod, chown, cp, dd, df, dmesg, du, echo, egrep, fgrep, grep, gunzip, gzip, halt, hostname, ifconfig, ifdown, ifenslave, ifup, init, insmod, ip, ipaddr,
iplink, iproute, kill, killall, killall5, linuxrc, ln, login, ls, lsmod, mesg, mkdir, mknod, mktemp, mount, mountpoint, mt, mv, netstat, nice, passwd, ping, ping6, pipe_progress, pivot_root,
poweroff, ps, pwd, realpath, reboot, reset, rm, rmmod, route, run-parts, rx, script, sed, sendmail, setsid, sh, sleep, start-stop-daemon, tar, telnetd, tftp, top, touch, traceroute, udhcpc, umount,
uname, unzip, usleep, vconfig, wget, which, zcat