-
Notifications
You must be signed in to change notification settings - Fork 23
RISCV hardware testing
- RISCV SiFive HiFive Unleashed SBC.
- A working linux desktop or Laptop. (This tutorial was made based on running on a Ubuntu machine with i5 8th Gen x86 machine. Laptop Model Acer Switft 3) (Also tested on Dell XPS 13).
- Download the folder that contains the supporting files for booting riscv QEMU.
- We have to update the kernel in the laptop to v5.2.21. (Downgrade if the distro is up to date).
- Follow the steps below to change the laptop kernel with popcorn sub system.
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git && cd linux
$ git checkout v5.2.21
$ patch -p1 < popcorn-kernel.diff
$ make oldconfig
- Now we have a basic .config file for the laptop.
- After this open the .config file and disable all the following configurations
-- ARCH_SUPPORTS_POPCORN
-- CONFIG_TRANSPARENT_HUGEPAGE
-- CONFIG_SWAP
-- CONFIG_CMA
-- CONFIGKSM
-- CONFIG_MEM_SOFT_DIRTY
-- CONFIG_MIGRATION
-- CONFIG_COMPACTION
- After disabling these switches , we will be able to include popcorn into the kernel.
$ make -j24
$ sudo make modules_install
$ sude make install
$ sudo update-grub
Make the following changes to your /etc/default/grub for safety , incase the kernel is corrupted.
-- Comment the lines with GRUB_HIDDEN*. (Use # for comments)
-- Change GRUB_TIMEOUT to -1. ( GRUB_TIMEOUT=-1)
- Now reboot your system to boot the popcorn kernel.
- Now you have a popcorn enabled kernel in your system.
- Yocto is used for building the kernel and ram-disk Image.
- The yocto build structure will look like below
riscv-sifive/
meta-openembedded/
meta-riscv/
meta-sifive/
openembedded-core/
- Follow the steps below to setup the Yocto enironment to build riscv.
$ mkdir riscv-sifive
$ cd riscv-sifive
$ repo init -u git://github.com/sifive/meta-sifive -b v201908-branch -m tools/manifests/sifive.xml
$ repo sync
$ cd meta-sifive
$ patch -p1 < meta-sifive-v201908-branch.diff
$ cd ../openembedded-core
$ patch -p1 < oe-v201908-branch.diff
$ cd ..
$ . ./meta-sifive/setup.sh
$ MACHINE=freedom-u540 bitbake demo-coreip-cli
$ zcat tmp-glibc/deploy/images/freedom-u540/demo-coreip-cli-freedom-u540-*.rootfs.wic.gz | sudo dd of=/dev/sdd
bs=512K iflag=fullblock oflag=direct conv=fsync status=progress
-
Warning : Make sure to point to the right device for the SD card in the last step. Pointing to a wrong device can destroy the system. (dd == device destroy)
-
With the above steps you can insert the SD card into the SiFive Hifive board.Provide the board with a ethernet connection. Either through USB or secure shell connect to the Sifive Board.
Do the following in both the x86 system and the Sifive board.
- Create a folder /etc/popcorn
- Create a file /etc/popcorn/nodes
- Both the files must contain identical nodes file. The file must contain x86's IP address in the first line and riscv ip address in seccond line.
Example:
$ cat /etc/popcorn/nodes
10.4.4.100
10.4.4.101
This must be the file in both machines. Very imporrtant.
10.4.4.100 --> Suppose x86 machine's IP is
10.4.4.101 --> Suppose riscv board's IP is
Now execute the following command in both the machines:
In the sifive board : root@freedom-u540:~# modprobe msg_socket
In the x86 machiens : user@x86 # modprobe msg_socket
- If all works fine you are set with environment.
- Refer this Wiki on how get the applications compiled for x86<-> riscv https://github.com/ssrg-vt/popcorn-kernel/wiki/RISCV-testing-of-popcorn
-The steps to follow in that Wiki :
-
Compiling the RISCV GNU toolchain. Link --> https://github.com/ssrg-vt/popcorn-kernel/wiki/RISCV-VM-testing-of-popcorn/_edit#compiling-the-riscv-gnu-toolchain
-
Compiling the popcorn compiler with riscv support. Link --> https://github.com/ssrg-vt/popcorn-kernel/wiki/RISCV-VM-testing-of-popcorn/_edit#compiling-the-popcorn-compiler-with-riscv-support
-
Compiling NPB applications for testing --> https://github.com/ssrg-vt/popcorn-kernel/wiki/RISCV-VM-testing-of-popcorn/_edit#compiling-npb-applications-for-testing
- Refer this Wiki on how to run the applications on x86<->riscv hardwares . Link --> https://github.com/ssrg-vt/popcorn-kernel/wiki/RISCV-VM-testing-of-popcorn/_edit#testing-the-x86---riscv-popcorn-system