Architectures/RISC-V/FPGA

From FedoraProject

Jump to: navigation, search

How to run Fedora/RISC-V on an FPGA.

Contents

What you will need to buy

Current recommended hardware is the Digilent Nexys 4 DDR. Richard bought one which cost £261 including tax and delivery.

You will also need a micro SDHC card (16GB recommended), plus whatever card reader you might need for your computer. The Nexys 4 comes with everything else.

You will need a host laptop running Fedora/x86_64, with "screen" installed.

Download

Grab all the files from http://oirase.annexia.org/riscv/nexys-4-ddr-fpga/ .xz-compressed files must be uncompressed.

Boot the FPGA

  • Copy the files chip_top.new.bit, boot, vmlinux and root.bin to the root directory of the SD card. Note the SD card must be formatted with a single FAT partition.
  • Insert the SD card into the Nexys 4.
  • Set the "POWER" switch to "OFF".
  • Set "JP1" to "USB/SD", and "JP2" to "SD".
  • Connect the OTG USB cable between your laptop and the Nexys 4 board.
  • Run: screen /dev/ttyUSB1 115200
  • Set the "POWER" switch to "ON".
  • The yellow "BUSY" light should come on, and after a few seconds, this is replaced by a green "DONE" light. If this doesn't happen, consult 2.3 USB Host and Micro SD Programming in the Nexys 4 reference manual.
  • You should also see Linux booting in the serial console (in "screen").

This boots into the lowRISC busybox environment.

Boot Fedora on the FPGA

Create an alternate root.bin containing either stage3 or stage4 Fedora/RISC-V.

You must compile the bootstrapping environment first.

For stage3 you would run:

cd stage3-chroot; virt-make-fs . ../root.bin -t ext2 -F raw -s +100M

NB The root.bin file must not exceed 2GB. (This limit comes from the FAT filesystem used by the SD card, which unfortunately we cannot change). If the final filesystem is too big, then you will need to remove files from stage3-chroot, or adjust the virt-make-fs -s parameter.

Copy the new root.bin to the SD card and proceed as above.