EV3 linux hacking
Posted: 09 Sep 2013, 05:10
There doesn't seem to be a thread focused on this yet so I'll start one I'd love to be able to write a perl or python script to program the EV3 instead of using the improved but still awful GUI programming software provided by lego.
Restoring the system
Before I venture into changing anything via the linux prompt is there anything one needs to do to restore the system other than re-image the firmware?
Writing to the filesystem
The filesystem is mounted as readonly and df claims there isn't any free space. I'm guessing one needs to insert a SD card and use that storage space for adding new software etc. I'll try that tomorrow.
Adding software
This thing is bare bones in terms of software. There is no gcc, no perl, no python, no vim, no ftp, no web server, etc. Most everything in /bin is via a busybox build from 2010
This build of busybox does include a FTP daemon so that makes it easier to copy files.
Does anyone know of a GCC binary that will work on this system?
Restoring the system
Before I venture into changing anything via the linux prompt is there anything one needs to do to restore the system other than re-image the firmware?
Writing to the filesystem
The filesystem is mounted as readonly and df claims there isn't any free space. I'm guessing one needs to insert a SD card and use that storage space for adding new software etc. I'll try that tomorrow.
Code: Select all
root@EV3:~# pwd
/home/root
root@EV3:~# whoami
root
root@EV3:~# touch foo
touch: foo: Read-only file system
root@EV3:~#
root@EV3:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 22.4M 22.4M 0 100% /
none 1.0M 48.0K 976.0K 5% /dev
tmpfs 2.0M 1.1M 932.0K 54% /var/volatile
tmpfs 6.0M 1.4M 4.6M 24% /mnt/ramdisk
root@EV3:~#
This thing is bare bones in terms of software. There is no gcc, no perl, no python, no vim, no ftp, no web server, etc. Most everything in /bin is via a busybox build from 2010
Code: Select all
root@EV3:/bin# ls -l | grep busybox
lrwxrwxrwx 1 root root 7 Jan 1 00:00 ash -> busybox
-rwxr-xr-x 1 root root 650588 Jan 1 00:00 busybox
lrwxrwxrwx 1 root root 7 Jan 1 00:00 cat -> busybox
lrwxrwxrwx 1 root root 7 Jan 1 00:00 chgrp -> busybox
lrwxrwxrwx 1 root root 7 Jan 1 00:00 chmod -> busybox
lrwxrwxrwx 1 root root 7 Jan 1 00:00 chown -> busybox
[snip]
root@EV3:/bin# ./busybox
BusyBox v1.13.2 (2010-12-21 19:28:47 CST) multi-call binary
The EV3 does however include wget and there is a pre-built binary of busybox 1.21.1 out there:
[url]http://www.busybox.net/downloads/binaries/1.21.1/busybox-armv5l[/url]
root@EV3:~# cd /tmp
root@EV3:/var/volatile/tmp#
root@EV3:/var/volatile/tmp# wget http://www.busybox.net/downloads/binaries/1.21.1/busybox-armv5l
Connecting to http://www.busybox.net (140.211.167.224:80)
busybox-armv5l 100% |***********************************************************************************************| 1083k 00:00:00 ETA
root@EV3:/var/volatile/tmp#
root@EV3:/var/volatile/tmp# chmod 755 busybox-armv5l
root@EV3:/var/volatile/tmp# ./busybox-armv5l
BusyBox v1.21.1 (2013-07-08 10:13:48 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:
[, [[, acpid, add-shell, addgroup, adduser, adjtimex, arp, arping, ash, awk, base64, basename, beep, blkid, blockdev, bootchartd,
brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot, chrt, chvt, cksum, clear,
cmp, comm, conspy, cp, cpio, crond, crontab, cryptpw, cttyhack, cut, date, dc, dd, deallocvt, delgroup, deluser, depmod, devmem, df,
dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env, envdir,
envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat, fdisk, fgconsole, fgrep, find, findfs,
flock, fold, free, freeramdisk, fsck, fsck.minix, fsync, ftpd, ftpget, ftpput, fuser, getopt, getty, grep, groups, gunzip, gzip, halt,
hd, hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock, id, ifconfig, ifdown, ifenslave, ifplugd, ifup, inetd, init, insmod,
install, ionice, iostat, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd,
last, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login, logname, logread, losetup, lpd, lpq, lpr, ls, lsattr,
lsmod, lsof, lspci, lsusb, lzcat, lzma, lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg, microcom, mkdir, mkdosfs, mke2fs,
mkfifo, mkfs.ext2, mkfs.minix, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe, more, mount, mountpoint, mpstat, mt, mv,
nameif, nanddump, nandwrite, nbd-client, nc, netstat, nice, nmeter, nohup, nslookup, ntpd, od, openvt, passwd, patch, pgrep, pidof,
ping, ping6, pipe_progress, pivot_root, pkill, pmap, popmaildir, poweroff, powertop, printenv, printf, ps, pscan, pstree, pwd, pwdx,
raidautorun, rdate, rdev, readahead, readlink, readprofile, realpath, reboot, reformime, remove-shell, renice, reset, resize, rev, rm,
rmdir, rmmod, route, rpm, rpm2cpio, rtcwake, run-parts, runlevel, runsv, runsvdir, rx, script, scriptreplay, sed, sendmail, seq,
setarch, setconsole, setfont, setkeycodes, setlogcons, setserial, setsid, setuidgid, sh, sha1sum, sha256sum, sha3sum, sha512sum,
showkey, slattach, sleep, smemcap, softlimit, sort, split, start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv, svlogd,
swapoff, swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd, time, timeout,
top, touch, tr, traceroute, traceroute6, true, tty, ttysize, tunctl, udhcpc, udhcpd, udpsvd, umount, uname, unexpand, uniq, unix2dos,
unlzma, unlzop, unxz, unzip, uptime, users, usleep, uudecode, uuencode, vconfig, vi, vlock, volname, wall, watch, watchdog, wc, wget,
which, who, whoami, whois, xargs, xz, xzcat, yes, zcat, zcip
root@EV3:/var/volatile/tmp#
Does anyone know of a GCC binary that will work on this system?