Linux On Vega¶
Linux for VEGA is maintained at VEGA Software Repository /operating-systems/linux-on-vega
. Only THEJAS64 supports Linux.
Install VEGA Linux Toolchain¶
VEGA Linux Toolchain contains necessary RISC-V Toolchains to compile C/C++ programs for Linux. To Install VEGA Linux Toolchain :
git clone https://gitlab.com/cdac-vega/operating-systems/linux-on-vega/linux-toolchains.git
Also add the toolchain path to .bashrc
file.
Download Precompiled Linux Image¶
Precompiled Linux for VEGA is available at VEGA Software Repository. To download precompiled Linux,
git clone https://gitlab.com/cdac-vega/operating-systems/precompiled-images.git
Inside the precompiled-images
directory, Linux
directory contains precompiled linux image (bbl.bin) and device tree file (riscv.dts).
Uploading Linux image to board¶
Reset Board and wait 3 seconds till board is ready for Ethernet mode.
Copy bbl.bin and riscv.dts to
vega-tools/utils/eth_transfer
directory.- Edit env.txt for sending two files. Refer sample env.txt :
# # CBL environment file # #Number of files to send files=2 #Addresses of corresponding files address1=0x80000000 address2=0x8fff0000 #Entrypoint of program to jump after download entrypoint=0x80000000 #Device tree binary address dtbaddress=0x8fff0000 #MAC address of board to set mac=aa:bb:cc:dd:ee:ff
Now generate binary device tree file (riscv.dts) by,
dtc -O dtb -o riscv.dtb riscv.dts
Now upload Linux image to target board using send.sh script. To upload use
./send.sh bbl.bin riscv.dtb
Compiling Applications for Linux¶
To compile programs for Linux, use the VEGA Linux Toolchain. For example, to compile a C file sample.c,
riscv64-buildroot-linux-gnu-gcc sample.c -o smaple.out
To run this you have to send executable smaple.out to Linux running on board using scp.
Note
Before doing scp to Linux running on board, board should get a vaild IP, either dynamic IP using udhcpc command or static IP using ifconfig command.