michaeljclark / busybear-linux

busybear-linux is a tiny RISC-V Linux root filesystem image that targets the VirtIO board in riscv-qemu.
93 stars 33 forks source link

Failed to build Linux due to wrong toolchain #5

Closed nightseas closed 5 years ago

nightseas commented 5 years ago

Change CONFIG_CROSS_COMPILE="riscv64-unknown-elf-" to "riscv64-unknown-linux-gnu-" in conf/linux.config will fix below issue: https://github.com/riscv/riscv-gnu-toolchain/issues/335

The interest thing is that if the kernel is compiled with linux toolchain for once, this issue will not happen again, even if I clean the repo and recompile it with the elf toolchain.

BR//Xiaohai Li

michaeljclark commented 5 years ago

Thanks!

Oh right. I remember. The latest version of the Newlib ELF Embedded toolchain cannot produce shared objects (which is unfortunate).

In Linux, shared object support is needed to link a single shared object file, the vdso, which means the Glibc toolchain must be used to compile Linux (which is unfortunate).

It is possible with earlier toolchains to use either newlib or glibc toolchains. It’s unfortunate that ELF shared object support was been disabled because ELF dynamic linking is standard. i.e. this was a backwards compatibility break.

I will make the change. Thank you.

michaeljclark commented 5 years ago

I've made the change here: https://github.com/michaeljclark/busybear-linux/commit/a01f6232b4b528eea9351ad9d84d897a50b353df