Open zoro269 opened 2 years ago
Hi @zoro269,
here is some code I used recently and that will probably be integrated soon in the repository:
def opensbi_build():
# Be sure third_party dir is present and switch to it.
create_third_party_dir()
os.chdir("third_party")
# Get OpenSBI.
if not os.path.exists("opensbi"):
os.system("git clone https://github.com/litex-hub/opensbi --branch 0.8-linux-on-litex-vexriscv")
os.chdir("opensbi")
# Configure / Build OpenSBI.
os.system("make CROSS_COMPILE=riscv64-unknown-elf- PLATFORM=litex/vexriscv")
# Copy Linux Images.
os.system("cp build/platform/litex/vexriscv/firmware/fw_payload.bin ../../images/opensbi.bin")
Please let me know if you still have troubles building with this.
Hi enjoy-digital Can you guide me the running steps and order of running? I still don't quite understand. Many thanks
Vào Th 3, 7 thg 6, 2022 vào lúc 14:05 enjoy-digital < @.***> đã viết:
Hi @zoro269 https://github.com/zoro269,
here is some code I used recently and that will probably be integrated soon in the repository:
def opensbi_build():
Be sure third_party dir is present and switch to it.
create_third_party_dir() os.chdir("third_party") # Get OpenSBI. if not os.path.exists("opensbi"): os.system("git clone https://github.com/litex-hub/opensbi --branch 0.8-linux-on-litex-vexriscv") os.chdir("opensbi") # Configure / Build OpenSBI. os.system("make CROSS_COMPILE=riscv64-unknown-elf- PLATFORM=litex/vexriscv") # Copy Linux Images. os.system("cp build/platform/litex/vexriscv/firmware/fw_payload.bin ../../images/opensbi.bin")
Please let me know if you still have troubles building with this.
— Reply to this email directly, view it on GitHub https://github.com/litex-hub/linux-on-litex-vexriscv/issues/282#issuecomment-1148276695, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZP7SWH5MXLTNUBUNLMAQG3VN3YD3ANCNFSM5X7VYLMA . You are receiving this because you were mentioned.Message ID: @.***>
This should work:
git clone https://github.com/litex-hub/opensbi --branch 0.8-linux-on-litex-vexriscv
cd opensbi
make CROSS_COMPILE=riscv64-unknown-elf- PLATFORM=litex/vexriscv
The binary is then located at build/platform/litex/vexriscv/firmware/fw_payload.bin
.
I followed the instructions and got some errors as follows:
first: at make CROSS_COMPILE=riscv64-unknown-elf- PLATFORM=litex/vexriscv . I got the following error:
ELF platform/litex/vexriscv/firmware/fw_dynamic.elf
/home/namnguyendc4/Testtt/linux-on-litex-vexriscv/opensbi/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/8.1.0/../../../../riscv64-unknown-elf/bin/ld: /home/namnguyendc4/Testtt/linux-on-litex-vexriscv/opensbi/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/8.1.0/libgcc.a(div.o): ABI is incompatible with that of the selected emulation:
target emulation elf64-littleriscv' does not match
elf32-littleriscv'
/home/namnguyendc4/Testtt/linux-on-litex-vexriscv/opensbi/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/8.1.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file /home/namnguyendc4/Testtt/linux-on-litex-vexriscv/opensbi/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/8.1.0/libgcc.a(div.o)
collect2: error: ld returned 1 exit status
make: *** [Makefile:317: /home/namnguyendc4/Testtt/linux-on-litex-vexriscv/opensbi/build/platform/litex/vexriscv/firmware/fw_dynamic.elf] Error 1
This leads to the file opensbi/build/platform/litex/vexriscv/firmware there is no file fw_payload.bin and here is a picture of my firmware
@zoro269: Can you test with the GCC toolchain provided by python3 litex_setup.py --gcc=riscv
?
(https://github.com/enjoy-digital/litex/blob/master/litex_setup.py#L323-L345)
@enjoy-digital I have installed and tried the toolchain and still have the error
@zoro269: Can you test with the GCC toolchain provided by
python3 litex_setup.py --gcc=riscv
?(https://github.com/enjoy-digital/litex/blob/master/litex_setup.py#L323-L345)
@enjoy-digital i tried it and it still fails
@enjoy-digital
@zoro269: Can you test with the GCC toolchain provided by
python3 litex_setup.py --gcc=riscv
?(https://github.com/enjoy-digital/litex/blob/master/litex_setup.py#L323-L345)
Thanks guys, I fixed it with the gcc toolchain that was shown and downloaded in the litex_setup.py file. But can you guys explain to me the difference between these two versions of gcc toolchain?
Hi @zoro269,
the OpenSBI build probably require a minimum GCC version to build correctly. We haven't analyzed this so just recommend using the version that has been used successfully.
https://github.com/litex-hub/linux-on-litex-vexriscv/issues/164#issue-767463348 I have followed the steps but still not working. The purpose I want is to be able to build an openSBI image file like in the instructions above