[lowrisc-dev] building lowRISC binaries with current riscv-gnu-toolchain?

Gabriel L. Somlo gsomlo at gmail.com
Tue Oct 16 20:59:29 BST 2018


Hi,

I'm trying to bring together a reasonably current hardware+software
riscv environment, and lowRISC (on nexys4-ddr) appeared to be the most
likely candidate :)

So I managed to replicate the entire from-source build process for
"lowrisc-chip-ethernet-v05", including the bitstream (with Vivado),
and riscv-tools (riscv-fesvr, riscv-isa-sim, riscv-gnu-toolchain,
busybox, the kernel, and the bbl bootloader).

I also managed to build poky, but as it turns out I can leave that
out, and still get a minimal busybox-in-initramfs working, bootable
system.

So far, so good.

I would, however, like to move toward upgrading this system to more
modern/recent/upstream components.

Busybox is easy, I can build 1.28.3 (currently the latest) with the
included toolchain, and things are still OK.

This is where I got stuck, though:

I can't build a more recent kernel (e.g. 4.19-rc8) with the included
toolchain.

So I grabbed the sources for https://github.com/riscv/riscv-gnu-toolchain
and built it for multilib, including "rv64imafd-lp64" which I believe
"should" work on the lowRISC implementation of the ISA.

However, if I try building a statically linked busybox binary with the
new/upstream toolchain, I'm getting either a signal-7 bus error or a
signal-4 illegal opcode error from the existing (working) lowRISC
kernel.

I noticed that, when using "file" on Fedora28, busybox compiled with
the lowRISC version of the toolchain looks like this:

busybox: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), statically linked, for GNU/Linux 2.6.32, stripped

whereas the one compiled with the new upstream toolchain says:

busybox: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), statically linked, for GNU/Linux 3.0.0, stripped

I haven't dug into it any further so far. I'm wondering though, did I
get the "-march=rv64imafd -mabi=lp64" right? I also tried "-mabi=lp64d"
without success. These were selected based on the "RV64G" string spit
out by /proc/cpuinfo.

Any help or clue as to what I'm doing wrong much appreciated.

Is there a better way to get to a relatively up-to-date
(ISA-bitstream, toolchain, kernel, busybox) tuple (e.g. with a
different board?)

Thanks much,
--Gabriel



More information about the lowrisc-dev mailing list