Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to build on Ubuntu w/ their version of GCC for RISCV #4

Open
wadester opened this issue Aug 27, 2018 · 1 comment
Open

how to build on Ubuntu w/ their version of GCC for RISCV #4

wadester opened this issue Aug 27, 2018 · 1 comment

Comments

@wadester
Copy link

I am trying to build busybear-linux with their supplied GCC for RISCV:
gcc-7-riscv64-linux-gnu and gcc-7-riscv64-linux-gnu-base:amd64
or gcc-8-riscv64-linux-gnu and gcc-8-riscv64-linux-gnu-base:amd64

I have multiple questions:
Should I use GCC 7 or 8?
How would I change the scripts from using a full tool install, for example into /opt/riscv?
If building GCC for RISCV should I use the multilib option:
./configure --prefix=/opt/riscv --enable-multilib
make linux

Could you update the docs to include some clarification.

Thanks for a great project. Note, I did something similar using buildroot on a 2.2 kernel
a very, very long time ago to make an image that fit on a floppy....

@michaeljclark
Copy link
Owner

Hi,

Sorry for the late reply. The project is currently configured for the toolchain directory layout of riscv-gnu-toolchain. I have not tried it using the debian toolchains. Feel free to make a pull request if you have time.

You would need to muck around with scripts/image.sh to figure out how to get it to build an image for a compiler with a different directory layout and different dynamic linker directories.

It should work either with or without --enable-multilib however most of the recent testing has been with multilib toolchains. It's intended for use with both which is why there is no mention in the docs. I'll consider updating the docs. Here is the fragment from scripts/image.sh that detects a multilib toolchain:

# copy libraries
if [ -d ${GCC_DIR}/sysroot/usr/lib${ARCH/riscv/}/${ABI}/ ]; then
    ABI_DIR=lib${ARCH/riscv/}/${ABI}
else
    ABI_DIR=lib
fi

This should pick either one of these:

  • PREFIX/sysroot/usr/lib64/lp64d
  • PREFIX/sysroot/usr/lib

Note: the expression ${ARCH/riscv/} extracts the bitwidth from the ARCH variable (either riscv32 or riscv64), as I it is also written to allow for creating test images using 32-bit toolchain and kernel.

It might good to add a static option which would simplify this a bit as the tricky bit is library dependencies (the shell script code in copy_libs).

Michael.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants