How to run Fedora/RISC-V on an FPGA.
What you will need to buy
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.
Grab all the files from .
.xz-compressed files must be uncompressed.
root.binfiles were provided by lowRISC. They are a Linux 3.14.41 kernel and a busybox root filesystem respectively (we will replace the root filesystem with a Fedora-based one, but keep the precompiled Linux kernel). You can also build these from source using the instructions on the lowRISC website.
chip_top.new.bitfile is the FPGA bitstream (program). RWMJ compiled this using Xilinx Vivado etc using the instructions on the lowRISC website. Note that it is not redistributable.
bootis the Berkeley Bootloader as supplied by lowRISC for the Nexys 4. RWMJ compiled it using the instructions on the lowRISC website.
Boot the FPGA
- Copy the files
root.binto 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.
screen /dev/ttyUSB1 115200
- Set the "POWER" switch to "ON".
- The yellow light should come on, and after a few seconds, this is replaced by a green 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
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
Copy the new
root.bin to the SD card and proceed as above.