May 29, 2024

EBAZ4205 Bitcoin miner board - linux userspace programs

My Ebaz boards run Petalinux, and my Antminer S9 boards run Angstrom.

My interest is in how I might build userspace programs to run on either of these. My x86 Fedora system has a package called "gcc-arm-linux-gnu" (as well as arm-none-eabi-gcc-cs). I have used both of these at various times for embedded "bare metal" projects. The question now is whether I can use the "linux" compiler to compile a simple userspace program.

I give it a try, expecting some issues:

arm-linux-gnu-gcc -o that that.c
/usr/bin/arm-linux-gnu-ld: cannot find crt1.o: No such file or directory
/usr/bin/arm-linux-gnu-ld: cannot find crti.o: No such file or directory
/usr/bin/arm-linux-gnu-ld: cannot find -lc: No such file or directory
/usr/bin/arm-linux-gnu-ld: cannot find crtn.o: No such file or directory
We knew we would need both header files and various libraries (libc if nothing else). It is possible that the header files installed for my x86 system would work, but I am not willing to bet on it. The official statement about gcc-arm-linux-gnu is:
Only building kernels is currently supported. Support for cross-building user space programs is not currently provided as that would massively multiply the number of packages
I also tried arm-none-eabi -- It got farther, finding:
/usr/lib/gcc/arm-none-eabi/13.2.0
This directory has "include" (but no stdio.h, just stdarg.h and such). It finds things in "newlib" under newlib/libc/stdlib and such, but these all fail trying to call basic system calls like _exit.

This could be pursued further -- in particular the business of newlib.

What next?

One option would be to get the glibc sources (and headers) and build my own library -- as well as placing the header files in an appropriate place. In other words, set up my own build system. Perhaps us -Bstatic rather than trying to sort out collisions with whatever libc.so is on my target system.

Another option would be to use some ARM board with a full blown linux install (such as a BBB, an OrangePi running Debian, or even a raspberry Pi. These should have everything set up and ready to go.

Something for another day.


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org